Skip to main content

BaseConvexMetaStrategy

BaseConvexMetaStrategy

MaxWithdrawalSlippageUpdated

event MaxWithdrawalSlippageUpdated(uint256 _prevMaxSlippagePercentage, uint256 _newMaxSlippagePercentage)

InitConfig

struct InitConfig {
address cvxDepositorAddress;
address metapoolAddress;
address metapoolMainToken;
address cvxRewardStakerAddress;
address metapoolLPToken;
uint256 cvxDepositorPTokenId;
}

cvxDepositorAddress

address cvxDepositorAddress

cvxRewardStakerAddress

address cvxRewardStakerAddress

cvxDepositorPTokenId

uint256 cvxDepositorPTokenId

metapool

contract ICurveMetaPool metapool

metapoolMainToken

contract IERC20 metapoolMainToken

metapoolLPToken

contract IERC20 metapoolLPToken

metapoolAssets

address[] metapoolAssets

maxWithdrawalSlippage

uint256 maxWithdrawalSlippage

crvCoinIndex

uint128 crvCoinIndex

mainCoinIndex

uint128 mainCoinIndex

initialize

function initialize(address[] _rewardTokenAddresses, address[] _assets, address[] _pTokens, struct BaseConvexMetaStrategy.InitConfig initConfig) external

Initializer for setting up strategy internal state. This overrides the InitializableAbstractStrategy initializer as Curve strategies don't fit well within that abstraction.

Parameters

NameTypeDescription
_rewardTokenAddressesaddress[]Address of CRV & CVX
_assetsaddress[]Addresses of supported assets. MUST be passed in the same order as returned by coins on the pool contract, i.e. DAI, USDC, USDT
_pTokensaddress[]Platform Token corresponding addresses
initConfigstruct BaseConvexMetaStrategy.InitConfigVarious addresses and info for initialization state

checkBalance

function checkBalance(address _asset) public view virtual returns (uint256 balance)

Get the total asset value held in the platform

Parameters

NameTypeDescription
_assetaddressAddress of the asset

Return Values

NameTypeDescription
balanceuint256Total value of the asset in the platform

_calcCurveMetaTokenAmount

function _calcCurveMetaTokenAmount(uint128 _coinIndex, uint256 _amount) internal returns (uint256 requiredMetapoolLP)

This function is completely analogous to _calcCurveTokenAmount[BaseCurveStrategy] and just utilizes different Curve (meta)pool API

_approveBase

function _approveBase() internal

_getMetapoolCoinIndex

function _getMetapoolCoinIndex(address _asset) internal view returns (uint128)

Get the index of the coin

setMaxWithdrawalSlippage

function setMaxWithdrawalSlippage(uint256 _maxWithdrawalSlippage) external

Sets max withdrawal slippage that is considered when removing liquidity from Metapools.

Parameters

NameTypeDescription
_maxWithdrawalSlippageuint256Max withdrawal slippage denominated in wad (number with 18 decimals): 1e18 == 100%, 1e16 == 1% IMPORTANT Minimum maxWithdrawalSlippage should actually be 0.1% (1e15) for production usage. Contract allows as low value as 0% for confirming correct behavior in test suite.

collectRewardTokens

function collectRewardTokens() external

Collect accumulated CRV and CVX and send to Harvester.

_max

function _max(int256 a, int256 b) internal pure returns (int256)

Returns the largest of two numbers int256 version