Solidity template
Quickly get up and running with a powerful Solidity project in no time.
✨
Tech stack used
- Hardhat. Tooling for compiling, deploying and testing smart contracts.
- Ethers. Library with Ethereum and Wallet implementations.
- Waffle, Chai. For testing the smart contracts comprehensively.
- Solhint, Prettier. For linting and formatting of the code.
- Gas reporter. For reporting gas usage of the smart contracts during testing.
- Typechain. For generating type definitions for the smart contracts.
👇
Pre-requisites
Ensure that you have the following tools ready and installed to use this:
- Git
- Node.js
Setup the environmental variables if you haven't yet.
You can setup the .env
variables based on the .env.example
file as provided. Setup the file using cp .env.example .env
and fill in the values.
🛠
Usage
Quickly get started by installing the dependencies.
npm install -D
# OR
yarn
NOTE Any contracts written should use the 0.8.0
or a specific minor-version pragma in order to retain backwards compatibility with all the versions of the compiler with same minor release.
Build the project
You can build the project using:
yarn run build
Note that, If you're not using this as a library, remove the build:lib
and all linked scripts. Else if you are, using this as a library that you want to publish, run yarn run build:lib
instead.
Linting and formatting
Linting and formatting is provided by the solhint and prettier packages respectively.
You can lint/format the whole project as so:
# Linting
yarn run lint
# Formatting
yarn run format
Testing
The project ships with a simple test suite. You can add your own as you work on more contracts. The gas reporter runs along with tests if enabled.
Run the tests as so:
yarn run test
Clean up project
A script has been provided to clean up artifacts, cache, typechain output and ABIs copied.
yarn run clean
Tasks
Hardhat scripts and tasks are present in their respective folders.
You can run any hardhat scripts using:
npx hardhat run scripts/path/to/script
Replace /path/to/script
with the actual path to script file.
The tasks can be run using the same manner.
npx hardhat <task-name>
Where task-name
is the unique identifier for a task. They're defined when creating a task, such as accounts
is one of the tasks present.
You can create your own scripts & tasks in the same manner by referring to the hardhat documentation on them.
Contributing
Contributions, issues and feature requests are welcome. After cloning & setting up project locally, you can just submit a PR to this repo and it will be deployed once it's accepted.
Show your support
We love people's support in growing and improving. Be sure to leave a