FluidVaultT1Secondary
Inherits:Variables, Error, Structs, Events
Fluid Vault protocol secondary methods contract.
Implements absorb()
and rebalance()
methods, extracted from main contract due to contract size limits.
Methods are limited to be called via delegateCall only (as done by Vault CoreModule "VaultT1" contract).
State Variables
NATIVE_TOKEN
address internal constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
X8
uint256 internal constant X8 = 0xff;
X10
uint256 internal constant X10 = 0x3ff;
X16
uint256 internal constant X16 = 0xffff;
X19
uint256 internal constant X19 = 0x7ffff;
X20
uint256 internal constant X20 = 0xfffff;
X24
uint256 internal constant X24 = 0xffffff;
X25
uint256 internal constant X25 = 0x1ffffff;
X30
uint256 internal constant X30 = 0x3fffffff;
X35
uint256 internal constant X35 = 0x7ffffffff;
X50
uint256 internal constant X50 = 0x3ffffffffffff;
X64
uint256 internal constant X64 = 0xffffffffffffffff;
X96
uint256 internal constant X96 = 0xffffffffffffffffffffffff;
X128
uint256 internal constant X128 = 0xffffffffffffffffffffffffffffffff;
addressThis
address private immutable addressThis;
Functions
constructor
constructor();
_verifyCaller
modifier _verifyCaller();
absorb
absorb function absorbs the bad debt if the bad debt is above max limit. The main use of it is if the bad debt didn't got liquidated in time maybe due to sudden price drop or bad debt was extremely small to liquidate and the bad debt goes above 100% ratio then there's no incentive for anyone to liquidate now hence absorb functions absorbs that bad debt to allow newer bad debt to liquidate seamlessly. if absorbing were to happen after this it's on governance on how to deal with it although it can still be removed through liquidate via liquidator if the price goes back up and liquidation becomes beneficial upon absorbed user position gets 100% liquidated.
function absorb() public _verifyCaller;
rebalance
Checks total supply of vault's in Liquidity Layer & Vault contract and rebalance it accordingly if vault supply is more than Liquidity Layer then deposit difference through reserve/rebalance contract if vault supply is less than Liquidity Layer then withdraw difference to reserve/rebalance contract if vault borrow is more than Liquidity Layer then borrow difference to reserve/rebalance contract if vault borrow is less than Liquidity Layer then payback difference through reserve/rebalance contract
function rebalance() external payable _verifyCaller returns (int256 supplyAmt_, int256 borrowAmt_);