Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/thenaubit/nau-hardhat-typescript-auditor-template

πŸ‘·β€β™‚οΈHardhat + Typescript auditor template ready to built POCs with it!
https://github.com/thenaubit/nau-hardhat-typescript-auditor-template

audit hardhat solidity solidity-security typescript

Last synced: 2 days ago
JSON representation

πŸ‘·β€β™‚οΈHardhat + Typescript auditor template ready to built POCs with it!

Awesome Lists containing this project

README

        

# Template for Solidity auditing and POCs building

## ![Template for Solidity auditing and POCs building](logo.jpg)

This is a **simple boilerplate using Hardhat and Typescript** for people looking to have an already working (and updated) template for their **audits / POCs**.

Although you can use this to develop Dapps, it is not optimized for it and you might want to install several other dependencies, change config files and so on.

But for just setting up a project, some contracts or building a quick POC it is perfect.

It has some cool features like:

- **πŸͺ„ Minimal and updated:** I tried to keep this repo updated with the latest stable libraries and settings so you don't have to worry on making this boilerplate work
- **πŸ‘·β€β™‚οΈ Typed:** It uses Typescript and it even generates types for the contracts when compiling them, so you can use their functions with Intellisense in your scripts
- **🐈 Linted:** It has Prettier configured both for your script files and your contract files
- **πŸͺŸ Cross-platform:** Don't be worried about why a command doesn't work in your OS. I focus on making this "1-click to run" in main OS!
- **πŸ”Œ Plugins ready:** Now you don't have to worry about which plugins you should use. You will be prompted with the recommended auditing plugins in case you don't have them.
- **β›½ Gas report:** In case you want to test the gas used by some functions, you can get a detailed report
- **πŸ”₯ VS Code Integrated:** Launch your Hardhat local node by just launching it from the VS Code debug section

## πŸ”§ Installation

1. Clone this repository or click in the "Use this template" button in this repository:

```bash
git clone https://github.com/NauCode/nau-hardhat-typescript-auditor-template.git
```

2. Open it in the terminal and instal the node modules:

#### With NPM

```bash
npm i
```

#### With Yarn

```bash
yarn
```

3. **Very important**: Run this command:

```bash
yarn clean
```

## β›½ Enabling the Gas Report feature (optional)

If you want to use the gas report feature, you need to create a .env file like this:

```bash
cp .env.example .env
```

Then, if you want the gas report with real prices (this step is optional), set the var `REPORT_GAS` as `TRUE` and [get a CoinMarketCap API key](https://coinmarketcap.com/api/documentation/v1/). Set that API key in the var `COINMARKETCAP_API_KEY`.
Now you are ready!

## βš’οΈ Functions and Tools included

### πŸ—οΈ Compile

Compile your contracts (and generate automatically their types) by running:

```bash
npx hardhat compile
```

or

```bash
yarn compile
```

### πŸ”— Scripts

Run any script you coded with:

```bash
npx hardhat run
```

or

```bash
yarn run <script path>
```

### πŸ§ͺ Run tests

Run your Hardhat tests with:

```bash
npx hardhat test
```

or

```bash
yarn test
```

### πŸͺŸ Launch your local Node

Launch a local blockchain node by launching it from the VS Code debug panel or:

```bash
yarn node
```

### β›½ Get a gas report

If you have configured the gas report settings, just run this command and it will generate a gas report for the contract functions tested in your test files:

```bash
yarn gas
```

### πŸ€” Having issues?

If you have any issue, try cleaning the project by running:

```bash
yarn clean
```

### πŸ“ Auto fix formats

Apply automatically all the formatting settings in all your files by running:

```bash
yarn format:fix
```

### βœ”οΈ Test Coverage

Check the test coverage of the project with one command:

```bash
yarn coverage
```

## πŸ”Œ VS Code Recommended Extensions

These are the extensions the template will recommend you:

- **Prettier**: [Marketplace docs](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
- **Solidity by Juan Blanco**: [Marketplace docs](https://marketplace.visualstudio.com/items?itemName=JuanBlanco.solidity)
- **Solidity Visual Developer**: [Marketplace docs](https://marketplace.visualstudio.com/items?itemName=tintinweb.solidity-visual-auditor)
- **Slither**: [Marketplace docs](https://marketplace.visualstudio.com/items?itemName=trailofbits.slither-vscode)
- **Solidity Metrics**: [Marketplace docs](https://marketplace.visualstudio.com/items?itemName=tintinweb.solidity-metrics)

## πŸ—οΈ Contributions

I am open for contributions in this repo but always remember the main goals of this repo:

- Simple to install and use
- Updated but without breaking previous functionality
- Targeted for auditors, not for developers
If your contribution fits to those goals, thank you for helping to maintain this!

## ⚠️ Extra

- We are using Ethers 5.7.2 as a dependency. Right now the most updated version is 6.1.0 but several of the Hardhat libraries are not compatible yet with that version, so make sure to don't update it or it won't work!