The goal of this project is to make optimal swap paths available in smart contracts without compromising on trustlessness.
The main smart contract, called PathRegistry.sol, has 2 functions:
- A registration and a quality verification of Uniswap v2 and v3 paths.
- Swapping tokens using the registered path. A path is selected based on input and output token addresses and the amount of input token to swap.
- Install Foundry
git clone https://github.com/benesjan/path-registry.git
git submodule update --init
cp ./foundry.toml_template ./foundry.toml
- Replace ARCHIVE_NODE_RPC_URL with actual archive node RPC endpoint (Archive node is required for tests to pass becase tests are fixed at a block.)
yarn
forge build
forge test
Note: Archive node is required for tests to pass because they are fixed at block 14411926. I use archivenode.io endpoint.