Skip to content

Commit

Permalink
fix: removed check for delegation parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
juanmardefago committed Aug 24, 2023
1 parent ae9a479 commit 8409df2
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions src/mappings/staking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,16 @@ import {
import { addresses } from '../../config/addresses'

export function handleDelegationParametersUpdated(event: DelegationParametersUpdated): void {
// Quick fix to avoid creating new Indexer entities if they don't exist yet.
let account = GraphAccount.load(event.params.indexer.toHexString())
if (account != null) {
let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address)
let indexer = createOrLoadIndexer(event.params.indexer, event.block.timestamp)
indexer.indexingRewardCut = event.params.indexingRewardCut.toI32()
indexer.queryFeeCut = event.params.queryFeeCut.toI32()
indexer.delegatorParameterCooldown = event.params.cooldownBlocks.toI32()
indexer.lastDelegationParameterUpdate = (
addresses.isL1 ? event.block.number : graphNetwork.currentL1BlockNumber!
).toI32()
indexer = updateAdvancedIndexerMetrics(indexer as Indexer)
indexer.save()
}
let graphNetwork = createOrLoadGraphNetwork(event.block.number, event.address)
let indexer = createOrLoadIndexer(event.params.indexer, event.block.timestamp)
indexer.indexingRewardCut = event.params.indexingRewardCut.toI32()
indexer.queryFeeCut = event.params.queryFeeCut.toI32()
indexer.delegatorParameterCooldown = event.params.cooldownBlocks.toI32()
indexer.lastDelegationParameterUpdate = (
addresses.isL1 ? event.block.number : graphNetwork.currentL1BlockNumber!
).toI32()
indexer = updateAdvancedIndexerMetrics(indexer as Indexer)
indexer.save()
}

/**
Expand Down

0 comments on commit 8409df2

Please sign in to comment.