Skip to content

ultrasound-labs/erc20-upgradeable

Repository files navigation

Upgradeable ERC20 Token

Build project

Run the following command in the root folder

forge build

Test project

Run the following command in the root folder

forge test --ffi

The --ffi flag is included in order to run external scripts our code needs to access.

Deployment and Verification

Currently, verification is via foundry script can be buggy. see this issue foundry-rs/foundry#7466

Very important to have set etherscan params in foundry.toml. See this link for more. Quick tip foundry.toml can also reference .env vars.

There are two options to deploy and verify

  1. forge create
  2. forge script

forge create

This approach has the disadvantage that constructor args have to be submitted via CLI.

make deploy-v1

forge script

make deploy-v1-with-script ARGS="--network tenderly"

Note that even with a response like that ...

Encountered an error verifying this contract:
Response: `NOTOK`
Details: `{"id":"df818a97-2afc-4776-b3e7-d17da61610b7","msg":"not found","slug":"not_found"}`
make: *** [deploy-v1-with-script] Error 1

The verification most presumably worked.

Deploy proxy and v1 Token

First deploy the v1 token contract, like seen before

make deploy-v1-with-script ARGS="--network tenderly"

Important: Now, before running the next command, you'll need to update the _implementation variable in the script/deployProxy.s.sol script with your deployed smart contract address (e.g., token address) from the previous step.

Then, deploy the proxy through the following command

make deploy-proxy-with-script ARGS="--network tenderly"

Resources

Find a guide here.

Tenderly SC Verification

How this project was setup

Set up a new foundry project.

In terminal within the project's root folder, run the command:

forge install foundry-rs/forge-std
forge install OpenZeppelin/openzeppelin-contracts --no-commit
forge install OpenZeppelin/openzeppelin-foundry-upgrades --no-commit
forge install OpenZeppelin/openzeppelin-contracts-upgradeable --no-commit

Add the following lines to the remappings.txt file:

@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/
@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/

For deployment on test or mainnet, define the "RPC_ENDPOINT_URL" in foundry.toml and "PRIVATE_KEY" in the .env files.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published