Skip to content

FluidVaultBorrowRewards ​

Git Source

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

solidity
modifier validAddress(address value_);

onlyRebalancer ​

Validates that an address is a rebalancer (taken from reserve contract)

solidity
modifier onlyRebalancer();

constructor ​

Constructs the FluidVaultBorrowRewards contract.

solidity
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

NameTypeDescription
reserveContract_IFluidReserveContractThe address of the reserve contract where rebalancers are defined.
vault_IFluidVaultT1The vault to which this contract will apply new magnifier parameter.
liquidity_IFluidLiquidityFluid liquidity address
rewardsAmt_uint256Amounts of rewards to distribute
duration_uint256rewards duration
initiator_addressaddress that can start rewards with start()
debtToken_addressvault debt token address
governance_addressgovernance address

rebalance ​

Rebalances the borrow rate magnifier based on the current debt borrow. Can only be called by an authorized rebalancer.

solidity
function rebalance() external onlyRebalancer;

calculateBorrowMagnifier ​

Calculates the new borrow rate magnifier based on the current debt borrow (vaultTVL()).

solidity
function calculateBorrowMagnifier() public view returns (uint256 magnifier_, bool ended_);

Returns

NameTypeDescription
magnifier_uint256The calculated magnifier value.
ended_bool

currentBorrowMagnifier ​

returns the currently configured borrow magnifier at the VAULT.

solidity
function currentBorrowMagnifier() public view returns (uint256);

vaultBorrowTVL ​

returns the current total value locked as debt (TVL) in the VAULT.

solidity
function vaultBorrowTVL() public view returns (uint256 tvl_);

getBorrowRate ​

Returns the current borrow rate from the liquidity contract.

solidity
function getBorrowRate() public view returns (uint256);

Returns

NameTypeDescription
<none>uint256The borrow rate as a uint256.

start ​

Starts the rewards at the current block timestamp.

solidity
function start() external;

startAt ​

Starts the rewards at a specified timestamp.

solidity
function startAt(uint256 startTime_) public;

Parameters

NameTypeDescription
startTime_uint256The 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.

solidity
function queueNextRewards(uint256 rewardsAmount_, uint256 duration_) external;

Parameters

NameTypeDescription
rewardsAmount_uint256The amount of rewards to be distributed.
duration_uint256The duration of the rewards program.