Sending a Quote
Sending a quote is a core action on the SYMM platform. It allows Party A to signal an intent to trade by submitting a detailed quote request. To ensure that the quote is accepted and ultimately opened by a hedger (Party B), you must follow the steps below and provide accurate parameters. Debugging is difficult with MultiAccount as the transaction could fail for a number of reasons.
sendQuoteWithAffiliate()
should be used to send quotes.
Function Signature
Parameter Breakdown
partyBsWhiteList[]
partyBsWhiteList[]
An array of Party B addresses (hedgers/solvers) that Party A is willing to trade with. Example:
symbolId
symbolId
The identifier for the trading symbol.
Use the getSymbols()
function on the SYMM Diamond to see available symbols, or query a solver’s supported symbols from the contract-symbols endpoint (RASA).
positionType
positionType
Enum indicating the type of position:
Use 0
for LONG positions and 1
for SHORT positions.
orderType
orderType
Enum indicating the order type:
Use 0
for LIMIT orders and 1
for MARKET orders.
price
price
For LIMIT orders:
This is the exact price (in 18 decimals) at which you wish to open the position.
For MARKET orders:
The price a quote is opened at includes the spread that a solver charges. In order for your MARKET quote to be accepted, you should send an price slightly adjusted from the current market price depending on the position type. This is an adjusted price includes a slippage buffer (e.g., 5%).
LONG Order: Increase the price you receive from Muon by 5% (your position opens slightly higher to reflect the hedger's spread)
SHORT Order: Decrease the price you receive from Muon by 5% (your position opens slightly lower to reflect the hedger's spread)
quantity
quantity
The total order quantity in 18‑decimal format. For example, a 5 ETH order would be 5e18.
cva, lf, partyAmm, partyBmm
cva, lf, partyAmm, partyBmm
These represent the locked value parameters—fractions (as percentages) of the notional value that define the risk and margin requirements.
cva
: Credit Valuation Adjustment. EitherpartyA
(the user) orpartyB
(the hedger) can get liquidated andcva
is the penalty that the liquidated side should pay to the other.lf
(Liquidator Fee): Fee reserved for liquidators.partyAmm
(Party A Maintenance Margin): Margin required for Party A.partyBmm
(Party B Maintenance Margin): Margin required for Party B.
Query the solver’s get_locked_params
endpoint. Multiply the notional value by the returned percentage (divided by 100) for each parameter. If you sent a MARKET order, make sure that the notional is calculated based on the adjustedPrice you sent (with the slippage included)
The general formula to send these values as parameters are described below:
LockedParam (Wei) = (Notional Value * lockedParam) / (100 * leverage)
The notional value must be calculated based on the price you wish to send to the contract, not the Muon price. It should reflect the hedger's spread.
Formula for MARKET orders:
notionalValue = (quantity * adjustedPrice)
Formula for LIMIT orders:
notionalValue = (quantity * requestedPrice)
Example Response:
maxFundingRate
maxFundingRate
The maximum funding rate allowed by Party A, converted to 18 decimals (this is usually 200e18)
You can obtain this from the solver's contract-symbols
endpoint (RASA)
deadline
deadline
A Unix timestamp marking the expiry of the quote. Ensure it’s set far enough in the future for a solver to act.
affiliate
affiliate
The affiliate address. This is the frontend's MultiAccount contract address.
upnlSig
upnlSig
This is A SingleUpnlAndPriceSig
struct that confirms:
reqId
: A unique request identifier.timestamp
: When the signature was generated.upnl
: The unrealized profit and loss for Party A.price
: The verified asset price (in 18 decimals).gatewaySignature
: A signature from the trusted gateway.sigs
: A Schnorr signature (withsignature
,owner
, andnonce
fields).
This data is obtained from the Muon oracle by calling the uPnl_A_withSymbolPrice
method.
Example Query:
Script Example for fetching and formatting the upnlSig for a sendQuoteWithAffiliate using axios and web3:
Parameter Encoding for sendQuoteWithAffiliate
When sending a quote using sendQuoteWithAffiliate()
, you must encode the function call with the SYMM Diamond’s ABI before forwarding it through your MultiAccount contract. This ensures that the parameters are formatted correctly and that the Diamond delegates the call to the appropriate facet.
The transaction payload before encoding should be formatted like this:
Steps to Encode and Send a Quote:
Encode the Function Call:
Use Web3’s ABI encoding to convert the
sendQuoteWithAffiliate
function call into a byte string. For example:sendQuoteWithAffiliateFunctionAbi: The ABI definition for the
sendQuoteWithAffiliate
function.sendQuoteParameters: An array containing all parameters in the order defined by the function signature.
Prepare the Call Data:
The MultiAccount contract’s
_call()
method expects an array where:The first element is the sub‑account address.
The second element is an array containing your encoded function call.
Send the Transaction:
Finally, forward the encoded call through your MultiAccount contract.
By following these steps, you can successfully encode and send a quote with affiliate information using the sendQuoteWithAffiliate()
function in SYMM.
Finding the Quote ID
Once you send a quote using the sendQuoteWithAffiliate()
function, the system will emit a SendQuote event. This event confirms that your quote has been successfully submitted and provides a unique identifier (the quoteId
) along with key details of your quote. For example, the event is defined as follows:
You can use this ID to track and query your quote later, using getQuote().
Last updated