/template-ethereum-contracts

Template to develop ethereum smart contracts

Primary LanguageSolidityMIT LicenseMIT

Boilerplate for ethereum solidity smart contract development

INSTALL

yarn

TEST

yarn test

SCRIPTS

Here is the list of npm scripts you can execute:

Some of them relies on ./_scripts.js to allow parameterizing it via command line argument (have a look inside if you need modifications)

yarn prepare

As a standard lifecycle npm script, it is executed automatically upon install. It generate config file and typechain to get you started with type safe contract interactions

yarn lint, yarn lint:fix, yarn format and yarn format:fix

These will lint and format check your code. the :fix version will modifiy the files to match the requirement specified in .eslintrc and .prettierrc.

yarn compile

These will compile your contracts

yarn void:deploy

This will deploy your contracts on the in-memory hardhat network and exit, leaving no trace. quick way to ensure deployments work as intended without consequences

yarn test [mocha args...]

These will execute your tests using mocha. you can pass extra arguments to mocha

yarn coverage

These will produce a coverage report in the coverage/ folder

yarn gas

These will produce a gas report for function used in the tests

yarn dev

These will run a local hardhat network on localhost:8545 and deploy your contracts on it. Plus it will watch for any changes and redeploy them.

yarn local:dev

This assumes a local node it running on localhost:8545. It will deploy your contracts on it. Plus it will watch for any changes and redeploy them.

yarn execute <network> <file.ts> [args...]

This will execute the script <file.ts> against the specified network

yarn deploy <network> [args...]

This will deploy the contract on the specified network.

Behind the scene it uses hardhat deploy command so you can append any argument for it

yarn export <network> <file.json>

This will export the abi+address of deployed contract to <file.json>

yarn fork:execute <network> [--blockNumber <blockNumber>] [--deploy] <file.ts> [args...]

This will execute the script <file.ts> against a temporary fork of the specified network

if --deploy is used, deploy scripts will be executed

yarn fork:deploy <network> [--blockNumber <blockNumber>] [args...]

This will deploy the contract against a temporary fork of the specified network.

Behind the scene it uses hardhat deploy command so you can append any argument for it

yarn fork:test <network> [--blockNumber <blockNumber>] [mocha args...]

This will test the contract against a temporary fork of the specified network.

yarn fork:dev <network> [--blockNumber <blockNumber>] [args...]

This will deploy the contract against a fork of the specified network and it will keep running as a node.

Behind the scene it uses hardhat node command so you can append any argument for it