Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
0xyijing committed Oct 10, 2024
1 parent cfc383b commit 497076c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
17 changes: 10 additions & 7 deletions src/filters/erc20_transfer_events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ export function filterERC20TransferEvents(
transaction: Transaction,
allowedTxnList?: Set<string>,
): Event[] {
if (allowedTxnList && allowedTxnList.size > 0) {
if (allowedTxnList.has(transaction.transactionHash)) {
return events.filter((e) => e !== null);
}
} else if (transaction.quoteId) {
return events.filter((e) => e !== null);
const filteredEvents = new Set<Event>();

if (allowedTxnList && allowedTxnList.size > 0 && allowedTxnList.has(transaction.transactionHash)) {
events.filter((e) => e !== null).forEach((e) => filteredEvents.add(e));
}
return [];

if (transaction.quoteId) {
events.filter((e) => e !== null).forEach((e) => filteredEvents.add(e));
}

return Array.from(filteredEvents);
}
8 changes: 3 additions & 5 deletions src/scripts/pull_and_save_block_events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,9 @@ function parseBlockTransactionsEvents(fullBlock: FullBlock, allowedTxnList?: Set

const usefullTxs: ParsedTransaction[] = fullBlock.transactions
.map((transaction: FullTransaction): ParsedTransaction | null => {
if (!allowedTxnList || allowedTxnList.has(transaction.hash)) {
const parsedTransactionEvents = parseTransactionEvents(transaction, allowedTxnList);
if (parsedTransactionEvents.parsedTransaction !== null) {
return parsedTransactionEvents;
}
const parsedTransactionEvents = parseTransactionEvents(transaction, allowedTxnList);
if (parsedTransactionEvents.parsedTransaction !== null) {
return parsedTransactionEvents;
}
return null;
})
Expand Down

0 comments on commit 497076c

Please sign in to comment.