aboutsummaryrefslogtreecommitdiffstats
path: root/contracts/protocol
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-12-24 11:49:08 +0800
committerGreg Hysen <greg.hysen@gmail.com>2019-01-15 02:49:44 +0800
commit0b6c9c84688b565a9000b2c4e889c682ccaa7e51 (patch)
treeae299ab0db6f182ed2ceafd729a63b3f713697e2 /contracts/protocol
parentd1fd4421be0a7639b99b374bf04e57fac4e8a486 (diff)
downloaddexon-sol-tools-0b6c9c84688b565a9000b2c4e889c682ccaa7e51.tar
dexon-sol-tools-0b6c9c84688b565a9000b2c4e889c682ccaa7e51.tar.gz
dexon-sol-tools-0b6c9c84688b565a9000b2c4e889c682ccaa7e51.tar.bz2
dexon-sol-tools-0b6c9c84688b565a9000b2c4e889c682ccaa7e51.tar.lz
dexon-sol-tools-0b6c9c84688b565a9000b2c4e889c682ccaa7e51.tar.xz
dexon-sol-tools-0b6c9c84688b565a9000b2c4e889c682ccaa7e51.tar.zst
dexon-sol-tools-0b6c9c84688b565a9000b2c4e889c682ccaa7e51.zip
Ran prettier
Diffstat (limited to 'contracts/protocol')
-rw-r--r--contracts/protocol/test/utils/exchange_wrapper.ts20
1 files changed, 15 insertions, 5 deletions
diff --git a/contracts/protocol/test/utils/exchange_wrapper.ts b/contracts/protocol/test/utils/exchange_wrapper.ts
index 28532f44b..2c27d0f2b 100644
--- a/contracts/protocol/test/utils/exchange_wrapper.ts
+++ b/contracts/protocol/test/utils/exchange_wrapper.ts
@@ -10,7 +10,7 @@ import { artifacts as tokensArtifacts } from '@0x/contracts-tokens';
import { OrderWithoutExchangeAddress, SignedOrder } from '@0x/types';
import { BigNumber } from '@0x/utils';
import { Web3Wrapper } from '@0x/web3-wrapper';
-import { AbiDefinition, MethodAbi ,Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
+import { AbiDefinition, MethodAbi, Provider, TransactionReceiptWithDecodedLogs } from 'ethereum-types';
import * as _ from 'lodash';
import { AbiEncoder } from '@0x/utils';
@@ -277,15 +277,25 @@ export class ExchangeWrapper {
);
return data;
}
- // @hysz -- TEMPORARY HACK @TODO remove
- public abiDecodeFillOrder(data: string): {order: OrderWithoutExchangeAddress, takerAssetFillAmount: BigNumber, signature: string} {
+ // @TODO hysz -- Remove once abi decoding has been added to contract templates
+ public abiDecodeFillOrder(
+ data: string,
+ ): { order: OrderWithoutExchangeAddress; takerAssetFillAmount: BigNumber; signature: string } {
+ // Lookup fillOrder ABI
let fillOrderAbi = _.find(this._exchange.abi, (value: AbiDefinition) => {
- if ((value.type === 'function') && (value as MethodAbi).name === 'fillOrder') {
+ 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};
+ // Decode input data
+ const abiEncoder = new AbiEncoder.Method(fillOrderAbi);
+ const decodedData = abiEncoder.decode(data) as {
+ order: OrderWithoutExchangeAddress;
+ takerAssetFillAmount: BigNumber;
+ signature: string;
+ };
+ return decodedData;
}
public getExchangeAddress(): string {
return this._exchange.address;