Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cowamm/univ2 multichain #48

Merged
merged 6 commits into from
Oct 1, 2024
Merged

Cowamm/univ2 multichain #48

merged 6 commits into from
Oct 1, 2024

Conversation

fleupold
Copy link
Contributor

The curated events tables don't follow a consistent format making it hard to abstract away the chain for different networks. Luckily the logic for indexing base events is very simple and can be done using the raw logs table (which does follow consistent naming.

Changes

  • replace PairCreated, Sync and Swap tables with parsing raw ethereum logs
  • use new cte's for invariant growth and 10k growth queries

Test Plan

We now have reference pool data on Gnosis Chain

image

@@ -17,15 +17,43 @@ with date_range as (
),

-- Finds the uniswap v2 pool address given tokens specified in query parameters (regardless of order)
pool as (
pools as (
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible that a pool is created, then closed, and then created again? If so, i guess this table would pick on all of these created pools. Not sure if it can ever happen but in that case i guess we should pick the latest creation log.

Copy link
Contributor

@harisang harisang Sep 27, 2024

Choose a reason for hiding this comment

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

Ah ok, here you actually assume that there might be more than 1, and this is also why you switched the name to "pools" instead of "pool". I guess i was wondering whether it might be that we are picking on pools that are non-existent anymore, but maybe that's fine.

Copy link
Contributor

@harisang harisang left a comment

Choose a reason for hiding this comment

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

Looks good! Asked one clarifying question but other than that i don't see any problems.

There is some code duplication so we could have the sync and swap events computed in some other subquery but that can be done in another PR, if we think it makes sense.

@fleupold
Copy link
Contributor Author

fleupold commented Oct 1, 2024

Combined the two queries

@fleupold fleupold merged commit 6a84344 into main Oct 1, 2024
1 check failed
@fleupold fleupold deleted the cowamm/univ2_multichain branch October 1, 2024 12:45
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