- git
git --version
- Nodejs
node --version
- Yarn instead of
npm
yarn --version
- Might need to install it with
npm
orcorepack
git clone https://github.com/akshtsng/HardhatFundMe
cd hardhat-fund-me
yarn
Deploy:
yarn hardhat deploy
yarn hardhat test
yarn hardhat coverage
- Setup environment variables
-
Set
GOERLI_RPC_URL
andPRIVATE_KEY
as environment variables. Add them to a.env
file. -
PRIVATE_KEY
: The private key of account (like from metamask). NOTE: FOR DEVELOPMENT, USE A KEY THAT DOESN'T HAVE ANY REAL FUNDS ASSOCIATED WITH IT. -
GOERLI_RPC_URL
: This is url of the goerli testnet node we're working with. We can get setup with one for free from Alchemy
- Get testnet ETH
- Go to goerlifaucet.com get some tesnet ETH.
- Deploy
yarn hardhat deploy --network goerli
After deploying to a testnet or local net, run the scripts.
yarn hardhat run scripts/fund.js
or
yarn hardhat run scripts/withdraw.js
Estimate how much gas things cost by running:
yarn hardhat test
We get output file called gas-report.txt
To get a USD estimation of gas cost, we'll need a COINMARKETCAP_API_KEY
environment variable. Get one for free from CoinMarketCap.
If we deploy to a testnet or mainnet, we can verify it if we get an API Key from Etherscan and set it as an environemnt variable named ETHERSCAN_API_KEY
.
In it's current state, if we have our api key set, it will auto verify goerli contracts!
However, we can manual verify with:
yarn hardhat verify --constructor-args arguments.js DEPLOYED_CONTRACT_ADDRESS
solhint
installation: Documentation
To check linting / code formatting:
yarn lint
or, to fix:
yarn lint:fix
yarn format