This project implements a simple probabilistic UniswapV2/Sushiswap arbitrage on MEV-Share, using the Artemis MEV-Share template found here.
We first load all WETH pools that exist on both Uniswap V2 and Sushiswap for which WETH is token1
in the pair. The list of these pools was found here.
After loading in the pools, we listen to MEV-Share events for transactions that are made to any of the pools (Uniswap and Sushiswap) loaded in. After detecting such a transaction, we find its corresponding pair (either the Uniswap V2 pair of the Sushiswap pair) and submit backruns of various size.
The project is structured as a mixed Rust workspace with a Foundry project under
contracts/
and typesafe auto-generated bindings to the contracts under
bindings/
.
├── Cargo.toml
├── bot // <-- Your bot logic
├── contracts // <- The smart contracts + tests using Foundry
├── bindings // <-- Generated bindings to the smart contracts' abis (like Typechain)
Given the repository contains both Solidity and Rust code, there's 2 different workflows.
Forge is using submodules to manage dependencies. Initialize the dependencies:
forge install
If you are in the root directory of the project, run:
forge test --root ./contracts
If you are in in contracts/
:
forge test
cargo test
Rust bindings to the contracts can be generated via forge bind
, which requires
first building your contracts:
forge bind --bindings-path ./bindings --root ./contracts --crate-name bindings
Any follow-on calls to forge bind
will check that the generated bindings match
the ones under the build files. If you want to re-generate your bindings, pass
the --overwrite
flag to your forge bind
command.
First run the command below to get foundryup
, the Foundry toolchain installer:
curl -L https://foundry.paradigm.xyz | bash
Then, in a new terminal session or after reloading your PATH
, run it to get
the latest forge
and cast
binaries:
foundryup
For more, see the official docs.