aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-10-10 16:45:57 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-10-10 16:45:57 +0800
commit3fa98ec00e158d5218e26fd09ed2aee347e6303b (patch)
tree3196a6f833bc0d0db2c89df0cdd2611778124322 /src
parent052fd5783f8d3df6475b1caf7cad118999996e4b (diff)
downloaddexon-sol-tools-3fa98ec00e158d5218e26fd09ed2aee347e6303b.tar
dexon-sol-tools-3fa98ec00e158d5218e26fd09ed2aee347e6303b.tar.gz
dexon-sol-tools-3fa98ec00e158d5218e26fd09ed2aee347e6303b.tar.bz2
dexon-sol-tools-3fa98ec00e158d5218e26fd09ed2aee347e6303b.tar.lz
dexon-sol-tools-3fa98ec00e158d5218e26fd09ed2aee347e6303b.tar.xz
dexon-sol-tools-3fa98ec00e158d5218e26fd09ed2aee347e6303b.tar.zst
dexon-sol-tools-3fa98ec00e158d5218e26fd09ed2aee347e6303b.zip
Assign to a variable before assigning
Diffstat (limited to 'src')
-rw-r--r--src/utils/exchange_transfer_simulator.ts6
1 files 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])) {