Skip to content
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: added csm block release #144

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/AccountingOracle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { StakingRouter } from '../generated/AccountingOracle/StakingRouter'
import { NodeOperatorsShares, NodeOperatorFees } from '../generated/schema'
import { ZERO, getAddress } from './constants'

import { _loadOracleReport } from './helpers'
import { _loadOracleReport, isLidoAddedCSM } from './helpers'
import { extractPairedEvent, getParsedEvent, parseEventLogs } from './parser'

export function handleProcessingStarted(event: ProcessingStartedEvent): void {
Expand All @@ -30,6 +30,13 @@ export function handleExtraDataSubmitted(event: ExtraDataSubmittedEvent): void {
oracleReportEntity.itemsCount = event.params.itemsCount
oracleReportEntity.save()

if (isLidoAddedCSM(event.block.number)) {
return
}

// note: we stopped supporting NodeOperatorFees & NodeOperatorsShares entities after CSM upgrade
// events Transfer and TransferShares are not in the same transaction with event ExtraDataSubmitted

// load all SR modules
const modules = StakingRouter.bind(
getAddress('STAKING_ROUTER')
Expand Down
8 changes: 8 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,13 @@ export const PROTOCOL_UPG_IDX_V1_SHARES = 1
// 8710746
export const PROTOCOL_UPG_IDX_V2 = 2

// Added CSM (Updated AccountingOracle)
// https://etherscan.io/tx/
// [here mainnet block]
// AccountingOracle update - https://holesky.etherscan.io/tx/0x9e9cbff4badc75cc8ca791afd9799e9e4744a13b41e718fe6d794572ff1c9fb4
// 1818028
export const PROTOCOL_UPG_IDX_V2_ADDED_CSM = 3

// list of app's upgrade ids and corresponding min compatible contract version

// block umbers corresponding protocol upgrades
Expand All @@ -241,6 +248,7 @@ PROTOCOL_UPG_BLOCKS.set('holesky', [
BigInt.fromI32(30592), // V1
BigInt.fromI32(30592), // V1_SHARES
BigInt.fromI32(30592), // V2
BigInt.fromI32(1818028), // V2 CSM Update
])

export const PROTOCOL_UPG_APP_VERS = new TypedMap<Bytes, i32[]>()
Expand Down
5 changes: 5 additions & 0 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
PROTOCOL_UPG_BLOCKS,
network,
ONE_HUNDRED_PERCENT,
PROTOCOL_UPG_IDX_V2_ADDED_CSM,
} from './constants'
import { Transfer } from '../generated/Lido/Lido'

Expand Down Expand Up @@ -378,6 +379,10 @@ export function isLidoTransferShares(block: BigInt = ZERO): bool {
return checkAppVer(block, LIDO_APP_ID, PROTOCOL_UPG_IDX_V1_SHARES)
}

export function isLidoAddedCSM(block: BigInt = ZERO): bool {
return checkAppVer(block, LIDO_APP_ID, PROTOCOL_UPG_IDX_V2_ADDED_CSM)
}

// export function isOracleV2(block: BigInt = ZERO): bool {
// return checkAppVer(block, ORACLE_APP_ID, UPG_V2_BETA)
// }
Expand Down
Loading