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.
- Solidity (Programming language for writing smart sontracts)
- Javascript (Used for testing and to build front end with React)
- Uniswap V2 Protocol
- Sushiswap Protocol
- Web3 (Blockchain interaction)
- Truffle (Development Ffamework)
- Ganache-cli (For local blockchain fork of the ethereum mainnet)
- Infura (connection to Ethereum networks)
- Open Zeppelin (smart contract libraries)
- 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 runnpm 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
$ git clone https://github.com/ethan-crypto/dex-aggregator-tutorial
$ cd dex-aggregator-tutorial
$ npm install
- Go to Infura, sign up, create a new project, copy that projects url e.g Mainnet URL https://mainnet.infura.io/v3/11111111111111111
$ ganache-cli -f https://mainnet.infura.io/v3/11111111111111111
-u 0xc647F8f745a59B74A26d76Da7dcCc8BadF649C32
- Copy private key of the addresses in ganache and import to Metamask
- Connect your metamask to network Localhost 8545
$ truffle exec ./scripts/transferUSDC.js
$ truffle migrate --reset
$ truffle test
$ npm run start
MIT