From 3ff43069e179a98fb7cbe7a1a1472f0527e4590a Mon Sep 17 00:00:00 2001 From: Samyak Jain Date: Sun, 7 Apr 2019 01:47:41 +0530 Subject: [PATCH] setApproval gas efficiency --- contracts/ProxyLogics/InstaUniswapPool.sol | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/contracts/ProxyLogics/InstaUniswapPool.sol b/contracts/ProxyLogics/InstaUniswapPool.sol index b00c718..439267f 100644 --- a/contracts/ProxyLogics/InstaUniswapPool.sol +++ b/contracts/ProxyLogics/InstaUniswapPool.sol @@ -37,7 +37,8 @@ contract Helper { * @dev get Uniswap Proxy address */ function getAddressUniFactory() public pure returns (address factory) { - factory = 0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95; + // factory = 0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95; + factory = 0xf5D915570BC477f9B8D6C0E980aA81757A3AaC36; // Rinkeby } // Get Uniswap's Exchange address from Factory Contract @@ -75,9 +76,10 @@ contract Helper { * @param token is the token address */ function setApproval(address token, uint srcAmt, address to) internal { - uint tokenAllowance = IERC20(token).allowance(address(this), to); + IERC20 erc20Contract = IERC20(token); + uint tokenAllowance = erc20Contract.allowance(address(this), to); if (srcAmt > tokenAllowance) { - IERC20(token).approve(to, 2**255); + erc20Contract.approve(to, 2**255); } }