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
makePayment() FunctionPermissioned Execution: Can be called by the authorized
Solveror PMM via theRouter.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_PAYMENTand logs submission time.Event Emission: Emits a
MadePaymentevent for validation.
report() Function
report() FunctionIf a payment is unsuccessful before scriptTimeout, the MPC reports the failure:
Permissioned Execution: Executable by authorized
MPC Nodevia theRouter.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
FailureReportedevent 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
paymentTxIdfor 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
