aboutsummaryrefslogtreecommitdiffstats
path: root/contracts/protocol/test/utils/exchange_wrapper.ts
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-12-19 14:37:36 +0800
committerGreg Hysen <greg.hysen@gmail.com>2019-01-15 02:49:44 +0800
commitf8684d6a776724d0172c30126a7277885ed4e966 (patch)
tree8f9c318fa5f60f3abddd7b1c573e184021d8ba6c /contracts/protocol/test/utils/exchange_wrapper.ts
parente4551c8f6037302124cae4cda51b8f7624ade687 (diff)
downloaddexon-sol-tools-f8684d6a776724d0172c30126a7277885ed4e966.tar
dexon-sol-tools-f8684d6a776724d0172c30126a7277885ed4e966.tar.gz
dexon-sol-tools-f8684d6a776724d0172c30126a7277885ed4e966.tar.bz2
dexon-sol-tools-f8684d6a776724d0172c30126a7277885ed4e966.tar.lz
dexon-sol-tools-f8684d6a776724d0172c30126a7277885ed4e966.tar.xz
dexon-sol-tools-f8684d6a776724d0172c30126a7277885ed4e966.tar.zst
dexon-sol-tools-f8684d6a776724d0172c30126a7277885ed4e966.zip
All contract tests working with new abi encoder
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;
}