Strategy
This is an abstract contract that implements key functionality for all strategies. For example, the AaveLeverageStrategy contract inherits from Strategy and AaveCore.
contract IERC20 collateralToken
address receiptToken
address pool
address feeCollector
contract ISwapManager swapManager
uint256 oraclePeriod
uint256 oracleRouterIdx
uint256 swapSlippage
struct EnumerableSet.AddressSet _keepers
event UpdatedFeeCollector(address previousFeeCollector, address newFeeCollector)
event UpdatedSwapManager(address previousSwapManager, address newSwapManager)
event UpdatedSwapSlippage(uint256 oldSwapSlippage, uint256 newSwapSlippage)
event UpdatedOracleConfig(uint256 oldPeriod, uint256 newPeriod, uint256 oldRouterIdx, uint256 newRouterIdx)
function addKeeper(address _keeperAddress) external
Add given address in keepers list.
Name | Type | Description |
---|---|---|
_keeperAddress | address | keeper address to add. |
function keepers() external view returns (address[])
Return list of keepers
function migrate(address _newStrategy) external virtual
Migrate all asset and vault ownership,if any, to new strategy
_beforeMigration hook can be implemented in child strategy to do extra steps.
Name | Type | Description |
---|---|---|
_newStrategy | address | Address of new strategy |
function removeKeeper(address _keeperAddress) external
Remove given address from keepers list.
Name | Type | Description |
---|---|---|
_keeperAddress | address | keeper address to remove. |
function updateFeeCollector(address _feeCollector) external
Update fee collector
Name | Type | Description |
---|---|---|
_feeCollector | address | fee collector address |
function updateSwapManager(address _swapManager) external
Update swap manager address
Name | Type | Description |
---|---|---|
_swapManager | address | swap manager address |
function updateSwapSlippage(uint256 _newSwapSlippage) external
function updateOracleConfig(uint256 _newPeriod, uint256 _newRouterIdx) external
function approveToken() external
Approve all required tokens
function setupOracles() external
function withdraw(uint256 _amount) external
Withdraw collateral token from lending pool.
Name | Type | Description |
---|---|---|
_amount | uint256 | Amount of collateral token |
function rebalance() external virtual
Rebalance profit, loss and investment of this strategy
function sweepERC20(address _fromToken) external
sweep given token to feeCollector of strategy
Name | Type | Description |
---|---|---|
_fromToken | address | token address to sweep |
function token() external view returns (address)
Returns address of token correspond to collateral token
function totalValue() public view virtual returns (uint256 _value)
Calculate total value of asset under management
Report total value in collateral token
function totalValueCurrent() external virtual returns (uint256)
Calculate total value of asset under management (in real-time)
Report total value in collateral token
function isReservedToken(address _token) public view virtual returns (bool)
Check whether given token is reserved or not. Reserved tokens are not allowed to sweep.
Last modified 7mo ago