Skip to content

Commit ea030f5

Browse files
committed
Add initial commit
0 parents  commit ea030f5

File tree

209 files changed

+62526
-0
lines changed

Some content is hidden

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

209 files changed

+62526
-0
lines changed

.circleci/config.yml

Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
version: 2
2+
3+
jobs:
4+
checkout_and_compile:
5+
docker:
6+
- image: circleci/node:12.16.0
7+
environment:
8+
NODE_OPTIONS: --max_old_space_size=8192
9+
resource_class: large
10+
working_directory: ~/set-v2-strategies
11+
steps:
12+
- checkout
13+
- restore_cache:
14+
key: module-cache-{{ checksum "yarn.lock" }}
15+
- run:
16+
name: Set Up Environment Variables
17+
command: cp .env.default .env
18+
- run:
19+
name: Fetch Dependencies
20+
command: yarn install
21+
- save_cache:
22+
key: module-cache-{{ checksum "yarn.lock" }}
23+
paths:
24+
- node_modules
25+
- run:
26+
name: Transpile Contracts
27+
command: yarn build
28+
- save_cache:
29+
key: compiled-env-{{ .Environment.CIRCLE_SHA1 }}
30+
paths:
31+
- ~/set-v2-strategies
32+
test:
33+
docker:
34+
- image: circleci/node:12.16.0
35+
working_directory: ~/set-v2-strategies
36+
parallelism: 3
37+
steps:
38+
- restore_cache:
39+
key: compiled-env-{{ .Environment.CIRCLE_SHA1 }}
40+
- run:
41+
name: Set Up Environment Variables
42+
command: cp .env.default .env
43+
- run:
44+
name: Test RPC
45+
command: yarn chain
46+
background: true
47+
- run:
48+
name: Hardhat Test
49+
command: |
50+
TEST_FILES="$(circleci tests glob "./test/**/*.spec.ts" | circleci tests split)"
51+
yarn test ${TEST_FILES}
52+
53+
test_forked_network:
54+
docker:
55+
- image: circleci/node:12.16.0
56+
working_directory: ~/set-v2-strategies
57+
steps:
58+
- restore_cache:
59+
key: compiled-env-{{ .Environment.CIRCLE_SHA1 }}
60+
- run:
61+
name: Set Up Environment Variables
62+
command: cp .env.default .env
63+
- run:
64+
name: Hardhat Test
65+
command: yarn test:fork
66+
67+
coverage:
68+
docker:
69+
- image: circleci/node:12.16.0
70+
working_directory: ~/set-v2-strategies
71+
# When changing the parallelism value, you also
72+
# need to update the `persist_to_workspace` paths
73+
# in this job (below) as well as the list of files passed
74+
# to istanbul-combine in the `report_coverage` job
75+
parallelism: 5
76+
steps:
77+
- restore_cache:
78+
key: compiled-env-{{ .Environment.CIRCLE_SHA1 }}
79+
- run:
80+
name: Set Up Environment Variables
81+
command: cp .env.default .env
82+
- run:
83+
name: Create shared coverage outputs folder
84+
command: mkdir -p /tmp/coverage
85+
- run:
86+
name: Coverage
87+
command: |
88+
TEST_FILES="{$(circleci tests glob "./test/**/*.spec.ts" | \
89+
circleci tests split | xargs | sed -e 's/ /,/g')}"
90+
yarn coverage -- --testfiles "$TEST_FILES"
91+
- run:
92+
name: Save coverage
93+
command: |
94+
cp coverage.json /tmp/coverage/cov_$CIRCLE_NODE_INDEX.json
95+
chmod -R 777 /tmp/coverage/cov_$CIRCLE_NODE_INDEX.json
96+
- persist_to_workspace:
97+
root: /tmp/coverage
98+
paths:
99+
- cov_0.json
100+
- cov_1.json
101+
- cov_2.json
102+
- cov_3.json
103+
- cov_4.json
104+
105+
report_coverage:
106+
docker:
107+
- image: circleci/node:12.16.0
108+
working_directory: ~/set-v2-strategies
109+
steps:
110+
- attach_workspace:
111+
at: /tmp/coverage
112+
- restore_cache:
113+
key: compiled-env-{{ .Environment.CIRCLE_SHA1 }}
114+
- run:
115+
name: Combine coverage reports
116+
command: |
117+
cp -R /tmp/coverage/* .
118+
npx istanbul-combine-updated -r lcov \
119+
cov_0.json \
120+
cov_1.json \
121+
cov_2.json \
122+
cov_3.json \
123+
cov_4.json
124+
- run:
125+
name: Upload coverage
126+
command: |
127+
cat coverage/lcov.info | node_modules/.bin/coveralls
128+
129+
workflows:
130+
version: 2
131+
build-and-test:
132+
jobs:
133+
- checkout_and_compile
134+
- test:
135+
requires:
136+
- checkout_and_compile
137+
- test_forked_network:
138+
requires:
139+
- checkout_and_compile
140+
- coverage:
141+
requires:
142+
- checkout_and_compile
143+
- report_coverage:
144+
requires:
145+
- coverage

.env.default

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# These are randomly generated hex so that CircleCI will work
2+
ALCHEMY_TOKEN=fake_alchemy_token
3+
INFURA_TOKEN=799e620c4b39064f7a8cfd8452976ed1
4+
KOVAN_DEPLOY_PRIVATE_KEY=0f3456f7f1ed59aaa29f35f4674a87e754e1055249a2888bdaec3dea49d2e456
5+
STAGING_MAINNET_DEPLOY_PRIVATE_KEY=0f3456f7f1ed59aaa29f35f4674a87e754e1055249a2888bdaec3dea49d2e456
6+
PRODUCTION_MAINNET_DEPLOY_PRIVATE_KEY=0f3456f7f1ed59aaa29f35f4674a87e754e1055249a2888bdaec3dea49d2e456
7+
8+
NODE_OPTIONS=--max_old_space_size=8192

.eslintrc.js

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
module.exports = {
2+
"env": {
3+
"browser": true,
4+
"node": true
5+
},
6+
"parser": "@typescript-eslint/parser",
7+
"parserOptions": {
8+
"project": "tsconfig.json",
9+
"sourceType": "module"
10+
},
11+
"plugins": [
12+
"eslint-plugin-no-null",
13+
"eslint-plugin-jsdoc",
14+
"@typescript-eslint",
15+
"@typescript-eslint/tslint"
16+
],
17+
"rules": {
18+
"@typescript-eslint/indent": [
19+
"error",
20+
2
21+
],
22+
"@typescript-eslint/member-delimiter-style": [
23+
"error",
24+
{
25+
"multiline": {
26+
"delimiter": "semi",
27+
"requireLast": true
28+
},
29+
"singleline": {
30+
"delimiter": "semi",
31+
"requireLast": false
32+
}
33+
}
34+
],
35+
"@typescript-eslint/prefer-namespace-keyword": "error",
36+
"@typescript-eslint/quotes": [
37+
"error",
38+
"double",
39+
{
40+
"avoidEscape": true
41+
}
42+
],
43+
"@typescript-eslint/semi": [
44+
"error",
45+
"always"
46+
],
47+
"@typescript-eslint/type-annotation-spacing": "error",
48+
"arrow-parens": [
49+
"error",
50+
"as-needed"
51+
],
52+
"brace-style": [
53+
"error",
54+
"1tbs"
55+
],
56+
"comma-dangle": [
57+
"error",
58+
{
59+
"objects": "only-multiline",
60+
"arrays": "only-multiline",
61+
"imports": "only-multiline",
62+
"exports": "only-multiline",
63+
"functions": "only-multiline"
64+
}
65+
],
66+
"jsdoc/check-alignment": "error",
67+
"jsdoc/check-indentation": "error",
68+
"jsdoc/newline-after-description": "error",
69+
"max-len": [
70+
"error",
71+
{
72+
"code": 150
73+
}
74+
],
75+
"no-null/no-null": "error",
76+
"no-trailing-spaces": "error",
77+
"no-unused-vars": "error",
78+
"no-var": "error",
79+
"prefer-const": "error",
80+
"quotes": "error",
81+
"semi": "error",
82+
"spaced-comment": [
83+
"error",
84+
"always",
85+
{
86+
"markers": [
87+
"/"
88+
]
89+
}
90+
],
91+
}
92+
};

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*.sol linguist-language=Solidity

.gitignore

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
.DS_Store
2+
/artifacts
3+
/build
4+
/cache
5+
/dist
6+
/etherscan
7+
/flatten
8+
/deployments/kovan
9+
/deployments/localhost_31337
10+
/deployments/staging_mainnet_1
11+
/deployments/production_1
12+
/deployments/50-development.json
13+
/node_modules
14+
/transpiled
15+
/types/generated/*
16+
/typechain
17+
coverage.json
18+
coverage/
19+
.env
20+
21+
/.coverage_cache
22+
/.coverage_contracts
23+
24+
### Node ###
25+
26+
# Logs
27+
*.log
28+
/logs
29+
npm-debug.log*
30+
yarn-debug.log*
31+
yarn-error.log*
32+
33+
# IDE Configs
34+
.vscode/*
35+
.idea

.npmignore

Whitespace-only changes.

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
contracts/

.prettierrc.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"printWidth": 100,
3+
"parser": "typescript",
4+
"tabWidth": 2,
5+
"trailingComma": "all",
6+
"arrowParens": "always"
7+
}

.solcover.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const shell = require('shelljs'); // This module is already a solidity-coverage dep
2+
3+
module.exports = {
4+
skipFiles: [
5+
'mocks',
6+
'interfaces',
7+
'protocol/modules/UniswapYieldStrategy.sol',
8+
'product/AssetLimitHook.sol',
9+
'protocol-viewers'
10+
],
11+
providerOptions: {
12+
default_balance_ether: 100000000,
13+
gasLimit: 30000000,
14+
}
15+
}

.solhint.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"extends": "solhint:recommended",
3+
"rules": {
4+
"reason-string": ["warn", { "maxLength": 50 }],
5+
"compiler-version": ["error", "0.6.10"]
6+
}
7+
}

0 commit comments

Comments
 (0)