What Makes a Trade Declarative
In a declarative trade, users do not specify an execution path. They specify:- The assets to trade.
- The minimum acceptable outcome.
- The slippage tolerance.
How Declarative Trades Execute
Declarative trades use an open-order + fill structure, executed using Jito bundles.A Jito bundle groups multiple transactions for ordered, atomic execution within the same slot. If any transaction in the bundle fails, none are processed.
- The user signs an open order transaction signaling an intent to trade.
- Funds are temporarily escrowed onchain in the DFlow Swap Orchestrator contract.
- The user then signs the open order transaction and submits it to the DFlow Aggregator to be filled.
- Routing is evaluated immediately before execution.
- The open-order and fill transactions execute together as a bundle.
Why Declarative Trades Reduce Slippage
Slippage occurs when prices change between quote and execution. Declarative trades reduce slippage by:- Delaying route finalization until execution.
- Evaluating prices onchain immediately before execution.
- Avoiding stale routes embedded at quote time.
Why Declarative Trades Improve Reliability
Many failed trades occur when prices move beyond slippage tolerance before execution. Declarative trades improve reliability by:- Reducing price drift between routing and execution.
- Lowering the chance of slippage violations.
- Avoiding retries and wasted fees.
Why Declarative Trades Reduce Sandwich Risk
Sandwich attacks exploit the gap between when a route is revealed and when execution happens. Declarative trades reduce this risk by avoiding fixed routes at quote time. Because routing is finalized at execution and submitted as a bundled transaction, there is less opportunity for third parties to react to a known path and insert transactions around it. This does not eliminate sandwich risk entirely, but it significantly reduces exposure compared to trades with pre-committed routes.When Declarative Trades Make Sense
Declarative trades are a good fit when:- Prices move quickly.
- Liquidity is fragmented.
- Minimizing slippage matters more than route control.
- Execution reliability is critical.