Skip to content

Commit

Permalink
Merge branch 'main' into net_transfers_arbitrum
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff-dude authored Jan 24, 2025
2 parents 979ae0d + 8b3fdb2 commit a11eb8a
Show file tree
Hide file tree
Showing 65 changed files with 1,001 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ with
transfer_combined as (
select * from {{ ref('nexusmutual_ethereum_capital_pool_transfers') }}
where block_time >= timestamp '2019-05-23'
and 1=1 -- dummy condition to trigger re-run
),

lido_oracle as (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,3 +122,4 @@ from transfer_nxmty_in
union all
select block_time, block_number, block_date, transfer_type, symbol, amount, contract_address, unique_key, tx_hash
from transfer_nxmty_out
where 1=1 -- dummy condition to trigger re-run
1 change: 1 addition & 0 deletions dbt_subprojects/dex/models/dex_info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ FROM (VALUES
, ('yaka', 'yaka', 'Direct', 'YakaFinance')
, ('klay_swap', 'KLAYswap', 'Direct', 'KLAYswap')
, ('neopin', 'neopin', 'Direct', 'NeopinOfficial')
, ('otsea', 'OTSea', 'Direct', 'otseaERC20')
, ('kaia_swap', 'KaiaSwap', 'Direct', 'KaiaSwap')
, ('defi_kingdoms', 'DeFi Kingdoms', 'Direct', 'DeFiKingdoms')
, ('hyperjump', 'HyperJump', 'Direct', 'Hyperjump_fi')
Expand Down
3 changes: 3 additions & 0 deletions dbt_subprojects/dex/models/trades/arbitrum/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ models:
- name: dex_arbitrum_base_trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: uniswap_v3_arbitrum_base_trades
meta:
Expand Down
3 changes: 3 additions & 0 deletions dbt_subprojects/dex/models/trades/avalanche_c/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ models:
- name: dex_avalanche_c_base_trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: uniswap_v3_avalanche_c_base_trades
meta:
Expand Down
22 changes: 21 additions & 1 deletion dbt_subprojects/dex/models/trades/base/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ models:
- name: dex_base_base_trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: uniswap_v3_base_base_trades
meta:
Expand Down Expand Up @@ -1042,6 +1045,23 @@ models:
- check_dex_base_trades_seed:
seed_file: ref('akronswap_base_base_trades_seed')

- name: otsea_base_base_trades
meta:
blockchain: base
sector: dex
project: otsea
contributors: princi
config:
tags: [ 'base', 'dex', 'trades', 'otsea' ]
description: "otsea base 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('otsea_base_base_trades_seed')

- name: jojo_base_base_trades
meta:
blockchain: base
Expand All @@ -1057,4 +1077,4 @@ models:
- tx_hash
- evt_index
- check_dex_base_trades_seed:
seed_file: ref('jojo_base_base_trades_seed')
seed_file: ref('jojo_base_base_trades_seed')
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
, ref('flashliquidity_base_base_trades')
, ref('akronswap_base_base_trades')
, ref('jojo_base_base_trades')
, ref('otsea_base_base_trades')
] %}

WITH base_union AS (
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
{{ config(
schema = 'otsea_base',
alias = 'base_trades',
partition_by = ['block_month'],
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
unique_key = ['tx_hash', 'evt_index']
) }}

WITH token_swaps AS (
SELECT
evt_block_number AS block_number,
CAST(evt_block_time AS timestamp(3) with time zone) AS block_time,
evt_tx_from AS maker,
evt_tx_to AS taker,
swapped AS token_sold_amount_raw,
received AS token_bought_amount_raw,
CAST(token AS varbinary) AS token_sold_address,
0x0000000000000000000000000000000000000000 AS token_bought_address,
contract_address AS project_contract_address,
evt_tx_hash AS tx_hash,
evt_index AS evt_index
FROM
{{ source('otsea_base', 'OTSeaV2_evt_SwappedTokensForETH') }}
{% if is_incremental() %}
WHERE
{{ incremental_predicate('evt_block_time') }}
{% endif %}
),
eth_swaps AS (
SELECT
evt_block_number AS block_number,
CAST(evt_block_time AS timestamp(3) with time zone) AS block_time,
evt_tx_from AS maker,
evt_tx_to AS taker,
swapped AS token_sold_amount_raw,
received AS token_bought_amount_raw,
0x0000000000000000000000000000000000000000 AS token_sold_address,
CAST(token AS varbinary) AS token_bought_address,
contract_address AS project_contract_address,
evt_tx_hash AS tx_hash,
evt_index AS evt_index
FROM
{{ source('otsea_base', 'OTSeaV2_evt_SwappedETHForTokens') }}
{% if is_incremental() %}
WHERE
{{ incremental_predicate('evt_block_time') }}
{% endif %}
)

SELECT
'base' AS blockchain,
'otsea' AS project,
'1' AS version,
CAST(date_trunc('month', block_time) AS date) AS block_month,
CAST(date_trunc('day', block_time) AS date) AS block_date,
block_time,
block_number,
token_sold_amount_raw,
token_bought_amount_raw,
token_sold_address,
token_bought_address,
maker,
taker,
project_contract_address,
tx_hash,
evt_index
FROM
token_swaps
UNION ALL
SELECT
'base' AS blockchain,
'otsea' AS project,
'1' AS version,
CAST(date_trunc('month', block_time) AS date) AS block_month,
CAST(date_trunc('day', block_time) AS date) AS block_date,
block_time,
block_number,
token_sold_amount_raw,
token_bought_amount_raw,
token_sold_address,
token_bought_address,
maker,
taker,
project_contract_address,
tx_hash,
evt_index
FROM
eth_swaps
3 changes: 3 additions & 0 deletions dbt_subprojects/dex/models/trades/blast/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ models:
- name: dex_blast_base_trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: uniswap_v3_blast_base_trades
meta:
Expand Down
3 changes: 3 additions & 0 deletions dbt_subprojects/dex/models/trades/bnb/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ models:
- name: dex_bnb_base_trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: uniswap_v3_bnb_base_trades
meta:
Expand Down
3 changes: 3 additions & 0 deletions dbt_subprojects/dex/models/trades/boba/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ models:
- name: dex_boba_base_trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: icecreamswap_boba_base_trades
meta:
Expand Down
3 changes: 3 additions & 0 deletions dbt_subprojects/dex/models/trades/celo/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ models:
- name: dex_celo_base_trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: uniswap_v3_celo_base_trades
meta:
Expand Down
3 changes: 3 additions & 0 deletions dbt_subprojects/dex/models/trades/ethereum/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ models:
- name: dex_ethereum_base_trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: uniswap_v1_ethereum_base_trades
meta:
Expand Down
3 changes: 3 additions & 0 deletions dbt_subprojects/dex/models/trades/fantom/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ models:
- name: dex_fantom_base_trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: sushiswap_v1_fantom_base_trades
meta:
Expand Down
3 changes: 3 additions & 0 deletions dbt_subprojects/dex/models/trades/flare/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ models:
Flare DEX trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: enosys_v2_flare_base_trades
meta:
Expand Down
3 changes: 3 additions & 0 deletions dbt_subprojects/dex/models/trades/gnosis/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ models:
- name: dex_gnosis_base_trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: sushiswap_v1_gnosis_base_trades
meta:
Expand Down
3 changes: 3 additions & 0 deletions dbt_subprojects/dex/models/trades/kaia/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ models:
- name: dex_kaia_base_trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: dragon_swap_v2_kaia_base_trades
meta:
Expand Down
3 changes: 3 additions & 0 deletions dbt_subprojects/dex/models/trades/linea/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ models:
- name: dex_linea_base_trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: sushiswap_v2_linea_base_trades
meta:
Expand Down
3 changes: 3 additions & 0 deletions dbt_subprojects/dex/models/trades/mantle/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ models:
- name: dex_mantle_base_trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: merchant_moe_mantle_base_trades
meta:
Expand Down
3 changes: 3 additions & 0 deletions dbt_subprojects/dex/models/trades/nova/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ models:
- name: dex_nova_base_trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: sushiswap_nova_base_trades
meta:
Expand Down
3 changes: 3 additions & 0 deletions dbt_subprojects/dex/models/trades/optimism/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ models:
- name: dex_optimism_base_trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: uniswap_v3_optimism_base_trades
meta:
Expand Down
3 changes: 3 additions & 0 deletions dbt_subprojects/dex/models/trades/polygon/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ models:
- name: dex_polygon_base_trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: uniswap_v3_polygon_base_trades
meta:
Expand Down
3 changes: 3 additions & 0 deletions dbt_subprojects/dex/models/trades/ronin/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ models:
- name: dex_ronin_base_trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: katana_v2_ronin_base_trades
meta:
Expand Down
3 changes: 3 additions & 0 deletions dbt_subprojects/dex/models/trades/scroll/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ models:
- name: dex_scroll_base_trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: uniswap_v3_scroll_base_trades
meta:
Expand Down
3 changes: 3 additions & 0 deletions dbt_subprojects/dex/models/trades/sei/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ models:
- name: dex_sei_base_trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: jelly_swap_sei_base_trades
meta:
Expand Down
20 changes: 20 additions & 0 deletions dbt_subprojects/dex/models/trades/sonic/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ models:
- name: dex_sonic_base_trades
data_tests:
- check_dex_info_relationship
- test_acceptable_usd_amount:
column_name: amount_usd
max_value: 1000000000

- name: beets_sonic_base_trades
meta:
Expand All @@ -22,6 +25,23 @@ models:
- check_dex_base_trades_seed:
seed_file: ref('beets_sonic_base_trades_seed')

- name: equalizer_sonic_base_trades
meta:
blockchain: sonic
sector: dex
project: equalizer
contributors: IrishLatte_19
config:
tags: ['sonic', 'dex', 'trades', 'equalizer']
description: "Equalizer 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('equalizer_sonic_base_trades_seed')

- name: wagmi_sonic_base_trades
meta:
blockchain: sonic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{% set base_models = [
ref('beets_sonic_base_trades')
, ref('wagmi_sonic_base_trades')
, ref('equalizer_sonic_base_trades')
] %}

WITH base_union AS (
Expand Down
Loading

0 comments on commit a11eb8a

Please sign in to comment.