Skip to content

Structs ​

Git Source

Structs ​

OperateMemoryVars ​

solidity
struct OperateMemoryVars {
    // ## User's position before update ##
    uint256 oldColRaw;
    uint256 oldNetDebtRaw; // total debt - dust debt
    int256 oldTick;
    // ## User's position after update ##
    uint256 colRaw;
    uint256 debtRaw;
    uint256 dustDebtRaw;
    int256 tick;
    uint256 tickId;
    // others
    uint256 vaultVariables2;
    uint256 branchId;
    int256 topTick;
    uint256 liquidityExPrice;
    uint256 supplyExPrice;
    uint256 borrowExPrice;
    uint256 branchData;
    // user's supply slot data in liquidity
    uint256 userSupplyLiquidityData;
}

BranchData ​

solidity
struct BranchData {
    uint256 id;
    uint256 data;
    uint256 ratio;
    uint256 debtFactor;
    int256 minimaTick;
    uint256 baseBranchData;
}

TickData ​

solidity
struct TickData {
    int256 tick;
    uint256 data;
    uint256 ratio;
    uint256 ratioOneLess;
    uint256 length;
    uint256 currentRatio; // current tick is ratio with partials.
    uint256 partials;
}

CurrentLiquidity ​

solidity
struct CurrentLiquidity {
    uint256 debtRemaining; // Debt remaining to liquidate
    uint256 debt; // Current liquidatable debt before reaching next check point
    uint256 col; // Calculate using debt & ratioCurrent
    uint256 colPerDebt; // How much collateral to liquidate per unit of Debt
    uint256 totalDebtLiq; // Total debt liquidated till now
    uint256 totalColLiq; // Total collateral liquidated till now
    int256 tick; // Current tick to liquidate
    uint256 ratio; // Current ratio to liquidate
    uint256 tickStatus; // if 1 then it's a perfect tick, if 2 that means it's a liquidated tick
    int256 refTick; // ref tick to liquidate
    uint256 refRatio; // ratio at ref tick
    uint256 refTickStatus; // if 1 then it's a perfect tick, if 2 that means it's a liquidated tick, if 3 that means it's a liquidation threshold
}

TickHasDebt ​

solidity
struct TickHasDebt {
    int256 tick; // current tick
    int256 nextTick; // next tick with liquidity
    int256 mapId; // mapping ID of tickHasDebt
    uint256 bitsToRemove; // liquidity to remove till tick_ so we can search for next tick
    uint256 tickHasDebt; // getting tickHasDebt_ from tickHasDebt[mapId_]
    uint256 mostSigBit; // most significant bit in tickHasDebt_ to get the next tick
}

LiquidateMemoryVars ​

solidity
struct LiquidateMemoryVars {
    uint256 vaultVariables2;
    int256 liquidationTick;
    int256 maxTick;
    uint256 supplyExPrice;
    uint256 borrowExPrice;
    uint256 actualDebtAmt;
    uint256 actualColAmt;
}

AbsorbMemoryVariables ​

solidity
struct AbsorbMemoryVariables {
    uint256 debtAbsorbed;
    uint256 colAbsorbed;
    int256 startingTick;
    uint256 mostSigBit;
}

Tokens ​

solidity
struct Tokens {
    address token0;
    address token1;
}

ConstantViews ​

solidity
struct ConstantViews {
    address liquidity;
    address factory;
    address operateImplementation;
    address adminImplementation;
    address secondaryImplementation;
    address deployer; // address which deploys oracle
    address supply; // either liquidity layer or DEX protocol
    address borrow; // either liquidity layer or DEX protocol
    Tokens supplyToken; // if smart collateral then address of token0 & token1 else just supply token address at token0 and token1 as empty
    Tokens borrowToken; // if smart debt then address of token0 & token1 else just borrow token address at token0 and token1 as empty
    uint256 vaultId;
    uint256 vaultType;
    bytes32 supplyExchangePriceSlot; // if smart collateral then slot is from DEX protocol else from liquidity layer
    bytes32 borrowExchangePriceSlot; // if smart debt then slot is from DEX protocol else from liquidity layer
    bytes32 userSupplySlot; // if smart collateral then slot is from DEX protocol else from liquidity layer
    bytes32 userBorrowSlot; // if smart debt then slot is from DEX protocol else from liquidity layer
}

RebalanceMemoryVariables ​

solidity
struct RebalanceMemoryVariables {
    uint256 liqSupplyExPrice;
    uint256 liqBorrowExPrice;
    uint256 vaultSupplyExPrice;
    uint256 vaultBorrowExPrice;
    uint256 totalSupply;
    uint256 totalBorrow;
    uint256 totalSupplyVault;
    uint256 totalBorrowVault;
    uint256 initialEth;
}