diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-02 23:37:28 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-02 23:37:28 +0800 |
commit | 0f7bd0597234dbeafcee31e6f715f3c2004696df (patch) | |
tree | 95d57b44a765fe071c7a2cbf1b75d4b431837bd1 | |
parent | ef3a27ed0545e2e30e965b928ae13c8a53e16e8d (diff) | |
download | dexon-sol-tools-0f7bd0597234dbeafcee31e6f715f3c2004696df.tar dexon-sol-tools-0f7bd0597234dbeafcee31e6f715f3c2004696df.tar.gz dexon-sol-tools-0f7bd0597234dbeafcee31e6f715f3c2004696df.tar.bz2 dexon-sol-tools-0f7bd0597234dbeafcee31e6f715f3c2004696df.tar.lz dexon-sol-tools-0f7bd0597234dbeafcee31e6f715f3c2004696df.tar.xz dexon-sol-tools-0f7bd0597234dbeafcee31e6f715f3c2004696df.tar.zst dexon-sol-tools-0f7bd0597234dbeafcee31e6f715f3c2004696df.zip |
Don't pass zrxTokenAsign
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 965b31710..d7d56c276 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -78,8 +78,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.validateFillOrderAndThrowIfInvalidAsync(signedOrder, fillTakerAmount, senderAddress, zrxTokenAddress); + await this.validateFillOrderAndThrowIfInvalidAsync(signedOrder, fillTakerAmount, senderAddress); const orderAddresses: OrderAddresses = [ signedOrder.maker, @@ -123,8 +122,9 @@ export class ExchangeWrapper extends ContractWrapper { ); this.throwErrorLogsAsErrors(response.logs); } - private async validateFillOrderAndThrowIfInvalidAsync(signedOrder: SignedOrder, fillTakerAmount: BigNumber.BigNumber, - senderAddress: string, zrxTokenAddress: string): Promise<void> { + private async validateFillOrderAndThrowIfInvalidAsync(signedOrder: SignedOrder, + fillTakerAmount: BigNumber.BigNumber, + senderAddress: string): Promise<void> { if (fillTakerAmount.eq(0)) { throw new Error(FillOrderValidationErrs.FILL_AMOUNT_IS_ZERO); } @@ -134,7 +134,7 @@ export class ExchangeWrapper extends ContractWrapper { if (signedOrder.expirationUnixTimestampSec.lessThan(Date.now() / 1000)) { throw new Error(FillOrderValidationErrs.EXPIRED); } - + const zrxTokenAddress = await this.getZRXTokenAddressAsync(); await this.validateFillOrderBalancesAndAllowancesAndThrowIfInvalidAsync(signedOrder, fillTakerAmount, senderAddress, zrxTokenAddress); @@ -226,7 +226,8 @@ export class ExchangeWrapper extends ContractWrapper { this.exchangeContractIfExists = contractInstance as ExchangeContract; return this.exchangeContractIfExists; } - private async getZRXTokenAddressAsync(exchangeInstance: ExchangeContract): Promise<string> { + private async getZRXTokenAddressAsync(): Promise<string> { + const exchangeInstance = await this.getExchangeContractAsync(); return exchangeInstance.ZRX.call(); } } |