diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-06 18:40:58 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-06-06 18:40:58 +0800 |
commit | f7236e7f499f59d883603798cda11d3636b26f4a (patch) | |
tree | a4ab3fd3758bc179cb16fea8dfa78700f5d309aa /src/contract_wrappers | |
parent | ed3d1a8142e6f65480f95df7c3991ae00c757e38 (diff) | |
download | dexon-sol-tools-f7236e7f499f59d883603798cda11d3636b26f4a.tar dexon-sol-tools-f7236e7f499f59d883603798cda11d3636b26f4a.tar.gz dexon-sol-tools-f7236e7f499f59d883603798cda11d3636b26f4a.tar.bz2 dexon-sol-tools-f7236e7f499f59d883603798cda11d3636b26f4a.tar.lz dexon-sol-tools-f7236e7f499f59d883603798cda11d3636b26f4a.tar.xz dexon-sol-tools-f7236e7f499f59d883603798cda11d3636b26f4a.tar.zst dexon-sol-tools-f7236e7f499f59d883603798cda11d3636b26f4a.zip |
Rename senderAccount to senderAddress
Diffstat (limited to 'src/contract_wrappers')
-rw-r--r-- | src/contract_wrappers/exchange_wrapper.ts | 16 | ||||
-rw-r--r-- | src/contract_wrappers/token_wrapper.ts | 10 |
2 files changed, 13 insertions, 13 deletions
diff --git a/src/contract_wrappers/exchange_wrapper.ts b/src/contract_wrappers/exchange_wrapper.ts index 5c5a46a03..dd06830aa 100644 --- a/src/contract_wrappers/exchange_wrapper.ts +++ b/src/contract_wrappers/exchange_wrapper.ts @@ -203,11 +203,11 @@ export class ExchangeWrapper extends ContractWrapper { } private async validateFillOrderAndThrowIfInvalidAsync(signedOrder: SignedOrder, fillTakerAmount: BigNumber.BigNumber, - senderAccount: string): Promise<void> { + senderAddress: string): Promise<void> { if (fillTakerAmount.eq(0)) { throw new Error(ExchangeContractErrs.ORDER_REMAINING_FILL_AMOUNT_ZERO); } - if (signedOrder.taker !== constants.NULL_ADDRESS && signedOrder.taker !== senderAccount) { + if (signedOrder.taker !== constants.NULL_ADDRESS && signedOrder.taker !== senderAddress) { throw new Error(ExchangeContractErrs.TRANSACTION_SENDER_IS_NOT_FILL_ORDER_TAKER); } const currentUnixTimestampSec = Date.now() / 1000; @@ -216,7 +216,7 @@ export class ExchangeWrapper extends ContractWrapper { } const zrxTokenAddress = await this.getZRXTokenAddressAsync(); await this.validateFillOrderBalancesAndAllowancesAndThrowIfInvalidAsync(signedOrder, fillTakerAmount, - senderAccount, zrxTokenAddress); + senderAddress, zrxTokenAddress); const wouldRoundingErrorOccur = await this.isRoundingErrorAsync( signedOrder.takerTokenAmount, fillTakerAmount, signedOrder.makerTokenAmount, @@ -237,16 +237,16 @@ export class ExchangeWrapper extends ContractWrapper { */ private async validateFillOrderBalancesAndAllowancesAndThrowIfInvalidAsync(signedOrder: SignedOrder, fillTakerAmount: BigNumber.BigNumber, - senderAccount: string, + senderAddress: string, zrxTokenAddress: string): Promise<void> { const makerBalance = await this.tokenWrapper.getBalanceAsync(signedOrder.makerTokenAddress, signedOrder.maker); - const takerBalance = await this.tokenWrapper.getBalanceAsync(signedOrder.takerTokenAddress, senderAccount); + const takerBalance = await this.tokenWrapper.getBalanceAsync(signedOrder.takerTokenAddress, senderAddress); const makerAllowance = await this.tokenWrapper.getProxyAllowanceAsync(signedOrder.makerTokenAddress, signedOrder.maker); const takerAllowance = await this.tokenWrapper.getProxyAllowanceAsync(signedOrder.takerTokenAddress, - senderAccount); + senderAddress); // exchangeRate is the price of one maker token denominated in taker tokens const exchangeRate = signedOrder.takerTokenAmount.div(signedOrder.makerTokenAmount); @@ -267,11 +267,11 @@ export class ExchangeWrapper extends ContractWrapper { const makerFeeBalance = await this.tokenWrapper.getBalanceAsync(zrxTokenAddress, signedOrder.maker); - const takerFeeBalance = await this.tokenWrapper.getBalanceAsync(zrxTokenAddress, senderAccount); + const takerFeeBalance = await this.tokenWrapper.getBalanceAsync(zrxTokenAddress, senderAddress); const makerFeeAllowance = await this.tokenWrapper.getProxyAllowanceAsync(zrxTokenAddress, signedOrder.maker); const takerFeeAllowance = await this.tokenWrapper.getProxyAllowanceAsync(zrxTokenAddress, - senderAccount); + senderAddress); if (signedOrder.takerFee.greaterThan(takerFeeBalance)) { throw new Error(ExchangeContractErrs.INSUFFICIENT_TAKER_FEE_BALANCE); diff --git a/src/contract_wrappers/token_wrapper.ts b/src/contract_wrappers/token_wrapper.ts index 326bca189..34697d97c 100644 --- a/src/contract_wrappers/token_wrapper.ts +++ b/src/contract_wrappers/token_wrapper.ts @@ -115,20 +115,20 @@ export class TokenWrapper extends ContractWrapper { /** * Transfers `amountInBaseUnits` ERC20 tokens from `fromAddress` to `toAddress`. * Requires the fromAddress to have sufficient funds and to have approved an allowance of - * `amountInBaseUnits` for senderAccount. + * `amountInBaseUnits` for senderAddress. */ public async transferFromAsync(tokenAddress: string, fromAddress: string, toAddress: string, - senderAccount: string, amountInBaseUnits: BigNumber.BigNumber): + senderAddress: string, amountInBaseUnits: BigNumber.BigNumber): Promise<void> { assert.isETHAddressHex('tokenAddress', tokenAddress); assert.isETHAddressHex('fromAddress', fromAddress); assert.isETHAddressHex('toAddress', toAddress); - await assert.isSenderAddressHexAsync('senderAccount', senderAccount, this.web3Wrapper); + await assert.isSenderAddressHexAsync('senderAddress', senderAddress, this.web3Wrapper); assert.isBigNumber('amountInBaseUnits', amountInBaseUnits); const tokenContract = await this.getTokenContractAsync(tokenAddress); - const fromAddressAllowance = await this.getAllowanceAsync(tokenAddress, fromAddress, senderAccount); + const fromAddressAllowance = await this.getAllowanceAsync(tokenAddress, fromAddress, senderAddress); if (fromAddressAllowance.lessThan(amountInBaseUnits)) { throw new Error(ZeroExError.INSUFFICIENT_ALLOWANCE_FOR_TRANSFER); } @@ -139,7 +139,7 @@ export class TokenWrapper extends ContractWrapper { } await tokenContract.transferFrom(fromAddress, toAddress, amountInBaseUnits, { - from: senderAccount, + from: senderAddress, }); } private async getTokenContractAsync(tokenAddress: string): Promise<TokenContract> { |