Skip to content

Commit

Permalink
V3 contract
Browse files Browse the repository at this point in the history
* Code changes for gas optimisations

* Unified shares parameter in registerValidator

* New architecture: SSVNetwork, SSVNetworkViews + libraries

* UUPS upgrades pattern using open zeppelin

* Solhint + slither in the CI pipeline added

* Support versioned contracts

* Operators can have 0 fee 

* Permissioned Operators with the use of a whitelisted address

* Manage validators efficiently through clusters

* Manage balances of clusters, operators, and network using snapshots

* Extensive unit test suite

* Add a minimum liquidation collateral in addition to the current liquidation threshold
  • Loading branch information
mtabasco authored Mar 30, 2023
1 parent 3db35fa commit db86a94
Show file tree
Hide file tree
Showing 93 changed files with 20,385 additions and 55,588 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
root = true

[*.{ts,json,js}]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.yml]
indent_size = 2

[*.md]
max_line_length = off
trim_trailing_whitespace = false
18 changes: 10 additions & 8 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
GOERLI_ETH_NODE_URL=
GOERLI_OWNER_PRIVATE_KEY=
GANACHE_ETH_NODE_URL=
GANACHE_OWNER_PRIVATE_KEY=
MAINNET_ETH_NODE_URL=
MAINNET_OWNER_PRIVATE_KEY=
GAS_PRICE=
GAS=
ETHERSCAN_KEY=
SSV_TOKEN_ADDRESS=
CDT_TOKEN_ADDRESS=
MINIMUM_BLOCKS_BEFORE_LIQUIDATION=100
MINIMUM_BLOCKS_BEFORE_LIQUIDATION=100800
MINIMUM_LIQUIDATION_COLLATERAL=200000000
OPERATOR_MAX_FEE_INCREASE=3
SET_OPERATOR_FEE_PERIOD=259200 # 3 days
APPROVE_OPERATOR_FEE_PERIOD=345600 # 4 days
VALIDATORS_PER_OPERATOR_LIMIT=2000
REGISTERED_OPERATORS_PER_ACCOUNT_LIMIT=10
DECLARE_OPERATOR_FEE_PERIOD=259200 # 3 days
EXECUTE_OPERATOR_FEE_PERIOD=345600 # 4 days
SSVNETWORK_PROXY_ADDRESS=
SSVNETWORKVIEWS_PROXY_ADDRESS=
INITIAL_VERSION="0.3.0"
27 changes: 27 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js', 'hardhat.config.ts'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
'indent': ['error', 2],
'semi': [2, 'always'],
'quotes': [2, 'single', 'avoid-escape'],
'@typescript-eslint/no-empty-function': 0,
},
};
6 changes: 3 additions & 3 deletions .github/workflows/code-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: npm install
node-version: '16.x'
- run: npm ci
env:
GH_TOKEN: ${{ secrets.github_token }}
- run: npx hardhat coverage
- run: NO_GAS_ENFORCE=1 npx hardhat coverage
4 changes: 2 additions & 2 deletions .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: npm install
node-version: '16.x'
- run: npm ci
env:
GH_TOKEN: ${{ secrets.github_token }}
- run: npx hardhat check
16 changes: 16 additions & 0 deletions .github/workflows/slither.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: Slither Analysis
on: [push]
jobs:
analyze:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Run Slither
uses: crytic/slither-action@v0.2.0
id: slither
with:
node-version: 16
fail-on: high
slither-args: --exclude controlled-delegatecall
4 changes: 2 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: '12.x'
- run: npm install
node-version: '16.x'
- run: npm ci
env:
GH_TOKEN: ${{ secrets.github_token }}
- run: npx hardhat test
12 changes: 4 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ cache
coverage
coverage.json
artifacts
.openzeppelin/unknown-*
subgraph/build
.idea
/incentivized_testnet/operators*
/incentivized_testnet/validators*
/incentivized_testnet/prod
/incentivized_testnet/stage
/incentivized_testnet/latest_metrics.json
typechain-types/
.openzeppelin/dev-*.json
.DS_Store
.history
Loading

0 comments on commit db86a94

Please sign in to comment.