Degen Code

Degen Code

Smart Contract Arbitrage — Optimizing the Input

Mad Maxing

Mar 16, 2022
∙ Paid

The trickiest part of a two-pool arbitrage is determining the optimal borrow amount.

To understand how the problem is solved, consider the the hypothetical equation:

P(x) = y_b(x) - y_a(x)

where y_b(x) is the output of token x swapped for token y through Pool B, y_a(x) is the repayment required in token y for a flash borrow of token x through Pool A, and …

Keep reading with a 7-day free trial

Subscribe to Degen Code to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 BowTiedDevil
Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture