diff options
author | Leonid <logvinov.leon@gmail.com> | 2018-01-18 06:56:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-18 06:56:08 +0800 |
commit | 60614ba250e8749311640dea1af3a69990672a81 (patch) | |
tree | b0ee9abf28596556a1d73de2c65a8731085b0dd9 /packages/0x.js/src | |
parent | 0e3bd0c6c19d0e0f6da59294dab5cb338337a1ee (diff) | |
parent | 278f68ae770b810960b761bd9eb7b57a24975253 (diff) | |
download | dexon-sol-tools-60614ba250e8749311640dea1af3a69990672a81.tar dexon-sol-tools-60614ba250e8749311640dea1af3a69990672a81.tar.gz dexon-sol-tools-60614ba250e8749311640dea1af3a69990672a81.tar.bz2 dexon-sol-tools-60614ba250e8749311640dea1af3a69990672a81.tar.lz dexon-sol-tools-60614ba250e8749311640dea1af3a69990672a81.tar.xz dexon-sol-tools-60614ba250e8749311640dea1af3a69990672a81.tar.zst dexon-sol-tools-60614ba250e8749311640dea1af3a69990672a81.zip |
Merge pull request #321 from 0xProject/fix/fill-up-to-validation
Fix fillOrdersUpTo validation
Diffstat (limited to 'packages/0x.js/src')
-rw-r--r-- | packages/0x.js/src/contract_wrappers/exchange_wrapper.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts index e1d80e01a..be88cdb20 100644 --- a/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts +++ b/packages/0x.js/src/contract_wrappers/exchange_wrapper.ts @@ -258,16 +258,18 @@ export class ExchangeWrapper extends ContractWrapper { ? SHOULD_VALIDATE_BY_DEFAULT : orderTransactionOpts.shouldValidate; if (shouldValidate) { + let filledTakerTokenAmount = new BigNumber(0); const zrxTokenAddress = this.getZRXTokenAddress(); const exchangeTradeEmulator = new ExchangeTransferSimulator(this._tokenWrapper, BlockParamLiteral.Latest); for (const signedOrder of signedOrders) { - await this._orderValidationUtils.validateFillOrderThrowIfInvalidAsync( + const singleFilledTakerTokenAmount = await this._orderValidationUtils.validateFillOrderThrowIfInvalidAsync( exchangeTradeEmulator, signedOrder, - fillTakerTokenAmount, + fillTakerTokenAmount.minus(filledTakerTokenAmount), takerAddress, zrxTokenAddress, ); + filledTakerTokenAmount = filledTakerTokenAmount.plus(singleFilledTakerTokenAmount); } } |