Skip to content

Commit

Permalink
Fix VIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Ktl-XV committed Jan 24, 2024
1 parent ee7318f commit a94583e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/data_sources/events/web3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export class Web3Source {
const reqParams = {
fromBlock: logPull.fromBlock,
toBlock: logPull.toBlock,
address: logPull.address === 'nofilter' ? null : logPull.address,
address: logPull.address,
topics: logPull.topics,
};
const req = this._web3.eth.getPastLogs.request(reqParams, (err: any, data: RawLog) => {
Expand Down
11 changes: 7 additions & 4 deletions src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ import {
} from './entities';
import {
filterSocketBridgeEventsGetContext,
filterNulls,
filterSocketBridgeEvents,
filterWrapUnwrapEvents,
filterWrapUnwrapEventsGetContext,
Expand Down Expand Up @@ -262,9 +263,10 @@ export const eventScrperProps: EventScraperProps[] = [
tType: ERC20BridgeTransferEvent,
table: 'erc20_bridge_transfer_events',
topics: [UNISWAP_V3_SWAP_EVENT_TOPIC_0, addressToTopic(EP_ADDRESS)],
contractAddress: 'nofilter',
contractAddress: null,
startBlock: UNISWAP_V3_VIP_SWAP_START_BLOCK,
parser: parseUniswapV3VIPSwapEvent,
filterFunction: filterNulls,
deleteOptions: { directFlag: true, directProtocol: ['UniswapV3'] },
tokenMetadataMap: { tokenA: 'fromToken', tokenB: 'toToken' },
},
Expand All @@ -286,9 +288,10 @@ export const eventScrperProps: EventScraperProps[] = [
tType: ERC20BridgeTransferEvent,
table: 'erc20_bridge_transfer_events',
topics: [UNISWAP_V2_SWAP_EVENT_TOPIC_0, addressToTopic(EP_ADDRESS)],
contractAddress: 'nofilter',
contractAddress: null,
startBlock: UNISWAP_V2_VIP_SWAP_START_BLOCK,
parser: parseUniswapV2SwapEvent,
filterFunction: filterNulls,
deleteOptions: { directFlag: true, directProtocol: UNISWAP_V2_VIP_SWAP_SOURCES },
tokenMetadataMap: { tokenA: 'fromToken', tokenB: 'toToken' },
},
Expand Down Expand Up @@ -482,7 +485,7 @@ export const eventScrperProps: EventScraperProps[] = [
tType: UniswapV2SyncEvent,
table: 'uniswap_v2_sync_events',
topics: UNISWAP_V2_SYNC_TOPIC,
contractAddress: 'nofilter',
contractAddress: null,
startBlock: UNISWAP_V2_SYNC_START_BLOCK,
parser: parseUniswapV2SyncEvent,
},
Expand All @@ -502,7 +505,7 @@ export const eventScrperProps: EventScraperProps[] = [
tType: UniswapV3SwapEvent,
table: 'uniswap_v3_swap_events',
topics: [UNISWAP_V3_SWAP_EVENT_TOPIC_0],
contractAddress: 'nofilter',
contractAddress: null,
startBlock: UNISWAP_V3_SWAP_START_BLOCK,
parser: parseUniswapV3SwapEvent,
},
Expand Down
2 changes: 2 additions & 0 deletions src/filters/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
export { filterSocketBridgeEventsGetContext, filterSocketBridgeEvents } from './socket_bridge_events';
export { filterWrapUnwrapEvents, filterWrapUnwrapEventsGetContext } from './wrap_unwrap_native_events';

export const filterNulls = (events: any[], _: any) => events.filter((e) => e !== null);
1 change: 1 addition & 0 deletions src/scripts/pull_and_save_block_events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ function parseTransactionEvents(transaction: FullTransaction): ParsedTransaction
const baseFilteredLogs = transaction.logs.filter((log) =>
contractTopicFilter(props.contractAddress, props.topics, log),
);

if (baseFilteredLogs.length > 0) {
const parsedLogs = baseFilteredLogs.map((log: LogEntry) => props.parser(log));

Expand Down
2 changes: 1 addition & 1 deletion src/scripts/pull_and_save_tokens_from_transfers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class TokensFromTransfersScraper {
SCAN_END_BLOCK.labels({ type: 'token-scraping', event: eventName }).set(endBlockNumber);

const logPullInfo: LogPullInfo = {
address: 'nofilter',
address: null,
fromBlock: startBlockNumber,
toBlock: endBlockNumber,
topics: [TRANSFER_EVENT_TOPIC_0],
Expand Down

0 comments on commit a94583e

Please sign in to comment.