This repository contains the implementation of a Router contract for swapping tokens using predefined routes. The routes must follow the PackedRoute format. The Router contract interacts with various decentralized exchanges (DEXs) such as Uniswap V2, Uniswap V3, and Trader Joe.
The main Router contract for swapping tokens using predefined routes. It supports both exact input and exact output swaps. The router contract will validate the route and perform the swaps using the RouterLogic
contract.
The RouterLogic contract implements the logic for swapping tokens using a route. It interacts with different DEXs to perform the swaps. The route must be in the PackedRoute format.
The RouterAdapter contract provides helper functions for interacting with different types of pairs, including Uniswap V2, Trader Joe Legacy LB, Trader Joe LB, and Uniswap V3 pairs.
Helper library for token operations, such as balanceOf, transfer, transferFrom, wrap, and unwrap.
Helper library for router operations, such as validateAndTransfer, transfer, and swap.
Helper library for interacting with Uniswap V2, Trader Joe, and Uniswap V3 pairs.
Helper library to decode packed route data. For more information on the PackedRoute format, see the PackedRoute documentation.
Helper library for parsing flags received from a packed route.
Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
$ forge build
$ forge test
This project is licensed under the MIT License. See the LICENSE file for details.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
For any questions or inquiries, please contact the repository owner.