This is a decentralized exchange where funds are locked in a smart contract in pools provided by liquidity providers and trades are carried out against the pools for a 0.3% fee.
This is a basic DEX - liquidity providers (LP) can provide liquidity to the exchange smart contract and trades can be done against the funds in the pool for a fee that is disbursed to the LP based on their ownership in the pool. The LP can also make part or full withdrawals of funds from the pool plus the fee earned from trading.
You can view the deployed DEX and token contracts at the Kovan etherscan addresses below:
To setup this project (on a Windows machine):
- Install the above technologies (Truffle, Ganache, Metamask)
- Make Sure Ganache is running (Ganache is the local blockchain)
- Connect your MetaMask wallet to Ganache:
a. Click the MetaMask browser extension
b. Click the Networks tab and select Custom RPC
c. Enter settings:
i. Network Name => Ganache
ii. New RPC URL (the RPC server on your running Ganache) => http://localhost:7545
iii. Chain ID => 1337 Explanation
d. Click Save - Select the newly added Ganache network and click the profile picture to reveal more settings
- Select "Import Account"
- Go to Ganache:
i. Click the key icon on the first address(Important!) (Ganache provides you with 10 accounts each prefunded with test Ether)
ii. Copy the private key - Go back to MetaMask, make sure the "Private Key" option is selected, paste the private key you copied and click import.
To run this project, install it locally using npm:
git clone https://github.com/icepaigez/Decentralized-ERC-20-Token-Exchange.git project-name
cd project-name
npm install
truffle migrate
npm start
List of features ready and TODOs for future development
- Provide Liquidity to a pool
- Make trades against available pools
- Withdraw from a pool
To-do list:
- Add functionality to create new liquidity pools
- Create a way for people to buy the native tokens that can be staked on the DEX i.e swapped with Ether
Project is: in progress, more features being developed.
Project inspired by Medium
Created by @shocotee - feel free to contact me!