cp .env.example .env
yarn && yarn check-env
Once installed, let's run Hardhat's testing network:
yarn fork || npx hardhat node
Then, on a new terminal, go to the repository's root folder and run this to deploy your contract:
npx hardhat run scripts/legacy-deploy.js --network localhost
Finally, we can run the frontend with:
cd frontend && yarn && yarn start
Open http://localhost:3000/ to see your Dapp. You will
need to have Metamask installed and listening to
localhost 8545
.
You can find detailed instructions on using this repository and many tips in its documentation.
- Writing and compiling contracts
- Setting up the environment
- Testing Contracts
- Setting up Metamask
- Hardhat's full documentation
For a complete introduction to Hardhat, refer to this guide.
This repository uses our recommended hardhat setup, by using our @nomicfoundation/hardhat-toolbox
. When you use this plugin, you'll be able to:
- ethers.js and the
hardhat-ethers
. - Tests with Mocha, Chai and our own Hardhat Chai Matchers.
- Hardhat Network Helpers.
- Verify the source code of your contracts with hardhat-etherscan.
- Get metrics on gas used via hardhat-gas-reporter.
- Measure tests coverage with solidity-coverage.
This project also includes a sample frontend/Dapp, which uses Create React App.
Invalid nonce
errors: if you are seeing this error on thenpx hardhat node
console, try resetting your Metamask account. This will reset the account's transaction history and also the nonce. Open Metamask, click on your account followed bySettings > Advanced > Reset Account
.