Skip to content

Commit e178542

Browse files
committed
Open source
0 parents  commit e178542

File tree

202 files changed

+44443
-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.

202 files changed

+44443
-0
lines changed

.eslintignore

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Solidity
2+
contracts
3+
4+
# General
5+
.DS_Store
6+
.swp
7+
8+
# IDE
9+
.vscode
10+
.idea
11+
12+
# Environment
13+
.env
14+
keystore
15+
16+
# Node modules
17+
node_modules
18+
19+
# Deployments
20+
deployments/*
21+
!deployments/mainnet
22+
!deployments/stage
23+
24+
# Coverage
25+
coverage
26+
coverage.json
27+
28+
# Hardhat stuff
29+
build
30+
artifacts
31+
cache
32+
33+
# Scripts
34+
scripts/private
35+
scripts/output
36+
37+
# Yarn stuff
38+
yarn-error.log
39+
40+
# TypeScript stuff
41+
dist
42+
43+
# Typechain
44+
typechain-types
45+
46+
.pnpm-debug.log
47+
48+
# Docs
49+
docs
50+
51+
# Artifacts
52+
packages
53+
deployments
54+
55+
# Config files
56+
.pnpm-debug.log
57+
pnpm-lock.yaml
58+
pnpm-workspace.yaml
59+
package.json
60+
tsconfig.json
61+
.gitignore
62+
.eslintignore
63+
.prettierignore
64+
.solcover.js
65+
.solhint.json
66+
.eslintrc.json
67+
.prettierr
68+
.husky
69+
tasks/inputs

.eslintrc.json

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"env": {
3+
"browser": false,
4+
"es2021": true,
5+
"mocha": true,
6+
"node": true
7+
},
8+
"plugins": [
9+
"@typescript-eslint",
10+
"chai-friendly"
11+
],
12+
"extends": [
13+
"standard",
14+
"plugin:prettier/recommended",
15+
"plugin:@typescript-eslint/recommended"
16+
],
17+
"parser": "@typescript-eslint/parser",
18+
"parserOptions": {
19+
"ecmaVersion": 12
20+
},
21+
"rules": {
22+
"semi": [
23+
"error"
24+
],
25+
"prettier/prettier": [
26+
"error",
27+
{
28+
"semi": false
29+
}
30+
],
31+
"node/no-unsupported-features/es-syntax": "off",
32+
"@typescript-eslint/ban-ts-comment": "off",
33+
"camelcase": "warn",
34+
"chai-friendly/no-unused-expressions": "error",
35+
"no-unused-expressions": "off",
36+
"n/no-deprecated-api": "warn"
37+
}
38+
}

.example.env

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
TESTNET_DEPLOYER_PK=<...>
2+
TESTNET_RPC=<...>
3+
4+
TENDERLY_PROJECT_ID=<...>
5+
TENDERLY_USERNAME=<...>
6+
TENDERLY_ACCESS_KEY=<...>
7+
8+
MAINNET_DEPLOYER_PK=<...>
9+
MAINNET_RPC=<...>
10+
11+
TESTNET_CHAINLINK_KEY_HASH=<...>
12+
TESTNET_CHAINLINK_VRF_REQUEST_FEE=<...>
13+
14+
ETHERSCAN_API_KEY=<...>
15+
16+
LOCALHOST_DEPLOYER_PK=<...>
17+
18+
# This env should be synced with provided MAINNET_RPC or TESTNET_RPC accordingly
19+
# Also, relevant addresses will be chosen with this setting
20+
FORKING_MODE=TESTNET|MAINNET|STAGE
21+
22+
# If not specified it will fork from current
23+
FORKING_FROM_BLOCK=30295651
24+
25+
# Decide if you want to use existed deployments on deploy command or not
26+
# (with this env specified on a new deploy it may override deployments/$FORKING_MODE
27+
# even when hardhat network is used)
28+
FORKING_MODE_USE_SOURCE_DEPLOYMENTS=true
29+
30+
# todo: deprecate since we use named account for sudo...
31+
SUDO_WALLET_ADDRESS=<...>
32+
33+
DEPLOYER_ADDRESS=0x833bdc983199edce94f9bddcb20b79fba4cb2027
34+
DEPLOYER_PASSWORD=

.gitignore

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# General
2+
.DS_Store
3+
.swp
4+
5+
# IDE
6+
.vscode
7+
.idea
8+
9+
# Environment
10+
.env
11+
keystore
12+
13+
# Node modules
14+
node_modules
15+
16+
# Deployments
17+
deployments/*
18+
!deployments/mainnet
19+
!deployments/stage
20+
21+
# Coverage
22+
coverage
23+
coverage.json
24+
25+
# Hardhat stuff
26+
build
27+
artifacts
28+
cache
29+
30+
# Scripts
31+
scripts/private
32+
scripts/output
33+
34+
# Scripts modular
35+
modules/scripts/private
36+
modules/scripts/output
37+
38+
# Tasks modular
39+
modules/tasks/private
40+
41+
# Yarn stuff
42+
yarn-error.log
43+
44+
# TypeScript stuff
45+
dist
46+
47+
# Typechain
48+
typechain-types
49+
50+
.pnpm-debug.log
51+
52+
# Docs
53+
docs

.gitlab-ci.yml

+144
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
default:
2+
image: $GCP_REGISTRY_URL/werf/ci-nodejs:latest
3+
tags: [lint]
4+
5+
stages:
6+
- compile
7+
- lint
8+
- unittest
9+
- reports
10+
- integration-test
11+
- cd
12+
13+
.hardhat-job-template: &hardhat-job-template
14+
before_script:
15+
- pnpm install --frozen-lockfile --prefer-offline
16+
artifacts:
17+
paths:
18+
- typechain-types/
19+
- artifacts/
20+
- cache/
21+
22+
.general-dependencies-template: &general-dependencies-template
23+
only:
24+
- merge_requests
25+
- dev
26+
- tags
27+
28+
# Compile Contracts & Store Artifacts
29+
compile:
30+
<<: *hardhat-job-template
31+
<<: *general-dependencies-template
32+
stage: compile
33+
script:
34+
- pnpm compile
35+
- pnpm typechain
36+
37+
# Lint Check
38+
lint:
39+
<<: *hardhat-job-template
40+
<<: *general-dependencies-template
41+
stage: lint
42+
needs: [compile]
43+
script:
44+
- pnpm lint
45+
46+
# Run Unittest
47+
unittest:
48+
<<: *hardhat-job-template
49+
<<: *general-dependencies-template
50+
stage: unittest
51+
needs: [lint]
52+
script:
53+
- pnpm test
54+
55+
# Form coverage report for visualization
56+
reports:
57+
<<: *hardhat-job-template
58+
stage: reports
59+
needs: [unittest]
60+
coverage: '/Statements.*?(\d+(?:\.\d+)?)%/'
61+
script:
62+
- pnpm coverage
63+
artifacts:
64+
reports:
65+
coverage_report:
66+
coverage_format: cobertura
67+
path: coverage/cobertura-coverage.xml
68+
69+
only:
70+
- merge_requests
71+
- dev
72+
73+
# On fork deploy impls, update them in update manager and checks upgradability finally
74+
# On failure it generates files in /modules/tasks/reports/error*.json
75+
upgradability-test:
76+
<<: *hardhat-job-template
77+
stage: integration-test
78+
needs: [unittest]
79+
variables:
80+
MAINNET_RPC: $MAINNET_RPC_INTEGRATION_TEST
81+
FORKING_MODE: "STAGE"
82+
FORKING_MODE_USE_SOURCE_DEPLOYMENTS: "true"
83+
MAINNET_UPDATE_MANAGERS_JSON: '[{"contractAddress" : "0xDeB6b06E22A5BdFB2d42000074B46F9C2c3861FE"},{"contractAddress" : "0x41c98A711273800f4275d7eA03161B1810Cf2D03"},{"contractAddress" : "0x0b99dbF8F3d81476BDeE982219a260d01E4E94f0"},{"contractAddress" : "0x2164e9Fa6004896986d2bCc7AC6Ee10A8ad07E00"},{"contractAddress" : "0x99e29A22F56c954Ac51261B69130A88d4ceFf145"},{"contractAddress" : "0xde11959E53ed7bA2B7Ed295c4CE00BDcAd42F587"},{"contractAddress" : "0xe087653B76e2382f55312E43fB0cBD8527527537"},{"contractAddress" : "0x6Eb2F80717F30B2D178443F1Bc919171490d7b97"}]'
84+
MAINNET_PROTOCOL_FILE_JSON: '[{"contractAddress":"0xDeB6b06E22A5BdFB2d42000074B46F9C2c3861FE","app":"UPDATE_MANAGER"},{"contractAddress":"0x41c98A711273800f4275d7eA03161B1810Cf2D03","app":"UPDATE_MANAGER"},{"contractAddress":"0x0b99dbF8F3d81476BDeE982219a260d01E4E94f0","app":"UPDATE_MANAGER"},{"contractAddress":"0x2164e9Fa6004896986d2bCc7AC6Ee10A8ad07E00","app":"UPDATE_MANAGER"},{"contractAddress":"0x99e29A22F56c954Ac51261B69130A88d4ceFf145","app":"UPDATE_MANAGER"},{"contractAddress":"0xde11959E53ed7bA2B7Ed295c4CE00BDcAd42F587","app":"UPDATE_MANAGER"},{"contractAddress":"0xe087653B76e2382f55312E43fB0cBD8527527537","app":"UPDATE_MANAGER"},{"contractAddress":"0x6Eb2F80717F30B2D178443F1Bc919171490d7b97","app":"UPDATE_MANAGER"},{"contractAddress":"0xC7c3c83B9e89645A2616ea94236FD052667fa4a1","app":"DAO_CONSTRUCTOR"},{"contractAddress":"0x08205A2a16963b00e29F67208820BC53fB31Df55","app":"DAO_CONSTRUCTOR"}]'
85+
STAGE_UPDATE_MANAGERS_JSON: '[{"contractAddress":"0x39048a9a1803beF19e65B32f3f1136C370145F92"}]'
86+
STAGE_PROTOCOL_FILE_JSON: '[{"contractAddress":"0x39048a9a1803beF19e65B32f3f1136C370145F92","app":"UPDATE_MANAGER"},{"contractAddress":"0x61DedCcE3a184Fb6b528dbeC9026cf1fa3B14907","app":"DAO_CONSTRUCTOR"}]'
87+
script:
88+
- echo $STAGE_UPDATE_MANAGERS_JSON > modules/tasks/inputs/updateManagersToUpd.json
89+
- echo $STAGE_PROTOCOL_FILE_JSON > modules/tasks/inputs/protocolContracts.json
90+
- pnpm hardhat upgradability-test --remote-fetch --update-managers-file modules/tasks/inputs/updateManagersToUpd.json --protocol-file modules/tasks/inputs/protocolContracts.json --batch-size 50 --network hardhat
91+
- git reset --hard
92+
artifacts:
93+
paths:
94+
- modules/tasks/reports/
95+
only:
96+
- dev
97+
98+
notify-of-errors:
99+
stage: cd
100+
needs: [upgradability-test]
101+
script:
102+
- if [ -f "/modules/tasks/reports/errors.integration-test.kernelsUpgradeError.json" ]; then exit 1; fi
103+
- if [ -f "/modules/tasks/reports/errors.integration-test.kernelsUpgradeGetterMethod.json" ]; then exit 1; fi
104+
- if [ -f "/modules/tasks/reports/errors.integration-test.kernelsUpgradeDifferentReturns.json" ]; then exit 1; fi
105+
- if [ -f "/modules/tasks/reports/errors.integration-test.protocolUpgradeError.json" ]; then exit 1; fi
106+
- if [ -f "/modules/tasks/reports/errors.integration-test.protocolGetterMethodError.json" ]; then exit 1; fi
107+
- if [ -f "/modules/tasks/reports/errors.integration-test.protocolDifferentReturnsError.json" ]; then exit 1; fi
108+
only:
109+
- dev
110+
111+
# update-contracts-on-mainnet:
112+
# <<: *hardhat-job-template
113+
# stage: cd
114+
# needs: [notify-if-errors-happendduring-integration-test-mainnet-fork]
115+
# variables:
116+
# MAINNET_RPC: $MAINNET_RPC_INTEGRATION_TEST
117+
# FORKING_MODE: STAGE
118+
# # env for the task are below
119+
# MAINNET_UPDATE_MANAGERS_JSON: '[{"contractAddress" : "0xDeB6b06E22A5BdFB2d42000074B46F9C2c3861FE"},{"contractAddress" : "0x41c98A711273800f4275d7eA03161B1810Cf2D03"},{"contractAddress" : "0x0b99dbF8F3d81476BDeE982219a260d01E4E94f0"},{"contractAddress" : "0x2164e9Fa6004896986d2bCc7AC6Ee10A8ad07E00"},{"contractAddress" : "0x99e29A22F56c954Ac51261B69130A88d4ceFf145"},{"contractAddress" : "0xde11959E53ed7bA2B7Ed295c4CE00BDcAd42F587"},{"contractAddress" : "0xe087653B76e2382f55312E43fB0cBD8527527537"},{"contractAddress" : "0x6Eb2F80717F30B2D178443F1Bc919171490d7b97"}]'
120+
# MAINNET_PROTOCOL_FILE_JSON: '[{"contractAddress":"0xDeB6b06E22A5BdFB2d42000074B46F9C2c3861FE","app":"UPDATE_MANAGER"},{"contractAddress":"0x41c98A711273800f4275d7eA03161B1810Cf2D03","app":"UPDATE_MANAGER"},{"contractAddress":"0x0b99dbF8F3d81476BDeE982219a260d01E4E94f0","app":"UPDATE_MANAGER"},{"contractAddress":"0x2164e9Fa6004896986d2bCc7AC6Ee10A8ad07E00","app":"UPDATE_MANAGER"},{"contractAddress":"0x99e29A22F56c954Ac51261B69130A88d4ceFf145","app":"UPDATE_MANAGER"},{"contractAddress":"0xde11959E53ed7bA2B7Ed295c4CE00BDcAd42F587","app":"UPDATE_MANAGER"},{"contractAddress":"0xe087653B76e2382f55312E43fB0cBD8527527537","app":"UPDATE_MANAGER"},{"contractAddress":"0x6Eb2F80717F30B2D178443F1Bc919171490d7b97","app":"UPDATE_MANAGER"},{"contractAddress":"0xC7c3c83B9e89645A2616ea94236FD052667fa4a1","app":"DAO_CONSTRUCTOR"},{"contractAddress":"0x08205A2a16963b00e29F67208820BC53fB31Df55","app":"DAO_CONSTRUCTOR"}]'
121+
# STAGE_UPDATE_MANAGERS_JSON: '[{"contractAddress":"0x39048a9a1803beF19e65B32f3f1136C370145F92"}]'
122+
# STAGE_PROTOCOL_FILE_JSON: '[{"contractAddress":"0x39048a9a1803beF19e65B32f3f1136C370145F92","app":"UPDATE_MANAGER"},{"contractAddress":"0x61DedCcE3a184Fb6b528dbeC9026cf1fa3B14907","app":"DAO_CONSTRUCTOR"}]'
123+
# script:
124+
# - echo $STAGE_UPDATE_MANAGERS_JSON > modules/tasks/inputs/updateManagersToUpd.json
125+
# - echo $STAGE_PROTOCOL_FILE_JSON > modules/tasks/inputs/protocolContracts.json
126+
# - pnpm hardhat auto-upgrade --remote-fetch --update-managers-file modules/tasks/inputs/updateManagersToUpd.json --protocol-contracts-file modules/tasks/inputs/protocolContracts.json --failed-kernels-to-file --update-protocol-apps --network hardhat --batch-size 50
127+
# only:
128+
# - dev
129+
130+
# Publish Artifacts & Typechain-types To Npm on Released Tag (e.g. 1.1.1)
131+
publish-package-artifacts:
132+
stage: cd
133+
needs: [unittest]
134+
variables:
135+
NPM_PUBLISH_TOKEN: $NPM_SUPERDAO_ACCESS_TOKEN
136+
script:
137+
- pnpm run --filter=@superdao/os npm:publish
138+
rules:
139+
- if: '$CI_COMMIT_BRANCH == "dev"'
140+
variables:
141+
PACKAGE_VERSION: "0.0.0-beta.${CI_COMMIT_SHORT_SHA}"
142+
- if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/'
143+
variables:
144+
PACKAGE_VERSION: ${CI_COMMIT_TAG}

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
pnpm lint:fix

0 commit comments

Comments
 (0)