An open API service indexing awesome lists of open source software.

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.

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
```