This repository is a Yarn zero-install repository for Smart Contracts development. It uses the following tools/libraries:
- Yarn
- Hardhat
- solc
- Typechain/Typescript
- OpenZeppelin
- Ethers.js
To start using this repo, first you need to have Node and Yarn installed. If you don't have them and don't know how to install them, you can refer to the PREREQUISITES.md installation instructions.
Then you can install all dependencies using the following command:
$ yarn install
If you are using VS Code, please read the file VSCODE.md to install the local VS Code SDK plus all the necessary plugins for this repo.
Copy the .env.template file into a .env file and fill in the values. You will need to fill at least the following values:
- WALLET_SEED - The seed of the wallet that will be used to deploy the contracts.
- ENDPOINT_PROVIDER - The endpoint provider that will be used to connect to the blockchain. It can be 'infura' or 'alchemy'
- ENDPOINT_API_KEY - The API key from your endpoint provider.
You can also fill in the following values, but they are optional:
- MAX_GAS - The maximum gas that will be used to deploy the contracts or perform a transaction.
- GAS_PRICE - The gas price that will be used when doing a transaction on the blockchain
- ETHERSCAN_API_KEY - The API key for Etherscan for contract verification. It can also be a JSON object with keys for each block scanner. Check Hardhat Block Explorers for more information
All the tools are configured with some plugins to get the most out of them. Some pre-configured commands are also provided in package.json.
hardhat:localnode
runs a Hardhat local chain for testinghardhat:accounts
shows all the accounts in the local chainganache:rinkeby
runs a Ganache local chain forking from Rinkebyganache:mainnet
runs a Ganache local chain forking from mainnet
contracts:clean
cleans the compilationcontracts:typechain
generates all typescript bindings for the contractscontracts:compile
compiles the contracts usinsolc
contracts:analyze
uses Slither to do static analysis of the contractscontracts:test
runs the tests for the Solidity contractscontracts:coverage
generates a code coverage report from the Solidity testscontracts:size
provides information about the contracts size
deploy:local
tries to deploy the contracts on the local chaindeploy:rinkeby
tries to deploy the contracts on the Rinkeby networkdeploy:mainnet
tries to deploy the contracts on the mainnet network
lint
runs the linter for Solidity contracts. This includes the Solidity and TS linters, and the prettier code formatter pluginlint:sol
runs the Solidity linterlint:ts
runs the TS linterprettier
runs the prettier linter and formats all supported files according to the configurationprettier:check
runs the prettier linter and informs if there are any formatting errors
For more information on how to create your own repo like this one, you can read the YARN.md and PACKAGES.md guides.
My name is Roberto Cano, I'm a Blockchain Engineer and Founder of The Solid Chain. You can find me on:
MIT License (see LICENSE.md)
Copyright (c) 2022 Roberto Cano & The Solid Chain