Stage: Make Payment & Failure Handling

Once a PMM is chosen, the trade moves to the MAKE_PAYMENT stage, where the PMM must transfer payment to the user and submit a paymentTxId. Submissions can be made by the Solver or the PMM to ensure transparent tracking and auditability. Failure to make the payment before scriptTimeout may lead the MPC to mark the trade as FAILURE.

Solver Responsibilities

  • Initiating Payment Submission (Optional): Assist in submission if needed.

  • Monitoring PMM Activity: Ensure payment is submitted on time.

PMM Responsibilities

  • Fulfilling the Payment: Transfer funds via an approved method.

  • Submitting paymentTxId: Publicly submit a verifiable transaction ID.

  • Signature Authentication: Use cryptographic signatures for authenticity.

  • Acting Within tradeTimeout: Complete payments before the deadline to avoid penalties.

  • Retrying After Warning: Resubmit necessary payments to correct failed trades.

Successful Payment Submission

A valid paymentTxId submission within scriptTimeout moves the trade forward, clears previous failures, and emits a MadePayment event. Delays beyond the tradeTimeout deadline can lead to rejection by the MPC.

Failure: No Payment Submitted & Timeout

If no valid paymentTxId is submitted by scriptTimeout, the trade is stalled. The MPC may use the report() function to mark it as failed.

Functions and Event Emissions

makePayment() Function

  • Permissioned Execution: Can be called by the authorized Solver or PMM via the Router.

  • Trade Stage Validation: Ensures correctness of stage and clears failures on valid retries.

  • Timeout & Expiry Checks: Validates against scriptTimeout.

  • Signature Verification: Confirms PMM’s signature for authenticity.

  • Trade State Transition: Advances to CONFIRM_PAYMENT and logs submission time.

  • Event Emission: Emits a MadePayment event for validation.

report() Function

If a payment is unsuccessful before scriptTimeout, the MPC reports the failure:

  • Permissioned Execution: Executable by authorized MPC Node via the Router.

  • Constraints & Behavior: Ensures trade's validity for reporting.

  • Signature Verification: Uses EIP-712 for authenticity.

  • Trade State Transition: Stores failure details and marks trade as FAILURE, allowing user refunds.

  • Event Emission: Emits a FailureReported event for monitoring.

Queryable Trade Data

Successful Payment

  • Get Trade Stage: Returns current trade stage (e.g., CONFIRM_PAYMENT).

  • Get Trade Finalization: Provides finalization details and paymentTxId for audit.

No Payment & Timeout

  • Get Trade Stage: Shows current stage (e.g., FAILURE).

  • Get Failure Details: Provides error metadata, including stage and reason.

Last updated