aboutsummaryrefslogtreecommitdiffstats
path: root/test/utils
diff options
context:
space:
mode:
authorLeonid <logvinov.leon@gmail.com>2017-06-08 23:20:36 +0800
committerGitHub <noreply@github.com>2017-06-08 23:20:36 +0800
commitb908df4a289db5164cca8d04f4b202db9139fcf8 (patch)
tree8120b50b1acd829f2565fda709c4be7ba20cd6c3 /test/utils
parent2195bc61347d6d132b6ce23ec05186c4afa4dd46 (diff)
parentf7953511bb1886c6fe3810462926bdbdd0088781 (diff)
downloaddexon-sol-tools-b908df4a289db5164cca8d04f4b202db9139fcf8.tar
dexon-sol-tools-b908df4a289db5164cca8d04f4b202db9139fcf8.tar.gz
dexon-sol-tools-b908df4a289db5164cca8d04f4b202db9139fcf8.tar.bz2
dexon-sol-tools-b908df4a289db5164cca8d04f4b202db9139fcf8.tar.lz
dexon-sol-tools-b908df4a289db5164cca8d04f4b202db9139fcf8.tar.xz
dexon-sol-tools-b908df4a289db5164cca8d04f4b202db9139fcf8.tar.zst
dexon-sol-tools-b908df4a289db5164cca8d04f4b202db9139fcf8.zip
Merge pull request #45 from 0xProject/batchFillAsync
Batch fill async
Diffstat (limited to 'test/utils')
-rw-r--r--test/utils/fill_scenarios.ts26
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,