diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-02 17:23:39 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-02 17:23:39 +0800 |
commit | a740498c8061bc7a3dafae82929b358e61bac2d4 (patch) | |
tree | abf66a0df929cee19b356bde959fcb7ff3b92b79 /test/utils/fill_scenarios.ts | |
parent | f663a15c9b000d639bd0d58d0c177e6de9d47346 (diff) | |
download | dexon-sol-tools-a740498c8061bc7a3dafae82929b358e61bac2d4.tar dexon-sol-tools-a740498c8061bc7a3dafae82929b358e61bac2d4.tar.gz dexon-sol-tools-a740498c8061bc7a3dafae82929b358e61bac2d4.tar.bz2 dexon-sol-tools-a740498c8061bc7a3dafae82929b358e61bac2d4.tar.lz dexon-sol-tools-a740498c8061bc7a3dafae82929b358e61bac2d4.tar.xz dexon-sol-tools-a740498c8061bc7a3dafae82929b358e61bac2d4.tar.zst dexon-sol-tools-a740498c8061bc7a3dafae82929b358e61bac2d4.zip |
Introduce coinBase account
Add makerAccount parameter
Adjust tests
Add more assertions to success test
Diffstat (limited to 'test/utils/fill_scenarios.ts')
-rw-r--r-- | test/utils/fill_scenarios.ts | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/test/utils/fill_scenarios.ts b/test/utils/fill_scenarios.ts index ac233ad50..26840bb0c 100644 --- a/test/utils/fill_scenarios.ts +++ b/test/utils/fill_scenarios.ts @@ -7,23 +7,29 @@ export class FillScenarios { private zeroEx: ZeroEx; private userAddresses: string[]; private tokens: Token[]; + private coinBase: string; constructor(zeroEx: ZeroEx, userAddresses: string[], tokens: Token[]) { this.zeroEx = zeroEx; this.userAddresses = userAddresses; this.tokens = tokens; + this.coinBase = userAddresses[0]; } public async createAFillableSignedOrderAsync(makerTokenAddress: string, takerTokenAddress: string, - takerAddress: string, fillableAmount: BigNumber.BigNumber, + makerAddress: string, takerAddress: string, + fillableAmount: BigNumber.BigNumber, expirationUnixTimestampSec?: BigNumber.BigNumber): Promise<SignedOrder> { - const [makerAddress] = this.userAddresses; + await this.zeroEx.token.transferAsync(makerTokenAddress, this.coinBase, makerAddress, fillableAmount); await this.zeroEx.token.setProxyAllowanceAsync(makerTokenAddress, makerAddress, fillableAmount); - await this.zeroEx.token.transferAsync(takerTokenAddress, makerAddress, takerAddress, fillableAmount); + await this.zeroEx.token.transferAsync(takerTokenAddress, this.coinBase, takerAddress, fillableAmount); await this.zeroEx.token.setProxyAllowanceAsync(takerTokenAddress, takerAddress, fillableAmount); + const transactionSenderAccount = this.zeroEx.getTransactionSenderAccount(); + this.zeroEx.setTransactionSenderAccount(makerAddress); const signedOrder = await orderFactory.createSignedOrderAsync(this.zeroEx, makerAddress, takerAddress, fillableAmount, makerTokenAddress, fillableAmount, takerTokenAddress, expirationUnixTimestampSec); + this.zeroEx.setTransactionSenderAccount(transactionSenderAccount); return signedOrder; } } |