This project demonstrates a basic Hardhat use case. It comes with a sample contract, a test for that contract, and a script that deploys that contract.
Try running some of the following tasks:
npx hardhat help
npx hardhat test
REPORT_GAS=true npx hardhat test
npx hardhat node
npx hardhat run scripts/deploy.js
- We don't want someone instantly draining all of our funds, so we should check that the
require
clause in thewithdraw()
function works as expected - The
destroyFaucet()
function should only be called by the owner, as should thewithdrawAll
function
From the Hardhat testing docs: A ContractFactory in ethers.js is an abstraction used to deploy new smart contracts, so Faucet here is a factory for instances of our faucet contract.