Skip to content

soliditylabs/forge-erc20-template

Repository files navigation

forge-erc20 • tests lints GitHub GitHub package.json version

Template for Forge based on femplate and forge-template with ERC-20 example tests.

Getting Started

Click use this template on Github to create a new repository with this repo as the initial state.

Or run (also works for existing projects):

forge init --template https://github.com/soliditylabs/forge-erc20-template
git submodule update --init --recursive
forge install

Blueprint

lib
├─ ds-test — https://github.com/dapphub/ds-test
├─ forge-std — https://github.com/brockelmore/forge-std
├─ openzeppelin-contracts — https://github.com/OpenZeppelin/openzeppelin-contracts
src
├─ tests
│  └─ MyERC20.t — "ERC-20 Transfer Tests"
└─ MyERC20"A Minimal ERC-20 Contract"

Development

Building

forge build

Testing

forge test -vvvvv

Deployment & Verification

Copy the .env.example file to .env and update the values.

To deploy the ERC-20 to Rinkeby:

./scripts/deploy-to-rinkeby.sh

To verify the ERC-20 on Rinkeby:

./scripts/deploy-to-rinkeby.sh

First time with Forge/Foundry?

See the official Foundry installation instructions.

Then, install the foundry toolchain installer (foundryup) with:

curl -L https://foundry.paradigm.xyz | bash

Now that you've installed the foundryup binary, anytime you need to get the latest forge or cast binaries, you can run foundryup.

So, simply execute:

foundryup

🎉 Foundry is installed! 🎉

Writing Tests with Foundry

With Foundry, tests are written in Solidity! 🥳

Create a test file for your contract in the src/tests/ directory.

For example, src/MyERC20.sol has its test file defined in ./src/tests/MyERC20.t.sol.

Configure Foundry

Using foundry.toml, Foundry is easily configurable.

For a full list of configuration options, see the Foundry configuration documentation.

License

MIT

Acknowledgements

Disclaimer

These smart contracts are being provided as is. No guarantee, representation or warranty is being made, express or implied, as to the safety or correctness of the user interface or the smart contracts. They have not been audited and as such there can be no assurance they will work as intended, and users may experience delays, failures, errors, omissions, loss of transmitted information or loss of funds. The creators are not liable for any of the foregoing. Users should proceed with caution and use at their own risk.

About

Template for Forge with ERC-20 example tests.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published