GithubHelp home page GithubHelp logo

soltanireza65 / defi-exchange Goto Github PK

View Code? Open in Web Editor NEW

This project forked from azurekn1ght/defi-exchange

0.0 0.0 0.0 331 KB

Build a Decentralized Exchange like Uniswap using Liquidity Pools

Home Page: https://defi-exchange-azurekn1ght.vercel.app/

License: GNU Affero General Public License v3.0

JavaScript 79.78% CSS 3.23% Solidity 16.99%

defi-exchange's Introduction

Build a Decentralized Exchange like Uniswap

Scenario: Now its time for you to launch a DeFi Exchange for your Crypto Dev tokens


Requirements

  • Build an exhange with only one asset pair (ETH / Crypto Dev)
  • Your Decentralized Exchange should take fees of 1% on swaps
  • When user adds liquidity, they should be given Crypto Dev LP tokens (Liquidity Provider tokens)
  • CDLP tokens should be given propotional to the Ether a user is willing to add to the liquidity

Prerequisites


BUILD IT

Smart Contract

To build the smart contract we would be using Hardhat. Hardhat is an Ethereum development environment and framework designed for full stack development in Solidity. In simple words you can write your smart contract, deploy them, run tests, and debug your code.

  • This project uses @openzeppelin/contracts as we would be importing Openzeppelin's ERC20 Contract in our Exchange contract

  • We would also install dotenv package to be able to import the env file and use it in our config. Thereby protecting our private keys and API keys, so as not to hardcode them and leak them on the Internet. Create a .env file in the hardhat folder and add the following lines, use the instructions in the comments to get your Alchemy API Key URL and Goerli Private Key. Make sure that the account from which you get your Goerli private key is funded with Goerli Test Ether.

    // Go to https://www.alchemyapi.io, sign up, create
    // a new App in its dashboard and select the network as Rinkeby, and replace "add-the-alchemy-key-url-here" with its key url
    ALCHEMY_API_KEY_URL="add-the-alchemy-key-url-here"
    
    // Replace this private key with your GOERLI account private key
    // To export your private key from Metamask, open Metamask and
    // go to Account Details > Export Private Key
    // NEVER put real ETH into testing accounts
    GOERLI_PRIVATE_KEY="add-the-goerli-private-key-here"

Website

  • To develop the website we would be using React and Next.js.

  • We will also use the Web3Modal library. Web3Modal is an easy-to-use library to help developers add support for multiple providers in their apps with a simple customizable configuration. By default Web3Modal Library supports injected providers like (Metamask, Dapper, Gnosis Safe, Frame, Web3 Browsers, etc), You can also easily configure the library to support Portis, Fortmatic, Squarelink, Torus, Authereum, and Arkane.

Technologies Used


DEPLOY ๐Ÿš€

We have deployed the dApp, so that everyone can see the website and we can share it with the world.

Smart Contract

https://goerli.etherscan.io/address/0x2eda149048dF83547DF2b53D4c73eeb933f2b0eF

Dapp Frontend

https://defi-exchange-azurekn1ght.vercel.app/

defi-exchange's People

Contributors

azurekn1ght 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.