Skip to content

Latest commit

 

History

History

hardhat

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Let's Fucking Game - Smart Contract

Coverage Report

Statements Functions Lines
Statements Functions Lines

Prerequisites

yarn install      # install deps
yarn run build    # install solc and other tools in the docker image

Don't forget to copy the .env.example file to a file named .env, and then edit it to fill in the details.

Running all the tests

yarn run test             # run tests on hardhat network with fresh config
yarn run test:trace       # shows logs + calls
yarn run test:coverage    # run tests on ganache with coverage reports

Formatters & Linters

You can use the below packages,

yarn run format
yarn run lint

Analyzers

You can use the below tools,

yarn run analyze:static <PATH_TO_CONTRACT>
yarn run analyze:security <PATH_TO_CONTRACT>
yarn run analyze:all <PATH_TO_CONTRACT>

Deploy Contract & Verification

To try out Etherscan verification, you first need to deploy a contract to an Ethereum network that's supported by Etherscan, such as Ropsten.

In this project, copy the .env.example file to a file named .env, and then edit it to fill in the details.

Name Description
NETWORK_RPC_URL One key by RCP network (see env.example). Required to deploy to public networks. Obtain from Infura's site.
DEPLOYER_WALLET_PRIVATE_KEY The private key of the account which will send the deployment transaction. The account must have enough ETH to deploy the contracts, as well as LINK which can be obtained from Chainlink's faucets.
ETHERSCAN_API_KEY You'll need an Blockchain Explorers API Key configured in your env file. You can get one from the Etherscan API site. for example.

With a valid .env file in place, first deploy your contract:

To deploy all contracts :

yarn run deploy:all <NETWORK>

To deploy contracts for a specific tag :

yarn run deploy <NETWORK> <TAG>

Also, you can add contract(s) manually to your tenderly projects from the output. https://dashboard.tenderly.co/contract/<NETWORK_NAME>/<CONTRACT_ADDRESS>

And then verify it:

yarn run verify <NETWORK> <DEPLOYED_CONTRACT_ADDRESS> "<CONSTRUCTOR_ARGUMENT(S)>"

SEE hardhat.config.ts to see all networks

Miscellaneous

yarn run generate:docs    # generate docs according to the contracts/ folder
yarn run generate:flatten <PATH_TO_CONTRACT>     # generate the flatten file (path must be "./" prefixed)
yarn run generate:abi <PATH_TO_CONTRACT>         # generate the ABI file (path must be "./" prefixed)
yarn run generate:bin <PATH_TO_CONTRACT>         # generate the binary in a hex (path must be "./" prefixed)
yarn run generate:metadata <PATH_TO_CONTRACT>    # generate the metadata (path must be "./" prefixed)
yarn run generate:all-abi
yarn run generate:all-bin
yarn run generate:all-metadata
yarn run share    # share project folder with remix ide