MuonStorage (0.8.5)
The MuonStorage library provides a storage slot for Muon-related configuration data. LibMuon modules read settings from it: signature validity periods, application identifiers, public keys, and trusted gateway addresses.
Data Structures
These structures define the signature and configuration data types used across the Muon ecosystem.
SchnorrSign
Schnorr signature used for cryptographic verification.
signature: The signature (uint256).
owner: Address that generated the signature.
nonce: Extra parameter for uniqueness (prevents replay attacks).
struct SchnorrSign {
uint256 signature;
address owner;
address nonce;
}PublicKey
Public key for signature verification.
x: The x-coordinate on the elliptic curve.
parity: Parity of the y-coordinate, used to recover the full public key.
SingleUpnlSig
Verifies a single unrealized profit and loss (uPnl) computation for one party.
reqId: Unique identifier for the request.
timestamp: Time the signature was generated.
upnl: The computed uPnl (positive or negative).
gatewaySignature: Secondary signature from Muon.
sigs:
SchnorrSignstructure holding the primary signature.
SingleUpnlAndPriceSig
Extends SingleUpnlSig with asset price information.
price: Asset price used in uPnl verification.
PairUpnlSig
uPnl values for two parties (PartyA and PartyB).
upnlPartyA: uPnl for PartyA.
upnlPartyB: uPnl for PartyB.
PairUpnlAndPriceSig
Combines pair uPnl data with price information.
price: Asset price used in both parties' uPnl calculations.
PairUpnlAndPricesSig
Extends the pair uPnl and price data to multiple symbols.
symbolIds: Array of symbol identifiers.
prices: Array of corresponding prices.
DeferredLiquidationSig
For deferred liquidation, where access revocation or delayed processing is needed.
liquidationBlockNumber: Block number when insolvency was detected.
liquidationTimestamp: Timestamp of insolvency.
liquidationAllocatedBalance: Allocated balance at insolvency.
liquidationId: Unique liquidation event identifier.
upnl: uPnl at insolvency.
totalUnrealizedLoss: Total loss triggering liquidation.
symbolIds & prices: Arrays of the symbol IDs involved and their prices.
LiquidationSig
Like DeferredLiquidationSig, but for immediate liquidation.
QuotePriceSig
Verifies price data for multiple quotes at once.
quoteIds: Array of quote identifiers.
prices: Corresponding price for each quote.
HighLowPriceSig
Price range information for a single symbol.
symbolId: Trading symbol identifier.
highest: Highest observed price in the period.
lowest: Lowest observed price in the period.
averagePrice: Average price over the period.
startTime & endTime: Time window the prices were observed over.
currentPrice: Current price used for calculations.
upnlPartyB & upnlPartyA: uPnl values for both parties (if applicable).
QuoteSettlementData
Settlement data for a quote.
quoteId: Quote identifier.
currentPrice: Price at settlement.
partyBUpnlIndex: Index of which PartyB uPnl is used.
SettlementSig
Aggregates quote settlement data and overall uPnl information during settlement.
quotesSettlementsData: Array of
QuoteSettlementDatastructures.upnlPartyBs: Array of uPnl values for PartyBs.
upnlPartyA: uPnl value for PartyA.
MuonStorage Library
The MuonStorage library reserves a storage slot for all Muon-related configuration data. It exposes one method to access the layout, and through it the Muon settings.
Storage Layout
The layout struct holds:
upnlValidTime: How long (in seconds) a uPnl signature stays valid.
priceValidTime: Validity period for price data.
priceQuantityValidTime: Currently unused; may be removed in a future update.
muonAppId: Unique identifier for the Muon application.
muonPublicKey: The public key (type
PublicKey) used to verify signatures.validGateway: Address of the trusted gateway whose signatures are accepted.
Last updated

