diff options
author | Fabio Berger <me@fabioberger.com> | 2017-06-09 00:09:47 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-06-09 00:09:47 +0800 |
commit | 2b08c04d4d7b67592d3f846dc31d01892bdbeaeb (patch) | |
tree | 87ca7011419f1f0a9131096d0afbca0cb8ab4e04 /test/utils | |
parent | f25447aa3dbbad0986d6dbd414b51a4591ccbc7c (diff) | |
parent | 31cc75bd6d2651466ebf50e9374d5cd19de6dd5e (diff) | |
download | dexon-sol-tools-2b08c04d4d7b67592d3f846dc31d01892bdbeaeb.tar dexon-sol-tools-2b08c04d4d7b67592d3f846dc31d01892bdbeaeb.tar.gz dexon-sol-tools-2b08c04d4d7b67592d3f846dc31d01892bdbeaeb.tar.bz2 dexon-sol-tools-2b08c04d4d7b67592d3f846dc31d01892bdbeaeb.tar.lz dexon-sol-tools-2b08c04d4d7b67592d3f846dc31d01892bdbeaeb.tar.xz dexon-sol-tools-2b08c04d4d7b67592d3f846dc31d01892bdbeaeb.tar.zst dexon-sol-tools-2b08c04d4d7b67592d3f846dc31d01892bdbeaeb.zip |
Merge branch 'master' into batchFillOrKill
# Conflicts:
# test/exchange_wrapper_test.ts
Diffstat (limited to 'test/utils')
-rw-r--r-- | test/utils/fill_scenarios.ts | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/test/utils/fill_scenarios.ts b/test/utils/fill_scenarios.ts index d8d6cd0b9..2860f1472 100644 --- a/test/utils/fill_scenarios.ts +++ b/test/utils/fill_scenarios.ts @@ -70,17 +70,35 @@ export class FillScenarios { makerFillableAmount: BigNumber.BigNumber, takerFillableAmount: BigNumber.BigNumber, feeRecepient: string, expirationUnixTimestampSec?: BigNumber.BigNumber): Promise<SignedOrder> { await this.zeroEx.token.transferAsync(makerTokenAddress, this.coinbase, makerAddress, makerFillableAmount); - await this.zeroEx.token.setProxyAllowanceAsync(makerTokenAddress, makerAddress, makerFillableAmount); + const oldMakerAllowance = await this.zeroEx.token.getProxyAllowanceAsync(makerTokenAddress, makerAddress); + const newMakerAllowance = oldMakerAllowance.plus(makerFillableAmount); + await this.zeroEx.token.setProxyAllowanceAsync( + makerTokenAddress, makerAddress, newMakerAllowance, + ); await this.zeroEx.token.transferAsync(takerTokenAddress, this.coinbase, takerAddress, takerFillableAmount); - await this.zeroEx.token.setProxyAllowanceAsync(takerTokenAddress, takerAddress, takerFillableAmount); + const oldTakerAllowance = await this.zeroEx.token.getProxyAllowanceAsync(takerTokenAddress, takerAddress); + const newTakerAllowance = oldTakerAllowance.plus(takerFillableAmount); + await this.zeroEx.token.setProxyAllowanceAsync( + takerTokenAddress, takerAddress, newTakerAllowance, + ); if (!makerFee.isZero()) { await this.zeroEx.token.transferAsync(this.zrxTokenAddress, this.coinbase, makerAddress, makerFee); - await this.zeroEx.token.setProxyAllowanceAsync(this.zrxTokenAddress, makerAddress, makerFee); + const oldMakerFeeAllowance = + await this.zeroEx.token.getProxyAllowanceAsync(this.zrxTokenAddress, makerAddress); + const newMakerFeeAllowance = oldMakerFeeAllowance.plus(makerFee); + await this.zeroEx.token.setProxyAllowanceAsync( + this.zrxTokenAddress, makerAddress, newMakerFeeAllowance, + ); } if (!takerFee.isZero()) { await this.zeroEx.token.transferAsync(this.zrxTokenAddress, this.coinbase, takerAddress, takerFee); - await this.zeroEx.token.setProxyAllowanceAsync(this.zrxTokenAddress, takerAddress, takerFee); + const oldTakerFeeAllowance = + await this.zeroEx.token.getProxyAllowanceAsync(this.zrxTokenAddress, takerAddress); + const newTakerFeeAllowance = oldTakerFeeAllowance.plus(takerFee); + await this.zeroEx.token.setProxyAllowanceAsync( + this.zrxTokenAddress, takerAddress, newTakerFeeAllowance, + ); } const signedOrder = await orderFactory.createSignedOrderAsync(this.zeroEx, |