forked from i-link-pro-team/hardhat-boilerplate
-
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 1773974
Showing
22 changed files
with
23,621 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,9 @@ | ||
ETHERSCAN_API_KEY= | ||
|
||
# GAS REPORTER | ||
COINMARKETCAP_API_KEY= | ||
REPORT_GAS=false | ||
TOKEN=AVAX | ||
GAS_PRICE_API=https://api.snowtrace.io/api?module=proxy&action=eth_gasPrice | ||
|
||
MNEMONIC="test test test test test test test test test test test junk" |
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,143 @@ | ||
module.exports = { | ||
parser: '@typescript-eslint/parser', | ||
parserOptions: { | ||
project: 'tsconfig.json', | ||
sourceType: 'module', | ||
}, | ||
plugins: ['@typescript-eslint/eslint-plugin'], | ||
extends: [ | ||
'airbnb-typescript/base', | ||
'prettier', | ||
'plugin:@typescript-eslint/eslint-recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:import/recommended', | ||
'plugin:import/typescript', | ||
], | ||
root: true, | ||
env: { | ||
node: true, | ||
jest: true, | ||
}, | ||
settings: { 'import/resolver': { typescript: {} } }, | ||
rules: { | ||
'@typescript-eslint/no-useless-constructor': 'off', | ||
camelcase: 'off', | ||
'no-unsafe-finally': 'off', | ||
'import/no-extraneous-dependencies': 'off', | ||
'import/no-cycle': 'off', | ||
'@typescript-eslint/lines-between-class-members': 'off', | ||
'max-classes-per-file': 'off', | ||
semi: 'off', | ||
'no-underscore-dangle': 'off', | ||
'class-methods-use-this': 'off', | ||
curly: ['error', 'all'], | ||
'import/prefer-default-export': 'off', | ||
'array-callback-return': 'error', | ||
'brace-style': ['error', '1tbs', { allowSingleLine: false }], | ||
'no-return-await': 'off', | ||
'no-invalid-this': 'off', | ||
'no-empty-pattern': 'error', | ||
'no-magic-numbers': 'off', | ||
'no-unused-vars': 'error', | ||
'object-shorthand': ['error', 'always'], | ||
'space-before-blocks': 'error', | ||
'@typescript-eslint/array-type': 'error', | ||
'@typescript-eslint/explicit-function-return-type': 'error', | ||
'@typescript-eslint/explicit-member-accessibility': [ | ||
'error', | ||
{ accessibility: 'no-public' }, | ||
], | ||
'@typescript-eslint/interface-name-prefix': 'off', | ||
'@typescript-eslint/naming-convention': [ | ||
'error', | ||
{ | ||
selector: 'default', | ||
format: ['camelCase'], | ||
}, | ||
{ | ||
selector: 'variable', | ||
types: ['function'], | ||
format: ['camelCase', 'PascalCase'], | ||
}, | ||
{ | ||
selector: 'variable', | ||
format: ['camelCase', 'UPPER_CASE', 'PascalCase'], | ||
filter: { | ||
regex: '^(.*-.*)$', | ||
match: false, | ||
}, | ||
leadingUnderscore: 'allow', | ||
}, | ||
{ | ||
selector: 'enumMember', | ||
format: ['camelCase', 'PascalCase', 'UPPER_CASE'], | ||
}, | ||
{ | ||
selector: 'parameter', | ||
format: ['camelCase'], | ||
leadingUnderscore: 'allow', | ||
}, | ||
{ | ||
selector: 'memberLike', | ||
format: ['camelCase'], | ||
leadingUnderscore: 'allow', | ||
}, | ||
{ | ||
selector: 'memberLike', | ||
format: null, | ||
filter: { | ||
regex: '[- ]', | ||
match: true, | ||
}, | ||
}, | ||
{ | ||
selector: 'memberLike', | ||
modifiers: ['private'], | ||
format: ['camelCase'], | ||
leadingUnderscore: 'require', | ||
}, | ||
{ | ||
selector: 'typeLike', | ||
format: ['PascalCase'], | ||
}, | ||
], | ||
'@typescript-eslint/no-explicit-any': [ | ||
'error', | ||
{ ignoreRestArgs: true }, | ||
], | ||
'@typescript-eslint/no-invalid-this': 'error', | ||
'@typescript-eslint/no-require-imports': 'error', | ||
'@typescript-eslint/no-for-in-array': 'error', | ||
'@typescript-eslint/no-misused-promises': 'error', | ||
'@typescript-eslint/no-magic-numbers': [ | ||
'error', | ||
{ | ||
ignoreEnums: true, | ||
ignoreArrayIndexes: true, | ||
ignoreNumericLiteralTypes: true, | ||
ignoreReadonlyClassProperties: true, | ||
ignore: [0, 1], | ||
}, | ||
], | ||
'@typescript-eslint/return-await': ['error', 'always'], | ||
'@typescript-eslint/semi': ['error', 'never'], | ||
'import/order': [ | ||
'error', | ||
{ | ||
alphabetize: { order: 'asc' }, | ||
'newlines-between': 'always', | ||
groups: [ | ||
'builtin', | ||
'external', | ||
'internal', | ||
'parent', | ||
'sibling', | ||
'index', | ||
'object', | ||
], | ||
}, | ||
], | ||
'no-restricted-syntax': 'off', | ||
}, | ||
ignorePatterns: ['.eslintrc.js'], | ||
} |
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,45 @@ | ||
# compiled output | ||
/dist | ||
/node_modules | ||
/typechain | ||
/artifacts | ||
/cache | ||
/abis | ||
/.openzeppelin | ||
/build | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# OS | ||
.DS_Store | ||
|
||
# Tests | ||
coverage.json | ||
/coverage | ||
/.nyc_output | ||
|
||
# IDEs and editors | ||
/.idea | ||
.project | ||
.classpath | ||
.c9/ | ||
*.launch | ||
.settings/ | ||
*.sublime-workspace | ||
args.js | ||
|
||
# IDE - VSCode | ||
.vscode/* | ||
!.vscode/settings.json | ||
!.vscode/tasks.json | ||
!.vscode/launch.json | ||
!.vscode/extensions.json | ||
|
||
.env | ||
|
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 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npm run pretty-quick |
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 @@ | ||
v14.16.1 |
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,24 @@ | ||
module.exports = { | ||
overrides: [ | ||
{ | ||
files: "*.sol", | ||
options: { | ||
bracketSpacing: false, | ||
printWidth: 300, | ||
tabWidth: 4, | ||
useTabs: false, | ||
singleQuote: false, | ||
explicitTypes: "always", | ||
}, | ||
}, | ||
{ | ||
files: "*.ts", | ||
options: { | ||
printWidth: 145, | ||
semi: false, | ||
tabWidth: 4, | ||
trailingComma: "es5", | ||
}, | ||
}, | ||
], | ||
} |
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 @@ | ||
{ | ||
"solidity.defaultCompiler": "remote", | ||
"solidity.compileUsingRemoteVersion": "0.8.12" | ||
} |
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,33 @@ | ||
# Smart contracts boilerplate | ||
## Installation | ||
```bash | ||
$ npm use | ||
``` | ||
|
||
```bash | ||
$ npm install | ||
``` | ||
|
||
## Development | ||
|
||
### Creating smart contract | ||
Create your smart contract in `contracts/` folder | ||
|
||
### Compilation | ||
Set solidity version in hardhat.config.ts file, solidity -> compilers -> version, then run compilation | ||
|
||
```bash | ||
$ npx hardhat compile | ||
``` | ||
|
||
### Running tests | ||
Create your tests in test folder. To set typed test, describe types in `test.config.d.ts`. Then, use it with Mocha.Context (this) | ||
|
||
Run tests with command: | ||
```bash | ||
$ npx hardhat test TEST_PATH | ||
``` | ||
|
||
## Useful links | ||
1. Hardhat documentation: | ||
https://hardhat.org/getting-started/ |
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,19 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.12; | ||
|
||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
import "@openzeppelin/contracts/access/Ownable.sol"; | ||
|
||
contract ERC20Mock is ERC20 { | ||
constructor( | ||
string memory name_, | ||
string memory symbol_, | ||
uint256 totalSupply_ | ||
) ERC20(name_, symbol_) { | ||
ERC20._mint(msg.sender, totalSupply_); | ||
} | ||
|
||
function decimals() public view virtual override returns (uint8) { | ||
return 6; | ||
} | ||
} |
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,24 @@ | ||
import { HardhatRuntimeEnvironment } from 'hardhat/types'; | ||
|
||
module.exports = async function (hre: HardhatRuntimeEnvironment) { | ||
const { deployments, getNamedAccounts, ethers } = hre; | ||
const { deploy } = deployments; | ||
|
||
const { deployer } = await getNamedAccounts(); | ||
|
||
const name = 'ERC20Mock' | ||
const symbol = 'ERC' | ||
const totalSupply = ethers.utils.parseUnits('1000000', 6) | ||
|
||
await deploy('ERC20Mock', { | ||
args: [ | ||
name, | ||
symbol, | ||
totalSupply | ||
], | ||
from: deployer, | ||
log: true, | ||
}); | ||
}; | ||
|
||
module.exports.tags = ["ERC20Mock"]; |
Oops, something went wrong.