https://github.com/solidstate-network/hardhat-template
👷🏽 Template for new Solidity projects built with Hardhat and tested with Chai 🫖
https://github.com/solidstate-network/hardhat-template
buidler eth ether ethereum hardhat smart-contracts solidity waffle wow
Last synced: 8 months ago
JSON representation
👷🏽 Template for new Solidity projects built with Hardhat and tested with Chai 🫖
- Host: GitHub
- URL: https://github.com/solidstate-network/hardhat-template
- Owner: solidstate-network
- Created: 2020-10-23T02:49:26.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-08-28T12:42:47.000Z (over 1 year ago)
- Last Synced: 2024-08-28T14:07:31.759Z (over 1 year ago)
- Topics: buidler, eth, ether, ethereum, hardhat, smart-contracts, solidity, waffle, wow
- Language: TypeScript
- Homepage:
- Size: 879 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Solidstate Smart Contract Project
> Note: This repository was generated from a template or is the template itself. To set up a new project, set the missing data marked "TODO" in `package.json` and remove this notice.
This project is built with [Solidstate](https://github.com/solidstate-network). See the [solidstate-solidity](https://github.com/solidstate-network/solidstate-solidity) documentation for information about contract integration and testing.
## Development
Install dependencies via Pnpm:
```bash
pnpm install
```
Setup Husky to format code on commit:
```bash
pnpm prepare
```
Compile contracts via Hardhat:
```bash
pnpm hardhat compile
```
The Hardhat environment relies on the following environment variables. The `dotenv` package will attempt to read them from the `.env` and `.env.secret` files, if they are present.
| Key | Description |
| ------------------- | ------------------------------------------------------------------------ |
| `API_KEY_ETHERSCAN` | [Etherscan](https://etherscan.io//) API key for source code verification |
| `NODE_URL_MAINNET` | JSON-RPC node URL for `mainnet` network |
| `NODE_URL_TESTNET` | JSON-RPC node URL for `testnet` network |
| `PKEY_TESTNET` | private key for test/development use on `testnet` network |
| `PKEY_MAINNET` | private key for production use on `mainnet` network |
| `REPORT_GAS` | if `true`, a gas report will be generated after running tests |
### Networks
By default, Hardhat uses the Hardhat Network in-process. Two additional networks, `mainnet` and `testnet` are available, and their behavior is determined by the configuration of environment variables.
### Testing
Test contracts via Hardhat:
```bash
pnpm hardhat test
```
Activate gas usage reporting by setting the `REPORT_GAS` environment variable to `"true"`:
```bash
REPORT_GAS=true pnpm hardhat test
```
Generate a code coverage report using `solidity-coverage`:
```bash
pnpm hardhat coverage
```
### Documentation
A static documentation site can be generated using `hardhat-docgen`:
```bash
pnpm hardhat docgen
```