diff options
author | Steve Klebanoff <steve.klebanoff@gmail.com> | 2019-01-16 02:38:23 +0800 |
---|---|---|
committer | Steve Klebanoff <steve.klebanoff@gmail.com> | 2019-01-16 02:38:23 +0800 |
commit | 7a2b312d64994f96db75864e9a61bb319efdda3a (patch) | |
tree | 6d7b030abe774c619067ae52e0ef1cf7ebdd0963 /contracts/protocol/test/utils/exchange_wrapper.ts | |
parent | 64a78149aa4a35aa339fb9ef80faea613ebaeffd (diff) | |
parent | f570f80674c22f69712c45e8e3c48e948b51f357 (diff) | |
download | dexon-0x-contracts-7a2b312d64994f96db75864e9a61bb319efdda3a.tar dexon-0x-contracts-7a2b312d64994f96db75864e9a61bb319efdda3a.tar.gz dexon-0x-contracts-7a2b312d64994f96db75864e9a61bb319efdda3a.tar.bz2 dexon-0x-contracts-7a2b312d64994f96db75864e9a61bb319efdda3a.tar.lz dexon-0x-contracts-7a2b312d64994f96db75864e9a61bb319efdda3a.tar.xz dexon-0x-contracts-7a2b312d64994f96db75864e9a61bb319efdda3a.tar.zst dexon-0x-contracts-7a2b312d64994f96db75864e9a61bb319efdda3a.zip |
Merge branch 'development' into fix/asset-buyer/zero-amount-available-test
Diffstat (limited to 'contracts/protocol/test/utils/exchange_wrapper.ts')
-rw-r--r-- | contracts/protocol/test/utils/exchange_wrapper.ts | 15 |
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; } |