For the complete documentation index, see llms.txt. This page is also available as Markdown.

Sending a Quote

Sending a quote is a core action on the SYMM platform. It lets PartyA signal an intent to trade by submitting a detailed quote request. For the quote to be accepted and opened by a hedger (PartyB), follow the steps below and provide accurate parameters. Debugging is harder when the call is forwarded through the AccountLayer's _call, since the transaction can fail for a number of reasons.

In v0.8.5 the quote is encoded and forwarded through the AccountLayer's _call, not a per-frontend MultiAccount. The current function is sendQuoteWithAffiliateAndData(), which takes the parameters below plus a trailing data bytes field (an off-chain correlation ID); the AccountLayer routes the quote to the right VirtualAccount. For the exact 0.8.5 encoder see Building a New Frontend, and for a wallet-free, session-key-signed version see the Instant Layer flow.

Function signature

function sendQuoteWithAffiliate(
    address[] memory partyBsWhiteList,
    uint256 symbolId,
    PositionType positionType,
    OrderType orderType,
    uint256 price,
    uint256 quantity,
    uint256 cva,
    uint256 lf,
    uint256 partyAmm,
    uint256 partyBmm,
    uint256 maxFundingRate,
    uint256 deadline,
    address affiliate,
    SingleUpnlAndPriceSig memory upnlSig
) external returns (uint256);

Parameter breakdown

partyBsWhiteList[]

An array of PartyB addresses (hedgers/solvers) that PartyA is willing to trade with.

symbolId

The identifier for the trading symbol.

Use getSymbols() on the SYMM Diamond to see available symbols, or query a solver's supported symbols from the contract-symbols endpoint (RASA).

positionType

Enum for the position type:

Use 0 for LONG and 1 for SHORT.

orderType

Enum for the order type:

Use 0 for LIMIT and 1 for MARKET.

price

For a LIMIT order, this is the exact price (in 18 decimals) at which you want to open the position.

For a MARKET order, the executed price includes the spread the solver charges, so you send a price adjusted from the current market price by a slippage buffer (e.g. 5%) to get the quote accepted:

  • LONG order: increase the price you get from Muon by 5% (the position opens slightly higher to reflect the hedger's spread).

  • SHORT order: decrease the price you get from Muon by 5% (the position opens slightly lower to reflect the hedger's spread).

quantity

The total order quantity in 18-decimal format. For example, a 5 ETH order is 5e18.

cva, lf, partyAmm, partyBmm

The locked-value parameters: fractions (as percentages) of the notional value that define the risk and margin requirements.

  • cva: Credit Valuation Adjustment. Either partyA (the user) or partyB (the hedger) can be liquidated, and cva is the penalty the liquidated side pays the other.

  • lf (Liquidator Fee): fee reserved for liquidators.

  • partyAmm (Party A Maintenance Margin): margin required for PartyA.

  • partyBmm (Party B Maintenance Margin): margin required for PartyB.

Query the solver's get_locked_params endpoint. Multiply the notional value by the returned percentage (divided by 100) for each parameter. For a MARKET order, calculate the notional from the adjustedPrice you sent (with slippage included).

The general formula for these values:

LockedParam (Wei) = (Notional Value * lockedParam) / (100 * leverage)

The notional value must be calculated from the price you send to the contract, not the Muon price. It should reflect the hedger's spread.

For MARKET orders:

notionalValue = (quantity * adjustedPrice)

For LIMIT orders:

notionalValue = (quantity * requestedPrice)

Example response:

maxFundingRate

The maximum funding rate PartyA allows, in 18 decimals (usually 200e18).

You can get this from the solver's contract-symbols endpoint (RASA).

deadline

A Unix timestamp marking the quote's expiry. Set it far enough in the future for a solver to act.

affiliate

The affiliate address: your registered affiliate address for this frontend, which links the quote to you for fee tracking and routing.

upnlSig

A SingleUpnlAndPriceSig struct that confirms:

  • reqId: a unique request identifier.

  • timestamp: when the signature was generated.

  • upnl: the unrealized profit and loss for PartyA.

  • price: the verified asset price (in 18 decimals).

  • gatewaySignature: a signature from the trusted gateway.

  • sigs: a Schnorr signature (with signature, owner, and nonce fields).

This data comes from the Muon oracle by calling the uPnl_A_withSymbolPrice method. A SubAccount bound to a single PartyB skips this Muon check on the trade path and can send an empty upnlSig; see the Instant Layer flow.

Example query:

Script to fetch and format the upnlSig for sendQuoteWithAffiliate, using axios and web3:

Parameter encoding for sendQuoteWithAffiliate

When sending a quote, encode the function call with the Symmio Core ABI before forwarding it through the AccountLayer's _call. This formats the parameters correctly and lets the Diamond delegate the call to the right facet.

The transaction payload before encoding should look like this:

Steps to encode and send a quote:

  1. Encode the function call. Use Web3's ABI encoding to turn the sendQuoteWithAffiliate call into a byte string:

    • sendQuoteWithAffiliateFunctionAbi: the ABI definition for sendQuoteWithAffiliate.

    • sendQuoteParameters: an array of all parameters in the order defined by the function signature.

  2. Prepare the call data. The AccountLayer's _call() method expects the SubAccount address and an array containing your encoded call:

  3. Send the transaction. Forward the encoded call through the AccountLayer:

Finding the quote ID

Once you send a quote with sendQuoteWithAffiliate(), the system emits a SendQuote event. It confirms the quote was submitted and carries a unique identifier (the quoteId) plus key details. The event is defined as:

Use this ID to track and query the quote later with getQuote().

Last updated