This template provides a template for contract development and operation, including tools and conventions. If you have a suggestion, please make a PR to the template.
There are a few things that MUST be done after a new repo has been created using this template.
- Update
package.json
by runningnpm init
- Things to remove
deployments/
lib/hardhat/index.ts
- Writing docs from template
- Overwrite
README.md
from README-TEMPLATE.md - Overwrite
GETTING-STARTED.md
from GETTING-STARTED-TEMPLATE.md
- Overwrite
See GETTING-STARTED for details.
From your hardhat project, run:
npm install @klaytn/contract-template
import { Counter } from "@klaytn/contract-template";
async function main() {
console.log(Counter.address, Counter.abi.substring(0, 16));
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
import "@klaytn/contract-template/contracts/Counter.sol";
Tools
- hardhat: Contract dev tool
- foundry: Contract dev tool
- hardhat-utils: Hardhat plugin
- eslint: typescript linter
- solhint: solidity linter
- prettier: markdown, typescript formatter
- husky: git hook tool
- Github actions
Files
- Sample contracts in
contracts/
- Sample hardhat-deploy scripts in
deploy/
- Sample library functions in
lib/
- Sample scripts in
script/
- Sample tests in
test/
- Document templates (
README-TEMPLATE.md
,GETTING-STARTED-TEMPLATE.md
) - Sample configurations (
hardhat.config.ts
,foundry.toml
)