Skip to content

Commit

Permalink
Merge pull request #2 from traderjoe-xyz/license-and-readme
Browse files Browse the repository at this point in the history
License and readme
  • Loading branch information
0x0Louis authored Jan 11, 2025
2 parents 729883e + 5b2000d commit 8a67ef0
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 44 deletions.
19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
MIT License

Copyright (c) 2022 Joemart Ltd

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
85 changes: 46 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,46 @@
## Foundry
# [Joe Router Contract](https://github.com/traderjoe-xyz/joe-router)

**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**
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.

## Contracts

### Router.sol

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.

### RouterLogic.sol

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.

### RouterAdapter.sol

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.

## Libraries

### TokenLib.sol

Helper library for token operations, such as balanceOf, transfer, transferFrom, wrap, and unwrap.

### RouterLib.sol

Helper library for router operations, such as validateAndTransfer, transfer, and swap.

### PairInteraction.sol

Helper library for interacting with Uniswap V2, Trader Joe, and Uniswap V3 pairs.

### PackedRoute.sol

Helper library to decode packed route data. For more information on the PackedRoute format, see the PackedRoute documentation.

### Flags.sol

Helper library for parsing flags received from a packed route.

Foundry consists of:
## Foundry

- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.
**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**

## Documentation

Expand All @@ -27,40 +60,14 @@ $ forge build
$ forge test
```

### Format

```shell
$ forge fmt
```

### Gas Snapshots

```shell
$ forge snapshot
```

### Anvil
## License

```shell
$ anvil
```

### Deploy

```shell
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
```
This project is licensed under the MIT License. See the LICENSE file for details.

### Cast
## Contributing

```shell
$ cast <subcommand>
```
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

### Help
## Contact

```shell
$ forge --help
$ anvil --help
$ cast --help
```
For any questions or inquiries, please contact the repository owner.
5 changes: 0 additions & 5 deletions src/libraries/Flags.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

// flags = [zeroForOne? | callback? | id]
// The zeroForOne flag is the first bit of the flags variable
// The callback flag is the second bit of the flags variable
// The id is the last 8 bits of the flags variable

/**
* @title Flags
* @dev Helper library for parsing flags received from a packed route
Expand Down

0 comments on commit 8a67ef0

Please sign in to comment.