Degen Code

Degen Code

Share this post

Degen Code
Degen Code
Uniswap V4/V3 Multi-Pool Arbitrage
Copy link
Facebook
Email
Notes
More

Uniswap V4/V3 Multi-Pool Arbitrage

Part III: Uniswap V4 Commands

May 22, 2025
∙ Paid
2

Share this post

Degen Code
Degen Code
Uniswap V4/V3 Multi-Pool Arbitrage
Copy link
Facebook
Email
Notes
More
Share

In Part II, I presented a set of fake contracts for testing, plus a series of tests to demonstrate the execution commands needed for arbitrarily sequenced Uniswap V3 swaps.

This installment will cover the fake contracts needed to test Uniswap V4 behavior, describe the commands needed to support Uniswap V4 swaps, and then wrap them all together with a series of tests across a mix of pool versions.

If you have not read my article on Testing with Ape Framework, you should! Otherwise you may be confused — I present test scripts and assume you can run them and interpret their results without further explanation.

Testing With Ape Framework

Testing With Ape Framework

BowTiedDevil
·
February 28, 2024
Read full story

Versions and Testing Platform

I am building and testing using Vyper 0.4.1 and Ape Framework version 0.8.33.

The project directory I’m using for these examples is ~/code/uniswap_v4_v3_executor.

I am testing with a standalone local fork (no upstream RPC), using this minimal Ape config:

ape-config.yaml

name: Uniswap V4-V3 (multi-pool) Executor

# Tests run against a fresh local chain, and do not require access 
# to historical state for an actual chain, or an external RPC.

default_ecosystem: ethereum

ethereum:
  default_network: local
  local:
    default_provider: foundry

plugins:   
  - foundry
  - vyper

Fake Testing Contracts

I have developed a Uniswap V4 fake contract that works similarly to the Uniswap V3 pool in Part II.

This post is for paid subscribers

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

Share

Copy link
Facebook
Email
Notes
More