diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-02 21:24:42 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-02 21:24:42 +0800 |
commit | d8587875b82ae2fde6dad1334a586c36cda2bfec (patch) | |
tree | caaacb3bcaacaca134d641fec4767a2e6725d734 /test/utils | |
parent | a07a9d8571928dbbe82d2cc0917dafe6b446f701 (diff) | |
download | dexon-sol-tools-d8587875b82ae2fde6dad1334a586c36cda2bfec.tar dexon-sol-tools-d8587875b82ae2fde6dad1334a586c36cda2bfec.tar.gz dexon-sol-tools-d8587875b82ae2fde6dad1334a586c36cda2bfec.tar.bz2 dexon-sol-tools-d8587875b82ae2fde6dad1334a586c36cda2bfec.tar.lz dexon-sol-tools-d8587875b82ae2fde6dad1334a586c36cda2bfec.tar.xz dexon-sol-tools-d8587875b82ae2fde6dad1334a586c36cda2bfec.tar.zst dexon-sol-tools-d8587875b82ae2fde6dad1334a586c36cda2bfec.zip |
Add success test for fill with fees
Diffstat (limited to 'test/utils')
-rw-r--r-- | test/utils/fill_scenarios.ts | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/test/utils/fill_scenarios.ts b/test/utils/fill_scenarios.ts index 31f93618f..706f3f281 100644 --- a/test/utils/fill_scenarios.ts +++ b/test/utils/fill_scenarios.ts @@ -9,11 +9,13 @@ export class FillScenarios { private userAddresses: string[]; private tokens: Token[]; private coinBase: string; - constructor(zeroEx: ZeroEx, userAddresses: string[], tokens: Token[]) { + private zrxTokenAddress: string; + constructor(zeroEx: ZeroEx, userAddresses: string[], tokens: Token[], zrxTokenAddress: string) { this.zeroEx = zeroEx; this.userAddresses = userAddresses; this.tokens = tokens; this.coinBase = userAddresses[0]; + this.zrxTokenAddress = zrxTokenAddress; } public async createFillableSignedOrderAsync(makerTokenAddress: string, takerTokenAddress: string, makerAddress: string, takerAddress: string, @@ -60,6 +62,15 @@ export class FillScenarios { await this.zeroEx.token.transferAsync(takerTokenAddress, this.coinBase, takerAddress, takerFillableAmount); await this.zeroEx.token.setProxyAllowanceAsync(takerTokenAddress, takerAddress, takerFillableAmount); + if (!makerFee.isZero()) { + await this.zeroEx.token.transferAsync(this.zrxTokenAddress, this.coinBase, makerAddress, makerFee); + await this.zeroEx.token.setProxyAllowanceAsync(this.zrxTokenAddress, makerAddress, makerFee); + } + if (!takerFee.isZero()) { + await this.zeroEx.token.transferAsync(this.zrxTokenAddress, this.coinBase, takerAddress, takerFee); + await this.zeroEx.token.setProxyAllowanceAsync(this.zrxTokenAddress, takerAddress, takerFee); + } + const transactionSenderAccount = await this.zeroEx.getTransactionSenderAccountIfExistsAsync(); this.zeroEx.setTransactionSenderAccount(makerAddress); const signedOrder = await orderFactory.createSignedOrderAsync(this.zeroEx, |