YearnAjnaDAIStakingStrategy
Overview
The YearnAjnaDAIStakingStrategy contract is a strategy that supplies DAI into a Yearn V3 Vault and stakes the vault shares to earn additional AJNA rewards. It manages token conversions through Curve's 3pool and Uniswap V3.
Constants
State Variables
Functions
Constructor
Empty constructor marked as initializer.
Initialization Functions
initialize
Initializes the strategy with required components.
Parameters:
_vault
: MaxApy vault address_keepers
: Array of keeper addresses_strategyName
: Name of the strategy_strategist
: Strategist address_yVault
: Yearn V3 vault address
Core Functions
liquidateExact
Withdraws exact amount to vault and re-stakes any remaining shares.
Parameters:
amountNeeded
: Amount to withdraw
Returns:
loss
: Amount of realized loss
maxLiquidateExact
Returns maximum withdrawable amount before losses.
Returns:
Maximum withdrawable amount
Internal Core Functions
_beforePrepareReturn
Claims and processes staking rewards before preparing return.
_invest
Invests assets by swapping to DAI and staking in Yearn.
Parameters:
amount
: Amount to investminOutputAfterInvestment
: Minimum expected shares
Returns:
depositedAmount
: Amount of tokens received
_divest
Unstakes and withdraws assets, converting back to underlying.
Parameters:
shares
: Amount of shares to withdraw
Returns:
withdrawn
: Amount of assets received
_liquidatePosition
Liquidates position up to requested amount.
Parameters:
amountNeeded
: Amount to liquidate
Returns:
liquidatedAmount
: Amount actually liquidatedloss
: Amount of losses incurred
_liquidateAllPositions
Liquidates all positions during emergency exit.
Returns:
amountFreed
: Amount freed
_unwindRewards
Claims AJNA rewards and converts them to underlying.
Parameters:
_yearnStakingRewards
: Staking rewards contract
Internal View Functions
_ajnaBalance
Returns strategy's AJNA token balance.
Returns:
Current AJNA balance
_shareBalance
Returns strategy's staked vault share balance.
Returns:
Current staked share balance
_shareValue
Calculates underlying value of shares including conversion rates.
Parameters:
shares
: Share amount
Returns:
Underlying value
_sharesForAmount
Calculates shares needed for amount including conversion rates.
Parameters:
amount
: Asset amount
Returns:
Required shares
Last updated