diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-08-23 21:36:03 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-08-24 15:55:02 +0800 |
commit | 5dc32c32a65c439867facfe3dadbf0908fd7c078 (patch) | |
tree | 0bc53a9353ae5aeab6420537af3e213680d9d3f2 | |
parent | 202d619435147499125e4f50b960c6849ca678ea (diff) | |
download | dexon-sol-tools-5dc32c32a65c439867facfe3dadbf0908fd7c078.tar.gz dexon-sol-tools-5dc32c32a65c439867facfe3dadbf0908fd7c078.tar.zst dexon-sol-tools-5dc32c32a65c439867facfe3dadbf0908fd7c078.zip |
Add a comment for isRoundingErrorAsync
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 76c35840a..beaf60ba0 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -677,15 +677,22 @@ export class ExchangeWrapper extends ContractWrapper { await this._orderValidationUtils.validateFillOrKillOrderThrowIfInvalidAsync( signedOrder, fillTakerTokenAmount, takerAddress, zrxTokenAddress); } - public async isRoundingErrorAsync(numerator: BigNumber.BigNumber, - demoninator: BigNumber.BigNumber, + /** + * Checks if rounding error will be > 0.1% + * when computing makerTokenAmount by doing `(fillTakerTokenAmount * makerTokenAmount) / takerTokenAmount` + * @param fillTakerTokenAmount The amount of the order (in taker tokens baseUnits) that you wish to fill. + * @param takerTokenAmount The order size on the taker side + * @param makerTokenAmount The order size on the maker size + */ + public async isRoundingErrorAsync(fillTakerTokenAmount: BigNumber.BigNumber, + takerTokenAmount: BigNumber.BigNumber, makerTokenAmount: BigNumber.BigNumber): Promise<boolean> { - assert.isBigNumber('numerator', numerator); - assert.isBigNumber('demoninator', demoninator); + assert.isBigNumber('fillTakerTokenAmount', fillTakerTokenAmount); + assert.isBigNumber('takerTokenAmount', takerTokenAmount); assert.isBigNumber('makerTokenAmount', makerTokenAmount); const exchangeInstance = await this._getExchangeContractAsync(); const isRoundingError = await exchangeInstance.isRoundingError.call( - numerator, demoninator, makerTokenAmount, + fillTakerTokenAmount, takerTokenAmount, makerTokenAmount, ); return isRoundingError; } |