janhenkgerritsen/amm-arbitrage-executor
Solidity smart contract used to execute arbitrage routes produced by a companion TypeScript arbitrage bot.
AMM Arbitrage Executor (Solidity)
This repository contains the Solidity smart contract used to execute arbitrage routes produced by a companion TypeScript arbitrage bot.
The contract is intentionally kept small and focused. All strategy, opportunity detection, and route selection happens off-chain; the executor receives a precomputed execution plan (route + parameters) from the arbitrage bot and executes it atomically on-chain.
Using a dedicated executor contract allows complex multi-step arbitrage routes to be executed in a single transaction, avoiding partial execution and ensuring that either the entire arbitrage succeeds or the transaction reverts.
For more details about the overall system and off-chain logic, see the companion TypeScript arbitrage bot:
Tooling
This project uses Foundry.
Basic commands:
forge install
forge build
forge testConfiguration
RPC endpoints are configured via environment variables referenced by foundry.toml.
Typical examples:
MAINNET_RPC_URLAVALANCHE_RPC_URL
Deploy
A deployment script is included under script/.
Example:
forge script script/DeployExecutor.s.sol --rpc-url $AVALANCHE_RPC_URL --broadcastAdjust the RPC URL and broadcast settings to your environment.
License
MIT. See LICENSE.
Attribution is appreciated if you use this code as a basis for other projects.