generated from defi-wonderland/solidity-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 623318f
Showing
49 changed files
with
14,618 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,26 @@ | ||
# network specific node uri: `"NODE_URI_" + networkName.toUpperCase()` | ||
NODE_URI_ETHEREUM=https://eth-mainnet.alchemyapi.io/v2/<apiKey> | ||
|
||
# network specific account type: `${networkName.toUpperCase()}_ACCOUNTS_TYPE`, can either be MNEMONIC, or PRIVATE_KEYS. | ||
ETHEREUM_ACCOUNTS_TYPE=PRIVATE_KEYS | ||
|
||
# network specific mnemonic: `${networkName.toUpperCase()}_MNEMONIC` | ||
ETHEREUM_MNEMONIC=<mnemonic for mainnet> | ||
|
||
# network specific private keys: `${networkName.toUpperCase()}_{INDEX_OF_ACCOUNT}_PRIVATE_KEY` | ||
ETHEREUM_1_PRIVATE_KEY=<private key for first mainnet account> | ||
|
||
# Mocha (10 minutes) | ||
MOCHA_TIMEOUT=600000 | ||
|
||
# Coinmarketcap (optional, only for gas reporting) | ||
COINMARKETCAP_API_KEY= | ||
COINMARKETCAP_DEFAULT_CURRENCY=USD | ||
|
||
# Etherscan (optional, only for verifying smart contracts) | ||
# network specific api key: `${networkName.toUpperCase()}_{INDEX_OF_ACCOUNT}_PRIVATE_KEY` | ||
ETHEREUM_ETHERSCAN_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 @@ | ||
*.sol linguist-language=Solidity |
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,46 @@ | ||
name: Gas report | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
run: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out github repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Install node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: "16.x" | ||
|
||
- name: Install dependencies | ||
run: yarn --frozen-lockfile | ||
|
||
- name: Compile eth-sdk | ||
run: yarn eth-sdk | ||
|
||
- name: Run gas tests | ||
run: yarn test:gas | ||
env: | ||
NODE_URI_ETHEREUM: https://eth-mainnet.alchemyapi.io/v2/${{ secrets.ALCHEMYKEY }} | ||
|
||
- name: Run eth gas reporter | ||
run: npx codechecks | ||
env: | ||
COINMARKETCAP_API_KEY: ${{ secrets.COINMARKETCAP_API_KEY }} | ||
CC_SECRET: ${{ secrets.CC }} |
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,44 @@ | ||
name: Lint | ||
|
||
on: [push] | ||
|
||
jobs: | ||
files: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out github repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Install node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: "16.x" | ||
|
||
- name: Install dependencies | ||
run: yarn --frozen-lockfile | ||
|
||
- name: Run linter | ||
run: yarn run lint:check | ||
|
||
commits: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out github repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Run commitlint | ||
uses: wagoid/commitlint-github-action@v2 |
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,53 @@ | ||
name: Slither Analysis | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
analyze: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
security-events: write | ||
steps: | ||
- name: Check out github repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Install node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: "16.x" | ||
|
||
- name: Install dependencies | ||
run: yarn --frozen-lockfile | ||
|
||
- name: Hardhat compile | ||
run: yarn compile | ||
|
||
- name: Run Slither | ||
uses: crytic/[email protected] | ||
id: slither | ||
continue-on-error: true | ||
with: | ||
solc-version: 0.8.13 | ||
ignore-compile: true | ||
node-version: 16 | ||
sarif: results.sarif | ||
|
||
- name: Upload SARIF file | ||
uses: github/codeql-action/upload-sarif@v1 | ||
with: | ||
sarif_file: ${{ steps.slither.outputs.sarif }} |
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,74 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
jobs: | ||
unit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out github repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Install node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: "16.x" | ||
|
||
- name: Install dependencies | ||
run: yarn --frozen-lockfile | ||
|
||
- name: Run unit tests | ||
run: yarn test:unit | ||
e2e: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out github repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }} | ||
|
||
- name: Cache hardhat network fork | ||
uses: actions/cache@v2 | ||
env: | ||
cache-name: cache-hardhat-network-fork | ||
with: | ||
path: cache/hardhat-network-fork | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('test/e2e/fork-block-numbers.ts') }} | ||
|
||
- name: Install node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: "16.x" | ||
|
||
- name: Install dependencies | ||
run: yarn --frozen-lockfile | ||
|
||
- name: Compile eth-sdk | ||
run: yarn eth-sdk | ||
|
||
- name: Run e2e tests | ||
run: yarn test:e2e | ||
env: | ||
NODE_URI_ETHEREUM: https://eth-mainnet.alchemyapi.io/v2/${{ secrets.ALCHEMYKEY }} |
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 @@ | ||
# General | ||
node_modules | ||
.DS_STORE | ||
yarn-error.log | ||
|
||
# Coverage | ||
coverage.json | ||
coverage | ||
|
||
# ETH-SDK | ||
eth-sdk/abis | ||
|
||
# Hardhat files | ||
cache | ||
artifacts | ||
typechained | ||
deployments/hardhat | ||
deployments/localhost | ||
|
||
# Config files | ||
.env | ||
|
||
# Not ignore gitkeep | ||
!/**/.gitkeep |
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 @@ | ||
_ |
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" | ||
|
||
npx --no-install commitlint --edit $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,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
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,10 @@ | ||
const dotenv = require('dotenv'); | ||
dotenv.config(); | ||
|
||
module.exports = { | ||
require: ['hardhat/register'], | ||
extension: ['.ts'], | ||
ignore: ['./test/utils/**'], | ||
recursive: true, | ||
timeout: process.env.MOCHA_TIMEOUT || 300000, | ||
}; |
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 @@ | ||
# General | ||
.prettierignore | ||
.solhintignore | ||
.husky | ||
.gitignore | ||
.gitattributes | ||
.env.example | ||
.env | ||
workspace.code-workspace | ||
.DS_STORE | ||
LICENSE | ||
codechecks.yml | ||
|
||
# Hardhat | ||
coverage | ||
coverage.json | ||
artifacts | ||
cache | ||
typechained | ||
deployments | ||
|
||
# JS | ||
node_modules | ||
package-lock.json | ||
yarn.lock | ||
|
||
# Solidity | ||
contracts/mock |
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,32 @@ | ||
{ | ||
"overrides": [ | ||
{ | ||
"files": "**.sol", | ||
"options": { | ||
"printWidth": 145, | ||
"tabWidth": 2, | ||
"useTabs": false, | ||
"singleQuote": true, | ||
"bracketSpacing": false | ||
} | ||
}, | ||
{ | ||
"files": ["**.ts", "**.js"], | ||
"options": { | ||
"printWidth": 145, | ||
"tabWidth": 2, | ||
"semi": true, | ||
"singleQuote": true, | ||
"useTabs": false, | ||
"endOfLine": "auto" | ||
} | ||
}, | ||
{ | ||
"files": "**.json", | ||
"options": { | ||
"tabWidth": 2, | ||
"printWidth": 200 | ||
} | ||
} | ||
] | ||
} |
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,8 @@ | ||
module.exports = { | ||
skipFiles: ['for-test', 'interfaces', 'external', 'mocks'], | ||
mocha: { | ||
forbidOnly: true, | ||
grep: '@skip-on-coverage', | ||
invert: 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", "wonderland"], | ||
"rules": { | ||
"prettier/prettier": "warn", | ||
"wonderland/non-state-vars-leading-underscore": "warn", | ||
"compiler-version": ["off"], | ||
"constructor-syntax": "warn", | ||
"quotes": ["error", "single"], | ||
"func-visibility": ["warn", { "ignoreConstructors": true }], | ||
"not-rely-on-time": "off", | ||
"private-vars-leading-underscore": ["warn", { "strict": false }] | ||
} | ||
} |
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,2 @@ | ||
node_modules | ||
contracts/mock |
Oops, something went wrong.