A Hardhat-based project for developing Solidity smart contracts, with sensible defaults.
- Hardhat: compile, run and test smart contracts
- TypeChain: generate TypeScript bindings for smart contracts
- Ethers: renowned Ethereum library and wallet implementation
- Solhint: code linter
- Solcover: code coverage
- Prettier Plugin Solidity: code formatter
This template comes with sensible default configurations in the following files:
├── .editorconfig
├── .eslintignore
├── .eslintrc.yml
├── .gitignore
├── .prettierignore
├── .prettierrc.yml
├── .solcover.js
├── .solhint.json
└── hardhat.config.ts
This template is IDE agnostic, but for the best user experience, you may want to use it in VSCode alongside Nomic Foundation's Solidity extension.
If you use VSCode, you can get Solidity syntax highlighting with the hardhat-solidity extension.
First, you need to install the dependencies:
bun install
Then, you need to set up all the required Hardhat Configuration Variables. You might also want to install some that are optional.
To assist with the setup process, run bunx hardhat vars setup
. To set a particular value, such as a BIP-39 mnemonic
variable, execute this:
bunx hardhat vars set MNEMONIC
? Enter value: ‣ here is where your twelve words mnemonic should be put my friend
If you do not already have a mnemonic, you can generate one using this website.
Compile the smart contracts with Hardhat:
bun run compile
Compile the smart contracts and generate TypeChain bindings:
bun run typechain
Run the tests with Hardhat:
bun run test
Lint the Solidity code:
bun run lint:sol
Lint the TypeScript code:
bun run lint:ts
Generate the code coverage report:
bun run coverage
See the gas usage per unit test and average gas per method call:
REPORT_GAS=true bun run test
Delete the smart contract artifacts, the coverage reports and the Hardhat cache:
bun run clean
Deploy the contracts to Hardhat Network:
bun run deploy
## License
This project is licensed under MIT.