author |
---|
mfw78 <mfw78@protonmail.com> |
This is a template repository for smart contract development in Hardhat. This repository contains the base tools required for testing, coverage analysis, and deployment. Tools used include:
- ethers
- hardhat / hardhat-deploy
- openzeppelin
- typescript / typechain
- solhint / gas-reporter / soliditiy-coverage
To commit to the repository after staging the commit:
yarn commit
Select the appropriate type of commit message, any issues to close, and note any breaking changes.
Test are handled with chai
and includes solidity-coverage
, enabling coverage
reports to be done for the code-base. By default, contracts located in contracts/test
are ignored by solidity-coverage
.
- Ensure 100% solidity coverage in tests prior to production deployment.
- All
Ownable
contracts MUST have their owner set to the community multi-sig and/orTimelockController
. NO contracts must be allowed to retain ANY deployer addresses in their configurtion. - MINIMUM two reviewers prior to commiting to the main branch.
This repository uses hardhat-deploy
for reproducible deployment tests, as well as:
- Get contracts via name from
ethers
. - Named accounts for more readable tests.
- Conditional logic execution based on tagged network deploying to (allowing for more complex logic when deploying across multiple chains, and/or testnets).
Deployment scripts are contained within deploy
, and these deployment scripts are executed
prior to any tests, and are executed in alphabetical order.
Unit testing:
yarn test
Coverage analysis:
yarn hardhat coverage
Run deploy scripts and deploy to mainnet
:
yarn hardhat deploy --network mainnet
Now verify the contracts on Etherscan:
yarn hardhat --network mainnet etherscan-verify
NOTE: Substitute mainnet
above for the applicable target network.