Git Product home page Git Product logo

dex's Introduction

DEX

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

Prerequisites

  • ICO Tutorial

Setup Hardhat

mkdir hardhat-tutorial
cd hardhat-tutorial
npm init --yes
npm install --save-dev hardhat
# init hardhat
npx hardhat
npm install @openzeppelin/contracts
# remove boilerplate contract
rm contracts/Lock.sol

Create Contract Files

touch contracts/Exchange.sol
code contracts/Exchange.sol

Environment Variables

npm install dotenv
touch .env.example
echo 'QUICKNODE_HTTP_URL=""' >> .env.example
echo 'PRIVATE_KEY=""' >> .env.example
cp .env.example .env
# set nft contract address
mkdir constants
touch constants/index.js

code .env
code constants/index.js
code scripts/deploy.js
code hardhat.config.js

Update files and deploy

npx hardhat compile
npx hardhat run scripts/deploy.js --network goerli

Frontend

npx create-next-app@latest
cd my-app
# add deps
npm install web3modal ethers
# add contract addresses
mkdir constants utils
touch constants/index.js
touch utils/addLiquidity.js
touch utils/removeLiquidity.js
touch utils/getAmounts.js
touch utils/swap.js
# make changes
code styles/Home.module.css
code pages/index.js
code constants/index.js
code utils/addLiquidity.js
code utils/removeLiquidity.js
code utils/getAmounts.js
code utils/swap.js
# run client
npm run dev

dex's People

Contributors

deecat10 avatar

Watchers

Macc Hiato 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.