0.0.7 • Published 1 year ago

contract-template v0.0.7

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

Contract-template

This template provides a template for contract development and operation, including tools and conventions. These are recommended and not mandatory. If you have a suggestion, please make a PR to the template.

Overview

Directory Structure

The directory structure of this template is as follows:

  • contracts/: solidity contracts
  • deploy/: deployment scripts
  • lib/: library functions to be published to NPM
  • script/: scripts to interact with contracts
  • test/: unit tests

Must-do After Repo Creation

There are a few things that must be done after a new repo has been created using this template.

  • Update package.json by running npm init
  • Things to remove
    • deployments/ directory
  • Replace README.md with README-TEMPLATE.md and fill in information
    • Fill in each section or add/remove sections as you want
    • Replace "@klaytn/contract-template" with appropriate NPM package name
  • Fill in docs/*.md for developer guide

Configuration

This template ships default configurations. However, if you need to change it, here's are some options:

Here are the list of configurable files:

  • package.json: package info. Need to be updated with npm init (see this section)
  • hardhat.config.ts (please sync foundry.toml as well)
    • defaultKey: default key to be used if env.PRIVATE_KEY is empty. Default is the well known key
    • network: list of networks. Can be selected with npx hardhat --network flag. These can contain tags depending on the deployment purpose, such as baobab-qa
    • namedAccounts: accounts for getNamedAccounts() (see deploy/deploy_lock.ts)
    • etherscan: required for etherscan-verify
    • dodoc: required for dodoc
    • paths: required for hardhat-deploy
    • external: required for hardhat-deploy
  • foundry.toml (please sync foundry.toml as well)
    • profile: list of profiles. Can be selected with HARDHAT_PROFILE environment variable.
    • rpc_endpoints: alias for cast