Constants ​
RESERVE_CONTRACT ​
contract IFluidReserveContract RESERVE_CONTRACT
LIQUIDITY ​
contract IFluidLiquidity LIQUIDITY
LIQUIDITY_RESOLVER ​
contract IFluidLiquidityResolver LIQUIDITY_RESOLVER
PROTOCOL ​
address PROTOCOL
BORROW_TOKEN ​
address BORROW_TOKEN
MAX_UTILIZATION ​
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 ​
uint256 MIN_UPDATE_DIFF
minimum percent difference to trigger an update. In percent (100 = 1%, 1 = 0.01%)
_LIQUDITY_PROTOCOL_BORROW_SLOT ​
bytes32 _LIQUDITY_PROTOCOL_BORROW_SLOT
MAX_UTILIZATION_PRECISION ​
uint256 MAX_UTILIZATION_PRECISION
DEFAULT_EXPONENT_SIZE ​
uint256 DEFAULT_EXPONENT_SIZE
DEFAULT_EXPONENT_MASK ​
uint256 DEFAULT_EXPONENT_MASK
EXCHANGE_PRICES_PRECISION ​
uint256 EXCHANGE_PRICES_PRECISION
X14 ​
uint256 X14
X18 ​
uint256 X18
X24 ​
uint256 X24
Events ​
LogUpdateBorrowMaxDebtCeiling ​
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 ​
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 IFluidLiquidity liquidity_, contract IFluidLiquidityResolver liquidityResolver_, address protocol_, address borrowToken_, uint256 maxUtilization_, uint256 minUpdateDiff_) public
getTotalSupply ​
function getTotalSupply() public view returns (uint256 totalSupplyNormal_)
returns BORROW_TOKEN
total supply at Liquidity (in normal).
currentMaxDebtCeiling ​
function currentMaxDebtCeiling() public view returns (uint256 maxDebtCeiling_)
returns the currently set max debt ceiling (in raw for mode with interest!).
calcMaxDebtCeilingNormal ​
function calcMaxDebtCeilingNormal() public view returns (uint256 maxDebtCeilingNormal_)
returns the max debt ceiling that should be set according to current state (in normal).
calcMaxDebtCeiling ​
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 ​
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 ​
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 ​
function _getTotalSupply() internal view returns (uint256 totalSupplyNormal_, uint256 borrowExchangePrice_)
_calcMaxDebtCeiling ​
function _calcMaxDebtCeiling() internal view returns (uint256 maxDebtCeilingRaw_, uint256 totalSupplyNormal_, uint256 borrowExchangePrice_, uint256 userBorrowData_, uint256 baseDebtCeilingRaw_)
_configPercentDiff ​
function _configPercentDiff(uint256 userBorrowData_, uint256 maxDebtCeilingRaw_) internal pure returns (uint256 configPercentDiff_, uint256 oldMaxDebtCeilingRaw_)
_updateBorrowLimits ​
function _updateBorrowLimits() internal returns (bool updated_)