Network-Goods / hypercerts-protocol

MIT License
13 stars 5 forks source link

DEPRECATED - Please refer to https://github.com/Network-Goods/hypercerts for the latest


hypercerts-protocol Github Actions Hardhat License: MIT

A Hardhat-based template for developing Solidity smart contracts, with sensible defaults.

Usage

Pre Requisites

Before being able to run any command, you need to create a .env file and set a BIP-39 compatible mnemonic as an environment variable. You can follow the example in .env.example. If you don't already have a mnemonic, you can use this website to generate one.

Then, proceed with installing dependencies:

NOTE: Make sure to use Node 16.

$ yarn install

Run local

$ yarn hardhat node

Compile

Compile the smart contracts with Hardhat:

$ yarn compile

TypeChain

Compile the smart contracts and generate TypeChain bindings:

$ yarn typechain

Test

Run the tests with Hardhat:

$ yarn test

Lint Solidity

Lint the Solidity code:

$ yarn lint:sol

Lint TypeScript

Lint the TypeScript code:

$ yarn lint:ts

Coverage

Generate the code coverage report:

$ yarn coverage

Report Gas

See the gas usage per unit test and average gas per method call:

$ REPORT_GAS=true yarn test

Clean

Delete the smart contract artifacts, the coverage reports and the Hardhat cache:

$ yarn clean

Deploy

Deploy the contracts to Hardhat Network:

$ yarn deploy

Deploy the contracts to live network (e.g. goerli):

$ yarn deploy --network goerli

Verify on Etherscan

To verify on Etherscan, first get the implementation address via Etherscan:

Example for Goerli:

yarn hardhat --network goerli verify CONTRACT_IMPLEMENTATION_ADDRESS

Tips

Syntax Highlighting

If you use VSCode, you can get Solidity syntax highlighting with the hardhat-solidity extension.

Using GitPod

GitPod is an open-source developer platform for remote development.

To view the coverage report generated by yarn coverage, just click Go Live from the status bar to turn the server on/off.

License

MIT © Paul Razvan Berg