Skip to content

Commit

Permalink
Merge pull request #16 from Badger-Finance/feat-redirection-gas
Browse files Browse the repository at this point in the history
Feat redirection gas
  • Loading branch information
sajanrajdev authored Aug 24, 2022
2 parents 40d3707 + c8819e4 commit 2f3f678
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions contracts/MyStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,10 @@ contract MyStrategy is BaseStrategy, ReentrancyGuardUpgradeable {

/// @dev Send funds to the bribes receiver
function _sendTokenToBribesProcessor(address token, uint256 amount) internal {
require(address(bribesProcessor) != address(0), "Bribes processor not set");
address cachedBribesProcessor = address(bribesProcessor);
require(cachedBribesProcessor != address(0), "Bribes processor not set");

IERC20Upgradeable(token).safeTransfer(address(bribesProcessor), amount);
IERC20Upgradeable(token).safeTransfer(cachedBribesProcessor, amount);
emit RewardsCollected(token, amount);
}

Expand All @@ -505,9 +506,10 @@ contract MyStrategy is BaseStrategy, ReentrancyGuardUpgradeable {
// Process redirection fee
uint256 redirectionFee = amount.mul(redirectionFees[token]).div(MAX_BPS);
if (redirectionFee > 0) {
IERC20Upgradeable(token).safeTransfer(IVault(vault).treasury(), redirectionFee);
address cachedTreasury = IVault(vault).treasury();
IERC20Upgradeable(token).safeTransfer(cachedTreasury, redirectionFee);
emit RedirectionFee(
IVault(vault).treasury(),
cachedTreasury,
token,
redirectionFee,
block.number,
Expand Down

0 comments on commit 2f3f678

Please sign in to comment.