diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-02 23:35:05 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-02 23:35:05 +0800 |
commit | ef3a27ed0545e2e30e965b928ae13c8a53e16e8d (patch) | |
tree | ce547730cdea4501f28f765c52833dda24d89e11 | |
parent | 9756aa86b051940b88f87fbecb313bf07590eca3 (diff) | |
download | dexon-0x-contracts-ef3a27ed0545e2e30e965b928ae13c8a53e16e8d.tar.gz dexon-0x-contracts-ef3a27ed0545e2e30e965b928ae13c8a53e16e8d.tar.zst dexon-0x-contracts-ef3a27ed0545e2e30e965b928ae13c8a53e16e8d.zip |
Rename validation functions
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 0c7f27507..965b31710 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -79,7 +79,7 @@ export class ExchangeWrapper extends ContractWrapper { const senderAddress = await this.web3Wrapper.getSenderAddressOrThrowAsync(); const exchangeInstance = await this.getExchangeContractAsync(); const zrxTokenAddress = await this.getZRXTokenAddressAsync(exchangeInstance); - await this.validateFillOrderAsync(signedOrder, fillTakerAmount, senderAddress, zrxTokenAddress); + await this.validateFillOrderAndThrowIfInvalidAsync(signedOrder, fillTakerAmount, senderAddress, zrxTokenAddress); const orderAddresses: OrderAddresses = [ signedOrder.maker, @@ -123,8 +123,8 @@ export class ExchangeWrapper extends ContractWrapper { ); this.throwErrorLogsAsErrors(response.logs); } - private async validateFillOrderAsync(signedOrder: SignedOrder, fillTakerAmount: BigNumber.BigNumber, - senderAddress: string, zrxTokenAddress: string): Promise<void> { + private async validateFillOrderAndThrowIfInvalidAsync(signedOrder: SignedOrder, fillTakerAmount: BigNumber.BigNumber, + senderAddress: string, zrxTokenAddress: string): Promise<void> { if (fillTakerAmount.eq(0)) { throw new Error(FillOrderValidationErrs.FILL_AMOUNT_IS_ZERO); } @@ -135,7 +135,7 @@ export class ExchangeWrapper extends ContractWrapper { throw new Error(FillOrderValidationErrs.EXPIRED); } - await this.validateFillOrderBalancesAndAllowancesAsync(signedOrder, fillTakerAmount, + await this.validateFillOrderBalancesAndAllowancesAndThrowIfInvalidAsync(signedOrder, fillTakerAmount, senderAddress, zrxTokenAddress); if (await this.isRoundingErrorAsync(signedOrder.takerTokenAmount, fillTakerAmount, @@ -143,10 +143,10 @@ export class ExchangeWrapper extends ContractWrapper { throw new Error(FillOrderValidationErrs.ROUNDING_ERROR); } } - private async validateFillOrderBalancesAndAllowancesAsync(signedOrder: SignedOrder, - fillTakerAmount: BigNumber.BigNumber, - senderAddress: string, - zrxTokenAddress: string): Promise<void> { + private async validateFillOrderBalancesAndAllowancesAndThrowIfInvalidAsync(signedOrder: SignedOrder, + fillTakerAmount: BigNumber.BigNumber, + senderAddress: string, + zrxTokenAddress: string): Promise<void> { // TODO: There is a possibility that the user might have enough funds // to fulfill the order or pay fees but not both. This will happen if // makerToken === zrxToken || makerToken === zrxToken |