This was extended and updated by @janek26
Using Hardhat, Typescript, Waffle, Mocha and Chai
This is a starter kit for developing, testing, and deploying smart contracts with a full Typescript environment. This stack uses Hardhat as the platform layer to orchestrate all the tasks. Ethers is used for all Ethereum interactions and testing.
Clone this repository, then install the dependencies with yarn
. Build everything with yarn build
. https://hardhat.org has excellent docs, and can be used as reference for extending this project.
You may want to create a .env
file, with your own and private keys, by running cp .env.sample .env
and editing it.
yarn compile
In one terminal run yarn chain
Then in another run yarn test
The gas usage table may be incomplete (the gas report currently needs to run with the --network localhost
flag; see below)
In one terminal run yarn chain
Then in another run yarn test --network localhost
Notes:
- When running with this
localhost
option, you get a gas report but may not get good callstacks - See here for how to configure the gas usage report.
yarn coverage
Create/modify network config in hardhat.config.ts
and add API key and private key, then run:
yarn deploy:init --network rinkeby
To upgrade your contract, set BOX_ADDRESS
in .env
to your proxy contract, then run:
yarn deploy:upgrade --network rinkeby
Add Etherscan API key to hardhat.config.ts
, then run:
npx hardhat verify-contract --contract-name Counter --address <DEPLOYED ADDRESS>
Additional tooling to make your DX as simple as possible.
This repo runs prettier
and prettier-plugin-solidity
to automate formatting. You can format your project by running yarn format
.
You may want to enable "format on save" in your IDE.
Using husky
and lint-staged
to format before every commit. It also runs tests before every push.
PRs and feedback welcome!