This tool compares the Uniswap protocol on EVM against the Jediswap protocol on Starknet. It creates two separate local nodes (Anvil and Katana) with each protocol implementation, and a sequence of interactions are passed to both. After each interaction, observable fields such as position data and token balances are verified to be the same across both nodes.
Built by Nethermind as part of a security and code-review engagement with the Jediswap team.
- Clone the repository to your local machine
- Create and active a virtual environment:
python3 -m venv simulation-env - Activate the new environment:
source simulation-env/bin/activate - Copy
.env_exampleto a new file.env, you can add your RPC url if you want to collect interactions - Install python dependencies:
pip install --requirement pip_requirements.txt - Install Foundry, link to installation
- Install Katana, link to installation (version
katana 0.6.0-alpha.6) - Install Starkli, link to installation (try version
0.1.20) - Install Scarb via
asdf, link to installation, set version to2.4.3withasdf local scarb 2.4.3 - Enter dir
Uniswap/PoolUtilsand runforge buildto compile Uniswap and helper contracts - Enter dir
Jediswap/PoolUtilsand runscarb buildto compile Jediswap and helper contracts
The interactions tested on both protocols are extracted directly from Uniswap pools, meaning that all simulations done through this program are done from real on-chain data. It can take a long amount of time to collect this data, access to a personal node or high-throughput RPC url is recommended. The given RPC endpoint must support the trace_replayTransaction method.
- Open
Interactions.pyand editPOOL_ADDRESSto your Uniswap pool of choice - Open
Interactions.pyand editPOOL_DEPLOYMENT_BLOCKto the block which the pool was deployed - Source
.envto get your RPC url:source .env - Collect interactions:
python3 Interactions.py - Allow this script to run as long as you like, ctrl+c to halt script
- Output is placed in
interactions/interactions.json - Consider renaming output to another name like
usdc-eth-interactions.json
All of the following interactions should be executed in a different terminal.
bash start_uniswap_anvil.shbash start_jediswap_katana.shsource .env; python3 Compare.py <interaction_file_path>