Nervos Swap

This application is a fork of Uniswap for the Godwoken network.

Godwoken is an EVM-compatible layer 2 built on top of the Nervos blockchain.

Nervos Swap enables the automated and decentralized exchange of cryptocurrencies through the use of smart contracts.

The protocol works through liquidity pools. Users provide liquidity to the app by depositing cryptocurrency tokens. These tokens can be bought and sold by other users. In return, liquidity providers receive a percentage of the fees generated by each exchange on the platform.

All swaps involving the native currency CKB are carried out with the CKB ERC20 (pCKB).

App structure

The application is composed of a user interface and a backend of smart contracts.

User Interface

The user interface is built with the open-source library React developed by Facebook. React code is made up of reusable entities called components.

Backend

The backend is composed of Uniswap smart contracts. These smart contracts are computer programs written in the solidity language. They manage all the logic of the exchange protocol. The main smart contracts of the application are:

Router

Entry point of the application, allowing to call the functions of adding/withdrawing/exchanging liquidity. As well as the pair consultation functions.

Pair Factory

Smart contract managing cryptocurrency trading pairs. It allows to retrieve an existing pair and create new ones.

Multicall Utility

Utility contract which provides a function to batch together multiple calls in a single external call. This in order to perform atomic transactions comprising several operations.

Test procedure

Use this Faucet to generate test tokens (TOKENA and TOKENB).

Test the application with one of these pairs: TOKENA/TOKENB, CKB/TOKENA, CKB/TOKENB.

Addresses of smart contracts

Built With

Share this project:

Updates