-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add uniswap worldchain trades #6940
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
9fc6f1f
Init dex_worldchain_base_trades
Hosuke 6c0b678
Add worldchain base sources
Hosuke a988237
Fix source
Hosuke a546a19
Add worldchain_docs_block.md
Hosuke 29b678b
Add uniswap_worldchain_base_trades_seed
Hosuke 7a49575
Merge branch 'main' into dex-uniswap-worldchain
jeff-dude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
version: 2 | ||
|
||
models: | ||
- name: dex_worldchain_base_trades | ||
tests: | ||
- check_dex_info_relationship | ||
|
||
- name: uniswap_v3_worldchain_base_trades | ||
meta: | ||
blockchain: worldchain | ||
sector: dex | ||
project: uniswap | ||
contributors: hosuke | ||
config: | ||
tags: [ 'worldchain', 'dex', 'trades', 'uniswap', 'v3' ] | ||
description: "uniswap worldchain v3 base trades" | ||
tests: | ||
- dbt_utils.unique_combination_of_columns: | ||
combination_of_columns: | ||
- tx_hash | ||
- evt_index | ||
- check_dex_base_trades_seed: | ||
seed_file: ref('uniswap_worldchain_base_trades_seed') | ||
filter: | ||
version: 3 |
48 changes: 48 additions & 0 deletions
48
dbt_subprojects/dex/models/trades/worldchain/dex_worldchain_base_trades.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{{ config( | ||
schema = 'dex_worldchain' | ||
, alias = 'base_trades' | ||
, materialized = 'view' | ||
) | ||
}} | ||
|
||
{% set base_models = [ | ||
ref('uniswap_v3_worldchain_base_trades') | ||
] %} | ||
|
||
WITH base_union AS ( | ||
SELECT * | ||
FROM ( | ||
{% for base_model in base_models %} | ||
SELECT | ||
blockchain | ||
, project | ||
, version | ||
, block_month | ||
, block_date | ||
, block_time | ||
, block_number | ||
, token_bought_amount_raw | ||
, token_sold_amount_raw | ||
, token_bought_address | ||
, token_sold_address | ||
, taker | ||
, maker | ||
, project_contract_address | ||
, tx_hash | ||
, evt_index | ||
FROM | ||
{{ base_model }} | ||
{% if not loop.last %} | ||
UNION ALL | ||
{% endif %} | ||
{% endfor %} | ||
) | ||
) | ||
|
||
{{ | ||
add_tx_columns( | ||
model_cte = 'base_union' | ||
, blockchain = 'worldchain' | ||
, columns = ['from', 'to', 'index'] | ||
) | ||
}} |
20 changes: 20 additions & 0 deletions
20
dbt_subprojects/dex/models/trades/worldchain/platforms/uniswap_v3_worldchain_base_trades.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{{ config( | ||
schema = 'uniswap_v3_worldchain' | ||
, alias = 'base_trades' | ||
, materialized = 'incremental' | ||
, file_format = 'delta' | ||
, incremental_strategy = 'merge' | ||
, unique_key = ['tx_hash', 'evt_index'] | ||
, incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')] | ||
) | ||
}} | ||
|
||
{{ | ||
uniswap_compatible_v3_trades( | ||
blockchain = 'worldchain' | ||
, project = 'uniswap' | ||
, version = '3' | ||
, Pair_evt_Swap = source('uniswap_worldchain', 'uniswapv3pool_evt_swap') | ||
, Factory_evt_PoolCreated = source('uniswap_worldchain', 'uniswapv3factory_evt_poolcreated') | ||
) | ||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
3 changes: 3 additions & 0 deletions
3
dbt_subprojects/dex/seeds/trades/uniswap_worldchain_base_trades_seed.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
blockchain,project,version,block_date,tx_hash,evt_index,token_bought_address,token_sold_address,block_number,token_bought_amount_raw,token_sold_amount_raw | ||
worldchain,uniswap,3,2024-10-13,0xf0fb23913be35bde58ff9cd1bde5b4e7e1b89c9fd1ca3e1b68bb3642a3a6826f,15,0x2cfc85d8e48f8eab294be644d9e25c3030863003,0x79a02482a880bce3f13e09da970dc34db4cd24d1,4725968,5115943631049460102,9199756 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
worldchain,uniswap,3,2024-10-13,0xb3bcf7ab7b5d55f0bfbac2bf723c8df074fa237a591639748196af02c73c8b31,5,0x79a02482a880bce3f13e09da970dc34db4cd24d1,0x2cfc85d8e48f8eab294be644d9e25c3030863003,4723857,17630073,10000000000000000000 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
version: 2 | ||
|
||
sources: | ||
- name: uniswap_worldchain | ||
tables: | ||
- name: uniswapv3factory_evt_poolcreated | ||
- name: uniswapv3pool_evt_swap |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uniswap_v3_worldchain_base_trades preview