Skip to content

simple decentralised exchange using solidity, truffle, react, metamask, ethereum, web3, dapps, es6, js, redux, and testing,

Notifications You must be signed in to change notification settings

MatricksDeCoder/Fojini-DEX

Repository files navigation

Fojini Decentralized Exchange

About

Fojini is a simple Ethereum based decentralized exchange with its own token Fojini, has low or no trading fees if you are lucky. Decentralized exchange allows for trustless exchange of assets and tokens on Ethereum without giving away control of your assets.

Usage

You need to have Metamask Wallet. Connect to the app using your wallet. When connected, your address will show on the top navigation bar. You can deposit your tokens or ether, create orders by choosing the amount of token you want to get in exchange for amount of ether or vice versa, or fill open orders to make a trade.

Development Project

Deployment

Smart Contracts deployed to Ethereum Rinkeby Testnet and Kovan Testnest. The smart contracts are not upgradeable. App deployed on Heroku and is available on site https://fojini.herokuapp.com/ but must have Metamask installed on your computer.

Technology Stack and Tools

  • Metamask Wallet
  • Truffle - development framework
  • React - front end framework
  • Redux - front end state management framework
  • Solidity - ethereum smart contract language
  • Ganache - local blockchain development
  • Web3 - library interact with ethereum nodes
  • JavaScript - logic front end and testing smart contracts
  • Infura - connection to ethereum networks
  • Open Zeppelin - smart contract libraries
  • Oracle - Lighthouse, Rhombus for randomness

Installation

You need to have ganache-cli installed globally using npm!

Clone the project

$ git clone https://github.com/MatricksDeCoder/Fojini-DEX.git
$ cd Fojini-DEX
Folder / Directory Structure
  • Fojini Dex
    • migrations
    • public
    • scripts
    • src
      • abis
      • components
      • contracts
      • flats
      • store index.js
    • tests

Node version used was v16.13.0

Install the dependancies

$ npm install

Run local blockchain with ganache. Ensure truffle-config.js networks config is your Ganache port. By default it should be host: 127.0.0.1 and port: 7545 or 8545 depending you used GUI or CLI.

$ ganache-cli

Connect your ganache addresses from list of given addresses to Metamask by copying the private key and importing these private keys to Metamask.

Compile, Test and Migrate Contracts on Ganache To deploy to rinkeby use truffle migrate --reset --network rinkeby Advisable to rerun ganache-cli before each test

$ truffle compile --all
$ truffle test ./test/Token.test.js
$ truffle test ./test/Exchange.test.js
$ truffle migrate --reset --network development

Load exchange with some initial data, orders, trades, cancels etc

$ truffle exec scripts/seed-exchange.js

Rinkeby

$ truffle exec scripts/seed-exchange.js --network rinkeby

Run app locally

$ npm run start

To interact with contracts, exchange with Metamask you need Metamask installed If using ganache copy private key from ganache cli to Metmask If want to interact with deployed contracts on other networks not local switch network on Metamask

Other documents for project

Doc Available at About
Design Patterns design_pattern_decisions.md Design pattern decisions
Security avoiding_common_attacks.md Security considerations and implementations
Addresses deployed_addresses.txt Addresses and networks and testnest where contracts deployed
Contributing Contributing.md How to contribute to project

Todos

  • Add more Etheruem tokens to trade
  • Extend the Fojini token
  • Make contract upgradeable
  • Explore protocols like 0x etc
  • Explore more DEFI intergration e.g Compound
  • Explore more complex orders, matching etc and executions on exchange
  • Routing on front end eg Admin panel to show status exchange,execute emergency etc

License

MIT

About

simple decentralised exchange using solidity, truffle, react, metamask, ethereum, web3, dapps, es6, js, redux, and testing,

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published