Comment on page

Virtual Orders

Virtual orders are described extensively in the Paradigm paper as:
“TWAMM breaks ... long-term orders into infinitely many infinitely small virtual sub-orders, which trade against the embedded AMM at an even rate over time. ... a closed-form mathematical formula allows us to calculate their cumulative effect only when needed.”
Figure 1: long term swap virtual orders executed off-chain until arbitrageur interacts with AMM
The use of the closed-form formula to calculate the cumulative effect and apply it to the contract state is Virtual Order Execution.
Virtual order execution is applicable to regular swaps in addition to LT swaps and any other contract operations affecting reserve values; the following operations in [2] require execution of virtual orders:
  • LT Swap
  • LT Swap Withdraw Funds
  • LT Swap Cancel
  • Swap
  • ProvideLiquidity (Mint)
  • RemoveLiquidity (Burn)
Each TWAMM operation incurs the gas burden of executing virtual orders, which is the leading gas usage contributor.