From 5dc32c32a65c439867facfe3dadbf0908fd7c078 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Wed, 23 Aug 2017 15:36:03 +0200 Subject: Add a comment for isRoundingErrorAsync --- src/contract_wrappers/exchange_wrapper.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src') 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 { - 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; } -- cgit v1.2.3