Skip to content

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 ​

solidity
modifier validAddress(address value_)

Validates that an address is not the zero address

onlyRebalancer ​

solidity
modifier onlyRebalancer()

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

constructor ​

solidity
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 ​

NameTypeDescription
reserveContract_contract IFluidReserveContractThe address of the reserve contract where rebalancers are defined.
vault_contract IFluidVaultT1The vault to which this contract will apply new magnifier parameter.
liquidity_contract 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 ​

solidity
function rebalance() external

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

calculateBorrowMagnifier ​

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

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

Return Values ​

NameTypeDescription
magnifier_uint256The calculated magnifier value.
ended_bool

currentBorrowMagnifier ​

solidity
function currentBorrowMagnifier() public view returns (uint256)

returns the currently configured borrow magnifier at the VAULT.

vaultBorrowTVL ​

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

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

getBorrowRate ​

solidity
function getBorrowRate() public view returns (uint256)

Returns the current borrow rate from the liquidity contract.

Return Values ​

NameTypeDescription
[0]uint256The borrow rate as a uint256.

start ​

solidity
function start() external

Starts the rewards at the current block timestamp.

startAt ​

solidity
function startAt(uint256 startTime_) public

Starts the rewards at a specified timestamp.

Parameters ​

NameTypeDescription
startTime_uint256The timestamp at which to start the rewards.

queueNextRewards ​

solidity
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 ​

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