Spread-aware DCA

A DCA order escrows its budget in PoincareDCA and swaps it in slices, one per interval. The Poincaré part is the protection: whether a slice may pay the trend spread.

How a slice fills

A keeper submits each slice; the contract re-checks the order's rules in the same transaction, quotes with the Lens and swaps through the canonical v4 router, and the output goes straight to the order's recipient. A keeper can only fill a slice the rules allow, and the owner can always fill their own.

Protections

PresetmaxSpreadBpspauseOnTrendBehaviour
Spread guard (default)0falseNever pays the spread: a slice that would pay it waits, and later slices catch up
Trend pause0trueAlso waits while a trend runs with the order's side, before any spread is charged
Always fill10000falseFills every slot whatever the spread, like a plain exchange DCA

Schedule and catch-up

Slot n opens at startTime + n × interval. Only slots that open strictly before the deadline count, and the default deadline (start + slices × interval) gives the last slice a full interval. With catchUp (on by default), later slices grow to spread what is left over the slots left, so an order that waited out a trend still finishes on time.

Price protection

  • limitPrice: the most a buy pays, the least a sell accepts (USDC per WETH). A slice below it is held.
  • maxSlippageBps: the router's floor against the quote taken in the same transaction (default 50).
Why same-transaction quotes matter. A market swap quoted one block early can land after a spread engages and revert on slippage. DCA slices quote and swap atomically, so they never see that gap.

Unichain Sepolia · chain 1301 · testnetLaunch app