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

PartyB Quote Actions Facet (0.8.4)

PartyB Quote Actions Facet (0.8.4)

The PartyB Quote Actions Facet provides Party B with the necessary functions to secure and manage quotes submitted by Party A. After a quote is issued, Party B may choose to lock it—thereby securing the funds required to open a position—and later unlock it if needed. Additionally, Party B can accept a cancellation request if a quote is in the cancellation-pending state.

Key Operations:

  • Lock Quote: Secure a quote by locking it, after verifying the UPnL using a Muon signature.

  • Unlock Quote: Unlock a previously locked quote if conditions permit, returning the quote to a pending state.

  • Accept Cancel Request: Accept a cancellation request for a quote that is in the cancellation-pending state, updating its status and refunding the associated trading fee.


lockQuote()

Locks a quote so that Party B can secure it by providing sufficient funds based on their estimated profit and loss from opening a position. This function requires a valid Muon signature (SingleUpnlSig) to verify the UPnL data for the quote.

Function Signature:

function lockQuote(uint256 quoteId, SingleUpnlSig memory upnlSig) external whenNotPartyBActionsPaused onlyPartyB notLiquidated(quoteId);

Parameters:

  • quoteId: The identifier of the quote to be locked.

  • upnlSig: A SingleUpnlSig structure containing the Muon signature for the UPnL value used during the locking process.

struct SingleUpnlSig {
	bytes reqId;
	uint256 timestamp;
	int256 upnl;
	bytes gatewaySignature;
	SchnorrSign sigs;
}

Example Usage:

Events Emitted:

  • LockQuote:

    Emitted with the Party B address and the locked quote ID.


unlockQuote()

Unlocks a previously locked quote. The function checks if the quote has expired based on its deadline; if so, it emits an expiration event. Otherwise, it unlocks the quote, reverts its status to PENDING, and clears the locked funds associated with Party B.

Function Signature:

Parameters:

  • quoteId: The identifier of the quote to be unlocked.

Example Usage:

Events Emitted:

  • If the quote has expired:

    • ExpireQuoteOpen: Emitted with the resulting status and the quote ID.

  • If the quote is unlocked successfully:

    • UnlockQuote:

      Emitted with the Party B address, quote ID, and the new status (typically PENDING).


acceptCancelRequest()

Accepts a cancellation request for a quote that is in the cancellation-pending state. This function finalizes the cancellation by updating the quote status to CANCELED, refunding the trading fee to Party A, and clearing the associated locked balances.

Function Signature:

Parameters:

  • quoteId: The identifier of the quote for which the cancellation request is accepted.

Example Usage:

Events Emitted:

  • AcceptCancelRequest: This event is emitted to signal that the cancellation request for the quote has been accepted and processed.

Last updated