Skip to content
All library documents

DEX Limit Orders, Execution Surplus, and Direct Curve Trading

Article FMZ digest · Author: 小草

Summary

The article compares limit orders routed through decentralized exchange aggregators with trading directly through a smart contract. It explains that aggregators monitor prices and arrange execution when a limit condition is met, sometimes using off-chain order storage and solver competition before on-chain settlement. The author highlights that execution better than the limit can create surplus, and that platforms may distribute or retain that value differently. Batch processing can also delay execution relative to market moves.

A Curve example shows how to query pool pricing, estimate a trade's potential return, and submit a swap with a minimum output constraint. The article discusses custom execution conditions, gas costs, wallet key handling, RPC access, slippage, and MEV. Its example estimates returns without gas costs and is explicitly illustrative; it does not establish a profitable live strategy. Contract safety, execution costs, key security, and changing prices remain material limitations.

Key ideas

  • DEX limit order services differ in how they route execution and allocate surplus beyond a user's limit.
  • Batching can save execution overhead but may delay a trade until after a short-lived opportunity changes.
  • Direct smart contract trading offers customized conditions and control over execution surplus, with added coding and gas requirements.
  • A Curve example estimates swap output and submits a transaction with a minimum output bound.
  • Gas, slippage, MEV, and private key exposure can undermine the example's apparent returns.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.