This project demonstrates how to work with events in hardhat. In the deploy_and_store
script, you'll see the output of the events.
- nodejs
- You can test it's installed by running
node --version
- You can test it's installed by running
- yarn
- You can test it's installed by running
yarn --version
- You can test it's installed by running
- git
- You can test it's installed by running
git --version
- You can test it's installed by running
Clone this repo & install dependencies
git clone https://github.com/PatrickAlphaC/hardhat-events-logs
cd hardhat-events-logs
yarn
Run:
npx hardhat run scripts/deploy_and_store.js
This will print out the events from our smart contracts.
To deploy to a testnet, you'll need.
- A Blockchain wallet
- Testnet Kovan ETH in your Blockchain Wallet.
- An alchemy RPC URL
- An Etherscan API Key
Then, create a .env
file and add the following lines:
ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
KOVAN_RPC_URL=https://eth-ropsten.alchemyapi.io/v2/<YOUR ALCHEMY KEY>
PRIVATE_KEY=YOUR_BLOCKCHAIN_WALLET_PRIVATE_KEY
DO NOT PUSH YOUR PRIVATE_KEY TO GITHUB. Please test and develop with a private key that doesn't have any real money in it.
Follow the basics tutorial to learn how to get everything setup.
Then, run:
hh run scripts/deploy_and_store.js --network kovan
npx hardhat test
Once you've deployed your code, to verify it run:
npx hardhat verify --network kovan DEPLOYED_CONTRACT_ADDRESS