Stage: PMM Selection & Failure Handling

The SELECT_PMM stage follows after the MPC confirms the deposit. At this point, the Solver chooses the optimal PMM (Professional Market Maker) based on the user's RFQ constraints. If a valid PMM isn't matched before scriptTimeout, the trade is marked as FAILURE.

Key Responsibilities

  • PMM Selection: Choose a PMM offering a valid quote based on minAmountOut.

  • Quote Verification: Confirm the quote is valid and linked to a pre-signed settlement.

  • Proof Submission: Submit signed data from both parties to validate the trade terms.

  • Fee Policy Compliance: Ensure fees align with the user's expectations.

Scenarios

  • Successful PMM Selection:

    • The protocol validates the PMM's data, locks fees, emits a SelectedPMM event, and advances to MAKE_PAYMENT.

  • No Match/Timeout:

    • If no PMM is selected within scriptTimeout, the trade is stalled. It may be marked as Failure, eligible for refund, and no payment occurs.

Function Descriptions

  • selectPMM(tradeId, info):

    • Executable only by the authorized Solver through the Router.

    • Validates the stage, timeout, fees, and signatures.

  • report(tradeId, msgError, signature):

    • Executable only by authorized MPC Node.

    • The trade transitions to FAILURE, enabling refunds after timeout.

Refund and Query

  • Post SELECT_PMM, query functions track trade status:

    • For Success: Use getCurrentStage to confirm advancement, getPMMSelection for selection data.

    • For Failure: Use getCurrentStage to confirm failure, getFailureInfo for error details.

Last updated