Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
0xShaito committed Jun 27, 2022
0 parents commit 623318f
Show file tree
Hide file tree
Showing 49 changed files with 14,618 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .env.example
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=




1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sol linguist-language=Solidity
46 changes: 46 additions & 0 deletions .github/workflows/gas-report.yml
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 }}
44 changes: 44 additions & 0 deletions .github/workflows/lint.yml
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
53 changes: 53 additions & 0 deletions .github/workflows/slither.yml
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 }}
74 changes: 74 additions & 0 deletions .github/workflows/tests.yml
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 }}
24 changes: 24 additions & 0 deletions .gitignore
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
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/commit-msg
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
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
10 changes: 10 additions & 0 deletions .mocharc.js
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,
};
28 changes: 28 additions & 0 deletions .prettierignore
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
32 changes: 32 additions & 0 deletions .prettierrc
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
}
}
]
}
8 changes: 8 additions & 0 deletions .solcover.js
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,
},
};
14 changes: 14 additions & 0 deletions .solhint.json
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 }]
}
}
2 changes: 2 additions & 0 deletions .solhintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
contracts/mock
Loading

0 comments on commit 623318f

Please sign in to comment.