GithubHelp home page GithubHelp logo

blockchainmasters21 / dex-erc20-amm Goto Github PK

View Code? Open in Web Editor NEW

This project forked from alcalawil/dex-erc20-amm

1.0 0.0 0.0 5.3 MB

Decentralized Exchange to Swap ERC20 tokens for ETH using Automated Market Makers. Deposit / Withdraw Liquidity.

Shell 0.07% JavaScript 66.55% CSS 3.13% HTML 22.43% Solidity 7.81%

dex-erc20-amm's Introduction

Decentralized Exchange with Automated Market Makers

Decentralized Exchange to Swap ERC20 tokens for ETH using Automated Market Makers. Deposit / Withdraw Liquidity.

---

This is a PoC decentralized exchange (like uniswap) that serves to exchange ERC20 tokes for eth. Currently version is working with a single token (injected in the constructor at deploying time). This project have the purpose of learning how about how DApps work. By building this project I learned:

  • How to code a ERC20 Token
  • How to sent ERC20 tokens
  • How Liquidity Pools Work
  • How Automated Market Makers work
  • How to use payable functions
  • How to interact with metamask
  • How to interact with Smart Contracts from a webapp
  • How to deploy contracts to a public testnet

Project Structure

It is structured in two main folders: UI and Contracts.

The UI folder has a frontend project vite + tailwind and the web3 library is implemented twice: one implementation using ether.js and the other one using web3.js.

On the other side the Contracts folder contain a truffle project with the Token.sol and Dex.sol contracts.

How to run

Make sure you have truffle installed.

You will need a Infura key if you want to order to deploy the contracts, but if you want to run a local blockchain (e.g ganache) you only have to make sure your the port it is running is the same as in the truffle-config.js (e.g port: 7545).

Deploy the Contracts

npm install

truflle compile

truflle deploy --network development

After deploying the contracts your deployer address will have a ton of ERC20 tokens that were minted at deploying stage.

Run the frontend DApp

go to the UI folder and follow the README instructions.

NOTE: You have to put the deployed addresses in the following file: /ui/packages/dapp-final/src/config/ping-contract.js

Acknowlegments

This project was built as Academic tool while I was working for Settle Network. The frontend code was entirely wrote by Jose Jimenez and Charly Iglesias. If you want to know what they are building, go and check the ping app

dex-erc20-amm's People

Contributors

alcalawil avatar manuelozada11 avatar

Stargazers

CJ avatar

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.