Skip to content

FluidMaxBorrowConfigHandler ​

Git Source

Inherits:Constants, Error, Events

Sets max borrow limit for a protocol on Liquidity based on utilization of total supply of the same borrow token

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 ​

solidity
constructor(
    IFluidReserveContract reserveContract_,
    IFluidLiquidity liquidity_,
    IFluidLiquidityResolver liquidityResolver_,
    address protocol_,
    address borrowToken_,
    uint256 maxUtilization_,
    uint256 minUpdateDiff_
)
    validAddress(address(reserveContract_))
    validAddress(address(liquidity_))
    validAddress(address(liquidityResolver_))
    validAddress(protocol_)
    validAddress(borrowToken_);

getTotalSupply ​

returns BORROW_TOKEN total supply at Liquidity (in normal).

solidity
function getTotalSupply() public view returns (uint256 totalSupplyNormal_);

currentMaxDebtCeiling ​

returns the currently set max debt ceiling (in raw for mode with interest!).

solidity
function currentMaxDebtCeiling() public view returns (uint256 maxDebtCeiling_);

calcMaxDebtCeilingNormal ​

returns the max debt ceiling that should be set according to current state (in normal).

solidity
function calcMaxDebtCeilingNormal() public view returns (uint256 maxDebtCeilingNormal_);

calcMaxDebtCeiling ​

returns the max debt ceiling that should be set according to current state (in raw for mode with interest!).

solidity
function calcMaxDebtCeiling() public view returns (uint256 maxDebtCeiling_);

configPercentDiff ​

returns how much new config would be different from current config in percent (100 = 1%, 1 = 0.01%).

solidity
function configPercentDiff() public view returns (uint256 configPercentDiff_);

rebalance ​

Rebalances the configs for PROTOCOL at Fluid Liquidity based on protocol total supply & total borrow. Emits LogUpdateBorrowMaxDebtCeiling if update is executed. Reverts if no update is needed. Can only be called by an authorized rebalancer.

solidity
function rebalance() external onlyRebalancer;

_getTotalSupply ​

| | INTERNALS | |__________________________________

solidity
function _getTotalSupply() internal view returns (uint256 totalSupplyNormal_, uint256 borrowExchangePrice_);

_calcMaxDebtCeiling ​

solidity
function _calcMaxDebtCeiling()
    internal
    view
    returns (
        uint256 maxDebtCeilingRaw_,
        uint256 totalSupplyNormal_,
        uint256 borrowExchangePrice_,
        uint256 userBorrowData_,
        uint256 baseDebtCeilingRaw_
    );

_configPercentDiff ​

solidity
function _configPercentDiff(uint256 userBorrowData_, uint256 maxDebtCeilingRaw_)
    internal
    pure
    returns (uint256 configPercentDiff_, uint256 oldMaxDebtCeilingRaw_);

_updateBorrowLimits ​

solidity
function _updateBorrowLimits() internal returns (bool updated_);