FluidVaultRewards
Inherits:Variables, Events, Error
This contract is designed to adjust the supply rate magnifier for a vault based on the current collateral supply & supply rate. The adjustment aims to dynamically scale the rewards given to lenders as the TVL in the vault changes. The magnifier is adjusted based on a regular most used reward type where rewardRate = totalRewardsAnnually / totalSupply. Reward rate is applied by adjusting the supply magnifier on vault. Adjustments are made via the rebalance function, which is restricted to be called by designated rebalancers only.
Functions
validAddress
Validates that an address is not the zero address
modifier validAddress(address value_);
onlyRebalancer
Validates that an address is a rebalancer (taken from reserve contract)
modifier onlyRebalancer();
constructor
Constructs the FluidVaultRewards contract.
constructor(
IFluidReserveContract reserveContract_,
IFluidVaultT1 vault_,
IFluidLiquidity liquidity_,
uint256 rewardsAmt_,
uint256 duration_,
address initiator_,
address collateralToken_
)
validAddress(address(reserveContract_))
validAddress(address(liquidity_))
validAddress(address(vault_))
validAddress(initiator_)
validAddress(address(collateralToken_));
Parameters
Name | Type | Description |
---|---|---|
reserveContract_ | IFluidReserveContract | The address of the reserve contract where rebalancers are defined. |
vault_ | IFluidVaultT1 | The vault to which this contract will apply new magnifier parameter. |
liquidity_ | IFluidLiquidity | Fluid liquidity address |
rewardsAmt_ | uint256 | Amounts of rewards to distribute |
duration_ | uint256 | rewards duration |
initiator_ | address | address that can start rewards with start() |
collateralToken_ | address | vault collateral token address |
rebalance
Rebalances the supply rate magnifier based on the current collateral supply. Can only be called by an authorized rebalancer.
function rebalance() external onlyRebalancer;
calculateMagnifier
Calculates the new supply rate magnifier based on the current collateral supply (vaultTVL()
).
function calculateMagnifier() public view returns (uint256 magnifier_, bool ended_);
Returns
Name | Type | Description |
---|---|---|
magnifier_ | uint256 | The calculated magnifier value. |
ended_ | bool |
currentMagnifier
returns the currently configured supply magnifier at the VAULT
.
function currentMagnifier() public view returns (uint256);
vaultTVL
returns the current total value locked as collateral (TVL) in the VAULT
.
function vaultTVL() public view returns (uint256 tvl_);
getSupplyRate
function getSupplyRate() public view returns (uint256 supplyRate_);
start
function start() external;