diff --git a/contracts/mainnet/connectors/uniswap_v3_erc20_staking/helpers.sol b/contracts/mainnet/connectors/uniswap_v3_erc20_staking/helpers.sol index e083fe94..ac412828 100644 --- a/contracts/mainnet/connectors/uniswap_v3_erc20_staking/helpers.sol +++ b/contracts/mainnet/connectors/uniswap_v3_erc20_staking/helpers.sol @@ -14,4 +14,11 @@ abstract contract Helpers is DSMath, Basic { TokenInterface constant internal rewardToken = TokenInterface(address(0)); // TODO + function getStakingContract(address stakingToken) internal view returns (address) { + IStakingRewardsFactory.StakingRewardsInfo memory stakingRewardsInfo = + stakingRewardsFactory.stakingRewardsInfoByStakingToken(stakingToken); + + return IStakingRewards(stakingRewardsInfo.stakingRewards); + } + } \ No newline at end of file diff --git a/contracts/mainnet/connectors/uniswap_v3_erc20_staking/main.sol b/contracts/mainnet/connectors/uniswap_v3_erc20_staking/main.sol index ecb4ea2c..4cd4fbcc 100644 --- a/contracts/mainnet/connectors/uniswap_v3_erc20_staking/main.sol +++ b/contracts/mainnet/connectors/uniswap_v3_erc20_staking/main.sol @@ -30,10 +30,7 @@ contract Main is Helpers, Events { ) external payable returns (string memory _eventName, bytes memory _eventParam) { uint _amt = getUint(getId, amt); - IStakingRewardsFactory.StakingRewardsInfo memory stakingRewardsInfo = - stakingRewardsFactory.stakingRewardsInfoByStakingToken(stakingToken); - - IStakingRewards stakingContract = IStakingRewards(stakingRewardsInfo.stakingRewards); + IStakingRewards stakingContract = IStakingRewards(getStakingContract(stakingToken)); TokenInterface stakingTokenContract = TokenInterface(stakingToken); _amt = _amt == uint(-1) ? stakingTokenContract.balanceOf(address(this)) : _amt; @@ -64,10 +61,7 @@ contract Main is Helpers, Events { ) external payable returns (string memory _eventName, bytes memory _eventParam) { uint _amt = getUint(getId, amt); - IStakingRewardsFactory.StakingRewardsInfo memory stakingRewardsInfo = - stakingRewardsFactory.stakingRewardsInfoByStakingToken(stakingToken); - - IStakingRewards stakingContract = IStakingRewards(stakingRewardsInfo.stakingRewards); + IStakingRewards stakingContract = IStakingRewards(getStakingContract(stakingToken)); _amt = _amt == uint(-1) ? stakingContract.balanceOf(address(this)) : _amt; uint intialBal = rewardToken.balanceOf(address(this)); @@ -94,10 +88,7 @@ contract Main is Helpers, Events { address stakingToken, uint setId ) external payable returns (string memory _eventName, bytes memory _eventParam) { - IStakingRewardsFactory.StakingRewardsInfo memory stakingRewardsInfo = - stakingRewardsFactory.stakingRewardsInfoByStakingToken(stakingToken); - - IStakingRewards stakingContract = IStakingRewards(stakingRewardsInfo.stakingRewards); + IStakingRewards stakingContract = IStakingRewards(getStakingContract(stakingToken)); uint intialBal = rewardToken.balanceOf(address(this)); stakingContract.getReward();