Skip to content

Commit

Permalink
N-05 Added CURVE_VIRTUAL_PRICE_SCALE constant
Browse files Browse the repository at this point in the history
  • Loading branch information
naddison36 committed Jan 15, 2024
1 parent cc4c40a commit 493f80d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 26 deletions.
6 changes: 5 additions & 1 deletion contracts/contracts/strategies/FraxConvexStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ contract FraxConvexStrategy is CurveTwoCoinFunctions, BaseCurveStrategy {
using StableMath for uint256;
using SafeERC20 for IERC20;

/// @dev The virtual price of the Curve LP token normalized to 1e18
uint256 internal constant CURVE_VIRTUAL_PRICE_SCALE = 1e18;

/// @notice The number of seconds to lock Frax Staked Convex LP tokens for.
/// 7 days is the minimum to get token rewards.
uint256 public constant LOCK_DURATION = 7 days + 1;
Expand Down Expand Up @@ -424,7 +427,8 @@ contract FraxConvexStrategy is CurveTwoCoinFunctions, BaseCurveStrategy {
// get_virtual_price is gas intensive, so only call it if we have LP tokens.
// Convert the Curve LP tokens controlled by this strategy to a value in USD or ETH
uint256 value = (curveLpTokens *
ICurvePool(CURVE_POOL).get_virtual_price()) / 1e18;
ICurvePool(CURVE_POOL).get_virtual_price()) /
CURVE_VIRTUAL_PRICE_SCALE;

// Divide by the number of assets in the Curve pool. eg 2 for the frxETH/WETH pool.
// An average is taken to prevent the balances being manipulated by tilting the Curve pool.
Expand Down
51 changes: 26 additions & 25 deletions contracts/docs/FraxConvexStrategySquashed.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 493f80d

Please sign in to comment.