Table of Contents
Fetching ...

Optimal Routing across Constant Function Market Makers with Gas Fees

Carlos Escudero, Felipe Lara, Miguel Sama

Abstract

We study the optimal routing problem in decentralized exchanges built on Constant Function Market Makers when trades can be split across multiple heterogeneous pools and execution incurs fixed on-chain costs (gas fees). While prior routing formulations typically abstract from fixed activation costs, real on-chain execution presents non-negligible gas fees. They also become convex under concavity/convexity assumptions on the invariant functions. We propose a general optimization framework that allows differentiable invariant functions beyond global convexity and incorporates fixed gas fees through a mixed-integer model that induces activation thresholds. Subsequently, we introduce a relaxed formulation of this model, whereby we deduce necessary optimality conditions, obtaining an explicit Karush-Kuhn-Tucker system that links prices, fees, and activation. We further establish sufficient optimality conditions using tools from generalized convexity (pseudoconcavity/pseudoconvexity and quasilinearity), yielding a verifiable optimality characterization without requiring convex trade functions. Finally, we relate the relaxed solution to the original mixed-integer model by providing explicit approximation bounds that quantify the utility gap induced by relaxation. Our results extend the mathematical theory for routing by offering no-trade conditions in fragmented on-chain markets in the presence of gas fees.

Optimal Routing across Constant Function Market Makers with Gas Fees

Abstract

We study the optimal routing problem in decentralized exchanges built on Constant Function Market Makers when trades can be split across multiple heterogeneous pools and execution incurs fixed on-chain costs (gas fees). While prior routing formulations typically abstract from fixed activation costs, real on-chain execution presents non-negligible gas fees. They also become convex under concavity/convexity assumptions on the invariant functions. We propose a general optimization framework that allows differentiable invariant functions beyond global convexity and incorporates fixed gas fees through a mixed-integer model that induces activation thresholds. Subsequently, we introduce a relaxed formulation of this model, whereby we deduce necessary optimality conditions, obtaining an explicit Karush-Kuhn-Tucker system that links prices, fees, and activation. We further establish sufficient optimality conditions using tools from generalized convexity (pseudoconcavity/pseudoconvexity and quasilinearity), yielding a verifiable optimality characterization without requiring convex trade functions. Finally, we relate the relaxed solution to the original mixed-integer model by providing explicit approximation bounds that quantify the utility gap induced by relaxation. Our results extend the mathematical theory for routing by offering no-trade conditions in fragmented on-chain markets in the presence of gas fees.
Paper Structure (8 sections, 6 theorems, 84 equations, 12 figures, 1 table)

This paper contains 8 sections, 6 theorems, 84 equations, 12 figures, 1 table.

Key Result

Proposition 3.1

Assume that properties p:Rb and p:market hold. Let $(\mathbf{\bar{x}}, \mathbf{\bar{y}}, \bar{\eta})$ be a solution to rP satisfying def:comple. Then, constraint qualification KRZ holds at $(\mathbf{\bar{x}}, \mathbf{\bar{y}}, \bar{\eta}) = (\mathbf{0}, \mathbf{0}, 0)$. Moreover, when $(\mathbf{\bar

Figures (12)

  • Figure 1: Example 1: No-trade region for the geometric mean function $\varphi _{\mathrm{gm}}$.
  • Figure 2: Example 1: No-trade region for the weighted quasi-arithmetic mean function $\varphi _{\mathrm{qm}}$.
  • Figure 3: Example 1: Activation of the market for $\varphi _{\mathrm{gm}}$.
  • Figure 4: Example 1: Activation of the market for $\varphi _{\mathrm{qm}}$.
  • Figure 5: Example 2: Optimal trades $(q_{i}=0.01)$.
  • ...and 7 more figures

Theorems & Definitions (21)

  • Remark 3.1
  • Proposition 3.1
  • proof
  • Theorem 3.1
  • proof
  • Remark 3.2
  • Remark 3.3
  • Theorem 3.2
  • proof
  • Theorem 3.3
  • ...and 11 more