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

Added Stablebase for Base #7221

Merged
merged 19 commits into from
Dec 4, 2024
Merged
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
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 @@ -12,6 +12,7 @@ SELECT project, name, marketplace_type, x_username
FROM (VALUES
('uniswap', 'Uniswap', 'Direct', 'Uniswap')
, ('pancakeswap', 'PancakeSwap', 'Direct', 'PancakeSwap')
, ('stablebase', 'Stablebase', 'Direct', 'stablebase_org')
, ('curve', 'Curve', 'Direct', 'CurveFinance')
, ('sushiswap', 'SushiSwap', 'Direct', 'SushiSwap')
, ('mdex', 'Mdex', 'Direct', 'Mdextech')
Expand Down
18 changes: 18 additions & 0 deletions dbt_subprojects/dex/models/trades/base/_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,24 @@ models:
seed_file: ref('aerodrome_base_base_trades_seed')


- name: stablebase_base_base_trades
meta:
blockchain: base
sector: dex
project: stablebase
contributors: Princi
config:
tags: [ 'base', 'dex', 'trades', 'stablebase' ]
description: stablebase 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('stablebase_base_base_trades_seed')


- name: sushiswap_v1_base_base_trades
meta:
blockchain: base
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
ref('uniswap_v3_base_base_trades')
, ref('sushiswap_v1_base_base_trades')
, ref('sushiswap_v2_base_base_trades')
, ref('stablebase_base_base_trades')
, ref('aerodrome_base_base_trades')
, ref('pancakeswap_v2_base_base_trades')
, ref('pancakeswap_v3_base_base_trades')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{{ config(
schema = 'stablebase',
jeff-dude marked this conversation as resolved.
Show resolved Hide resolved
alias = 'token_swap_events',
jeff-dude marked this conversation as resolved.
Show resolved Hide resolved
partition_by = ['block_month'],
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index']
) }}

WITH token_swaps AS (
SELECT
evt_block_number AS block_number,
evt_block_time AS block_time,
evt_tx_from AS maker,
evt_tx_to AS taker,
tokensSold AS token_sold_amount_raw,
tokensBought AS token_bought_amount_raw,
soldId AS token_sold_id,
boughtId AS token_bought_id,
PatelPrinci marked this conversation as resolved.
Show resolved Hide resolved
contract_address AS project_contract_address,
evt_tx_hash AS tx_hash,
evt_index AS evt_index
FROM
{{ source('stablebase_base', 'SwapFlashLoan_evt_TokenSwap') }}
{% if is_incremental() %}
WHERE
{{ incremental_predicate('evt_block_time') }}
{% endif %}
)

SELECT
'base' AS blockchain,
'stablebase' AS project,
'1' AS version,
CAST(date_trunc('month', token_swaps.block_time) AS date) AS block_month,
CAST(date_trunc('day', token_swaps.block_time) AS date) AS block_date,
token_swaps.block_time,
token_swaps.block_number,
token_swaps.token_sold_amount_raw,
token_swaps.token_bought_amount_raw,
token_swaps.token_sold_id,
token_swaps.token_bought_id,
jeff-dude marked this conversation as resolved.
Show resolved Hide resolved
token_swaps.maker,
token_swaps.taker,
token_swaps.project_contract_address,
token_swaps.tx_hash,
token_swaps.evt_index
FROM
token_swaps
Loading
Loading