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

Adding shadow to dex.trades on sonic #7584

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 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
18 changes: 17 additions & 1 deletion dbt_subprojects/dex/models/trades/sonic/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,23 @@ models:
- evt_index
- check_dex_base_trades_seed:
seed_file: ref('wagmi_sonic_base_trades_seed')


- name: shadow_sonic_base_trades
meta:
blockchain: sonic
sector: dex
project: shadow
contributors: discochuck
config:
tags: ['sonic', 'dex', 'trades', 'shadow']
description: "Shadow sonic base trades"
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- tx_hash
- evt_index
- check_dex_base_trades_seed:
seed_file: ref('shadow_sonic_base_trades_seed')

- name: silverswap_sonic_base_trades
meta:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
ref('beets_sonic_base_trades')
, ref('wagmi_sonic_base_trades')
, ref('equalizer_sonic_base_trades')
, ref('shadow_sonic_base_trades')
, ref('silverswap_sonic_base_trades')
] %}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{{
config(
schema = 'equalizer_sonic',
Hosuke marked this conversation as resolved.
Show resolved Hide resolved
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_v2_trades(
blockchain = 'sonic',
project = 'shadow',
version = '1',
Pair_evt_Swap = source('shadow_sonic', 'Pair_evt_Swap'),
Factory_evt_PairCreated = source('shadow_sonic', 'Core_PairFactory_evt_PairCreated')
)
}}

{{
uniswap_compatible_v3_trades(
blockchain = 'sonic',
project = 'shadow',
version = '3',
Pair_evt_Swap = source('shadow_sonic', 'RamsesV3Pool_evt_Swap'),
Factory_evt_PoolCreated = source('shadow_sonic', 'RamsesV3Factory_evt_PoolCreated')
)
}}
Copy link
Collaborator

Choose a reason for hiding this comment

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

We may need to split this part into 2 spells.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so like shadow_sonic_base_trades_v1.sql and shadow_sonic_base_trades_v3.sql ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll take a look at snipping out the v2 bits since a majority of the volume goes through v3 pools.

and then double back and do another one of these for the v2.

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 @@ -4819,3 +4819,18 @@ seeds:
token_bought_amount_raw: uint256
token_sold_amount_raw: uint256
block_date: timestamp

- name: shadow_sonic_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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
blockchain,project,version,block_month,block_date,block_time,block_number,token_sold_amount_raw,token_bought_amount_raw,token_sold_address,token_bought_address,tx_hash,evt_index
sonic,shadow,1,2025-01-01 00:00,2025-01-16 00:00,2025-01-16 00:25,4074192,5000000000000000000,342625313575091371,0x039e2fb66102314ce7b64ce5ce3e5183bc94ad38,0x3333b97138d4b086720b5ae8a7844b1345a33333,0xe1f2af42b3146ba103604d38c04b69c5f7e9dcdc6cf30fe55779a9e3a7e1eec5,3
discochuck marked this conversation as resolved.
Show resolved Hide resolved
sonic,shadow,3,2025-01-01 00:00,2025-01-24 00:00,2025-01-24 14:34,5266265,151051097278346452,900000000000000000000,0x50c42dEAcD8Fc9773493ED674b675bE577f2634b,0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38,0x7b9c8c8eb8d384b892be64f8ce461b20575a327a15a3c64e8b010a3bd0f343a8,0
Copy link
Collaborator

@Hosuke Hosuke Feb 1, 2025

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

will check it out on Monday!

thx @Hosuke

Copy link
Contributor Author

Choose a reason for hiding this comment

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

looks like I managed to get the seed sorted, I think.
image

Now I'm stuck on: Failure in test check_dex_info_relationship_dex_sonic_base_trades_
which when I run the associated query: select * from hive.test_schema.git_dunesql_74bbc6d_check_dex_info_relationship_dex_sonic_base_trades_

it returns "shadow" as missing dex info.

Failure in test check_dex_info_relationship_dex_sonic_base_trades_ (models/trades/sonic/_schema.yml)

I thought there was an entry for shadow in the _schema.yml file, but really I'm just out of my depth here.

8 changes: 7 additions & 1 deletion sources/_sector/dex/trades/sonic/_sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,10 @@ sources:
- name: silverswap_sonic
tables:
- name: AlgebraFactory_evt_Pool
- name: AlgebraPool_evt_Swap
- name: AlgebraPool_evt_Swap
- name: shadow_sonic
tables:
- name: Pair_evt_Swap
- name: Core_PairFactory_evt_PairCreated
- name: RamsesV3Pool_evt_Swap
- name: RamsesV3Factory_evt_PoolCreated
Loading