Querying Info from the SYMM Diamond
Last updated
Last updated
Because the Diamond delegates function calls to its facets, directly interacting with the Diamond via a blockchain explorer can be challenging. Instead, use specialized tools and subgraphs for querying:
Louper is a user‑friendly interface that displays all facets and their functions for a Diamond contract. It allows you to:
Inspect Facets:
The facets()
function (from the DiamondLoupeFacet) returns an array of facet structs with their addresses and function selectors.
Query View Functions:
By selecting the “Read” tab and choosing the View Facet, you can query data directly. For example, you can call getSymbol(symbolId)
to find all the information related to a symbol.
How to use Louper:
Select the Chain: Choose the correct network (e.g., BNB).
Query Data:
Go to the “Read” tab, select the View Facet, and call functions such as getSymbol(symbolId)
to fetch trading symbols.
We now use Goldsky for our subgraphs. SYMM provides subgraph endpoints to query the Diamond’s data.
Example Subgraph Endpoint (BNB):
Example Query (GraphQL):
The following functions allow you to retrieve essential information from the SYMM system. These functions are designed to help applications display real‑time account data and market status. All functions are to be called on the Diamond contract, which will delegate the queries to the appropriate facets.
allocatedBalanceOfPartyA(address partyA)
:
Returns the allocated balance for a given sub‑account. This balance represents the collateral that is “free”—i.e., not locked in open positions. Full documentation here.
balanceInfoOfPartyA(address subaccount)
:
Provides detailed balance information for Party A. This includes allocated balances, locked balances, pending locked funds, and other relevant metrics. Full documentation here.
deallocateCooldown(address subaccount)
:
Retrieves the cooldown period required before funds can be withdrawn following a deallocation. This period is typically set to 12 hours.
getpartyAOpenPositions(address subaccount)
:
Returns an array of all open positions held by Party A. Full documentation here.
getQuote(uint quoteId)
:
Fetches detailed information about a specific quote. Use this function to review all parameters of a quote submitted by a user. Full documentation here.
getSymbol(uint symbolId)
:
Returns details about a trading symbol, including its name, trading fee, and other configuration parameters. Full documentation here.
partyAPositionsCount(address subaccount)
:
Provides the total number of open positions held by Party A. This is useful for quickly assessing account exposure. Full documentation here.
withdrawCooldownOf(address subaccount)
:
Retrieves the withdrawal cooldown timestamp for a sub‑account, indicating when funds will next be available for withdrawal. Full documentation here.