diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-02 18:57:21 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-02 18:57:21 +0800 |
commit | e1ee6b84945e729d894f6535be02f3541e43dbf0 (patch) | |
tree | ab58800b09c204ab05fb9c2a1161ded792d7e244 /test/utils/fill_scenarios.ts | |
parent | 2a0c6abbe7f9abeacc4fea05bc468413ec1f4732 (diff) | |
download | dexon-sol-tools-e1ee6b84945e729d894f6535be02f3541e43dbf0.tar dexon-sol-tools-e1ee6b84945e729d894f6535be02f3541e43dbf0.tar.gz dexon-sol-tools-e1ee6b84945e729d894f6535be02f3541e43dbf0.tar.bz2 dexon-sol-tools-e1ee6b84945e729d894f6535be02f3541e43dbf0.tar.lz dexon-sol-tools-e1ee6b84945e729d894f6535be02f3541e43dbf0.tar.xz dexon-sol-tools-e1ee6b84945e729d894f6535be02f3541e43dbf0.tar.zst dexon-sol-tools-e1ee6b84945e729d894f6535be02f3541e43dbf0.zip |
Add check for ROUNDING_ERROR and test for it
Diffstat (limited to 'test/utils/fill_scenarios.ts')
-rw-r--r-- | test/utils/fill_scenarios.ts | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/test/utils/fill_scenarios.ts b/test/utils/fill_scenarios.ts index 3b66937e6..568b11ef8 100644 --- a/test/utils/fill_scenarios.ts +++ b/test/utils/fill_scenarios.ts @@ -14,20 +14,29 @@ export class FillScenarios { this.tokens = tokens; this.coinBase = userAddresses[0]; } - public async createAFillableSignedOrderAsync(makerTokenAddress: string, takerTokenAddress: string, - makerAddress: string, takerAddress: string, - fillableAmount: BigNumber.BigNumber, - expirationUnixTimestampSec?: BigNumber.BigNumber): + public async createFillableSignedOrderAsync(makerTokenAddress: string, takerTokenAddress: string, + makerAddress: string, takerAddress: string, + fillableAmount: BigNumber.BigNumber, + expirationUnixTimestampSec?: BigNumber.BigNumber): Promise<SignedOrder> { - await this.zeroEx.token.transferAsync(makerTokenAddress, this.coinBase, makerAddress, fillableAmount); - await this.zeroEx.token.setProxyAllowanceAsync(makerTokenAddress, makerAddress, fillableAmount); - await this.zeroEx.token.transferAsync(takerTokenAddress, this.coinBase, takerAddress, fillableAmount); - await this.zeroEx.token.setProxyAllowanceAsync(takerTokenAddress, takerAddress, fillableAmount); + return this.createAsymetricFillableSignedOrderAsync( + makerTokenAddress, takerTokenAddress, makerAddress, takerAddress, + fillableAmount, fillableAmount, expirationUnixTimestampSec, + ); + } + public async createAsymetricFillableSignedOrderAsync( + makerTokenAddress: string, takerTokenAddress: string, makerAddress: string, takerAddress: string, + makerFillableAmount: BigNumber.BigNumber, takerFillableAmount: BigNumber.BigNumber, + expirationUnixTimestampSec?: BigNumber.BigNumber): Promise<SignedOrder> { + await this.zeroEx.token.transferAsync(makerTokenAddress, this.coinBase, makerAddress, makerFillableAmount); + await this.zeroEx.token.setProxyAllowanceAsync(makerTokenAddress, makerAddress, makerFillableAmount); + await this.zeroEx.token.transferAsync(takerTokenAddress, this.coinBase, takerAddress, takerFillableAmount); + await this.zeroEx.token.setProxyAllowanceAsync(takerTokenAddress, takerAddress, takerFillableAmount); const transactionSenderAccount = await this.zeroEx.getTransactionSenderAccountIfExistsAsync(); this.zeroEx.setTransactionSenderAccount(makerAddress); const signedOrder = await orderFactory.createSignedOrderAsync(this.zeroEx, makerAddress, - takerAddress, fillableAmount, makerTokenAddress, fillableAmount, takerTokenAddress, + takerAddress, makerFillableAmount, makerTokenAddress, takerFillableAmount, takerTokenAddress, expirationUnixTimestampSec); this.zeroEx.setTransactionSenderAccount(transactionSenderAccount as string); return signedOrder; |