FluidLiquidityConfigHandler

Git Source

Inherits:Constants, Error, Events, Structs

Sets limits on Liquidity for a protocol based on TVL checkpoints.

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_,
    address protocol_,
    address withdrawToken_,
    address borrowToken_,
    LimitCheckPoints memory withdrawCheckPoints_,
    LimitCheckPoints memory borrowCheckPoints_
) validAddress(address(reserveContract_)) validAddress(address(liquidity_)) validAddress(protocol_);

getProtocolSupplyData

returns PROTOCOL total supply at Liquidity

function getProtocolSupplyData()
    public
    view
    returns (uint256 supply_, uint256 oldExpandPercent_, uint256 userSupplyData_);

getProtocolBorrowData

returns PROTOCOL total borrow at Liquidity

function getProtocolBorrowData()
    public
    view
    returns (uint256 borrow_, uint256 oldExpandPercent_, uint256 userBorrowData_);

rebalance

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

function rebalance() external onlyRebalancer;

_updateWithdrawLimits

| | INTERNALS | |__________________________________

function _updateWithdrawLimits() internal returns (bool updated_);

_updateBorrowLimits

function _updateBorrowLimits() internal returns (bool updated_);

_validateLimitCheckPoints

function _validateLimitCheckPoints(LimitCheckPoints memory checkPoints_) internal pure;