Giter VIP home page Giter VIP logo

foundry-erc20-f24's Introduction

Foundry ERC20

Talk about ERC20 contract

Requirements

  • git
    • You'll know you did it right if you can run git --version and you see a response like git version x.x.x
  • foundry
    • You'll know you did it right if you can run forge --version and you see a response like forge 0.2.0 (816e00b 2023-03-16T00:05:26.396218Z)

Start

  • run:
    mkdir foundry-erc20-f24
    cd foundry-erc20-f24
    code .
    forge init

What is an ERC? What is an EIP?

  • EIP: Ethereum Improvement Proposal
  • ERC: Ethereum Request for Comments
  • BEP: Binance Evolution Proposal
  • PEP: Python Enhancement Proposal
  • go to https://eips.ethereum.org/EIPS/eip-20
  • go to https://ethereum.org/en/developers/docs/standards/tokens/erc-20/

What is an ERC20?

  • ERC-20
  • ERC-677
  • ERC-777

Manually Creating an ERC20 Token

  • create ManualToken.sol

ERC20 Token - Openzeppelin

  • run
    forge install OpenZeppelin/openzeppelin-contracts --no-commit
  • add remappings into foundry.toml
  • create OurToken.sol
  • run forge build

Deploy Script

  • create DeployOurToken.s.sol
  • create Makefile
  • run:
    forge install
    make anvil
    make deploy

AI Tests

  • create OurTokenTest.t.sol

  • run:

    forge test --match-test testBobBalance
  • go to https://etherscan.io/tokenapprovalchecker, we can see the amount eth transferFrom can use

  • run:

    forge test --match-test testAllowancesWorks
    forge test
    forge coverage

foundry-erc20-f24's People

Contributors

lightrao avatar

Watchers

 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.