Git Product home page Git Product logo

blockchain-developer-bootcamp-final-project's Introduction

Blockchain Developer Bootcamp: Final Project

This project will implement an Automated Market Maker (AMM) application based on the Uniswap V2 model.

Screencast Link: https://cln.sh/ZUYdmE

Public Ethereum Account for Certification as NFT: 0x28751d69ca780F7E7520Dc7C131e91ca2ffc6696

Useful Links

While testing, don't forget to click on "Set Allowance to 100 Tokens" for each token that you want to use on Pools Page.

More details on sections below.

About the Project

Objective

The user will be able to exchange between ERC20 tokens through the project interface, only when there is a possible pool to exchange between assets.

In addition, the user can create new ERC20 token pools if they do not exist.

Flowchart

Persona: Buyer The buyer will access the solution's web application, and will select the pair of assets they want to exchange. If there is liquidity required for the exchange, an atomic swap will be performed.

Persona: Liquidity Provider The LP may create new liquidity pairs by creating a new pool, or add liquidity to existing pools. He will need to lock assets in the smart contract.

Deployments

The project was successfully deployed into the Ropsten test network. You can see the deployed addresses below:

Ropsten Test Net
---------------------------------
TokenA: 0xE546a083C0a8C5c2A71b43d4F974EFE14bBc6E49
TokenB: 0x196A16ee8e52a4f22d1cECaEB0e895a0D0033f37
TokenC: 0x162e4E31Cb88517bE5e321f95f84c1bA801B3Ec0
TokenD: 0x7c187f66755155d92bb16Cc090242E00D438D30a
DEXRegistry: 0x84e6092Ff9737B5da254A6DB6367F073A78F2fAb


Pool Addresses (generated through DEXRegistry) on Ropsten (CREATE2):
--------------------------------------------------------------------

TokenA <> TokenB:
-----------------
Pool Address: 0x096b3D271b2D380275458a9F8f1209b9A2C96F69
Transaction: https://ropsten.etherscan.io/tx/0x5f83186180069908a206ed13468a90b8fa63c457c2f80c33769d6f374c5900c6


TokenC <> TokenA:
-----------------
Pool Address: 0x897138a64fe68bcd73bdaac5be389df5442f6acf
Transaction: https://ropsten.etherscan.io/tx/0x1895ed2e46bd8779d8ff91f2bdb64f21a2412a735ff8425c9dcb5fb017c68ca1

Contracts

Details of the smart contracts:

  • Developed using Solidity 0.8.9
  • Hardhat with hardhat-deploy for easier and more secure deployments
  • Using the etherscan-verify plugin to validate contracts on Etherscan
  • Usage of Typechain to generate Typescript bindings for Ethersv5
  • Unit Tests using Mocha and Waffle
  • Using solhint to avoid pitfalls
  • Hot Reloading using Hardhat and NextJS
  • Multicall usage for better performance on state interaction

You can check the contracts on the folder packages/contracts.

For local deployment, you should run the following commands:

cd packages/contracts
hh node --watch --export-all ../swap-app/deployments.json

This will start the JSON-RPC interface on http://127.0.0.1:8545/, deploy all the contracts (also a Multicall contract), and export all deployed addresses into the swap-app/deployments.json for hot-reloading.

While testing, don't forget to click on "Set Allowance to 100 Tokens" for each token that you want to use on Pools Page.

Frontend

The frontend was built using:

  • NextJS
  • Typescript
  • Typechain which provide type-safety interface between our contracts and Ethers
  • Ethers v5
  • ChakraUI
  • useDapps for better React Hooks usage with Ethers

The frontend was deployed using Vercel.

To start the local frontend, you should run the following commands:

cd packages/swap-app
npm run dev

The frontend will start on http://localhost:3000.

blockchain-developer-bootcamp-final-project's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

blockchain-developer-bootcamp-final-project's Issues

Final Project Feedback

Hi @brunoalano, I'm a mentor of the consensy bootcamp responsible for grading your project.
Congratulations, your Final Project passed! We'll be approving it on the course itself in a week or two, but here's your feedback in the meanwhile:

Front-end

  • looks good, and great to see you using vercel to bootstrap it.

Smart Contract

  • architecture and design choices are spot on. Great to see you using CREATE2 to clone the contracts.

Unit Testing

  • Unfortunately I wasn't able to run the unit tests locally, which impacts your grading a bit. I can see the tests implemented, but I'm unable to validate/grade them without executing them. It seems like there are some compilation issues in the tests, because the errors reported are related to typing (see image below). There's not info about how to run the unit tests in the readme.md, so I just tried the following:
cd packages/contracts
npx hardhat test

Overall Feedback
It's a really good project, with a nice complexity and good implementation. Certainly above expectations. Well done!
Tip: it's a good practice to add clear instructions to the readme on how to execute all the commands required for the project for onboarding devs ;-)

Parabéns!!! 🇧🇷 aqui

Follow up
If you want to add instructions on how to run the tests and potential installation requirements for the project, I'll give it another try.
Find below a screenshot of the errors I got when running the commands mentioned above.

image

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.