Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/emretepedev/solidity-hardhat-typescript-boilerplate

Solidity Hardhat Typescript Boilerplate
https://github.com/emretepedev/solidity-hardhat-typescript-boilerplate

blockchain boilerplate ethers hardhat solidity template typechain typescript waffle web3

Last synced: 21 days ago
JSON representation

Solidity Hardhat Typescript Boilerplate

Awesome Lists containing this project

README

        

# Coverage Report

| Statements | Functions | Lines |
| ---------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------ |
| ![Statements](https://img.shields.io/badge/statements-100%25-brightgreen.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-100%25-brightgreen.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-100%25-brightgreen.svg?style=flat) |

# Prerequisites

- Docker

```shell
PATH+=":./bin" # use your sh files (which are located in bin/) directly from the root of the project
```

```shell
yarn install # install deps
yarn run build # install solc and other tools in the docker image
```

Don't forget to copy the .env.example file to a file named .env, and then edit it to fill in the details.

# Running all the tests

```shell
yarn run test
yarn run test:trace # shows logs + calls
yarn run test:fresh # force compile and then run tests
yarn run test:coverage # run tests with coverage reports
```

# Formatters & Linters

You can use the below packages,

- Solhint
- ESLint
- Prettier

```shell
yarn run format
yarn run lint
```

# Analyzers

You can use the below tools,

- Slither
- Mythril

```shell
yarn run analyze:static path/to/contract
yarn run analyze:security path/to/contract
yarn run analyze:all path/to/contract
```

# Deploy Contract & Verification

To try out Etherscan verification, you first need to deploy a contract to an Ethereum network that's supported by Etherscan, such as Sepolia.

In this project, copy the .env.example file to a file named .env, and then edit it to fill in the details.

- Enter your Etherscan API key
- Sepolia Node URL (eg from Alchemy)
- The private key of the account which will send the deployment transaction.

With a valid .env file in place, first deploy your contract:

```shell
yarn run deploy sepolia # related to scripts/deploy/.ts
yarn run deploy:all sepolia # related to scripts/deploy.ts
```

Also, you can add contract(s) manually to your tenderly projects from the output.
`https://dashboard.tenderly.co/contract//`

And then verify it:

```shell
yarn run verify sepolia "" # hardhat.config.ts to see all networks
```

# Finder

```shell
yarn run finder --path contracts/Workshop.sol --name Workshop abi --colorify --compact --prettify # find contract outputs of specific contract
```

```shell
yarn run finder --help # see all supported outputs (abi, metadata, bytecode and more than 20+ outputs)
```

# Storage Vault

```shell
yarn run storage:lock # create storage layout for all contracts
```

```shell
yarn run storage:lock --help # see all supported options
```

```shell
yarn run storage:check # check storage layout for all contracts by comparing with existing layout json file
```

```shell
yarn run storage:check --help # see all supported options
```

# Miscellaneous

```shell
yarn run generate:docs # generate docs according to the contracts/ folder
```

```shell
yarn run generate:flatten ./path/to/contract # generate the flatten file (path must be "./" prefixed)
yarn run generate:abi ./path/to/contract # generate the ABI file (path must be "./" prefixed)
yarn run generate:bin ./path/to/contract # generate the binary in a hex (path must be "./" prefixed)
yarn run generate:metadata ./path/to/contract # generate the metadata (path must be "./" prefixed)
yarn run generate:all-abi
yarn run generate:all-bin
yarn run generate:all-metadata
```

```shell
yarn run share # share project folder with remix ide
```

# TODO

- Increase diversity in the Workshop Contract
- Add Workshop Contract tests
- Add Upgradeable Contract Examples
- Add OpenZeppelin Defender
- Add Tenderly
- Fix Prettier for Solidity files