Smart contract development boilerplate for EVM-compatible chains.
Run the following command to build the contracts.
It uses hardhat and foundry both - hardhat compile
and forge build
will be executed. Also it generates the typechain bindings for the contracts.
yarn build
This boilerplate uses hardhat-deploy
for deploying the contracts.
But it also uses openzeppelin-upgrades
for deploying the UUPS upgradeable contracts(Since hardhat-deploy
does not support UUPS upgradeable patterns). If you use the non-UUPS upgradeable patterns, you can either use hardhat-deploy
for deploying the upgradeable contracts.
- Add the network to the
hardhat.config.ts
file. - Add the new .env file to the
tools/env
folder. The name should be like.env.${network}
. - Create a new folder in the
scripts/deploy
folder. You can copy thebase_sepolia
folder for the reference. As a result, the folder structure should be like below:
π scripts/deploy
βββ π ${network}
β βββ π done # The scripts that have been done.
β βββ π todo # The scripts that are not done.
- Run the scripts below to deploy the contracts. Either you can add the shortcuts to the
package.json
.
"dotenv -e ./tools/env/.env.${network} -- npx hardhat deploy --network ${network} --export ./deployments/${network}.json"
This boilerplate uses Foundry
for testing.
For more information about testing with Foundry, see the Foundry Book.
Fixtures are used to initialize the test environment.
BaseFixture
(intest/common
): A base fixture for all test suites. It initializes the users and deploys the contract instances.BaseForkFixture
(intest/fork
): A base fixture for all fork test suites. It works similar toBaseFixture
but it gets the deployed contract instances from a forked network. You should add the contract addresses to theaddresses.json
file.