diff --git a/ethereum-governance/src/services/easy-track/EasyTrack.srv.ts b/ethereum-governance/src/services/easy-track/EasyTrack.srv.ts index d698c2c9..74109bbe 100644 --- a/ethereum-governance/src/services/easy-track/EasyTrack.srv.ts +++ b/ethereum-governance/src/services/easy-track/EasyTrack.srv.ts @@ -2,7 +2,6 @@ import { ethers, Finding, FindingSeverity, FindingType, getEthersProvider } from import { elapsedTime } from '../../shared/time' import { etherscanAddress, formatEth, getMotionLink, getMotionType } from '../../shared/string' import { TransactionEvent } from 'forta-agent/dist/sdk/transaction.event' -import { MOTION_CREATED_EVENT } from '../../shared/events/motion_created_events' import { Logger } from 'winston' import { IEasyTrackClient } from './contract' @@ -17,7 +16,7 @@ import { } from 'constants/easy-track' import * as E from 'fp-ts/Either' import { networkAlert } from '../../shared/errors' -import { EASY_TRACK_EVENTS } from '../../shared/events/easytrack_events' +import { EASY_TRACK_EVENTS, MOTION_CREATED_EVENT } from '../../shared/events/easytrack_events' import { TopUpAllowedRecipients__factory } from '../../generated' import { getMotionCreatorNamedLink, getSafeNameByAddress, getStonksContractInfo } from './utils' diff --git a/ethereum-governance/src/services/trp-changes/TrpChanges.srv.ts b/ethereum-governance/src/services/trp-changes/TrpChanges.srv.ts index 2dca6b26..0ffa76f5 100644 --- a/ethereum-governance/src/services/trp-changes/TrpChanges.srv.ts +++ b/ethereum-governance/src/services/trp-changes/TrpChanges.srv.ts @@ -4,7 +4,7 @@ import { handleEventsOfNotice } from '../../shared/notice' import { Finding, TransactionEvent } from 'forta-agent' -import { TRP_EVENTS_OF_NOTICE } from '../../shared/events/trp_changes' +import { TRP_EVENTS_OF_NOTICE } from '../../shared/events/trp_events' export class TrpChangesSrv { private readonly logger: Logger diff --git a/ethereum-governance/src/shared/events/burner_events.ts b/ethereum-governance/src/shared/events/burner_events.ts deleted file mode 100644 index 7a508224..00000000 --- a/ethereum-governance/src/shared/events/burner_events.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { EventOfNotice } from '../../entity/events' -import { FindingSeverity, FindingType } from 'forta-agent' -import { Result } from '@ethersproject/abi/lib' -import { etherscanAddress } from '../string' - -export function getBurnerEvents(BURNER_ADDRESS: string): EventOfNotice[] { - return [ - { - address: BURNER_ADDRESS, - event: 'event ERC20Recovered(address indexed requestedBy, address indexed token,uint256 amount)', - alertId: 'LIDO-BURNER-ERC20-RECOVERED', - name: 'ℹī¸ Lido Burner: ERC20 recovered', - description: (args: Result) => - `ERC20 recovered:\n` + - `Requested by: ${etherscanAddress(args.requestedBy)}\n` + - `Token: ${etherscanAddress(args.token)}\n` + - `Amount: ${args.amount}`, - severity: FindingSeverity.Info, - type: FindingType.Info, - }, - { - address: BURNER_ADDRESS, - event: 'event ERC721Recovered(address indexed requestedBy, address indexed token, uint256 tokenId)', - alertId: 'LIDO-BURNER-ERC721-RECOVERED', - name: 'ℹī¸ Lido Burner: ERC721 recovered', - description: (args: Result) => - `ERC721 recovered:\n` + - `Requested by: ${etherscanAddress(args.requestedBy)}\n` + - `Token: ${etherscanAddress(args.token)}\n` + - `Token ID: ${args.tokenId}`, - severity: FindingSeverity.Info, - type: FindingType.Info, - }, - ] -} diff --git a/ethereum-governance/src/shared/events/deposit_security_events.ts b/ethereum-governance/src/shared/events/deposit_security_events.ts deleted file mode 100644 index 3e90b791..00000000 --- a/ethereum-governance/src/shared/events/deposit_security_events.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { EventOfNotice } from '../../entity/events' -import { FindingSeverity, FindingType } from 'forta-agent' -import { Result } from '@ethersproject/abi/lib' -import { etherscanAddress } from '../string' - -export function getDepositSecurityEvents(DEPOSIT_SECURITY_ADDRESS: string): EventOfNotice[] { - return [ - { - address: DEPOSIT_SECURITY_ADDRESS, - event: 'event DepositsPaused(address indexed guardian)', - alertId: 'LIDO-DEPOSITS-PAUSED', - name: '🚨 Deposit Security: Deposits paused', - description: (args: Result) => `Deposits were paused by ${etherscanAddress(args.guardian)}`, - severity: FindingSeverity.Critical, - type: FindingType.Info, - }, - { - address: DEPOSIT_SECURITY_ADDRESS, - event: 'event DepositsUnpaused()', - alertId: 'LIDO-DEPOSITS-UNPAUSED', - name: '⚠ī¸ Deposit Security: Deposits resumed', - description: () => `Deposits were resumed`, - severity: FindingSeverity.High, - type: FindingType.Info, - }, - { - address: DEPOSIT_SECURITY_ADDRESS, - event: 'event GuardianAdded(address guardian)', - alertId: 'LIDO-DEPOSITOR-GUARDIAN-ADDED', - name: '⚠ī¸ Deposit Security: Guardian added', - description: (args: Result) => `New guardian added ${etherscanAddress(args.guardian)}`, - severity: FindingSeverity.High, - type: FindingType.Info, - }, - { - address: DEPOSIT_SECURITY_ADDRESS, - event: 'event GuardianRemoved(address guardian)', - alertId: 'LIDO-DEPOSITOR-GUARDIAN-REMOVED', - name: '⚠ī¸ Deposit Security: Guardian removed', - description: (args: Result) => `Guardian ${etherscanAddress(args.guardian)} was removed`, - severity: FindingSeverity.High, - type: FindingType.Info, - }, - { - address: DEPOSIT_SECURITY_ADDRESS, - event: 'event GuardianQuorumChanged(uint256 newValue)', - alertId: 'LIDO-DEPOSITOR-GUARDIAN-QUORUM-CHANGED', - name: '🚨 Deposit Security: Guardian quorum changed', - description: (args: Result) => `New quorum size ${args.newValue}`, - severity: FindingSeverity.High, - type: FindingType.Info, - }, - { - address: DEPOSIT_SECURITY_ADDRESS, - event: 'event MaxOperatorsPerUnvettingChanged(uint256 newValue)', - alertId: 'LIDO-DEPOSITOR-MAX-OPERATORS-PER-UNVETTING-CHANGED', - name: '⚠ī¸ Deposit Security: Max operators per unvetting changed', - description: (args: Result) => `New value ${args.newValue}`, - severity: FindingSeverity.High, - type: FindingType.Info, - }, - { - address: DEPOSIT_SECURITY_ADDRESS, - event: 'event OwnerChanged(address newValue)', - alertId: 'LIDO-DEPOSITOR-OWNER-CHANGED', - name: '🚨 Deposit Security: Owner changed', - description: (args: Result) => `New owner ${etherscanAddress(args.newValue)}`, - severity: FindingSeverity.Critical, - type: FindingType.Info, - }, - ] -} diff --git a/ethereum-governance/src/shared/events/easytrack_events.ts b/ethereum-governance/src/shared/events/easytrack_events.ts index 84a3984a..5dae5ccd 100644 --- a/ethereum-governance/src/shared/events/easytrack_events.ts +++ b/ethereum-governance/src/shared/events/easytrack_events.ts @@ -2,9 +2,18 @@ import { EventOfNotice } from '../../entity/events' import { FindingSeverity, FindingType } from 'forta-agent' import { etherscanAddress } from '../string' import { EASY_TRACK_ADDRESS, REWARD_PROGRAMS_REGISTRY_ADDRESS, EVM_SCRIPT_EXECUTOR_ADDRESS } from 'constants/easy-track' -import { MOTION_ENACTED_EVENT } from './motion_enacted_events' import { Result } from '@ethersproject/abi/lib' +export const MOTION_CREATED_EVENT = ` + event MotionCreated( + uint256 indexed _motionId, + address _creator, + address indexed _evmScriptFactory, + bytes _evmScriptCallData, + bytes _evmScript + ) +` + export const EASY_TRACK_EVENTS: EventOfNotice[] = [ { address: EASY_TRACK_ADDRESS, @@ -50,7 +59,7 @@ export const EASY_TRACK_EVENTS: EventOfNotice[] = [ }, { address: EASY_TRACK_ADDRESS, - event: MOTION_ENACTED_EVENT, + event: 'event MotionEnacted(uint256 indexed _motionId)', alertId: 'EASY-TRACK-MOTION-ENACTED', name: '✅ EasyTrack: Motion executed successfully 🎉', description: (args: Result) => `EasyTrack motion ${args._motionId} was enacted`, diff --git a/ethereum-governance/src/shared/events/gate_seal_events.ts b/ethereum-governance/src/shared/events/gate_seal_events.ts deleted file mode 100644 index 84b2db24..00000000 --- a/ethereum-governance/src/shared/events/gate_seal_events.ts +++ /dev/null @@ -1,4 +0,0 @@ -export const GATE_SEAL_SEALED_EVENT = - 'event Sealed (address gate_seal, address sealed_by, uint256 sealed_for, address sealable, uint256 sealed_at)' - -export const GATE_SEAL_FACTORY_GATE_SEAL_CREATED_EVENT = 'event GateSealCreated (address gate_seal)' diff --git a/ethereum-governance/src/shared/events/insurance_fund_events.ts b/ethereum-governance/src/shared/events/insurance_fund_events.ts deleted file mode 100644 index 6dd750f6..00000000 --- a/ethereum-governance/src/shared/events/insurance_fund_events.ts +++ /dev/null @@ -1,81 +0,0 @@ -import { EventOfNotice } from '../../entity/events' -import { ERC20, ETH_DECIMALS } from '../constants' -import BigNumber from 'bignumber.js' -import { FindingSeverity, FindingType } from 'forta-agent' -import { Result } from '@ethersproject/abi/lib' -import { etherscanAddress } from '../string' - -export function getInsuranceFundEvents( - INSURANCE_FUND_ADDRESS: string, - KNOWN_ERC20: Map, -): EventOfNotice[] { - return [ - { - address: INSURANCE_FUND_ADDRESS, - event: 'event EtherTransferred(address indexed _recipient, uint256 _amount)', - alertId: 'INS-FUND-ETH-TRANSFERRED', - name: '⚠ī¸ Insurance fund: ETH transferred', - description: (args: Result) => - `${new BigNumber(String(args._amount)) - .div(ETH_DECIMALS) - .toFixed(2)} ETH were transferred from insurance fund to ${etherscanAddress(args._recipient)}`, - severity: FindingSeverity.Info, - type: FindingType.Info, - }, - { - address: INSURANCE_FUND_ADDRESS, - event: - 'event ERC721Transferred(address indexed _token, address indexed _recipient, uint256 _tokenId, bytes _data)', - alertId: 'INS-FUND-ERC721-TRANSFERRED', - name: '⚠ī¸ Insurance fund: ERC721 transferred', - description: (args: Result) => - `ERC721 token (address: ${etherscanAddress(args._token)}, id: ${ - args._tokenId - }) was transferred form insurance fund to ${etherscanAddress(args._recipient)}`, - severity: FindingSeverity.Info, - type: FindingType.Info, - }, - { - address: INSURANCE_FUND_ADDRESS, - event: 'event ERC20Transferred(address indexed _token, address indexed _recipient, uint256 _amount)', - alertId: 'INS-FUND-ERC20-TRANSFERRED', - name: '🚨 Insurance fund: ERC20 transferred', - description: (args: Result) => { - const tokenInfo = KNOWN_ERC20.get(args._token.toLowerCase()) || { - decimals: 18, - name: 'unknown', - } - return `${new BigNumber(String(args._amount)).div(10 ** tokenInfo.decimals).toFixed(2)} of ${etherscanAddress( - args._token, - )}(${tokenInfo.name}) were transferred from insurance fund to ${etherscanAddress(args._recipient)}` - }, - severity: FindingSeverity.High, - type: FindingType.Info, - }, - { - address: INSURANCE_FUND_ADDRESS, - event: - 'event ERC1155Transferred(address indexed _token, address indexed _recipient, uint256 _tokenId, uint256 _amount, bytes _data)', - alertId: 'INS-FUND-ERC1155-TRANSFERRED', - name: '⚠ī¸ Insurance fund: ERC1155 transferred', - description: (args: Result) => - `${args._amount} of ERC1155 token (address: ${etherscanAddress(args._token)}, id: ${ - args._tokenId - }) was transferred form insurance fund to ${etherscanAddress(args._recipient)}`, - severity: FindingSeverity.Info, - type: FindingType.Info, - }, - { - address: INSURANCE_FUND_ADDRESS, - event: 'event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)', - alertId: 'INS-FUND-OWNERSHIP-TRANSFERRED', - name: '🚨 Insurance fund: Ownership transferred', - description: (args: Result) => - `Owner of the insurance fund was transferred from ${etherscanAddress(args.previousOwner)} to ${etherscanAddress( - args.newOwner, - )}`, - severity: FindingSeverity.Critical, - type: FindingType.Info, - }, - ] -} diff --git a/ethereum-governance/src/shared/events/lido_events.ts b/ethereum-governance/src/shared/events/lido_events.ts deleted file mode 100644 index 025aedd1..00000000 --- a/ethereum-governance/src/shared/events/lido_events.ts +++ /dev/null @@ -1,109 +0,0 @@ -import { FindingSeverity, FindingType } from 'forta-agent' -import { EventOfNotice } from '../../entity/events' -import { Result } from '@ethersproject/abi/lib' -import { etherscanAddress } from '../string' - -export const alertId_token_rebased = 'LIDO-TOKEN-REBASED' - -export function getLidoEvents(LIDO_STETH_ADDRESS: string): EventOfNotice[] { - return [ - { - address: LIDO_STETH_ADDRESS, - event: 'event Stopped()', - alertId: 'LIDO-STOPPED', - name: '🚨🚨🚨 Lido: Stopped 🚨🚨🚨', - description: () => `Lido DAO contract was stopped`, - severity: FindingSeverity.Critical, - type: FindingType.Info, - }, - { - address: LIDO_STETH_ADDRESS, - event: 'event Resumed()', - alertId: 'LIDO-RESUMED', - name: '⚠ī¸ Lido: Resumed', - description: () => `Lido DAO contract was resumed`, - severity: FindingSeverity.High, - type: FindingType.Info, - }, - { - address: LIDO_STETH_ADDRESS, - event: 'event StakingPaused()', - alertId: 'LIDO-STAKING-PAUSED', - name: '🚨 Lido: Staking paused', - description: () => `Staking was paused!`, - severity: FindingSeverity.Critical, - type: FindingType.Info, - }, - { - address: LIDO_STETH_ADDRESS, - event: 'event StakingResumed()', - alertId: 'LIDO-STAKING-RESUMED', - name: '⚠ī¸ Lido: Staking resumed', - description: () => `Staking was resumed!`, - severity: FindingSeverity.High, - type: FindingType.Info, - }, - { - address: LIDO_STETH_ADDRESS, - event: 'event StakingLimitSet(uint256 maxStakeLimit, uint256 stakeLimitIncreasePerBlock)', - alertId: 'LIDO-STAKING-LIMIT-SET', - name: '⚠ī¸ Lido: Staking limit set', - description: (args: Result) => - `Staking limit was set with:\n` + - `Max staking limit: ${args.maxStakeLimit}\n` + - `Stake limit increase per block: ${args.stakeLimitIncreasePerBlock}`, - severity: FindingSeverity.High, - type: FindingType.Info, - }, - { - address: LIDO_STETH_ADDRESS, - event: 'event StakingLimitRemoved()', - alertId: 'LIDO-STAKING-LIMIT-REMOVED', - name: '🚨 Lido: Staking limit removed', - description: () => `Staking limit was removed`, - severity: FindingSeverity.High, - type: FindingType.Info, - }, - { - address: LIDO_STETH_ADDRESS, - event: 'event LidoLocatorSet(address lidoLocator)', - alertId: 'LIDO-LOCATOR-SET', - name: '🚨 Lido: Locator set', - description: (args: Result) => `Lido locator was set to: ${etherscanAddress(args.lidoLocator)}`, - severity: FindingSeverity.Critical, - type: FindingType.Info, - }, - { - address: LIDO_STETH_ADDRESS, - event: 'event RecoverToVault(address vault, address token, uint256 amount)', - alertId: 'LIDO-RECOVER-TO-VAULT', - name: '⚠ī¸ Lido: Funds recovered to vault', - description: (args: Result) => - `Funds recovered to vault:\n` + - `Vault: ${etherscanAddress(args.vault)}\n` + - `Token: ${etherscanAddress(args.token)}\n` + - `Amount: ${args.amount}`, - severity: FindingSeverity.Info, - type: FindingType.Info, - }, - { - address: LIDO_STETH_ADDRESS, - event: 'event ContractVersionSet(uint256 version)', - alertId: 'LIDO-CONTRACT-VERSION-SET', - name: '⚠ī¸ Lido: Contract version set', - description: (args: Result) => `Contract version set:\n` + `Version: ${args.version}`, - severity: FindingSeverity.Info, - type: FindingType.Info, - }, - { - address: LIDO_STETH_ADDRESS, - event: - 'event TokenRebased(uint256 indexed reportTimestamp, uint256 timeElapsed, uint256 preTotalShares, uint256 preTotalEther, uint256 postTotalShares, uint256 postTotalEther, uint256 sharesMintedAsFees)', - alertId: alertId_token_rebased, - name: 'ℹī¸ Lido: Token rebased', - description: (args: Result) => `reportTimestamp: ${args.reportTimestamp}`, - severity: FindingSeverity.Info, - type: FindingType.Info, - }, - ] -} diff --git a/ethereum-governance/src/shared/events/motion_created_events.ts b/ethereum-governance/src/shared/events/motion_created_events.ts deleted file mode 100644 index 1d5726f2..00000000 --- a/ethereum-governance/src/shared/events/motion_created_events.ts +++ /dev/null @@ -1,9 +0,0 @@ -export const MOTION_CREATED_EVENT = ` - event MotionCreated( - uint256 indexed _motionId, - address _creator, - address indexed _evmScriptFactory, - bytes _evmScriptCallData, - bytes _evmScript - ) -` diff --git a/ethereum-governance/src/shared/events/motion_enacted_events.ts b/ethereum-governance/src/shared/events/motion_enacted_events.ts deleted file mode 100644 index b1dd1455..00000000 --- a/ethereum-governance/src/shared/events/motion_enacted_events.ts +++ /dev/null @@ -1,5 +0,0 @@ -export const MOTION_ENACTED_EVENT = ` - event MotionEnacted( - uint256 indexed _motionId - ) -` diff --git a/ethereum-governance/src/shared/events/trp_changes.ts b/ethereum-governance/src/shared/events/trp_events.ts similarity index 100% rename from ethereum-governance/src/shared/events/trp_changes.ts rename to ethereum-governance/src/shared/events/trp_events.ts diff --git a/ethereum-governance/src/shared/events/vault_events.ts b/ethereum-governance/src/shared/events/vault_events.ts deleted file mode 100644 index 16b733ce..00000000 --- a/ethereum-governance/src/shared/events/vault_events.ts +++ /dev/null @@ -1,7 +0,0 @@ -export const TRANSFER_SHARES_EVENT = ` - event TransferShares( - address indexed from, - address indexed to, - uint256 sharesValue - ) -` diff --git a/ethereum-governance/src/shared/events/withdrawals_events.ts b/ethereum-governance/src/shared/events/withdrawals_events.ts deleted file mode 100644 index 21963fa8..00000000 --- a/ethereum-governance/src/shared/events/withdrawals_events.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { FindingSeverity, FindingType } from 'forta-agent' -import BigNumber from 'bignumber.js' -import { Result } from '@ethersproject/abi/lib' -import { EventOfNotice } from '../../entity/events' - -export const WITHDRAWALS_BUNKER_MODE_ENABLED_EVENT = 'event BunkerModeEnabled(uint256 _sinceTimestamp)' - -export const WITHDRAWALS_BUNKER_MODE_DISABLED_EVENT = 'event BunkerModeDisabled()' - -export const WITHDRAWAL_QUEUE_WITHDRAWAL_REQUESTED_EVENT = - 'event WithdrawalRequested(uint256 indexed requestId, address indexed requestor, address indexed owner, uint256 amountOfStETH, uint256 amountOfShares)' - -export const LIDO_TOKEN_REBASED_EVENT = - 'event TokenRebased(uint256 indexed reportTimestamp, uint256 timeElapsed, uint256 preTotalShares, uint256 preTotalEther, uint256 postTotalShares, uint256 postTotalEther, uint256 sharesMintedAsFees)' - -export const WITHDRAWAL_QUEUE_WITHDRAWALS_FINALIZED_EVENT = - 'event WithdrawalsFinalized(uint256 indexed from, uint256 indexed to, uint256 amountOfETHLocked, uint256 sharesToBurn, uint256 timestamp)' - -export const WITHDRAWAL_QUEUE_WITHDRAWAL_CLAIMED_EVENT = - 'event WithdrawalClaimed(uint256 indexed requestId, address indexed owner, address indexed receiver, uint256 amountOfETH)' - -export function getWithdrawalsEvents(WITHDRAWALS_QUEUE_ADDRESS: string): EventOfNotice[] { - return [ - { - address: WITHDRAWALS_QUEUE_ADDRESS, - event: 'event Resumed()', - alertId: 'WITHDRAWALS-UNPAUSED', - name: '⚠ī¸ Withdrawals: contract was unpaused', - description: () => 'Contract was resumed', - severity: FindingSeverity.High, - type: FindingType.Info, - }, - { - address: WITHDRAWALS_QUEUE_ADDRESS, - event: 'event Paused(uint256 duration)', - alertId: 'WITHDRAWALS-PAUSED', - name: '🚨 Withdrawals: contract was paused', - description: (args: Result) => `For ${new BigNumber(args.duration).div(60 * 60)} hours`, - severity: FindingSeverity.Critical, - type: FindingType.Info, - }, - ] -}