Skip to content

A simple full stack application with smart contract that compares exchange rates for the weth/usdc trading pair across Uniswap and Sushiswap and then routes users swap to the dex with the best price.

Notifications You must be signed in to change notification settings

ethan-crypto/dex-aggregator-tutorial

Repository files navigation

Dex Aggregator

About

A simple full stack application with smart contract that compares exchange rates for the weth/usdc trading pair across Uniswap and Sushiswap and then routes users swap to the dex with the best price.

User Interface

Technology Stack & Tools

Requirements For Initial Setup

  • Install NodeJS, should work with any node version below 16.5.0
  • Install Truffle, In your terminal, you can check to see if you have truffle by running truffle version. To install truffle run npm i -g truffle. Ideal to have truffle version 5.4 to avoid dependency issues.
  • Install Ganache-cli. Install ganache globally by running npm install -g ganache-cli in your terminal

Setting Up

1. Clone/Download the Repository

$ git clone https://github.com/ethan-crypto/dex-aggregator-tutorial

2. Install Dependencies:

$ cd dex-aggregator-tutorial
$ npm install 

3. Get Infura URL

3. Start Ganache-cli as a fork of the mainnet and unlock account with a lot of USDC.

$ ganache-cli -f https://mainnet.infura.io/v3/11111111111111111
-u 0xc647F8f745a59B74A26d76Da7dcCc8BadF649C32

4. Connect you ganache-cli addresses to Metamask

  • Copy private key of the addresses in ganache and import to Metamask
  • Connect your metamask to network Localhost 8545

5. Run script that transfers USDC from unlcoked account to first development account

$ truffle exec ./scripts/transferUSDC.js

6. Migrate smart contracts

$ truffle migrate --reset

7. Run tests

$ truffle test

8. Run app locally

$ npm run start

License

MIT

About

A simple full stack application with smart contract that compares exchange rates for the weth/usdc trading pair across Uniswap and Sushiswap and then routes users swap to the dex with the best price.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published