Skip to content

Add integration test for wildcard indexing with filters#197

Merged
JonoPrest merged 2 commits into
mainfrom
jp/wildcard-test
Sep 16, 2024
Merged

Add integration test for wildcard indexing with filters#197
JonoPrest merged 2 commits into
mainfrom
jp/wildcard-test

Conversation

@JonoPrest

Copy link
Copy Markdown
Collaborator

No description provided.

Comment on lines +262 to +272
let topicSelections = switch topic0sGrouped {
| [] => topicSelectionWithFilters
| topic0sGrouped =>
[
LogSelection.makeTopicSelection(~topic0=topic0sGrouped)->Utils.unwrapResultExn,
]->Belt.Array.concat(topicSelectionWithFilters)
}

{
isWildcard,
topicSelections: Belt.Array.concat(topicSelectionWithFilters, [topicSelectionNoFilters]),
topicSelections,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a bug I picked up during the test. When there are filters selected this threw an error because it would try and create a topic selection with no topic0s

Comment on lines +3 to +19
const DAI_ADDRESS = "0x6B175474E89094C44Da98b954EedeAC495271d0F";
UniswapV3Factory.PoolCreated.handler(
async ({ event, context }) => {
context.PoolCreated.set({
id: event.transaction.hash + event.logIndex.toString(),
token0: event.params.token0,
token1: event.params.token1,
fee: event.params.fee,
tickSpacing: event.params.tickSpacing,
pool: event.params.pool,
});
},
{
wildcard: true,
eventFilters: [{ token0: DAI_ADDRESS }, { token1: DAI_ADDRESS }],
},
);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm quite boolish on this 🐮, feels super powerful

@JonoPrest JonoPrest requested a review from DZakh September 13, 2024 13:38

@DZakh DZakh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@JonoPrest JonoPrest enabled auto-merge (squash) September 16, 2024 08:58
@JonoPrest JonoPrest merged commit 68ef8ee into main Sep 16, 2024
@JonoPrest JonoPrest deleted the jp/wildcard-test branch September 16, 2024 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants