Skip to content

eugenioclrc/huffswap-v2-core

Repository files navigation

HuffSwap Logo

HuffSwap

A Simple DEX with BALLs

HuffSwap V2 Core

HuffSwap V2 Core is a decentralized trading protocol that facilitates permissionless and trustless trading of ERC20 tokens through smart contracts. Its based on Uniswap V2, and should be compatible.

Previous Work

This project builds upon the UniswapV2-core contracts and maintains full compatibility. It also draws inspiration from previous efforts to rebuild the pair contract in Huff, such as UniswapV2-Huff.

Prerequisites

These steps are optional if you want to modify the Pair code and recompile everything.

  1. Install BALLs
  2. Install Huff

Recompilation

To recompile the contracts, run the following commands:

sh build-erc20.sh
sh build-erc1363.sh
sh build-libs.sh
sh build-lp.sh
sh create-bytecode-pair.sh

If you are on a liunx env you might want to limit the max amount of RAM to avoid deadlocks, example;

systemd-run --scope -p MemoryLimit=14000M ./build-lp.sh

After recompiling, paste your new bytecode into Factory:getCreationCode.

Setup Instructions

To get started with HuffSwap V2 Core, ensure you have Foundry installed. Follow these steps:

  1. Clone the HuffSwap V2 Core repository:
git clone https://github.com/eugenioclrc/huffswap-v2-core.git
  1. Navigate to the project directory:
cd huffswap-v2-core
  1. Install dependencies:
forge update
  1. Build the project:
forge build
  1. Run tests to ensure everything is set up correctly:
forge test

Contributing

We welcome contributions from the community! To contribute, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix.
  3. Make your changes.
  4. Submit a pull request with a detailed description of your changes.

License

HuffSwap V2 Core is released under the MIT License.

Contact

For questions or support, please open an issue in this repository or reach out me on twitter.