Code Monkey home page Code Monkey logo

dex's Introduction

Dex

A decentralized exchange for Ether and ERC-20 tokens

Table of contents

General info

This project is a working decentralized exchange for Ether and ERC20 tokens and was built as part of coursework in the Ivan on Tech Blockchain Academy.

Technologies

  • Truffle - v5.1.58 (core: 5.1.58)
  • Solidity - 0.7.6 (solc-js)
  • Node - v10.16.3
  • Web3.js v1.2.9

Setup

In order to demo this project, please do the following:

  • $ git clone this repository to your local machine Install Truffle and Ganache on your local machine
  • Open Ganache and connect a workspace to the truffle-config.js file in the project directory
  • In the project root directory, run $ truffle migrate to deploy the dex and sample tokens contract to your Ganache local node
  • Once the contracts have successfully deployed, you can use Truffle's console to interact with the deployed contract

Code Examples

Example of contract interaction via Truffle console:

  • let dex = await Dex.deployed()
  • let link = await Link.deployed()
  • link.approve(dex.address, 500)
  • await dex.deposit(500, web3.utils.utf8toHex('LINK'))
  • await dex.depositEth({value: 10000, from: accounts[1]})
  • await dex.createLimitOrder(0, web3.utils.utf8ToHex('LINK"), 10, 300, {from: accounts[1]})
  • await dex.createMarketOrder(1, web3.utils.utf8ToHex('LINK"), 10)

Features

List of features ready:

  • Add support for an ERC-20 token to the exchange contract
  • Deposit and withdraw Ether and tokens to and from the exchange contract
  • Place limit buy and sell orders
  • Place market buy and sell orders
  • Query the blockchain for an asset's buy or sell orderbook

To-do list: *Replace on-chain orderbook functionality with liquidity pool and automated market maker functionality

Status

Project is: in progress

Contact

Created by @matthewwatman - feel free to contact me!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.