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

Add uniswap worldchain trades #6940

Merged
merged 6 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dbt_subprojects/dex/models/trades/dex_base_trades.sql
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
, ref('dex_polygon_base_trades')
, ref('dex_scroll_base_trades')
, ref('dex_sei_base_trades')
, ref('dex_worldchain_base_trades')
, ref('dex_zkevm_base_trades')
, ref('dex_zksync_base_trades')
, ref('dex_zora_base_trades')
Expand Down
25 changes: 25 additions & 0 deletions dbt_subprojects/dex/models/trades/worldchain/_schema.yml
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
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

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
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']
)
}}
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')
)
}}
15 changes: 15 additions & 0 deletions dbt_subprojects/dex/seeds/trades/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4171,6 +4171,21 @@ seeds:
token_sold_amount_raw: uint256
block_date: timestamp

- name: uniswap_worldchain_base_trades_seed
config:
column_types:
blockchain: varchar
project: varchar
version: varchar
tx_hash: varbinary
evt_index: uint256
block_number: uint256
token_bought_address: varbinary
token_sold_address: varbinary
token_bought_amount_raw: uint256
token_sold_amount_raw: uint256
block_date: timestamp

- name: sushiswap_zkevm_base_trades_seed
config:
column_types:
Expand Down
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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

7 changes: 7 additions & 0 deletions sources/_sector/dex/trades/worldchain/_sources.yml
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
Loading