Skip to content

Commit

Permalink
improve performance by initializing only once the excluded blocks and…
Browse files Browse the repository at this point in the history
… improving on the check condition.

Signed-off-by: Alfredo Gutierrez <[email protected]>
  • Loading branch information
AlfredoG87 committed Mar 28, 2024
1 parent a5a8c76 commit d6d983c
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions subgraphs/saucerswap/v2/src/mappings/position-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@ import { ADDRESS_ZERO, factoryContract, ZERO_BD, ZERO_BI } from '../utils/consta
import { Address, BigInt, ethereum, log } from '@graphprotocol/graph-ts'
import { convertTokenToDecimal, loadTransaction } from '../utils'

const excludedBlocks: BigInt[] = [
BigInt.fromI32(56517027),
BigInt.fromI32(56520786)
// Add more block numbers as needed here
];

export function isBlockNumberExcluded(blockNumber: BigInt): boolean {
// Initialize the list of excluded blocks each time the function is called
let excludedBlocks: BigInt[] = [
BigInt.fromI32(56517027),
BigInt.fromI32(56520786)
// Add more block numbers as needed here
];

return excludedBlocks.some(excludedBlock => excludedBlock.equals(blockNumber));
return excludedBlocks.includes(blockNumber);
}

function getPosition(event: ethereum.Event, tokenId: BigInt): Position | null {
Expand Down

0 comments on commit d6d983c

Please sign in to comment.