Talk about ERC20 contract
- git
- You'll know you did it right if you can run
git --version
and you see a response likegit version x.x.x
- You'll know you did it right if you can run
- foundry
- You'll know you did it right if you can run
forge --version
and you see a response likeforge 0.2.0 (816e00b 2023-03-16T00:05:26.396218Z)
- You'll know you did it right if you can run
- run:
mkdir foundry-erc20-f24 cd foundry-erc20-f24 code . forge init
- 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/
- ERC-20
- ERC-677
- ERC-777
- create
ManualToken.sol
- run
forge install OpenZeppelin/openzeppelin-contracts --no-commit
- add
remappings
intofoundry.toml
- create
OurToken.sol
- run
forge build
- create
DeployOurToken.s.sol
- create
Makefile
- run:
forge install make anvil make deploy
-
create
OurTokenTest.t.sol
-
run:
forge test --match-test testBobBalance
-
go to
https://etherscan.io/tokenapprovalchecker
, we can see the amount ethtransferFrom
can use -
run:
forge test --match-test testAllowancesWorks forge test forge coverage