Skip to content

Commit

Permalink
Cached rewardPID in updateFarm()
Browse files Browse the repository at this point in the history
  • Loading branch information
arcantheon committed Nov 30, 2023
1 parent 9f3db4e commit 51259ed
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions contracts/strategies/stargate/StargateStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,11 @@ contract StargateStrategy is InitializableAbstractStrategy {
/// @param _asset Address of asset of which lp token is to be withdrawn and deposited
/// @dev Only callable by owner
function updateFarm(address _newFarm, address _asset) external onlyOwner {
uint256 _rewardPID = assetInfo[_asset].rewardPID;
uint256 lpTokenAmt = checkLPTokenBalance(_asset);
ILPStaking(farm).withdraw(assetInfo[_asset].rewardPID, lpTokenAmt);
ILPStaking(farm).withdraw(_rewardPID, lpTokenAmt);
farm = _newFarm;
ILPStaking(_newFarm).deposit(assetInfo[_asset].rewardPID, lpTokenAmt); // Gas savings
ILPStaking(_newFarm).deposit(_rewardPID, lpTokenAmt); // Gas savings
emit FarmUpdated(_newFarm);
}

Expand Down

0 comments on commit 51259ed

Please sign in to comment.