FluidMaxBorrowConfigHandler ​
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
modifier validAddress(address value_);
onlyRebalancer ​
Validates that an address is a rebalancer (taken from reserve contract)
modifier onlyRebalancer();
constructor ​
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).
function getTotalSupply() public view returns (uint256 totalSupplyNormal_);
currentMaxDebtCeiling ​
returns the currently set max debt ceiling (in raw for mode with interest!).
function currentMaxDebtCeiling() public view returns (uint256 maxDebtCeiling_);
calcMaxDebtCeilingNormal ​
returns the max debt ceiling that should be set according to current state (in normal).
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!).
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%).
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.
function rebalance() external onlyRebalancer;
_getTotalSupply ​
| | INTERNALS | |__________________________________
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_);