Skip to content

Constants ​

RESERVE_CONTRACT ​

solidity
contract IFluidReserveContract RESERVE_CONTRACT

LIQUIDITY ​

solidity
contract IFluidLiquidity LIQUIDITY

PROTOCOL ​

solidity
address PROTOCOL

WITHDRAW_TOKEN ​

solidity
address WITHDRAW_TOKEN

BORROW_TOKEN ​

solidity
address BORROW_TOKEN

BORROW_CHECKPOINT1 ​

solidity
uint256 BORROW_CHECKPOINT1

BORROW_CHECKPOINT2 ​

solidity
uint256 BORROW_CHECKPOINT2

BORROW_CHECKPOINT3 ​

solidity
uint256 BORROW_CHECKPOINT3

BORROW_EXPAND_UNTIL_CHECKPOINT1 ​

solidity
uint256 BORROW_EXPAND_UNTIL_CHECKPOINT1

BORROW_EXPAND_UNTIL_CHECKPOINT2 ​

solidity
uint256 BORROW_EXPAND_UNTIL_CHECKPOINT2

BORROW_EXPAND_UNTIL_CHECKPOINT3 ​

solidity
uint256 BORROW_EXPAND_UNTIL_CHECKPOINT3

BORROW_EXPAND_ABOVE_CHECKPOINT3 ​

solidity
uint256 BORROW_EXPAND_ABOVE_CHECKPOINT3

WITHDRAW_CHECKPOINT1 ​

solidity
uint256 WITHDRAW_CHECKPOINT1

WITHDRAW_CHECKPOINT2 ​

solidity
uint256 WITHDRAW_CHECKPOINT2

WITHDRAW_CHECKPOINT3 ​

solidity
uint256 WITHDRAW_CHECKPOINT3

WITHDRAW_EXPAND_UNTIL_CHECKPOINT1 ​

solidity
uint256 WITHDRAW_EXPAND_UNTIL_CHECKPOINT1

WITHDRAW_EXPAND_UNTIL_CHECKPOINT2 ​

solidity
uint256 WITHDRAW_EXPAND_UNTIL_CHECKPOINT2

WITHDRAW_EXPAND_UNTIL_CHECKPOINT3 ​

solidity
uint256 WITHDRAW_EXPAND_UNTIL_CHECKPOINT3

WITHDRAW_EXPAND_ABOVE_CHECKPOINT3 ​

solidity
uint256 WITHDRAW_EXPAND_ABOVE_CHECKPOINT3

_LIQUDITY_WITHDRAW_TOKEN_EXCHANGE_PRICES_SLOT ​

solidity
bytes32 _LIQUDITY_WITHDRAW_TOKEN_EXCHANGE_PRICES_SLOT

_LIQUDITY_BORROW_TOKEN_EXCHANGE_PRICES_SLOT ​

solidity
bytes32 _LIQUDITY_BORROW_TOKEN_EXCHANGE_PRICES_SLOT

_LIQUDITY_PROTOCOL_SUPPLY_SLOT ​

solidity
bytes32 _LIQUDITY_PROTOCOL_SUPPLY_SLOT

_LIQUDITY_PROTOCOL_BORROW_SLOT ​

solidity
bytes32 _LIQUDITY_PROTOCOL_BORROW_SLOT

DEFAULT_EXPONENT_SIZE ​

solidity
uint256 DEFAULT_EXPONENT_SIZE

DEFAULT_EXPONENT_MASK ​

solidity
uint256 DEFAULT_EXPONENT_MASK

X14 ​

solidity
uint256 X14

X18 ​

solidity
uint256 X18

X24 ​

solidity
uint256 X24

X64 ​

solidity
uint256 X64

Events ​

LogUpdateWithdrawLimitExpansion ​

solidity
event LogUpdateWithdrawLimitExpansion(uint256 supply, uint256 oldExpandPercent, uint256 newExpandPercent)

emitted when withdraw limit expand percent is updated

LogUpdateBorrowLimitExpansion ​

solidity
event LogUpdateBorrowLimitExpansion(uint256 borrow, uint256 oldExpandPercent, uint256 newExpandPercent)

emitted when borrow limit expand percent is updated

Structs ​

LimitCheckPoints ​

solidity
struct LimitCheckPoints {
  uint256 tvlCheckPoint1;
  uint256 expandPercentUntilCheckPoint1;
  uint256 tvlCheckPoint2;
  uint256 expandPercentUntilCheckPoint2;
  uint256 tvlCheckPoint3;
  uint256 expandPercentUntilCheckPoint3;
  uint256 expandPercentAboveCheckPoint3;
}

FluidExpandPercentConfigHandler ​

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

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_, address protocol_, address withdrawToken_, address borrowToken_, struct Structs.LimitCheckPoints withdrawCheckPoints_, struct Structs.LimitCheckPoints borrowCheckPoints_) public

getProtocolSupplyData ​

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

returns PROTOCOL total supply at Liquidity

getProtocolBorrowData ​

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

returns PROTOCOL total borrow at Liquidity

rebalance ​

solidity
function rebalance() external

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.

_updateWithdrawLimits ​

solidity
function _updateWithdrawLimits() internal returns (bool updated_)

_updateBorrowLimits ​

solidity
function _updateBorrowLimits() internal returns (bool updated_)

_validateLimitCheckPoints ​

solidity
function _validateLimitCheckPoints(struct Structs.LimitCheckPoints checkPoints_) internal pure