Skip to content

Optimization

Optimization primitives answer “what’s the best version of this action?” — the optimal split for a single-sided deposit, the cost of a rebalance, the tradeoff across V3 tick ranges.

Per-protocol single-primitive coverage — each protocol gets the optimization question most relevant to its mechanics.

  • OptimalDepositSplit — V2-only: optimal swap fraction for a single-sided zap-in (closed-form quadratic with the counterintuitive dα/d(dx) < 0 result).
  • EvaluateRebalance — V2-only: cost of cycling a position (withdraw → swap → re-zap).
  • EvaluateTickRanges — V3-only: capital-efficiency vs IL-exposure vs fee-capture across N candidate ranges.
ProtocolCoverageNotes
Uniswap V2FullOptimalDepositSplit, EvaluateRebalance.
Uniswap V3FullEvaluateTickRanges.
BalancerDeferred (v2.1)Optimal-weight selection and zap-in optimization deferred until weighted-pool primitives stabilize.
StableswapDeferred (v2.1)Stableswap zap-in is non-trivial (non-symmetric reserves at peg); unblocked by future invariant-math primitives.

None of these are in the curated v2.0 set. Optimization primitives require multi-step reasoning (“is this rebalance worth it?”, “should I narrow my range?”) that’s better composed LLM-side over the leaf cost/scenario primitives. The category exists for when an agent needs the building blocks; the verdict is the LLM’s job.