DeFiFoFum / hardhat-template

Solidity Smart Contract development template using modern Web3 frameworks/tools including Hardhat, Typechain and more.
GNU General Public License v3.0
1 stars 3 forks source link
hardhat solidity typescript

Hardhat w/ Foundry Template - by DeFiFoFum DeFiFoFum Avatar

lint & test Docs License

Solidity Smart Contract development template using modern Web3 frameworks/tools including Hardhat, Typechain and more.

Features

For testing features see README-testing.md

Deployment and Verification

This project uses special tasks, adapted from Balancer protocol, to deploy and verify contracts which provides methods for saving custom outputs and easily verifying contracts as well as compartmentalizing different types of deployments.

Configuration

Deployment & Verification

  1. Create a deployment script in scripts/deploy. (Use deployLock as a template.)
  2. Use DeployManager to deploy contracts to easily deploy, verify and save the output to the deployments directory.
  3. Run a deployment with npx hardhat run ./scripts/deploy/deployLock.ts --network <network>
  4. Etherscan-like API key should be stored in hardhat.config.ts under etherscan and the DeployManager can use that to verify contracts after deployment.

Linting

This project uses Prettier, an opinionated code formatter, to keep code styles consistent. This project has additional plugins for Solidity support as well.

Linting Solidity Code

Build/Publish as NPM Package

  1. Currently this repo uses tsc to build files to dist/.
  2. Files are cherry picked in package.json under files as there are a lot of support files included in this repo.

Consider including only what is needed.

  "files": [
    "dist/index.js",
    "dist/index.d.ts",
    "dist/src/**/*",
    "dist/typechain-types/**/*",
    // "dist/artifacts/**/*"
  ],

Gotchas

  1. Put single quotes around globs in package.json:
    • "lint:ts": "prettier --check './{scripts,tasks,src,hardhat,test}/**/*.ts'"