aboutsummaryrefslogtreecommitdiffstats
path: root/contracts/protocol/test/utils/exchange_wrapper.ts
diff options
context:
space:
mode:
Diffstat (limited to 'contracts/protocol/test/utils/exchange_wrapper.ts')
-rw-r--r--contracts/protocol/test/utils/exchange_wrapper.ts16
1 files changed, 14 insertions, 2 deletions
diff --git a/contracts/protocol/test/utils/exchange_wrapper.ts b/contracts/protocol/test/utils/exchange_wrapper.ts
index cb6dce901..28532f44b 100644
--- a/contracts/protocol/test/utils/exchange_wrapper.ts
+++ b/contracts/protocol/test/utils/exchange_wrapper.ts
@@ -7,10 +7,12 @@ import {
SignedTransaction,
} from '@0x/contracts-test-utils';
import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
-import { SignedOrder } from '@0x/types';
+import { OrderWithoutExchangeAddress, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
-import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
+import { AbiDefinition, MethodAbi ,Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
+import * as _ from 'lodash';
+import { AbiEncoder } from '@0x/utils';
import { ExchangeContract } from '../../generated-wrappers/exchange';
import { artifacts } from '../../src/artifacts';
@@ -275,6 +277,16 @@ export class ExchangeWrapper {
);
return data;
}
+ // @hysz -- TEMPORARY HACK @TODO remove
+ public abiDecodeFillOrder(data: string): {order: OrderWithoutExchangeAddress, takerAssetFillAmount: BigNumber, signature: string} {
+ let fillOrderAbi = _.find(this._exchange.abi, (value: AbiDefinition) => {
+ if ((value.type === 'function') && (value as MethodAbi).name === 'fillOrder') {
+ return true;
+ }
+ return false;
+ }) as MethodAbi;
+ return (new AbiEncoder.Method(fillOrderAbi)).decode(data) as {order: OrderWithoutExchangeAddress, takerAssetFillAmount: BigNumber, signature: string};
+ }
public getExchangeAddress(): string {
return this._exchange.address;
}