diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-01-16 18:22:04 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-01-16 18:22:04 +0800 |
commit | 89d6326a83afc386d7d388776ab0a419ece20739 (patch) | |
tree | f2c550a3cb85e441737ae0ce7962117c288997d9 /packages/0x.js/src/contract_wrappers/exchange_wrapper.ts | |
parent | 8b81ea162fd32df0dc2dcbdbc47be0e1bb09ea0f (diff) | |
download | dexon-0x-contracts-89d6326a83afc386d7d388776ab0a419ece20739.tar dexon-0x-contracts-89d6326a83afc386d7d388776ab0a419ece20739.tar.gz dexon-0x-contracts-89d6326a83afc386d7d388776ab0a419ece20739.tar.bz2 dexon-0x-contracts-89d6326a83afc386d7d388776ab0a419ece20739.tar.lz dexon-0x-contracts-89d6326a83afc386d7d388776ab0a419ece20739.tar.xz dexon-0x-contracts-89d6326a83afc386d7d388776ab0a419ece20739.tar.zst dexon-0x-contracts-89d6326a83afc386d7d388776ab0a419ece20739.zip |
Fix fillOrdersUpTo balances validation
Diffstat (limited to 'packages/0x.js/src/contract_wrappers/exchange_wrapper.ts')
-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); } } |