From 3fa98ec00e158d5218e26fd09ed2aee347e6303b Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 10 Oct 2017 11:45:57 +0300 Subject: Assign to a variable before assigning --- src/utils/exchange_transfer_simulator.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/utils/exchange_transfer_simulator.ts b/src/utils/exchange_transfer_simulator.ts index 86682f39e..74df87357 100644 --- a/src/utils/exchange_transfer_simulator.ts +++ b/src/utils/exchange_transfer_simulator.ts @@ -55,7 +55,8 @@ export class BalanceAndProxyAllowanceLazyStore { const balance = await this._token.getBalanceAsync(tokenAddress, userAddress); this.setBalance(tokenAddress, userAddress, balance); } - return this._balance[tokenAddress][userAddress]; + const cachedBalance = this._balance[tokenAddress][userAddress]; + return cachedBalance; } protected setBalance(tokenAddress: string, userAddress: string, balance: BigNumber.BigNumber): void { if (_.isUndefined(this._balance[tokenAddress])) { @@ -69,7 +70,8 @@ export class BalanceAndProxyAllowanceLazyStore { const proxyAllowance = await this._token.getProxyAllowanceAsync(tokenAddress, userAddress); this.setProxyAllowance(tokenAddress, userAddress, proxyAllowance); } - return this._proxyAllowance[tokenAddress][userAddress]; + const cachedProxyAllowance = this._proxyAllowance[tokenAddress][userAddress]; + return cachedProxyAllowance; } protected setProxyAllowance(tokenAddress: string, userAddress: string, proxyAllowance: BigNumber.BigNumber): void { if (_.isUndefined(this._proxyAllowance[tokenAddress])) { -- cgit