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.ts15
1 files changed, 13 insertions, 2 deletions
diff --git a/contracts/protocol/test/utils/exchange_wrapper.ts b/contracts/protocol/test/utils/exchange_wrapper.ts
index cb6dce901..437882b41 100644
--- a/contracts/protocol/test/utils/exchange_wrapper.ts
+++ b/contracts/protocol/test/utils/exchange_wrapper.ts
@@ -8,13 +8,16 @@ import {
} from '@0x/contracts-test-utils';
import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
import { SignedOrder } from '@0x/types';
-import { BigNumber } from '@0x/utils';
+import { AbiEncoder, BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
-import { Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
+import { MethodAbi, Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
+import * as _ from 'lodash';
import { ExchangeContract } from '../../generated-wrappers/exchange';
import { artifacts } from '../../src/artifacts';
+import { AbiDecodedFillOrderData } from './types';
+
export class ExchangeWrapper {
private readonly _exchange: ExchangeContract;
private readonly _web3Wrapper: Web3Wrapper;
@@ -275,6 +278,14 @@ export class ExchangeWrapper {
);
return data;
}
+ public abiDecodeFillOrder(data: string): AbiDecodedFillOrderData {
+ // Lookup fillOrder ABI in exchange abi
+ const fillOrderAbi = _.find(this._exchange.abi, { name: 'fillOrder' }) as MethodAbi;
+ // Decode input data
+ const abiEncoder = new AbiEncoder.Method(fillOrderAbi);
+ const decodedData = abiEncoder.decode(data) as AbiDecodedFillOrderData;
+ return decodedData;
+ }
public getExchangeAddress(): string {
return this._exchange.address;
}