Skip to content

This repository is an example repo to showcase how to migrate Uniswap V2 contracts to =nil; L2

License

Notifications You must be signed in to change notification settings

NilFoundation/uniswap-v2-nil

Repository files navigation

Uniswap V2 =nil;

📋 Overview

This repository showcases the migration of Uniswap V2 to the =nil; We have adapted Uniswap’s core contracts — Factory, Pair, and Router — to work seamlessly with the unique capabilities of =nil; By using this example, developers can learn how to migrate dApps from Ethereum compatible networks to the =nil; and take advantage of its features, such as:

  1. Multi-Currency Support: Learn how =nil; supports multiple currencies natively and how they replace the ERC20 standard
  2. Async/Sync Calls: Discover how to effectively utilize async and sync messaging between shards, making the protocol both scalable and performant
  3. Load Distribution: Understand how to distribute operations across multiple shards, enhancing parallel processing and scalability

This repository also aims to spark discussion on the potential of running DeFi protocols on sharded architectures, demonstrating their feasibility and advantages

⚙️ Prerequirements

Before working with this repository, ensure that you have properly set up your environment:

  1. .env Configuration:
    Make sure to create a .env file in the root directory. All required environment variables are listed in the .env.example file, which you can use as a reference. Link to .env.example

  2. Getting an RPC Endpoint:
    To request an RPC endpoint:

  3. Obtaining a Private Key and Wallet:

🎯 Usage

To help you get started quickly, we provide two demo tasks that showcase the full lifecycle from deployment to execution. These tasks cover deploying and initializing all necessary contracts, as well as performing operations like minting, swapping, and burning

Demo Tasks

  1. Using Factory and Pair Contracts Only
    This demo handles deploying the Factory and Pair contracts and executing a complete flow of operations
    View the demo task

  2. Using Factory, Pair, and Router Contracts
    This demo includes an additional layer by utilizing the Router contract along with Factory and Pair View the demo-router task

Running the Demo Tasks

  1. Compile the Project:
    npx hardhat compile
  2. Run the Demo Tasks:
    • For the core demo (Factory and Pair):
      npx hardhat demo --network nil
    • For the demo with Router (Factory, Pair, and Router):
      npx hardhat demo-router --network nil

Manual Setup

If you prefer to run everything manually, we provide Ignition modules for each contract: Ignition Modules

Additionally, all crucial contract methods have corresponding tasks: Tasks

Each subdirectory contains a README explaining the details of the tasks

🤝 Contributing

We welcome contributions from the community to make this project even better! If you have suggestions, improvements, or find any bugs, please feel free to submit a pull request or open an issue.

Check out our open issues and improvements in the GitHub Issues section. If you're new to the project, look for issues labeled as good first issue — they're a great place to start.

Your input and contributions are greatly appreciated!

License

This project is licensed under the GPL-3.0 License. See the LICENSE file for more details. Portions of this project are derived from Uniswap V2 and are also subject to the GPL-3.0 License.

About

This repository is an example repo to showcase how to migrate Uniswap V2 contracts to =nil; L2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •