Skip to content

Commit

Permalink
🪲 [H-1] fix potential Convex rewards loss
Browse files Browse the repository at this point in the history
  • Loading branch information
0xIryna committed May 9, 2024
1 parent 5eb9c2f commit 73c0f0b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/AfCvx.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { UUPSUpgradeable } from "@openzeppelin/contracts-upgradeable/proxy/utils
import { TrackedAllowances, Allowance } from "./utils/TrackedAllowances.sol";
import { IAfCvx } from "./interfaces/afCvx/IAfCvx.sol";
import { ICleverCvxStrategy } from "./interfaces/afCvx/ICleverCvxStrategy.sol";
import { CVX } from "./interfaces/convex/Constants.sol";
import { CVX, CVXCRV } from "./interfaces/convex/Constants.sol";
import { CVX_REWARDS_POOL } from "./interfaces/convex/ICvxRewardsPool.sol";
import { CLEVER_CVX_LOCKER } from "./interfaces/clever/ICLeverCvxLocker.sol";
import { Zap } from "./utils/Zap.sol";
Expand Down Expand Up @@ -448,9 +448,9 @@ contract AfCvx is IAfCvx, TrackedAllowances, Ownable, ERC4626Upgradeable, ERC20P
/// @dev Should be called at the beginning of each epoch.
/// Keeps harvested rewards in the contract. Call `distribute` to redeposit rewards.
function harvest(uint256 minAmountOut) external onlyOperatorOrOwner returns (uint256 rewards) {
uint256 convexStakedRewards = CVX_REWARDS_POOL.earned(address(this));
CVX_REWARDS_POOL.getReward(address(this), false, false);
uint256 convexStakedRewards = CVXCRV.balanceOf(address(this));
if (convexStakedRewards != 0) {
CVX_REWARDS_POOL.getReward(address(this), false, false);
convexStakedRewards = Zap.swapCvxCrvToCvx(convexStakedRewards, minAmountOut);
}

Expand Down
1 change: 1 addition & 0 deletions src/interfaces/convex/Constants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ pragma solidity 0.8.25;
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

IERC20 constant CVX = IERC20(address(0x4e3FBD56CD56c3e72c1403e103b45Db9da5B9D2B));
IERC20 constant CVXCRV = IERC20(address(0x62B9c7356A2Dc64a1969e19C23e4f579F9810Aa7));

0 comments on commit 73c0f0b

Please sign in to comment.