https://github.com/alchemyplatform/erc20-example-foundry
A simple Foundry Repo to build, test, and deploy an ERC-20 token.
https://github.com/alchemyplatform/erc20-example-foundry
Last synced: 12 months ago
JSON representation
A simple Foundry Repo to build, test, and deploy an ERC-20 token.
- Host: GitHub
- URL: https://github.com/alchemyplatform/erc20-example-foundry
- Owner: alchemyplatform
- License: mit
- Created: 2023-10-10T23:47:01.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-10-11T02:30:02.000Z (over 2 years ago)
- Last Synced: 2024-04-14T10:32:59.148Z (about 2 years ago)
- Language: Solidity
- Homepage:
- Size: 6.84 KB
- Stars: 2
- Watchers: 6
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ERC-20 Example with Foundry
This is a simple ERC-20 token based off the tutorial: https://www.youtube.com/watch?v=fNMfMxGxeag
It is used to demonstrate the power of gasless minting using Account Abstraction.
## Build and Test
Reference: https://book.getfoundry.sh/projects/working-on-an-existing-project
These are commands you can use to start developing:
```
forge install --no-commit
forge build
forge test
```
Reference: https://book.getfoundry.sh/projects/creating-a-new-project
These are the commands I used to create this project on this repo from scratch. Ignore flags as necessary:
```
mkdir
cd
forge init --force
forge install openzeppelin/openzeppelin-contracts
forge build
forge test
```
## Deploy
Reference: https://book.getfoundry.sh/forge/deploying
1. Set your environment variables by running:
```
export ALCHEMY_RPC_URL=
export WALLET_PRIVATE_KEY=
export ETHERSCAN_API_KEY=
```
2. Deploy and Verify the Contract using:
```
forge create --rpc-url=$ALCHEMY_RPC_URL \
--private-key=$WALLET_PRIVATE_KEY \
--etherscan-api-key=$ETHERSCAN_API_KEY \
--verify
```
If you need testnet tokens for the EOA wallet deploying this contract, use: https://sepoliafaucet.com.
If you need an etherscan API key, use: https://etherscan.io/myapikey.
If successfully deployed, you will see the deploying wallet's address, the contract's address as well as the transaction hash printed to your terminal.
Don't forget to remove the sensitive variables you exported:
```
unset ALCHEMY_RPC_URL
unset WALLET_PRIVATE_KEY
unset ETHERSCAN_API_KEY
```