View Facet
This facet covers all functions related to viewing account details, symbol details, statuses etc.
Accounts
balanceOf()
Description: Retrieves the balance of a specified user.
Parameter: user
- Address of the user.
Returns: The current balance of the user in the system.
partyAStats()
Description: Provides detailed statistics related to Party A's trading and liquidation status.
Parameter: partyA
- Address of Party A.
Returns: A tuple containing various counts and status flags related to Party A, including liquidation status, allocated balances, locked values, and nonce counts.
balanceInfoOfPartyA()
Description: Retrieves comprehensive balance details for Party A.
Parameter: partyA
- Address of Party A.
Returns: A tuple of balances and locked values specific to Party A.
balanceInfoOfPartyB()
Description: Fetches balance details for Party B relative to Party A.
Parameters:
partyB
- Address of Party B.partyA
- Address of Party A they are associated with.
Returns: A tuple of balances and locked values related to Party B with respect to Party A.
allocatedBalanceOfPartyA()
Description: Gets the total allocated balance for Party A.
Parameter: partyA
- Address of Party A.
Returns: Total allocated balance for Party A.
allocatedBalanceOfPartyB()
Description: Retrieves the total allocated balance for Party B concerning Party A.
Parameters:
partyB
- Address of Party B.partyA
- Address of Party A they are associated with.
Returns: Allocated balance for Party B with respect to Party A.
allocatedBalanceOfPartyBs()
Description: Fetches allocated balances for multiple Party Bs concerning a single Party A.
Parameters:
partyA
- Address of Party A.partyBs
- Array of Party B addresses.Returns: Array of allocated balances for each Party B.
withdrawCooldownOf()
Description: Obtains the withdrawal cooldown for a user.
Parameter: user
- Address of the user.
Returns: Cooldown period before the user can make a withdrawal.
nonceOfPartyA()
Description: Provides the current nonce for Party A, which tracks the number of transactions.
Parameter:
partyA
- Address of Party A.Returns: Current nonce of Party A.
nonceOfPartyB()
Description: Fetches the nonce for Party B specific to their transactions with Party A.
Parameters:
partyB
- Address of Party B.partyA
- Address of Party A.
Returns: Current nonce of Party B for transactions with Party A.
isSuspended()
Description: Checks if a user's account is suspended.
Parameter: user
- Address of the user.
Returns: Boolean indicating if the account is suspended.
getLiquidatedStateOfPartyA()
Description: Retrieves the liquidation details for Party A.
Parameter:
partyA
- Address of Party A.Returns: A
LiquidationDetail
struct containing all details related to Party A’s liquidation.
getSettlementStates()
Description: Provides the settlement states for multiple Party Bs with respect to Party A.
Parameters:
partyA
- Address of Party A.partyBs
- Array of Party B addresses.
Returns: Array of SettlementState
structs detailing the settlement status for each Party B with Party A.
Symbols
getSymbol()
Description: Retrieves the symbol by its symbolId
.
Parameter:
symbolId
- The identifier of the symbol.
Returns: A
Symbol
struct containing all relevant details of the specified symbol, such as its trading parameters and status.
getSymbols()
Description: Fetches a list of symbols within a specified range.
Parameters:
start
- The starting index for symbol retrieval.size
- The number of symbols to retrieve from the starting index.
Returns: An array of Symbol
structs representing a sequential list of trading symbols from the specified start index.
symbolsByQuoteId()
Description: Provides symbol details for a list of quote IDs.
Parameter:
quoteIds
- An array of quote IDs for which symbol information is required.
Returns: An array of
Symbol
structs associated with the provided quote IDs.
symbolNameByQuoteId()
Description: Retrieves the names of symbols associated with a list of quote IDs.
Parameter:
quoteIds
- An array of quote IDs for which symbol names are requested.
Returns: An array of strings containing the names of symbols related to the provided quote IDs.
symbolNameById()
Description: Obtains the names of symbols based on an array of symbol IDs.
Parameter:
symbolIds
- An array of symbol IDs.
Returns: An array of strings representing the names of the symbols corresponding to the provided IDs.
Quote
getQuote()
Description: Fetches a specific quote by its ID.
Parameter: quoteId
- The unique identifier of the quote.
Returns: A Quote
struct containing all the details of the specified quote.
getQuotesByParent()
Description: Retrieves a sequence of related quotes starting from a parent quote.
Parameters:
quoteId
- ID of the parent quote.size
- Number of related quotes to retrieve.
Returns: An array of Quote
structs representing the hierarchy of related quotes (for partially open positions)
quoteIdsOf()
Description: Lists IDs of quotes associated with a specific Party A, starting from a specified index.
Parameters:
partyA
- Address of Party A.start
- Starting index for retrieval.size
- Number of quote IDs to retrieve.
Returns: An array of quote IDs belonging to Party A.
getQuotes()
Description: Retrieves a list of quotes for Party A starting from a specified index.
Parameters:
partyA
- Address of Party A.start
- Starting index for retrieval.size
- Number of quotes to retrieve.
Returns: An array of Quote
structs associated with Party A.
quotesLength()
Description: Provides the total number of quotes associated with a user.
Parameter: user
- Address of the user.
Returns: Total number of quotes linked to the user.
partyAPositionsCount()
Description: Counts the number of open positions for Party A.
Parameter: partyA
- Address of Party A.
Returns: Count of open positions held by Party A.
getPartyAOpenPositions()
Description: Retrieves a list of open positions for Party A.
Parameters:
partyA
- Address of Party A.start
- Starting index for retrieval.size
- Number of positions to retrieve.
Returns: An array of Quote
structs representing open positions for Party A.
getPartyBOpenPositions()
Description: Fetches open positions where Party B is involved with Party A.
Parameters:
partyB
- Address of Party B.partyA
- Address of Party A.start
- Starting index.size
- Number of positions to retrieve.
Returns: An array of Quote
structs representing open positions for Party B with Party A.
partyBPositionsCount()
Description: Counts the number of open positions where Party B is involved with Party A.
Parameters:
partyB
- Address of Party B.partyA
- Address of Party A.
Returns: Total count of open positions for Party B with Party A.
getPartyAPendingQuotes()
Description: Lists all pending quotes initiated by Party A.
Parameter: partyA
- Address of Party A.
Returns: An array of quote IDs that are pending for Party A.
getPartyBPendingQuotes()
Description: Lists all pending quotes where Party B is involved with Party A.
Parameters:
partyB
- Address of Party B.partyA
- Address of Party A.
Returns: An array of quote IDs pending for Party B with Party A.
Roles
hasRole()
Description: Checks if a given user has been assigned a specific role.
Parameters:
user
- The address of the user.role
- The role identifier, represented as abytes32
hash.
Returns: true
if the user has the specified role; otherwise, false
.
Usage: This function is used to verify access permissions, ensuring that operations are performed by authorized users only.
getRoleHash()
Description: Computes the hash of a role from its string representation, which is used as the unique identifier for role-based operations.
Parameter:
str
- The string name of the role.
Returns: A bytes32
hash of the role string, which is used to uniquely identify the role across the system.
MasterAgreement
getCollateral()
Description: Retrieves the address of the collateral token used in the trading system.
Returns: Address of the collateral token.
getFeeCollector()
Description: Fetches the address designated as the fee collector.
Returns: Address where trading fees are collected.
isPartyALiquidated()
Description: Checks if Party A has been liquidated.
Parameter:
partyA
- Address of Party A.
Returns: true
if Party A has been liquidated, otherwise false
.
isPartyBLiquidated()
Description: Determines whether Party B has been liquidated in relation to Party A.
Parameters:
partyB
- Address of Party B.partyA
- Address of Party A.
Returns: true
if Party B related to Party A has been liquidated, otherwise false
.
isPartyB()
Description: Verifies if the user is registered as Party B.
Parameter:
user
- Address of the user to check.
Returns: true
if the user is registered as Party B, otherwise false
.
pendingQuotesValidLength()
Description: Retrieves the maximum allowable length for pending quotes.
Returns: Maximum number of pending quotes allowed.
forceCloseGapRatio()
Description: Gets the gap ratio used in forced close calculations.
Returns: Gap ratio value.
forceClosePricePenalty()
Description: Provides the penalty applied to price calculations during a forced close operation.
Returns: Penalty value.
liquidatorShare()
Description: Fetches the share percentage that a liquidator receives during the liquidation process.
Returns: Share percentage as a uint256.
liquidationTimeout()
Description: Returns the timeout period for liquidation actions to be valid.
Returns: Timeout period in seconds.
partyBLiquidationTimestamp()
Description: Provides the timestamp when Party B's liquidation was initiated concerning Party A.
Parameters:
partyB
- Address of Party B.partyA
- Address of Party A.
Returns: Timestamp of liquidation initiation.
coolDownsOfMA()
Description: Retrieves cooldown periods for various operations in Master Agreements.
Returns: A tuple containing cooldown periods for deallocation, force cancellation, force cancel close and force close functions.
Misc
getMuonConfig()
Description: Retrieves the configuration times related to Muon's signature validity for prices and unrealized profits and losses.
Returns:
upnlValidTime
- Duration for which the unrealized profit and loss (UPNL) signature is considered valid.priceValidTime
- Duration for which the price signature is considered valid.priceQuantityValidTime
- Validity duration for the price quantity signature.
getMuonIds()
Description: Fetches the identifiers and public key used for Muon's operations.
Returns:
muonAppId
- Application identifier used within the Muon network.muonPublicKey
- Public key associated with the application in the Muon network.validGateway
- Address of the gateway used for Muon network interactions.
pauseState()
Description: Provides the current pause states for various operational aspects of the trading system.
Returns:
globalPaused
- Indicates if the entire system is paused.liquidationPaused
- Shows if liquidation processes are currently paused.accountingPaused
- Status indicating if accounting related actions are paused.partyBActionsPaused
- Pause status for actions initiated by Party B.partyAActionsPaused
- Pause status for actions initiated by Party A.emergencyMode
- Indicates if the system is in emergency mode.
getPartyBEmergencyStatus()
Description: Checks if Party B is in an emergency status.
Parameter:
partyB
- Address of Party B.
Returns: true
if Party B is in an emergency status, otherwise false
.
getBalanceLimitPerUser()
Description: Retrieves the maximum balance limit per user.
Returns: Balance limit per user as a uint256.
verifyMuonTSSAndGateway()
Description: Verifies signatures and gateway authentication for Muon network transactions.
Parameters:
hash
- The hash to be verified.sign
- The Schnorr signature data.gatewaySignature
- The signature from the gateway.
Note: This function is for validation and does not return a value but is essential for security checks.
getNextQuoteId()
Description: Retrieves the next available quote identifier that will be assigned to a new quote.
Returns: Next quote ID as a uint256.
getQuotesWithBitmap()
The getQuotesWithBitmap
function is a specialized retrieval method used in blockchain applications to fetch multiple quote entries efficiently from storage using a bitmap indexing technique. This method is particularly useful in environments where gas cost and data retrieval efficiency are critical, such as in the Symmio trading platform.
Parameters:
bitmap
: A data structure that specifies which quotes to retrieve. The bitmap is composed of elements that indicate the positions of quotes in storage that are to be fetched.
gasNeededForReturn
: The minimum gas remaining required to process the return of data. This helps in ensuring that the function does not run out of gas mid-execution, especially after performing potentially costly state reads.
Returns:
quotes
: An array ofQuote
structs retrieved based on the indices specified in the input bitmap.
Data Structures:
Bitmap
: Represents a collection of indices in a compact form using bits.size
: Total number of quotes expected to be fetched.elements[]
: An array ofBitmapElement
structures, each representing a segment of the overall bitmap.offset
: Starting index in the quote storage for the bitmap segment.bitmap
: A 256-bit integer where each bit represents the presence (1) or absence (0) of a quote at the corresponding index starting fromoffset
.
Functionality Overview:
The function iterates over the array of bitmap elements, for each element, it decodes the bitmap to determine which quotes need to be fetched. It checks each bit of the bitmap; if a bit is set (1
), the function fetches the quote from storage at the position determined by the offset
plus the current bit's position. This process is repeated until all bits in the bitmap have been checked or until the gas remaining is less than the gasNeededForReturn
.
Last updated