Template for Forge based on femplate and forge-template with ERC-20 example tests.
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 installlib
├─ 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"Building
forge buildTesting
forge test -vvvvvDeployment & Verification
Copy the .env.example file to .env and update the values.
To deploy the ERC-20 to Rinkeby:
./scripts/deploy-to-rinkeby.shTo verify the ERC-20 on Rinkeby:
./scripts/deploy-to-rinkeby.shSee the official Foundry installation instructions.
Then, install the foundry toolchain installer (foundryup) with:
curl -L https://foundry.paradigm.xyz | bashNow 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! 🎉
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.
Using foundry.toml, Foundry is easily configurable.
For a full list of configuration options, see the Foundry configuration documentation.
- femplate as main reference
- foundry
- Openzeppelin
- forge-std
- forge-template by FrankieIsLost.
- Georgios Konstantopoulos for forge-template resource.
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.
