Skip to content

Latest commit

 

History

History
146 lines (104 loc) · 2.35 KB

README.md

File metadata and controls

146 lines (104 loc) · 2.35 KB

TypeScript Solidity Boilerplate

Hardhat Shorthand

npm i -g hardhat-shorthand

https://hardhat.org/guides/shorthand.html

Common Shorthand Commands

  • hh compile - to compile smart contract and generate typechain ts bindings
  • hh test - to run tests
  • hh deploy - to deploy to local network (see options for more)
  • hh node - to run a localhost node
  • hh help - to see all available commands
  • hh TABTAB - to use autocomplete
  • hh - to see help and all task

Usage

Setup

1. Install Dependencies

npm install

2. Environment Setup

Create .env file and add your environment variables.

Make sure you include either MNEMONIC or PRIVATE_KEY in your .env file.

3. Compile Contracts

npm run compile

Example Flow - Deploy ERC721 Token

1. Deploy BasicERC721 Contract

hh deploy --network mumbai --tags BasicERC721

2. Verify Contract

hh --network mumbai etherscan-verify

3. Interact With Contract - Mint

hh erc721-mint \
 --contract 0x... \
 --recipient 0x... \
 --network mumbai

Testing

Run Tests

npm run test

Run Coverage

npm run coverage

Project Hygiene

Prettier - Non Solidity Files

npm run format:check
npm run format:write

Lint - Non Solidity Files

npm run lint:check
npm run lint:fix

Prettier - Solidity

npm run sol:format:check
npm run sol:format:write

Solhint - Enforcing styles and security best practices

npm run solhint

Project Structure

.
├── contracts
│   ├── BasicERC1155.sol
│   ├── BasicERC20.sol
│   └── BasicERC721.sol
├── deploy
│   ├── Deploy_BasicERC1155.ts
│   ├── Deploy_BasicERC20.ts
│   └── Deploy_BasicERC721.ts
├── deployments
├── hardhat.config.ts
├── tasks
│   ├── erc1155
│   ├── erc20
│   ├── erc721
│   └── utils
└── test
    ├── BasicERC1155.ts
    ├── BasicERC20.ts
    └── BasicERC721.ts

Supported Networks

  • Hardhat Network (localhost)
  • Ethereum Mainnet
  • Ethereum Sepolia Testnet
  • Polygon Mainnet
  • Polygon Mumbai Testnet

add more networks in hardhat.config.ts file.