FluidVaultBorrowRewards ​
Inherits:Variables, Events, Error
This contract is designed to adjust the borrow rate magnifier for a vault based on the current debt borrow & borrow 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 / totalborrow. Reward rate is applied by adjusting the borrow 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 FluidVaultBorrowRewards contract.
constructor(
IFluidReserveContract reserveContract_,
IFluidVaultT1 vault_,
IFluidLiquidity liquidity_,
uint256 rewardsAmt_,
uint256 duration_,
address initiator_,
address debtToken_,
address governance_
)
validAddress(address(reserveContract_))
validAddress(address(liquidity_))
validAddress(address(vault_))
validAddress(initiator_)
validAddress(address(debtToken_))
validAddress(governance_);
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() |
debtToken_ | address | vault debt token address |
governance_ | address | governance address |
rebalance ​
Rebalances the borrow rate magnifier based on the current debt borrow. Can only be called by an authorized rebalancer.
function rebalance() external onlyRebalancer;
calculateBorrowMagnifier ​
Calculates the new borrow rate magnifier based on the current debt borrow (vaultTVL()
).
function calculateBorrowMagnifier() public view returns (uint256 magnifier_, bool ended_);
Returns
Name | Type | Description |
---|---|---|
magnifier_ | uint256 | The calculated magnifier value. |
ended_ | bool |
currentBorrowMagnifier ​
returns the currently configured borrow magnifier at the VAULT
.
function currentBorrowMagnifier() public view returns (uint256);
vaultBorrowTVL ​
returns the current total value locked as debt (TVL) in the VAULT
.
function vaultBorrowTVL() public view returns (uint256 tvl_);
getBorrowRate ​
Returns the current borrow rate from the liquidity contract.
function getBorrowRate() public view returns (uint256);
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The borrow rate as a uint256. |
start ​
Starts the rewards at the current block timestamp.
function start() external;
startAt ​
Starts the rewards at a specified timestamp.
function startAt(uint256 startTime_) public;
Parameters
Name | Type | Description |
---|---|---|
startTime_ | uint256 | The timestamp at which to start the rewards. |
queueNextRewards ​
Queues the next rewards with specified amount and duration.
This function can only be called by the governance address.
Reverts if the current rewards period has already ended.
function queueNextRewards(uint256 rewardsAmount_, uint256 duration_) external;
Parameters
Name | Type | Description |
---|---|---|
rewardsAmount_ | uint256 | The amount of rewards to be distributed. |
duration_ | uint256 | The duration of the rewards program. |