Skip to content

Structs ​

Git Source

Structs ​

PricesAndExchangePrice ​

solidity
struct PricesAndExchangePrice {
    uint256 lastStoredPrice; // last stored price in 1e27 decimals
    uint256 centerPrice; // last stored price in 1e27 decimals
    uint256 upperRange; // price at upper range in 1e27 decimals
    uint256 lowerRange; // price at lower range in 1e27 decimals
    uint256 geometricMean; // geometric mean of upper range & lower range in 1e27 decimals
    uint256 supplyToken0ExchangePrice;
    uint256 borrowToken0ExchangePrice;
    uint256 supplyToken1ExchangePrice;
    uint256 borrowToken1ExchangePrice;
}

ExchangePrices ​

solidity
struct ExchangePrices {
    uint256 supplyToken0ExchangePrice;
    uint256 borrowToken0ExchangePrice;
    uint256 supplyToken1ExchangePrice;
    uint256 borrowToken1ExchangePrice;
}

CollateralReserves ​

solidity
struct CollateralReserves {
    uint256 token0RealReserves;
    uint256 token1RealReserves;
    uint256 token0ImaginaryReserves;
    uint256 token1ImaginaryReserves;
}

CollateralReservesSwap ​

solidity
struct CollateralReservesSwap {
    uint256 tokenInRealReserves;
    uint256 tokenOutRealReserves;
    uint256 tokenInImaginaryReserves;
    uint256 tokenOutImaginaryReserves;
}

DebtReserves ​

solidity
struct DebtReserves {
    uint256 token0Debt;
    uint256 token1Debt;
    uint256 token0RealReserves;
    uint256 token1RealReserves;
    uint256 token0ImaginaryReserves;
    uint256 token1ImaginaryReserves;
}

DebtReservesSwap ​

solidity
struct DebtReservesSwap {
    uint256 tokenInDebt;
    uint256 tokenOutDebt;
    uint256 tokenInRealReserves;
    uint256 tokenOutRealReserves;
    uint256 tokenInImaginaryReserves;
    uint256 tokenOutImaginaryReserves;
}

SwapInMemory ​

solidity
struct SwapInMemory {
    address tokenIn;
    address tokenOut;
    uint256 amtInAdjusted;
    address withdrawTo;
    address borrowTo;
    uint256 price; // price of pool after swap
    uint256 fee; // fee of pool
    uint256 revenueCut; // revenue cut of pool
    int256 swapRoutingAmt;
    bytes data; // just added to avoid stack-too-deep error
}

SwapOutMemory ​

solidity
struct SwapOutMemory {
    address tokenIn;
    address tokenOut;
    uint256 amtOutAdjusted;
    address withdrawTo;
    address borrowTo;
    uint256 price; // price of pool after swap
    uint256 fee;
    uint256 revenueCut; // revenue cut of pool
    int256 swapRoutingAmt;
    bytes data; // just added to avoid stack-too-deep error
    uint256 msgValue;
}

DepositColMemory ​

solidity
struct DepositColMemory {
    uint256 token0AmtAdjusted;
    uint256 token1AmtAdjusted;
    uint256 token0ReservesInitial;
    uint256 token1ReservesInitial;
}

WithdrawColMemory ​

solidity
struct WithdrawColMemory {
    uint256 token0AmtAdjusted;
    uint256 token1AmtAdjusted;
    uint256 token0ReservesInitial;
    uint256 token1ReservesInitial;
    address to;
}

BorrowDebtMemory ​

solidity
struct BorrowDebtMemory {
    uint256 token0AmtAdjusted;
    uint256 token1AmtAdjusted;
    uint256 token0DebtInitial;
    uint256 token1DebtInitial;
    address to;
}

PaybackDebtMemory ​

solidity
struct PaybackDebtMemory {
    uint256 token0AmtAdjusted;
    uint256 token1AmtAdjusted;
    uint256 token0DebtInitial;
    uint256 token1DebtInitial;
}

Oracle ​

solidity
struct Oracle {
    uint256 twap1by0; // TWAP price
    uint256 lowestPrice1by0; // lowest price point
    uint256 highestPrice1by0; // highest price point
    uint256 twap0by1; // TWAP price
    uint256 lowestPrice0by1; // lowest price point
    uint256 highestPrice0by1; // highest price point
}

Implementations ​

solidity
struct Implementations {
    address shift;
    address admin;
    address colOperations;
    address debtOperations;
    address perfectOperationsAndSwapOut; // unused, kept for compatibility purposes
}

ConstantViews ​

solidity
struct ConstantViews {
    uint256 dexId;
    address liquidity;
    address factory;
    Implementations implementations;
    address deployerContract;
    address token0;
    address token1;
    bytes32 supplyToken0Slot;
    bytes32 borrowToken0Slot;
    bytes32 supplyToken1Slot;
    bytes32 borrowToken1Slot;
    bytes32 exchangePriceToken0Slot;
    bytes32 exchangePriceToken1Slot;
    uint256 oracleMapping;
}

ConstantViews2 ​

solidity
struct ConstantViews2 {
    uint256 token0NumeratorPrecision;
    uint256 token0DenominatorPrecision;
    uint256 token1NumeratorPrecision;
    uint256 token1DenominatorPrecision;
}