BaseStrategy
Inherits: Initializable, OwnableUpgradeable, ReentrancyGuardUpgradeable
Author: Sperax Foundation
Contract acts as a single interface for implementing specific yield-earning strategies.
State Variables
vault
withdrawSlippage
depositSlippage
harvestIncentiveRate
assetsMapped
rewardTokenAddress
assetToPToken
gap
Functions
onlyVault
onlyVaultOrOwner
constructor
updateVault
Update the linked vault contract.
Parameters
updateHarvestIncentiveRate
Updates the HarvestIncentive rate for the user.
Parameters
recoverERC20
A function to recover any erc20 token sent to this strategy mistakenly.
Only callable by owner.
reverts if amount > balance.
Parameters
deposit
Deposit an amount of asset into the platform.
Parameters
withdraw
Withdraw an amount of asset from the platform.
Parameters
Returns
withdrawToVault
Withdraw an amount of asset from the platform to vault.
Parameters
collectInterest
Withdraw the interest earned of asset from the platform.
Parameters
collectReward
Collect accumulated reward token and send to Vault.
checkBalance
Get the amount of a specific asset held in the strategy, excluding the interest.
Curve: assuming balanced withdrawal.
Parameters
Returns
checkAvailableBalance
Get the amount of a specific asset held in the strategy, excluding the interest and any locked liquidity that is not available for instant withdrawal.
Curve: assuming balanced withdrawal.
Parameters
Returns
checkInterestEarned
AAVE: Get the interest earned on a specific asset. Curve: Get the total interest earned.
Curve: to avoid double-counting, _asset has to be of index 'entryTokenIndex'.
Parameters
Returns
checkRewardEarned
Get the amount of claimable reward.
Returns
checkLPTokenBalance
Get the total LP token balance for a asset.
Parameters
supportsCollateral
Check if an asset/collateral is supported.
Parameters
Returns
updateSlippage
Change to a new depositSlippage & withdrawSlippage.
Parameters
_initialize
Initialize the base properties of the strategy.
Parameters
_setPTokenAddress
Provide support for asset by passing its pToken address. Add to internal mappings and execute the platform specific, abstract method _abstractSetPToken
.
Parameters
_removePTokenAddress
Remove a supported asset by passing its index. This method can only be called by the system owner.
Parameters
Returns
_splitAndSendReward
Splits and sends the accumulated rewards to harvestor and yield receiver.
Sends the amount to harvestor as per harvestIncentiveRate
and sends the rest to yield receiver.
Parameters
Returns
_abstractSetPToken
Call the necessary approvals for the underlying strategy.
Parameters