Skip to content

PatrickAlphaC/hardhat-events-logs

Repository files navigation

Hardhat-Events-Logs

This project demonstrates how to work with events in hardhat. In the deploy_and_store script, you'll see the output of the events.

Requirements

  • nodejs
    • You can test it's installed by running node --version
  • yarn
    • You can test it's installed by running yarn --version
  • git
    • You can test it's installed by running git --version

Installation

Clone this repo & install dependencies

git clone https://github.com/PatrickAlphaC/hardhat-events-logs
cd hardhat-events-logs
yarn

Quickstart

Run:

npx hardhat run scripts/deploy_and_store.js

This will print out the events from our smart contracts.

Testnet (Kovan) Deployment

To deploy to a testnet, you'll need.

  1. A Blockchain wallet
  2. Testnet Kovan ETH in your Blockchain Wallet.
  3. An alchemy RPC URL
  4. 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

Testing

npx hardhat test

Etherscan verification

Once you've deployed your code, to verify it run:

npx hardhat verify --network kovan DEPLOYED_CONTRACT_ADDRESS 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published