Stage: Confirm Payment & Failure Handling

Upon the PMM's payment via makePayment(), including a paymentTxId, the trade enters the CONFIRM_PAYMENT phase. The MPC, acting as the payment verifier, must confirm the payment meets protocol specifications, checking amounts, destination chain, and paymentTxId accuracy.

Steps in This Phase

  • Successful Payment: The MPC calls confirmPayment(), transitioning the trade to CONFIRM_SETTLEMENT, and emits a PaymentConfirmed event for traceability. Once confirmed, the payment is immutable.

  • Failed Payment: If discrepancies like an incorrect amount or malformed paymentTxId occur, the trade moves to the WARNING stage. Here, the PMM can resubmit correct payments within the scriptTimeout.

Actionable Functions

  • confirmPayment()

    function confirmPayment(bytes32 tradeId, bytes calldata signature) external;
    • Execution: Through the Router by authorized MPC Node.

    • Verification: Ensures the trade is in the correct stage and within scriptTimeout.

    • State Transition: Advances trade to CONFIRM_SETTLEMENT, logs confirmed paymentTxId, and emits PaymentConfirmed.

  • report()

    function report(bytes32 tradeId, bytes calldata msgError, bytes calldata signature) external;
    • Execution: Through the Router by authorized MPC Node.

    • Verification: Ensures trade is not yet finalized.

    • State Transition: Logs failure, moves trade to WARNING, and emits FailureReported.

Trade Data Query

  • On Success: Access trade stages and finalization details through relevant view functions.

    function getCurrentStage(bytes32 tradeId) external view returns (uint256);
    function getTradeFinalization(bytes32 tradeId) external view returns (TradeFinalization memory);
  • On Failure: Retrieve error metadata with details for resolution.

    function getCurrentStage(bytes32 tradeId) external view returns (uint256);
    function getFailureInfo(bytes32 tradeId) external view returns (FailureDetails memory);

Last updated