Uniswap V4/V3 Multi-Pool Arbitrage
Part III: Uniswap V4 Commands
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.
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
- vyperFake Testing Contracts
I have developed a Uniswap V4 fake contract that works similarly to the Uniswap V3 pool in Part II.
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.

