Trade Life Cycle

The Optimex Protocol enables secure cross-chain asset transfers through a structured, multi-step trade process that includes user deposits, market maker (PMM) execution, and final settlement. Each trade progresses through clearly defined stages and is continuously monitored by a decentralized Multi-Party Computation (MPC) network, ensuring consistency, validation, and reliable failure recovery.

Optimistic Swap - Trade Life Cycle

πŸ“¦ Trade Completion States

Each trade concludes in one of two final states:

  • Completed – The trade successfully progresses through all required lifecycle stages and the recipient receives the intended asset.

  • Refunded – The trade encounters an issue that prevents completion. The protocol safely returns funds to the user.

βœ… Successful Trade Lifecycle

A trade is considered Completed only when it successfully passes through the following sequential stages:

  • Trade Submitted – The Solver submits initial trade data to the protocol.

  • Deposit Confirmed – The MPC verifies that the user's deposit was received on the source chain.

  • PMM Selected – A Professional Market Maker (PMM) is selected to fulfill the trade.

  • Payment Transferred – The PMM sends the target asset to the user on the destination chain.

  • Payment Confirmed – The MPC validates that the payment has been successfully completed.

  • Completed – The trade is finalized and marked as successful, triggering settlement and releasing funds to the PMM.

❌ Failure Detection and Handling

While the protocol is designed for high success rates, failures may occur at specific stages. The MPC plays a key role in proactively detecting and resolving failures.

πŸ” Deposit Failure Detection

  • After trade submission, the MPC validates deposit details.

  • If a mismatch or timeout occurs, the MPC can mark the trade as Failure.

  • A trade marked as Failure is permanently halted and cannot proceed.

  • After a grace period (timeout), the MPC finalizes the trade and triggers an automatic refund of the user’s funds.

πŸ” Payment Failure Detection

  • The payment (paymentTxId) may be submitted by the Solver or PMM.

  • The MPC verifies payment accuracy and consistency.

  • If a problem is detected:

    • The trade is moved to a WARNING state.

    • The PMM is notified and may attempt to make another payment.

      • If successful, the trade returns to Confirm Payment.

      • If not, the MPC escalates the trade to FAILURE after the timeout period and initiates the refund process accordingly.

πŸ” Other Failure Scenarios

  • For all other stages (e.g., Select PMM, Make Payment, Warning, Confirm Settlement), failure handling is only triggered after a timeout.

  • The MPC monitors pending trades and moves them to Failure if they remain stalled.

  • Refund handling follows the same policy based on the auto-refund setting.

⚠️ Note: Auto-refund is mandatory. However, in rare cases, the MPC may process the refund with a delay. Users can still manually claim refunds via the DApp interface after the timeout period if the refund hasn't been issued automatically.

Last updated