FluidVaultBorrowRewards ​
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.
validAddress ​
modifier validAddress(address value_)
Validates that an address is not the zero address
onlyRebalancer ​
modifier onlyRebalancer()
Validates that an address is a rebalancer (taken from reserve contract)
constructor ​
constructor(contract IFluidReserveContract reserveContract_, contract IFluidVaultT1 vault_, contract IFluidLiquidity liquidity_, uint256 rewardsAmt_, uint256 duration_, address initiator_, address debtToken_, address governance_) public
Constructs the FluidVaultBorrowRewards contract.
Parameters ​
Name | Type | Description |
---|---|---|
reserveContract_ | contract IFluidReserveContract | The address of the reserve contract where rebalancers are defined. |
vault_ | contract IFluidVaultT1 | The vault to which this contract will apply new magnifier parameter. |
liquidity_ | contract 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 ​
function rebalance() external
Rebalances the borrow rate magnifier based on the current debt borrow. Can only be called by an authorized rebalancer.
calculateBorrowMagnifier ​
function calculateBorrowMagnifier() public view returns (uint256 magnifier_, bool ended_)
Calculates the new borrow rate magnifier based on the current debt borrow (vaultTVL()
).
Return Values ​
Name | Type | Description |
---|---|---|
magnifier_ | uint256 | The calculated magnifier value. |
ended_ | bool |
currentBorrowMagnifier ​
function currentBorrowMagnifier() public view returns (uint256)
returns the currently configured borrow magnifier at the VAULT
.
vaultBorrowTVL ​
function vaultBorrowTVL() public view returns (uint256 tvl_)
returns the current total value locked as debt (TVL) in the VAULT
.
getBorrowRate ​
function getBorrowRate() public view returns (uint256)
Returns the current borrow rate from the liquidity contract.
Return Values ​
Name | Type | Description |
---|---|---|
[0] | uint256 | The borrow rate as a uint256. |
start ​
function start() external
Starts the rewards at the current block timestamp.
startAt ​
function startAt(uint256 startTime_) public
Starts the rewards at a specified timestamp.
Parameters ​
Name | Type | Description |
---|---|---|
startTime_ | uint256 | The timestamp at which to start the rewards. |
queueNextRewards ​
function queueNextRewards(uint256 rewardsAmount_, uint256 duration_) external
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.
Parameters ​
Name | Type | Description |
---|---|---|
rewardsAmount_ | uint256 | The amount of rewards to be distributed. |
duration_ | uint256 | The duration of the rewards program. |