From 647599083397ec0163fe7999804b58b30fc09812 Mon Sep 17 00:00:00 2001 From: 0xVorian <33686588+0xVorian@users.noreply.github.com> Date: Mon, 29 Jul 2024 11:51:00 +0200 Subject: [PATCH] Update EventProcessor.ts --- src/EventProcessor.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/EventProcessor.ts b/src/EventProcessor.ts index 166cf74..85ac148 100644 --- a/src/EventProcessor.ts +++ b/src/EventProcessor.ts @@ -1,6 +1,7 @@ import { EventData, EventQueue } from './EventQueue'; import { FriendlyFormatNumber, norm, sleep } from './Utils'; import { SendTelegramMessage } from './TelegramHelper'; +import { ethers } from 'ethers'; const TG_BOT_ID: string | undefined = process.env.TG_BOT_ID; const TG_CHAT_ID: string | undefined = process.env.TG_CHAT_ID; @@ -35,6 +36,19 @@ async function ProcessAsync(event: EventData) { } console.log(`NEW EVENT DETECTED AT BLOCK ${event.block}: ${event.eventName}`, { args: event.eventArgs }); + if (process.env.FILTER_AUTHOR) { + if ( + event.eventName.toLowerCase() === 'reallocatewithdraw' || + event.eventName.toLowerCase() === 'reallocatesupply' + ) { + const provider = new ethers.JsonRpcProvider(process.env.RPC_URL); + const transaction = await provider.getTransaction(event.txHash); + if (transaction && transaction.from.toLowerCase() === '0xf404dbb34f7f16bfa315daaa9a8c33c7abe94ed1') { + console.log(`Ignoring event - ${event.eventName} - from address 0xF404dBb34f7F16BfA315daaA9a8C33c7aBe94eD1`); + return; + } + } + } const msgToSend: string | undefined = buildMessageFromEvent(event); if (!msgToSend) { console.log('Nothing to send to TG');