-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add mellow-vaults bot scaffold #555
Open
katamarinaki
wants to merge
62
commits into
main
Choose a base branch
from
feat/mellow-alerts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 42 commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
40885fb
feat: add mellow-vaults bot scaffold
katamarinaki 38206fd
feat: add some alerts and tests:
BATMAH69 d52beb4
feat: change owners
BATMAH69 c798523
feat: uncomment handleTransaction
BATMAH69 19f19ca
feat: add storage watcher
BATMAH69 40d2057
feat: fix some pr comments
BATMAH69 bf5a71d
feat: revert old notice logic
BATMAH69 48178fd
feat: alert once
BATMAH69 d48c42d
feat: fix README.md
BATMAH69 7284c1a
feat: fix provider rpc
BATMAH69 3faa0a9
feat: fix import
BATMAH69 19cace8
feat: fix types
BATMAH69 9c69451
feat: fix imports
BATMAH69 bbe74fd
feat: separate multisig watchers
BATMAH69 3750735
feat: rollback multisig bot
BATMAH69 bb7a822
feat: update feat: fix README.md
BATMAH69 0d70416
feat: move acl check to this bot, rollback changes in ethethereum-gov…
BATMAH69 1692d01
feat: add readme
BATMAH69 f7d1a29
feat: add alert, cleanup description
BATMAH69 a34cd9d
feat: filter max Supply event, add symbiotic limit watcher
BATMAH69 8bb1b26
feat: add limit reached alert, fix critical alert number
BATMAH69 feb9bee
feat: add curators alerts
BATMAH69 ccc3846
feat: change type for VAULT-WSTETH-LIMIT-REACHED
BATMAH69 021c9a8
feat: improve withdrawals alert logic
BATMAH69 066a546
feat: change period for notifications
BATMAH69 a98a7be
feat: add Vault name, fix handle multicall tx, add condition to 48h a…
BATMAH69 84cecdb
feat: add new Vaults
BATMAH69 66e876c
feat: test for forta
BATMAH69 dc729fc
feat: update test blocks aft adding new vaults
BATMAH69 5ca1dd0
fix: distribute vault config check by block number to solve slow Fort…
Ivan-Feofanov b9ac5f0
feat: update handleEventsOfNotice
BATMAH69 394c08a
feat: add multicall
BATMAH69 fbee818
feat: remove multicall, it works slow
BATMAH69 3de8767
feat: change connect position
BATMAH69 9da7e7f
fix: fix typo
BATMAH69 8b7c300
feat: move vault-watcher spec, change interfaces to last version
BATMAH69 b806315
feat: move acl-changes and multisig-changes spec, change test interfa…
BATMAH69 588079b
feat: add test for slot change
BATMAH69 15b407e
feat: update acl snapshot
BATMAH69 fd2c3bd
cln: remove unused and format
BATMAH69 5f08277
fix: resolve conflict
BATMAH69 0d784a1
Merge branch 'main' into feat/mellow-alerts
BATMAH69 0dd291d
fix: fix pr comments
BATMAH69 8be29ae
fix: fix pr comments
BATMAH69 04a1912
fix: change work with keys
BATMAH69 f767351
fix: change cast to lower case
BATMAH69 63b109c
cln: lint
BATMAH69 f95fe36
cln: removed await
BATMAH69 27a7e51
feat: change divide multi vault handler into 2 methods add loggers
BATMAH69 252b402
feat: divide historical query by 5 min one after another
BATMAH69 2c97999
test: added test for withdrawal event
BATMAH69 32e9e57
fix: remove spam logs
BATMAH69 f417353
feat: add new vault, add fix for tests, remove empty initialize
BATMAH69 ea6b5ed
fix: vault config to lower case
BATMAH69 d6e828f
fix: remove DVstETH vault
BATMAH69 8d39107
fix: fix DVSTETH vault address
BATMAH69 351a73e
feat: add custom limits option
BATMAH69 e961463
feat: add alert for vault with 2 tokens, add period for notification …
BATMAH69 c532ea7
fix: inc warning limit
BATMAH69 ff08525
fix: inc warning limit
BATMAH69 cff80e5
fix: inc warning limit, add more info to description
BATMAH69 d46ae9d
fix: inc warning limit
BATMAH69 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules/ | ||
dist/ | ||
forta.config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"parser": "@typescript-eslint/parser", | ||
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"], | ||
"plugins": ["@typescript-eslint", "prettier"], | ||
"env": { | ||
"node": true, | ||
"es6": true | ||
}, | ||
"rules": { | ||
"prettier/prettier": "error", | ||
"curly": "error", | ||
"semi": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
node_modules | ||
dist | ||
forta.config.json | ||
.yarn/* | ||
!.yarn/releases/ | ||
*.log | ||
version.json | ||
.DS_Store | ||
/coverage/ | ||
/src/generated/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
v20.10.0 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"semi": false, | ||
"trailingComma": "all", | ||
"singleQuote": true, | ||
"printWidth": 120, | ||
"tabWidth": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Build stage: compile Typescript to Javascript | ||
FROM node:20.10.0-alpine3.18 AS builder | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
RUN yarn install --immutable && yarn run build | ||
# Build app | ||
RUN yarn run build | ||
|
||
# Final stage: copy compiled Javascript from previous stage and run the app | ||
FROM node:20.10.0-alpine3.18 as production | ||
LABEL "network.forta.settings.agent-logs.enable"="true" | ||
ENV NODE_ENV=production | ||
WORKDIR /app | ||
|
||
COPY package*.json yarn.lock ./ | ||
COPY --from=builder /app/node_modules ./node_modules | ||
COPY --from=builder /app/dist ./src | ||
COPY version.json ./ | ||
|
||
CMD ["yarn", "run", "start:prod"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# Lido x Mellow Detection Bot for Forta | ||
|
||
## Supported chains | ||
|
||
- Ethereum mainnet | ||
|
||
## Alerts | ||
|
||
1. Vault operations | ||
1. HandleBlock | ||
1. 🚨🚨🚨 Vault vaultTotalSupply and vaultUnderlyingTvl is not the same | ||
2. 🚨🚨🚨 Vault totalSupply more than maximalTotalSupply | ||
3. 🚨🚨🚨 Vault critical storage slot value changed | ||
4. 🚨 Vault critical storage not loaded | ||
5. ⚠️ Vault withdrawals haven’t been called for at least 48 hours | ||
6. ⚠️ Vault totalSupply close to maximalTotalSupply (every 1800 blocks) | ||
7. ⚠️ Vault totalSupply reached maximalTotalSupply (every 1800 blocks) | ||
2. HandleTransaction | ||
1. 🚨 Vault: Role Admin changed | ||
2. 🚨 Vault: Role revoked | ||
3. 🚨 Vault: Role granted | ||
4. ⚠️ Vault: Symbiotic limit increased | ||
5. ⚠️ Vault: Symbiotic limit reached | ||
6. ⚠️ Vault: Withdrawals haven’t been called for at least 48 hours | ||
7. ⚠️ Vault: Withdrawal partial | ||
8. ℹ️ Vault: Withdrawal all | ||
2. Multisig | ||
1. HandleTransaction | ||
1. 🚨 Gnosis Safe: Owner added | ||
2. 🚨 Gnosis Safe: Owner removed | ||
3. 🚨 Gnosis Safe: Fallback handler changed | ||
4. 🚨 Gnosis Safe: Guard changed | ||
5. 🚨 Gnosis Safe: Threshold changed | ||
6. 🚨 Gnosis Safe: Module disabled | ||
7. 🚨 Gnosis Safe: Module enabled | ||
8. ❌ Gnosis Safe: TX Execution faile | ||
9. ✅ Gnosis Safe: TX Executed | ||
10. ❌ Gnosis Safe: Execution failed from module | ||
11. ✅ Gnosis Safe: Execution success from module | ||
3. ACL | ||
1. HandleBlock | ||
1. 🚨 Vault Contract owner set to address not in whitelist | ||
2. 🚨🚨🚨 Vault Contract owner set to EOA 🚨🚨🚨 | ||
|
||
## Development | ||
|
||
Install deps: | ||
|
||
``` | ||
yarn install | ||
``` | ||
|
||
### Mainnet | ||
|
||
Edit `alerting-forta/<SUBMODULE>/forta.config.json` and set `jsonRpcUrl` to your Mainnet JSON-RPC provider. | ||
|
||
Running in a live mode: | ||
|
||
``` | ||
yarn start:dev | ||
``` | ||
|
||
Testing on a specific block/range/transaction: | ||
|
||
``` | ||
yarn block 20061166 | ||
yarn range '20061165..20061166' | ||
yarn tx 0xb8b96ee47cadb80ec41dafceba1fe5b10b1d50b75e7ad9114ee16180bda2d2b4 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** @type {import("ts-jest").JestConfigWithTsJest} */ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
testPathIgnorePatterns: ['dist'], | ||
moduleNameMapper: { | ||
'constants/common': '<rootDir>/src/shared/constants/common/mainnet', | ||
'constants/acl-changes': '<rootDir>/src/shared/constants/acl-changes/mainnet', | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
{ | ||
"name": "lido-mellow-vaults-forta-bot", | ||
"version": "1.0.0", | ||
"description": "Forta Bot for Mellow Vault", | ||
"repository": { | ||
"type": "git", | ||
"directory": "https://github.com/lidofinance/alerting-forta/tree/main/mellow-vaults" | ||
}, | ||
"license": "MIT", | ||
"chainIds": [ | ||
1 | ||
], | ||
"chainSettings": { | ||
"default": { | ||
"shards": 1, | ||
"target": 5 | ||
} | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "yarn run lint" | ||
} | ||
}, | ||
"scripts": { | ||
"update-version": "node ../utils/write-version.js", | ||
"build": "tsc && tsc-alias && yarn run copy-version", | ||
"copy-version": "cp version.json dist", | ||
"start": "yarn run update-version && yarn run start:dev", | ||
"start:dev": "nodemon --watch src --watch forta.config.json -e js,ts,json --exec \"yarn run build && yarn run copy-version && forta-agent run\"", | ||
"start:prod": "forta-agent run --prod", | ||
"tx": "yarn run build && forta-agent run --tx", | ||
"block": "yarn run build && forta-agent run --block", | ||
"range": "yarn run build && forta-agent run --range", | ||
"alert": "yarn run build && forta-agent run --alert", | ||
"sequence": "yarn run build && forta-agent run --sequence", | ||
"file": "yarn run build && forta-agent run --file", | ||
"publish": "yarn run update-version && forta-agent publish", | ||
"info": "forta-agent info", | ||
"logs": "forta-agent logs", | ||
"push": "yarn run update-version && forta-agent push", | ||
"disable": "forta-agent disable", | ||
"enable": "forta-agent enable", | ||
"keyfile": "forta-agent keyfile", | ||
"stake": "forta-agent stake", | ||
"test": "jest", | ||
"generate-types": "typechain --target=ethers-v5 --out-dir=./src/generated ./src/abi/*", | ||
"eslint:lint": "eslint ./src", | ||
"eslint:format": "eslint ./src --fix", | ||
"prettier:check": "prettier --check ./src", | ||
"prettier:format": "prettier --write ./src README.md", | ||
"lint": "yarn run prettier:check && yarn run eslint:lint", | ||
"format": "yarn run eslint:format && yarn run prettier:format", | ||
"postinstall": "yarn generate-types" | ||
}, | ||
"dependencies": { | ||
"@ethersproject/abi": "^5.0.0", | ||
"@ethersproject/providers": "^5.0.0", | ||
"@types/lodash": "^4.14.202", | ||
"async-mutex": "^0.4.0", | ||
"bignumber.js": "^9.1.2", | ||
"ethereum-multicall": "^2.24.0", | ||
"ethers": "^5.5.1", | ||
"forta-agent": "^0.1.48", | ||
"fp-ts": "^2.16.1", | ||
"knex": "^3.1.0", | ||
"lodash": "^4.17.21", | ||
"ts-retry": "^4.2.4", | ||
"winston": "^3.11.0" | ||
}, | ||
"devDependencies": { | ||
"@faker-js/faker": "^8.3.1", | ||
"@jest/globals": "^29.7.0", | ||
"@tsconfig/node20": "^20.1.2", | ||
"@typechain/ethers-v5": "^11.1.2", | ||
"@types/jest": "^29.5.11", | ||
"@types/nodemon": "^1.19.0", | ||
"@types/ws": "^8.5.10", | ||
"@typescript-eslint/eslint-plugin": "^6.12.0", | ||
"@typescript-eslint/parser": "^6.12.0", | ||
"eslint": "^8.54.0", | ||
"eslint-config-prettier": "^9.0.0", | ||
"eslint-plugin-jest": "^27.6.0", | ||
"eslint-plugin-prettier": "^5.0.1", | ||
"husky": "^8.0.3", | ||
"jest": "^29.7.0", | ||
"jest-resolve": "^29.7.0", | ||
"nodemon": "^3.0.1", | ||
"postinstall": "^0.8.0", | ||
"prettier": "^3.1.0", | ||
"ts-generator": "^0.1.1", | ||
"ts-jest": "^29.1.2", | ||
"tsc-alias": "^1.8.8", | ||
"typechain": "^8.3.2", | ||
"typescript": "^5.3.2" | ||
}, | ||
"packageManager": "[email protected]" | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useless. Just look on CI file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it is help to change env without looking in file