Skip to content

FluidVaultT1Secondary ​

Git Source

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 ​

solidity
address internal constant NATIVE_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;

X8 ​

solidity
uint256 internal constant X8 = 0xff;

X10 ​

solidity
uint256 internal constant X10 = 0x3ff;

X16 ​

solidity
uint256 internal constant X16 = 0xffff;

X19 ​

solidity
uint256 internal constant X19 = 0x7ffff;

X20 ​

solidity
uint256 internal constant X20 = 0xfffff;

X24 ​

solidity
uint256 internal constant X24 = 0xffffff;

X25 ​

solidity
uint256 internal constant X25 = 0x1ffffff;

X30 ​

solidity
uint256 internal constant X30 = 0x3fffffff;

X35 ​

solidity
uint256 internal constant X35 = 0x7ffffffff;

X50 ​

solidity
uint256 internal constant X50 = 0x3ffffffffffff;

X64 ​

solidity
uint256 internal constant X64 = 0xffffffffffffffff;

X96 ​

solidity
uint256 internal constant X96 = 0xffffffffffffffffffffffff;

X128 ​

solidity
uint256 internal constant X128 = 0xffffffffffffffffffffffffffffffff;

addressThis ​

solidity
address private immutable addressThis;

Functions ​

constructor ​

solidity
constructor();

_verifyCaller ​

solidity
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.

solidity
function absorb(uint256 vaultVariables_, int256 maxTick_) public _verifyCaller returns (uint256);

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

solidity
function rebalance() external payable _verifyCaller returns (int256 supplyAmt_, int256 borrowAmt_);