Skip to content

Constants ​

RESERVE_CONTRACT ​

solidity
contract IFluidReserveContract RESERVE_CONTRACT

LIQUIDITY ​

solidity
contract IFluidLiquidity LIQUIDITY

LIQUIDITY_RESOLVER ​

solidity
contract IFluidLiquidityResolver LIQUIDITY_RESOLVER

PROTOCOL ​

solidity
address PROTOCOL

BORROW_TOKEN ​

solidity
address BORROW_TOKEN

MAX_UTILIZATION ​

solidity
uint256 MAX_UTILIZATION

max utilization of total supply that will be set as max borrow limit. In percent (100 = 1%, 1 = 0.01%)

MIN_UPDATE_DIFF ​

solidity
uint256 MIN_UPDATE_DIFF

minimum percent difference to trigger an update. In percent (100 = 1%, 1 = 0.01%)

_LIQUDITY_PROTOCOL_BORROW_SLOT ​

solidity
bytes32 _LIQUDITY_PROTOCOL_BORROW_SLOT

MAX_UTILIZATION_PRECISION ​

solidity
uint256 MAX_UTILIZATION_PRECISION

DEFAULT_EXPONENT_SIZE ​

solidity
uint256 DEFAULT_EXPONENT_SIZE

DEFAULT_EXPONENT_MASK ​

solidity
uint256 DEFAULT_EXPONENT_MASK

EXCHANGE_PRICES_PRECISION ​

solidity
uint256 EXCHANGE_PRICES_PRECISION

X14 ​

solidity
uint256 X14

X18 ​

solidity
uint256 X18

X24 ​

solidity
uint256 X24

Events ​

LogUpdateBorrowMaxDebtCeiling ​

solidity
event LogUpdateBorrowMaxDebtCeiling(uint256 totalSupplyNormal, uint256 oldMaxDebtCeilingRaw, uint256 maxDebtCeilingRaw, uint256 borrowExchangePrice)

emitted when borrow max limit is updated

FluidMaxBorrowConfigHandler ​

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

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 IFluidLiquidity liquidity_, contract IFluidLiquidityResolver liquidityResolver_, address protocol_, address borrowToken_, uint256 maxUtilization_, uint256 minUpdateDiff_) public

getTotalSupply ​

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

returns BORROW_TOKEN total supply at Liquidity (in normal).

currentMaxDebtCeiling ​

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

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

calcMaxDebtCeilingNormal ​

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

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

calcMaxDebtCeiling ​

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

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

configPercentDiff ​

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

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

rebalance ​

solidity
function rebalance() external

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.

_getTotalSupply ​

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_)