Skip to content

Dapp that enable user to compare prices a cross different exchanges and swap at the best rate

License

Notifications You must be signed in to change notification settings

kaymen99/Dex-aggregator

Repository files navigation

Dex-aggregator

With the ever growing DEFI world and the appearance of multiple decentralized exchanges on the different blockchains, the WEB3 ecosystem needs a way to compare the pros & cons of swapping on each DEX.

This excatly what Paraswap & 1inch protocol are trying to do, they aggregate the prices of tokens from multiple exchanges in each Blockchain (for example: uniswap, sushiswap, shibaswap in the Ethereum Mainnet), then they compare those prices and the swapping fee and offer to their user the best exchange rate possible.

In this Dapp, i built a simplified version of Paraswap it works on 4 blockchains: Ethereum, Polygon, Binance Smart Chain and the kovan testnet.For the moment it supports some well known tokens (ETH, Matic, Dai, USDC,...).

Dark

Built With

Getting Started

Prerequisites

Please install or have installed the following:

Installation

  1. Installing Brownie: Brownie is a python framework for smart contracts development,testing and deployments. It's quit like HardHat but it uses python for writing test and deployements scripts instead of javascript. Here is a simple way to install brownie.

     pip install --user pipx
     pipx ensurepath
     # restart your terminal
     pipx install eth-brownie
    

    Or if you can't get pipx to work, via pip (it's recommended to use pipx)

    pip install eth-brownie

    Install ganache-cli:

     npm install -g ganache-cli
  2. Clone the repo:

    git clone https://github.com/kaymen99/Dex-aggregator.git
    cd Dex-aggregator
  3. Set your environment variables To be able to deploy to real testnets you need to add your PRIVATE_KEY (You can find your PRIVATE_KEY from your ethereum wallet like metamask) and the infura project Id (just create an infura account it's free) to the .env file:

    PRIVATE_KEY=<PRIVATE_KEY>
    WEB3_INFURA_PROJECT_ID=<< YOUR INFURA PROJECT ID >>
    

    You can choose to use ethereum testnets like rinkeby, Kovan or any other evm compatible testnet. You'll also need some eth in the testnet. You can get it into your wallet by using a public faucet.

(back to top)

How to Use

After going throught the installation part you can start the app by running:

cd front-end
yarn
yarn start

The front-end is built using the following libraries:

  • Ethers.js: used as interface between the UI and the deployed smart contract
  • Web3modal: for conecting to Metamask
  • @reduxjs/toolkit & redux-persist: for managing the app states (account, balance, blockchain)
  • Material UI: used for react components and styles

There are 2 main components:
  • Swap component: It finds the best price possible for the user tokens from the supported exchanges and allow user to approve & excute the swap transaction
  • Exchanges component: For getting the token prices on the different exchanges

(back to top)

Contact

If you have any question or problem running this project just contact me: [email protected]

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

About

Dapp that enable user to compare prices a cross different exchanges and swap at the best rate

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published