Types

Git Source

Author: Morpho Labs.

Common types and structs used in Morpho contracts.

Structs

SupplyBalance

STRUCTS ///

struct SupplyBalance {
    uint256 inP2P;
    uint256 onPool;
}

BorrowBalance

struct BorrowBalance {
    uint256 inP2P;
    uint256 onPool;
}

Indexes

struct Indexes {
    uint256 p2pSupplyIndex;
    uint256 p2pBorrowIndex;
    uint256 poolSupplyIndex;
    uint256 poolBorrowIndex;
}

MaxGasForMatching

struct MaxGasForMatching {
    uint64 supply;
    uint64 borrow;
    uint64 withdraw;
    uint64 repay;
}

Delta

struct Delta {
    uint256 p2pSupplyDelta;
    uint256 p2pBorrowDelta;
    uint256 p2pSupplyAmount;
    uint256 p2pBorrowAmount;
}

AssetLiquidityData

struct AssetLiquidityData {
    uint256 decimals;
    uint256 tokenUnit;
    uint256 liquidationThreshold;
    uint256 ltv;
    uint256 underlyingPrice;
    uint256 collateralEth;
    uint256 debtEth;
}

LiquidityData

struct LiquidityData {
    uint256 collateralEth;
    uint256 borrowableEth;
    uint256 maxDebtEth;
    uint256 debtEth;
}

PoolIndexes

struct PoolIndexes {
    uint32 lastUpdateTimestamp;
    uint112 poolSupplyIndex;
    uint112 poolBorrowIndex;
}

Market

struct Market {
    address underlyingToken;
    uint16 reserveFactor;
    uint16 p2pIndexCursor;
    bool isCreated;
    bool isPaused;
    bool isPartiallyPaused;
    bool isP2PDisabled;
}

MarketPauseStatus

struct MarketPauseStatus {
    bool isSupplyPaused;
    bool isBorrowPaused;
    bool isWithdrawPaused;
    bool isRepayPaused;
    bool isLiquidateCollateralPaused;
    bool isLiquidateBorrowPaused;
    bool isDeprecated;
}

Enums

PositionType

ENUMS ///

enum PositionType {
    SUPPLIERS_IN_P2P,
    SUPPLIERS_ON_POOL,
    BORROWERS_IN_P2P,
    BORROWERS_ON_POOL
}