Skip to content

Commit 873b5e7

Browse files
upgrade packages + foundry setup + start fixes test (#51)
1 parent 51a4394 commit 873b5e7

File tree

104 files changed

+4648
-4530
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+4648
-4530
lines changed

.eslintrc.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = {
77
'plugin:@typescript-eslint/recommended',
88
'plugin:prettier/recommended',
99
],
10-
plugins: ['mocha-no-only', 'promise', 'prettier', '@typescript-eslint'],
10+
plugins: ['mocha-no-only', 'promise', 'prettier', '@typescript-eslint', 'simple-import-sort', 'mocha'],
1111
env: {
1212
browser: true,
1313
node: true,
@@ -28,7 +28,7 @@ module.exports = {
2828
'prettier/prettier': 'error',
2929
// Code style
3030
'array-bracket-spacing': ['off'],
31-
camelcase: ['error', { properties: 'always', ignoreImports: true, allow: ['.*__factory$'] }],
31+
camelcase: ['error', { properties: 'always', allow: ['(.*?)__factory'] }],
3232
'comma-dangle': ['error', 'always-multiline'],
3333
'comma-spacing': ['error', { before: false, after: true }],
3434
'dot-notation': ['error', { allowKeywords: true, allowPattern: '' }],
@@ -43,18 +43,19 @@ module.exports = {
4343
'no-mixed-spaces-and-tabs': ['error', 'smart-tabs'],
4444
'no-redeclare': ['error', { builtinGlobals: true }],
4545
'no-trailing-spaces': ['error', { skipBlankLines: false }],
46+
'no-unused-expressions': 'off',
47+
'no-non-null-asserted-optional-chain': 'off',
4648
'no-undef': 'error',
4749
'no-use-before-define': 'off',
4850
'no-var': 'error',
4951
'object-curly-spacing': ['error', 'always'],
5052
'prefer-const': 'error',
51-
quotes: ['error', 'single'],
5253
semi: ['error', 'always'],
5354
'space-before-function-paren': 0,
5455
'@typescript-eslint/no-non-null-assertion': 0,
55-
56+
'simple-import-sort/imports': 'error',
57+
'simple-import-sort/exports': 'error',
5658
'mocha-no-only/mocha-no-only': ['error'],
57-
5859
'promise/always-return': 'off',
5960
'promise/avoid-new': 'off',
6061
},

.github/workflows/ci.yml

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,22 @@ on:
1212
required: true
1313
options:
1414
- all
15-
- run-compile
15+
- hardhat-tests
16+
- foundry-tests
17+
pull_request:
18+
types:
19+
- ready_for_review
20+
- review_requested
21+
pull_request_review:
22+
types: [submitted]
1623

1724
defaults:
1825
run:
1926
shell: bash
2027

2128
jobs:
2229
run-linters:
30+
if: github.ref == 'refs/heads/main' || github.event.review.state == 'approved' || github.event.action == 'ready_for_review' || github.event.action == 'review_requested'
2331
runs-on: ubuntu-latest
2432
steps:
2533
- uses: actions/checkout@v2
@@ -33,17 +41,15 @@ jobs:
3341
restore-keys: yarn-
3442
- name: Install dependencies
3543
run: |
36-
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
44+
npm config set //registry.npmjs.org/
3745
yarn install --frozen-lockfile
38-
env:
39-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4046
- name: Run solhint
4147
run: yarn lint:sol
4248
- name: Run eslint
4349
run: yarn lint:js:fix
4450

45-
run-compile:
46-
if: ${{ github.ref == 'refs/heads/main' || github.event.inputs.workflow_to_run == 'all' || github.event.inputs.workflow_to_run == 'unit_tests' }}
51+
hardhat-tests:
52+
if: github.ref == 'refs/heads/main' || github.event.inputs.workflow_to_run == 'all' || github.event.inputs.workflow_to_run == 'hardhat-tests' || github.event.review.state == 'approved' || github.event.action == 'ready_for_review' || github.event.action == 'review_requested'
4753
runs-on: ubuntu-latest
4854
steps:
4955
- uses: actions/checkout@v2
@@ -57,17 +63,46 @@ jobs:
5763
restore-keys: yarn-
5864
- name: Install dependencies
5965
run: |
60-
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN
66+
npm config set //registry.npmjs.org/
6167
yarn install --frozen-lockfile
62-
env:
63-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
64-
6568
# This is required separately from yarn test because it generates the typechain definitions
6669
- name: Compile
67-
run: yarn compile
70+
run: yarn hardhat:compile
71+
- run: export NODE_OPTIONS=--max_old_space_size=11264
6872
- name: Run unit tests
69-
run: yarn test
73+
run: yarn hardhat:test
7074
env:
7175
ENABLE_GAS_REPORT: true
7276
CI: true
7377
ETH_NODE_URI_ETH_FOUNDRY: ${{secrets.ETH_NODE_URI_ETH_FOUNDRY}}
78+
ETH_NODE_URI_POLYGON: ${{ secrets.ETH_NODE_URI_POLYGON }}
79+
ETH_NODE_URI_FORK: ${{ secrets.ETH_NODE_URI_FORK }}
80+
ETH_NODE_URI_MAINNET: ${{ secrets.ETH_NODE_URI_MAINNET }}
81+
82+
foundry-tests:
83+
if: github.ref == 'refs/heads/main' || github.event.inputs.workflow_to_run == 'all' || github.event.inputs.workflow_to_run == 'foundry-tests' || github.event.review.state == 'approved' || github.event.action == 'ready_for_review' || github.event.action == 'review_requested'
84+
runs-on: ubuntu-latest
85+
steps:
86+
- uses: actions/checkout@v2
87+
88+
- uses: actions/setup-node@v2
89+
with:
90+
node-version: 14
91+
- uses: actions/cache@v2
92+
with:
93+
path: node_modules
94+
key: yarn-${{ hashFiles('yarn.lock') }}
95+
restore-keys: yarn-
96+
- run: yarn install --frozen-lockfile
97+
98+
- name: Install Foundry
99+
uses: foundry-rs/foundry-toolchain@v1
100+
with:
101+
version: nightly
102+
- name: Run Foundry tests
103+
run: yarn foundry:test
104+
env:
105+
ETH_NODE_URI_MAINNET: ${{ secrets.ETH_NODE_URI_MAINNET }}
106+
ETH_NODE_URI_POLYGON: ${{ secrets.ETH_NODE_URI_POLYGON }}
107+
ETH_NODE_URI_GOERLI: ${{ secrets.ETH_NODE_URI_GOERLI }}
108+
ETH_NODE_URI_FANTOM: ${{ secrets.ETH_NODE_URI_FANTOM }}

.gitignore

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,44 @@ __pycache__
33
.idea
44
.DS_Store
55
.deps
6-
.vscode
76
.docs
87
.env
98
node_modules
10-
tenderly.yaml
11-
settings.json
12-
.mocharc.json
139
venv
1410

1511
# Build output
16-
cache
12+
/cache
13+
/cache-hh
1714
build
1815
export
1916
**/artifacts
2017
.openzeppelin
21-
docgen/docs
22-
docgen/SUMMARY.md
23-
solidity-flattenedContracts
24-
./crytic-export
2518
typechain
26-
19+
slither-audit.txt
20+
slither
21+
slither.db.json
2722

2823
# Test output
2924
coverage
3025
coverage.json
26+
lcov.info
3127

3228
# Running output
3329
gas-report.txt
3430
gasReporterOutput.json
3531
addresses.json
3632
blockchain_db
37-
ganache*
3833
yarn-error.log
34+
broadcast
3935

4036
# deployments
41-
deployments/*
42-
!deployments/kovan
43-
!deployments/rinkeby
44-
!deployments/mainnet
45-
!deployments/polygon
37+
deployments/localhost
38+
deployments/mainnetForkRemote
4639

4740
# bin
4841
bin
4942

50-
# temporary delete
51-
test/perpetualManager/perpetualManagerChangeBase.test.js
52-
typechain/cacheIndex.ts
5343

54-
# used for storing temporary vyper artifacts
55-
vyper_temp_dir
44+
# foundry
45+
/out
46+
/cache-forge

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "lib/forge-std"]
2+
path = lib/forge-std
3+
url = https://github.com/foundry-rs/forge-std

.mocharc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"require": "ts-node/register/files",
3+
"mochaExplorer.files": "test/**/*.ts",
4+
"timeout": 20000
5+
}

.prettierrc

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
2-
"arrowParens": "avoid",
3-
"jsxSingleQuote": true,
4-
"singleQuote": true,
5-
"printWidth": 120,
6-
"semi": true,
7-
"trailingComma": "all",
8-
"useTabs": false,
9-
"overrides": [
10-
{
11-
"files": "*.sol",
12-
"options": {
13-
"printWidth": 120,
14-
"singleQuote": false,
15-
"bracketSpacing": true,
16-
"explicitTypes": "always"
17-
}
18-
}
19-
]
2+
"arrowParens": "avoid",
3+
"jsxSingleQuote": true,
4+
"singleQuote": true,
5+
"printWidth": 120,
6+
"semi": true,
7+
"trailingComma": "all",
8+
"useTabs": false,
9+
"overrides": [
10+
{
11+
"files": "*.sol",
12+
"options": {
13+
"printWidth": 120,
14+
"singleQuote": false,
15+
"bracketSpacing": true,
16+
"explicitTypes": "always"
17+
}
18+
}
19+
]
2020
}

.solhint.json

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,21 @@
22
"extends": "solhint:recommended",
33
"plugins": ["prettier"],
44
"rules": {
5-
"prettier/prettier": "warning",
5+
"avoid-call-value": "warn",
6+
"avoid-low-level-calls": "warn",
7+
"avoid-tx-origin": "warn",
8+
"const-name-snakecase": "warn",
9+
"contract-name-camelcase": "warn",
10+
"imports-on-top": "warn",
11+
"prettier/prettier": "warn",
612
"ordering": "off",
713
"mark-callable-contracts": "off",
814
"no-empty-blocks": "off",
915
"not-rely-on-time": "off",
1016
"compiler-version": "off",
11-
"private-vars-leading-underscore": "off",
17+
"private-vars-leading-underscore": "warn",
18+
"reentrancy": "warn",
1219
"reason-string": "off",
13-
"const-name-snakecase": "off",
14-
"func-visibility": ["error", { "ignoreConstructors": true }]
20+
"func-visibility": ["warn", { "ignoreConstructors": true }]
1521
}
1622
}

.solhintignore

Lines changed: 0 additions & 3 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"python.terminal.activateEnvironment": true,
3+
"python.defaultInterpreterPath": "/opt/anaconda3/envs/angle/bin/python",
4+
"python.terminal.activateEnvInCurrentTerminal": false,
5+
"python.terminal.executeInFileDir": false
6+
}

0 commit comments

Comments
 (0)