aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-12-24 13:37:41 +0800
committerGreg Hysen <greg.hysen@gmail.com>2019-01-15 02:49:44 +0800
commitf73c68ee612841323357703fbc2ea58566934a4e (patch)
tree6ddcfb7513d4d16ea851d261398606c680961c66
parent33f340522699322b0a0d76ffb5c4ebef3351c53a (diff)
downloaddexon-sol-tools-f73c68ee612841323357703fbc2ea58566934a4e.tar
dexon-sol-tools-f73c68ee612841323357703fbc2ea58566934a4e.tar.gz
dexon-sol-tools-f73c68ee612841323357703fbc2ea58566934a4e.tar.bz2
dexon-sol-tools-f73c68ee612841323357703fbc2ea58566934a4e.tar.lz
dexon-sol-tools-f73c68ee612841323357703fbc2ea58566934a4e.tar.xz
dexon-sol-tools-f73c68ee612841323357703fbc2ea58566934a4e.tar.zst
dexon-sol-tools-f73c68ee612841323357703fbc2ea58566934a4e.zip
Created an interface for abi decoded fillOrder data
-rw-r--r--contracts/protocol/test/utils/exchange_wrapper.ts11
-rw-r--r--contracts/protocol/test/utils/types.ts8
2 files changed, 12 insertions, 7 deletions
diff --git a/contracts/protocol/test/utils/exchange_wrapper.ts b/contracts/protocol/test/utils/exchange_wrapper.ts
index 2c27d0f2b..804b0141e 100644
--- a/contracts/protocol/test/utils/exchange_wrapper.ts
+++ b/contracts/protocol/test/utils/exchange_wrapper.ts
@@ -17,6 +17,8 @@ import { AbiEncoder } from '@0x/utils';
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;
@@ -277,10 +279,9 @@ export class ExchangeWrapper {
);
return data;
}
- // @TODO hysz -- Remove once abi decoding has been added to contract templates
public abiDecodeFillOrder(
data: string,
- ): { order: OrderWithoutExchangeAddress; takerAssetFillAmount: BigNumber; signature: string } {
+ ): AbiDecodedFillOrderData {
// Lookup fillOrder ABI
let fillOrderAbi = _.find(this._exchange.abi, (value: AbiDefinition) => {
if (value.type === 'function' && (value as MethodAbi).name === 'fillOrder') {
@@ -290,11 +291,7 @@ export class ExchangeWrapper {
}) as MethodAbi;
// Decode input data
const abiEncoder = new AbiEncoder.Method(fillOrderAbi);
- const decodedData = abiEncoder.decode(data) as {
- order: OrderWithoutExchangeAddress;
- takerAssetFillAmount: BigNumber;
- signature: string;
- };
+ const decodedData = abiEncoder.decode(data) as AbiDecodedFillOrderData;
return decodedData;
}
public getExchangeAddress(): string {
diff --git a/contracts/protocol/test/utils/types.ts b/contracts/protocol/test/utils/types.ts
new file mode 100644
index 000000000..d18cd0599
--- /dev/null
+++ b/contracts/protocol/test/utils/types.ts
@@ -0,0 +1,8 @@
+import { SignedOrder } from '@0x/types';
+import { BigNumber } from '@0x/utils';
+
+export interface AbiDecodedFillOrderData {
+ order: SignedOrder;
+ akerAssetFillAmount: BigNumber;
+ signature: string;
+} \ No newline at end of file