generated from dl-solarity/hardhat-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3ebcf84
Showing
27 changed files
with
14,742 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[*] | ||
charset = utf-8 | ||
end_of_line = lf | ||
indent_style = space | ||
insert_final_newline = true | ||
[*.ts] | ||
indent_size = 2 | ||
max_line_length = 120 | ||
[*.sol] | ||
indent_size = 4 | ||
max_line_length = 99 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Deployer private key | ||
PRIVATE_KEY=YOUR PRIVATE KEY | ||
|
||
# RPC Endpoints | ||
INFURA_KEY=INFURA PROJECT ID | ||
|
||
# Additional keys | ||
ETHERSCAN_KEY=ETHERSCAN API KEY | ||
BSCSCAN_KEY=BSCSCAN API KEY | ||
POLYGONSCAN_KEY=POLYGONSCAN API KEY | ||
AVALANCHE_KEY=AVALANCHE API KEY | ||
COINMARKETCAP_KEY=COINMARKETCAP API KEY |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Bug Report | ||
description: File a bug report | ||
labels: ['bug'] | ||
assignees: | ||
- | ||
body: | ||
- type: markdown | ||
attributes: | ||
value: Thanks for taking the time to fill out this bug report! | ||
- type: input | ||
id: version | ||
attributes: | ||
label: "Project version" | ||
placeholder: "1.2.3" | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: what-happened | ||
attributes: | ||
label: What happened? | ||
description: A brief description of what happened and what you expected to happen | ||
validations: | ||
required: true | ||
- type: textarea | ||
id: reproduction-steps | ||
attributes: | ||
label: "Minimal reproduction steps" | ||
description: "The minimal steps needed to reproduce the bug" | ||
validations: | ||
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Feature request | ||
description: Suggest a new feature | ||
labels: ['feature'] | ||
assignees: | ||
- | ||
body: | ||
- type: textarea | ||
id: feature-description | ||
attributes: | ||
label: "Describe the feature" | ||
description: "A description of what you would like to see in the project" | ||
validations: | ||
required: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
name: Other issue | ||
about: Other kind of issue | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: setup | ||
|
||
description: setup | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16.18.x" | ||
cache: npm | ||
- name: Install packages | ||
run: npm install | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: "checks" | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
- dev | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the repository | ||
uses: actions/checkout@v3 | ||
- name: Setup | ||
uses: ./.github/actions/setup | ||
- name: Run tests | ||
run: npm run test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
node_modules | ||
.env | ||
.DS_Store | ||
|
||
# Hardhat files | ||
cache | ||
artifacts | ||
coverage.json | ||
coverage | ||
|
||
# Typechain generated files | ||
generated-types | ||
|
||
# Hardhat migrate | ||
.storage.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
npm run lint-fix && git add -u |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
node_modules | ||
.env | ||
.DS_Store | ||
package-lock.json | ||
|
||
# Hardhat files | ||
cache | ||
artifacts | ||
coverage.json | ||
coverage | ||
|
||
# Typechain generated files | ||
generated-types | ||
|
||
# Hardhat migrate | ||
.storage.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"plugins": ["prettier-plugin-solidity"], | ||
"overrides": [ | ||
{ | ||
"files": "*.sol", | ||
"options": { | ||
"printWidth": 99, | ||
"tabWidth": 4, | ||
"useTabs": false, | ||
"singleQuote": false, | ||
"bracketSpacing": false | ||
} | ||
}, | ||
{ | ||
"files": "*.ts", | ||
"options": { | ||
"printWidth": 120, | ||
"tabWidth": 2 | ||
} | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
skipFiles: [], | ||
configureYulOptimizer: true, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"extends": "solhint:recommended", | ||
"plugins": ["prettier"], | ||
"rules": { | ||
"prettier/prettier": "warn", | ||
"reentrancy": "off", | ||
"modifier-name-mixedcase": "off", | ||
"no-empty-blocks": "off", | ||
"func-visibility": "off", | ||
"max-states-count": "off", | ||
"not-rely-on-time": "off", | ||
"compiler-version": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Solarity | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Hardhat template | ||
|
||
Template hardhat repository for ad-hoc smart contracts development. | ||
|
||
### How to use | ||
|
||
The template works out of the box. To clean up the repo, you may need to delete the mock contracts, tests and migration files. | ||
|
||
#### Compilation | ||
|
||
To compile the contracts, use the next script: | ||
|
||
```bash | ||
npm run compile | ||
``` | ||
|
||
#### Test | ||
|
||
To run the tests, execute the following command: | ||
|
||
```bash | ||
npm run test | ||
``` | ||
|
||
Or to see the coverage, run: | ||
|
||
```bash | ||
npm run coverage | ||
``` | ||
|
||
#### Local deployment | ||
|
||
To deploy the contracts locally, run the following commands (in the different terminals): | ||
|
||
```bash | ||
npm run private-network | ||
npm run deploy-localhost | ||
``` | ||
|
||
#### Bindings | ||
|
||
The command to generate the bindings is as follows: | ||
|
||
```bash | ||
npm run generate-types | ||
``` | ||
|
||
> See the full list of available commands in the `package.json` file. | ||
### Integrated plugins | ||
|
||
- Hardhat official `ethers` + `ethers-v6` | ||
- [`Typechain`](https://www.npmjs.com/package/@typechain/hardhat) | ||
- [`hardhat-migrate`](https://www.npmjs.com/package/@solarity/hardhat-migrate), [`hardhat-markup`](https://www.npmjs.com/package/@solarity/hardhat-markup), [`hardhat-gobind`](https://www.npmjs.com/package/@solarity/hardhat-gobind) | ||
- [`hardhat-contract-sizer`](https://www.npmjs.com/package/hardhat-contract-sizer) | ||
- [`hardhat-gas-reporter`](https://www.npmjs.com/package/hardhat-gas-reporter) | ||
- [`solidity-coverage`](https://www.npmjs.com/package/solidity-coverage) | ||
|
||
### Other niceties | ||
|
||
- The template comes with presetup `prettier` and `solhint` that lint the project via `husky` before compilation hook. | ||
- The `.env.example` file is provided to check what is required as ENVs | ||
- Preinstalled `@openzeppelin/contracts` and `@solarity/solidity-lib` |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.20; | ||
|
||
import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
|
||
contract ERC20Mock is ERC20 { | ||
uint8 internal _decimals; | ||
|
||
constructor( | ||
string memory name_, | ||
string memory symbol_, | ||
uint8 decimalPlaces_ | ||
) ERC20(name_, symbol_) { | ||
_decimals = decimalPlaces_; | ||
} | ||
|
||
function decimals() public view override returns (uint8) { | ||
return _decimals; | ||
} | ||
|
||
function mint(address to_, uint256 amount_) public { | ||
_mint(to_, amount_); | ||
} | ||
|
||
function burn(address to_, uint256 amount_) public { | ||
_burn(to_, amount_); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Deployer, Reporter } from "@solarity/hardhat-migrate"; | ||
|
||
import { ERC20Mock__factory } from "@ethers-v6"; | ||
|
||
export = async (deployer: Deployer) => { | ||
const erc20 = await deployer.deploy(ERC20Mock__factory, ["Mock", "Mock", 18]); | ||
|
||
Reporter.reportContracts(["ERC20Mock", await erc20.getAddress()]); | ||
}; |
Oops, something went wrong.