View Facet (0.8.4)

View Facet (0.8.4)

The View Facet is a read-only interface that allows clients and external systems to query the state of the SYMM protocol. It aggregates data from multiple storages—including account balances, quote information, symbol details, settlement states, and configuration parameters—to provide a comprehensive view of the system’s state.


Account Balances & Stats

balanceOf()

Description: Returns the free balance (in 18 decimals) of the specified user.

function balanceOf(address user) external view returns (uint256);

partyAStats()

Returns a detailed set of statistics for Party A, including liquidation status, various balance metrics, positions count, pending quotes count, nonces, and the total number of quotes.

function partyAStats(address partyA)
    external
    view
    returns (
        bool liquidationStatus,
        uint256 allocatedBalances,
        uint256 lockedCVA,
        uint256 lockedLF,
        uint256 lockedPartyAmm,
        uint256 lockedPartyBmm,
        uint256 pendingLockedCVA,
        uint256 pendingLockedLF,
        uint256 pendingLockedPartyAmm,
        uint256 pendingLockedPartyBmm,
        uint256 partyAPositionsCount,
        uint256 partyAPendingQuotesCount,
        uint256 partyANonces,
        uint256 quoteIdsCount
    );

balanceInfoOfPartyA()

Returns detailed balance information of Party A, including allocated, locked, and pending locked balances for various components (CVA, LF, partyAmm, partyBmm).

function balanceInfoOfPartyA(address partyA) external view returns (
    uint256 allocatedBalances,
    uint256 lockedCVA,
    uint256 lockedLF,
    uint256 lockedPartyAmm,
    uint256 lockedPartyBmm,
    uint256 pendingLockedCVA,
    uint256 pendingLockedLF,
    uint256 pendingLockedPartyAmm,
    uint256 pendingLockedPartyBmm
);

balanceInfoOfPartyB()

Returns detailed balance information for Party B corresponding to a given Party A.

function balanceInfoOfPartyB(address partyB, address partyA) external view returns (
    uint256 allocatedBalances,
    uint256 lockedCVA,
    uint256 lockedLF,
    uint256 lockedPartyAmm,
    uint256 lockedPartyBmm,
    uint256 pendingLockedCVA,
    uint256 pendingLockedLF,
    uint256 pendingLockedPartyAmm,
    uint256 pendingLockedPartyBmm
);

allocatedBalanceOfPartyA() & allocatedBalanceOfPartyB()

Description:

  • allocatedBalanceOfPartyA: Returns Party A’s allocated balance.

  • allocatedBalanceOfPartyB: Returns the allocated balance of Party B for a specific Party A.

function allocatedBalanceOfPartyA(address partyA) external view returns (uint256);
function allocatedBalanceOfPartyB(address partyB, address partyA) external view returns (uint256);

balanceOfReserveVault()

Returns the balance held in the emergency reserve vault for Party B.

function balanceOfReserveVault(address partyB) external view returns (uint256);

allocatedBalanceOfPartyBs()

Returns an array of allocated balances for a set of Party Bs for a given Party A.

function allocatedBalanceOfPartyBs(address partyA, address[] memory partyBs) external view returns (uint256[] memory);

withdrawCooldownOf()

Returns the timestamp indicating when the user last executed a deallocation (i.e. their withdrawal cooldown).

function withdrawCooldownOf(address user) external view returns (uint256);

nonceOfPartyA() & nonceOfPartyB()

Returns the current nonce for Party A or Party B (with respect to a specific Party A).

function nonceOfPartyA(address partyA) external view returns (uint256);
function nonceOfPartyB(address partyB, address partyA) external view returns (uint256);

Quotes & Positions

getQuote()

Returns the complete details of a quote identified by its ID.

function getQuote(uint256 quoteId) external view returns (Quote memory);

Example Response:

{
  "id": "22000", //ID of the QUOTE
  "partyBsWhiteList": [
    "0x00c069d68bc7420740460DBC3cc3fFF9b3742421"
  ], //Array of partyBs (hedgers) to accept the quote
  "symbolId": "116", //The symbol ID
  "positionType": 1, //Position Type (0 = LONG, 1 = SHORT)
  "orderType": 1, //Order Type (0 = LIMIT, 1 = MARKET)
  "openedPrice": "3665277843182656445", //The Price PartyB Opened the position at (this shifts when funding rates are charged and the uPnL is settled)
  "initialOpenedPrice": "3661652747252747252", //The initial opened price
  "requestedOpenPrice": "3610334000000000000", //Requested openPrice from the user
  "marketPrice": "3664453530000000000", //Market price from the Muon Signature
  "quantity": "1364400000000000000000", //Quantity (in e18 form)
  "closedAmount": "1364400000000000000000", //The quantity closed)
  "initialLockedValues": {
    "cva": "69948343876320000000", //Credit Value Adjustment
    "lf": "3940751767680000000", //Liquidator Fee
    "partyAmm": "911298846276000000000", //Party A Maintenance Margin
    "partyBmm": "0"
  },
  "lockedValues": {
    "cva": "0",
    "lf": "0",
    "partyAmm": "0",
    "partyBmm": "0"
  },
  "maxFundingRate": "200000000000000000000", //The Maximum Funding Rate (as requested by partyA)
  "partyA": "0x20A144bDb43B499aD20b01769f1E776b8bEc9Ea8", //The partyA address
  "partyB": "0x00c069d68bc7420740460DBC3cc3fFF9b3742421", //The PartyB address
  "quoteStatus": 7, //The Quote Status
  "avgClosedPrice": "3268950650650650650",//Average Close Price
  "requestedClosePrice": "0", //Requested Close Price
  "quantityToClose": "0", //Quantity to Close
  "parentId": "0", //Parent ID of the Quote (if applicable)
  "createTimestamp": "1738156558", //The time the quote was created
  "statusModifyTimestamp": "1738523304", //The time the quote was last modified
  "lastFundingPaymentTimestamp": "1738512000", //The last funding payment charge
  "deadline": "1738525099", //Deadline of the quote
  "tradingFee": "3800000000000000", //The trading fee
  "affiliate": "0x6273242a7E88b3De90822b31648C212215caaFE4" //Affiliate (this is the MultiAccount Address)
}

quoteIdsOf()

Description: Returns an array of quote IDs associated with a Party A address, starting at a specified index.

function quoteIdsOf(address partyA, uint256 start, uint256 size) external view returns (uint256[] memory);

getQuotes() & getQuotesByParent()

Description:

  • getQuotes: Retrieves an array of quotes associated with Party A.

  • getQuotesByParent: Retrieves quotes linked to a parent quote (e.g., residual quotes).

function getQuotes(address partyA, uint256 start, uint256 size) external view returns (Quote[] memory);
function getQuotesByParent(uint256 quoteId, uint256 size) external view returns (Quote[] memory);

quotesLength()

Returns the total number of quotes associated with a user.

function quotesLength(address user) external view returns (uint256);

partyAPositionsCount()

Description: Returns the number of open positions held by Party A.

function partyAPositionsCount(address partyA) external view returns (uint256);

getPartyAPendingQuotes() & getPartyBPendingQuotes()

Description:

  • getPartyAPendingQuotes: Returns an array of pending quote IDs for Party A.

  • getPartyBPendingQuotes: Returns an array of pending quote IDs for Party B associated with a given Party A.

function getPartyAPendingQuotes(address partyA) external view returns (uint256[] memory);
function getPartyBPendingQuotes(address partyB, address partyA) external view returns (uint256[] memory);

getPartyAOpenPositions() & getPartyBOpenPositions()

Description:

  • getPartyAOpenPositions: Retrieves an array of open positions (quotes) for Party A.

  • getPartyBOpenPositions: Retrieves an array of open positions for Party B for a specific Party A.

function getPartyAOpenPositions(address partyA, uint256 start, uint256 size) external view returns (Quote[] memory);
function getPartyBOpenPositions(address partyB, address partyA, uint256 start, uint256 size) external view returns (Quote[] memory);

getPositionsFilteredByPartyB() & getOpenPositionsFilteredByPartyB()

Description:

  • getPositionsFilteredByPartyB: Returns positions filtered by Party B.

  • getOpenPositionsFilteredByPartyB: Returns only those positions that are currently open for Party B.

function getPositionsFilteredByPartyB(address partyB, uint256 start, uint256 size) external view returns (Quote[] memory);
function getOpenPositionsFilteredByPartyB(address partyB, uint256 start, uint256 size) external view returns (Quote[] memory);

partyBPositionsCount()

Description: Returns the number of positions held by Party B for a specific Party A.

function partyBPositionsCount(address partyB, address partyA) external view returns (uint256);

Symbols & Bridge Transactions

getSymbol()9 & getSymbols()

Description:

  • getSymbol: Retrieves the details of a symbol by its ID.

  • getSymbols: Retrieves an array of symbols starting from a specified index.

function getSymbol(uint256 symbolId) external view returns (Symbol memory);
function getSymbols(uint256 start, uint256 size) external view returns (Symbol[] memory);

Example Response:

{
  "symbolId": "1",
  "name": "BTCUSDT",
  "isValid": true,
  "minAcceptableQuoteValue": "120000000000000000000",
  "minAcceptablePortionLF": "3000000000000000",
  "tradingFee": "3800000000000000",
  "maxLeverage": "100000000000000000000",
  "fundingRateEpochDuration": "14400",
  "fundingRateWindowTime": "420"
}

symbolsByQuoteId(), symbolNameByQuoteId() & symbolNameById()

Description:

  • symbolsByQuoteId: Returns an array of symbols associated with an array of quote IDs.

  • symbolNameByQuoteId: Returns an array of symbol names for the given quote IDs.

  • symbolNameById: Returns an array of symbol names for the provided symbol IDs.

function symbolsByQuoteId(uint256[] memory quoteIds) external view returns (Symbol[] memory);
function symbolNameByQuoteId(uint256[] memory quoteIds) external view returns (string[] memory);
function symbolNameById(uint256[] memory symbolIds) external view returns (string[] memory);

getBridgeTransaction() & getNextBridgeTransactionId()

Description:

  • getBridgeTransaction: Retrieves the details of a specific bridge transaction.

  • getNextBridgeTransactionId: Returns the next available bridge transaction ID.

function getBridgeTransaction(uint256 transactionId) external view returns (BridgeTransaction memory);
function getNextBridgeTransactionId() external view returns (uint256);

Configuration & System State

isSuspended()

Checks whether a user is suspended.

function isSuspended(address user) external view returns (bool);

getLiquidatedStateOfPartyA()

Returns the liquidation details for Party A.

function getLiquidatedStateOfPartyA(address partyA) external view returns (LiquidationDetail memory);

getDeallocateDebounceTime()

Returns the current deallocate debounce time (in seconds).

function getDeallocateDebounceTime() external view returns (uint256);

getInvalidBridgedAmountsPool()

Returns the address of the pool for invalid bridged amounts.

function getInvalidBridgedAmountsPool() external view returns (address);

getSettlementStates()

Returns an array of settlement states for Party Bs corresponding to a given Party A.

function getSettlementStates(address partyA, address[] memory partyBs) external view returns (SettlementState[] memory);

pendingQuotesValidLength()

Returns the maximum allowed number of pending quotes.

function pendingQuotesValidLength() external view returns (uint256);

forceCloseGapRatio(), forceClosePricePenalty(), forceCloseMinSigPeriod()

Description:

  • forceCloseGapRatio: Returns the force close gap ratio for a given symbol.

  • forceClosePricePenalty: Returns the current force close price penalty.

  • forceCloseMinSigPeriod: Returns the minimum signature period required for force closing.

function forceCloseGapRatio(uint256 symbolId) external view returns (uint256);
function forceClosePricePenalty() external view returns (uint256);
function forceCloseMinSigPeriod() external view returns (uint256);

liquidatorShare(), liquidationTimeout(), partyBLiquidationTimestamp()

Description:

  • liquidatorShare: Returns the percentage share for liquidators.

  • liquidationTimeout: Returns the timeout duration for liquidation for partyB (in seconds).

  • partyBLiquidationTimestamp: Returns the liquidation timestamp for PartyB (with respect to a given Party A).

function liquidatorShare() external view returns (uint256);
function liquidationTimeout() external view returns (uint256);
function partyBLiquidationTimestamp(address partyB, address partyA) external view returns (uint256);

coolDownsOfMA(), forceCloseCooldowns(), deallocateCooldown(), settlementCooldown(), lastUpnlSettlementTimestamp()

Description:

  • coolDownsOfMA: Returns several MA (Master Agreement) cooldown values.

  • forceCloseCooldowns: Returns the force close first and second cooldowns.

  • deallocateCooldown: Returns the current deallocate cooldown.

  • settlementCooldown: Returns the settlement cooldown period.

  • lastUpnlSettlementTimestamp: Returns the last UPnL settlement timestamp for a given combination of sender Party B, target Party B, and Party A.

function coolDownsOfMA() external view returns (uint256, uint256, uint256, uint256);
function forceCloseCooldowns() external view returns (uint256, uint256);
function deallocateCooldown() external view returns (uint256);
function settlementCooldown() external view returns (uint256);
function lastUpnlSettlementTimestamp(address senderPartyB, address targetPartyB, address partyA) external view returns (uint256)

cooldownsOfMA() Example Response:

[
  "43200", //deallocateCooldown
  "150", //forceCancelCooldown
  "150", //forceCancelCloseCooldown
  "90" //forceCloseFirstCooldown
]

getMuonConfig() & getMuonIds()

Description:

  • getMuonConfig: Retrieves the current Muon UPnL and price validity periods.

  • getMuonIds: Retrieves the Muon application ID, public key, and valid gateway address.

function getMuonConfig() external view returns (uint256 upnlValidTime, uint256 priceValidTime);
function getMuonIds() external view returns (uint256 muonAppId, PublicKey memory muonPublicKey, address validGateway);

pauseState()

Returns the current pause state of various system operations.

function pauseState() external view returns (
    bool globalPaused,
    bool liquidationPaused,
    bool accountingPaused,
    bool partyBActionsPaused,
    bool partyAActionsPaused,
    bool internalTransferPaused,
    bool emergencyMode
);

getPartyBEmergencyStatus() & getBalanceLimitPerUser()

Description:

  • getPartyBEmergencyStatus: Checks if Party B is in emergency status.

  • getBalanceLimitPerUser: Returns the maximum balance allowed per user.

function getPartyBEmergencyStatus(address partyB) external view returns (bool);
function getBalanceLimitPerUser() external view returns (uint256);

verifyMuonTSSAndGateway()

Verifies a given hash against a Schnorr signature and a gateway signature using Muon’s TSS.

function verifyMuonTSSAndGateway(bytes32 hash, SchnorrSign memory sign, bytes memory gatewaySignature) external view;

getNextQuoteId<()

Returns the next available quote ID.

function getNextQuoteId() external view returns (uint256);

getQuoteCloseId()

Description: Returns the close ID associated with a given quote.

function getQuoteCloseId(uint256 quoteId) external view returns (uint256);

Last updated