HarvestManager.sol
Harvest Manager is a contract that is used to manage the process of swapping yield generated by sfuAVAX vault and distributing it to the beneficiaries. Swapping and disributing strategies are separate contracts. The contract is managed by multisig in the beginning and governance in the future.
Swap and distribute strategies are stored in the /strategies folder. Since this contract supports swaping any ERC-20 tokens, it is required to provide address of both tokens (in and out) to perform a swap.
State Variables
owner
The owner of the contract. It can be changed by calling changeOwner() function.
address public owner;activeSwapStrategyAddress
The address of the active swap strategy. It can be changed by calling updateSwapStrategy() function.
address public activeSwapStrategyAddress;activeDistributeStrategyAddress
The address of the active distributing strategy. It can be changed by calling updateDistributeStrategy() function.
address public activeDistributeStrategyAddress;Functions
constructor
constructor();onlyOwner
Modifier to check if the caller is the owner of the contract.
modifier onlyOwner();swap
The function that users (keepers) call to swap harvested yield for an assets suitable for donation (e.g. stablecoin). This contract doesn't have a logic to exscute transfer. Instead, it calls the swap function on the active swap strategy contract.
function swap(address _token0, address _token1, ISwapStrategy) external onlyOwner;Parameters
_token0
address
The address of the token that is swapped (usually sAVAX, but also can be used to swap any other ERC-20 tokens sent to manager by mistake).
_token1
address
The address of the token that is received after swap (e.g. USDC)
<none>
ISwapStrategy
distribute
The function that users (keepers) call to distribute harvested yield to beneficiaries after it was swapped to more stable asset (e.g. stablecoin). This contract doesn't have a logic to exscute transfer. Instead, it calls the distribute function on the active distribute strategy contract.
function distribute(address _distributionToken) external onlyOwner;Parameters
_distributionToken
address
The address of the token that is distributed (usually USDC, but also can be used to distribute any other ERC-20 tokens sent to manager by mistake).
updateSwapStrategy
The function to update the address of the active swap strategy.
function updateSwapStrategy(address _newSwapStrategyAddress) external onlyOwner;Parameters
_newSwapStrategyAddress
address
The address of the new swap strategy contract.
updateDistributeStrategy
The function that owner calls to update the address of the active distribution strategy.
function updateDistributeStrategy(address _newDistributeStrategyAddress) external onlyOwner;Parameters
_newDistributeStrategyAddress
address
The address of the new distribution strategy contract.
changeOwner
The function that owner calls to transfer ownership of the contract.
function changeOwner(address _newOwner) external onlyOwner;Parameters
_newOwner
address
The address of the new owner.
Events
Swap
The event emitted when swap function is called.
event Swap(address _token0, address _token1, uint256 _amount, address _swapStrategy);Distribute
The event emitted when distribute function is called.
event Distribute(address _distributionToken, uint256 _amount);Last updated