diff --git a/dbt_macros/shared/balancer/balancer_bpt_prices_macro.sql b/dbt_macros/shared/balancer/balancer_bpt_prices_macro.sql index 92fae3fa1b5..9a0ad174f84 100644 --- a/dbt_macros/shared/balancer/balancer_bpt_prices_macro.sql +++ b/dbt_macros/shared/balancer/balancer_bpt_prices_macro.sql @@ -402,7 +402,7 @@ WITH pool_labels AS ( decimals, APPROX_PERCENTILE(median_price, 0.5) AS price, DATE_TRUNC ('day', next_change) AS next_change - FROM {{ ref('balancer_v3_erc4626_token_prices') }} + FROM {{ source('balancer_v3' , 'erc4626_token_prices') }} WHERE blockchain = '{{blockchain}}' GROUP BY 1, 2, 3, 5 ), diff --git a/dbt_macros/shared/balancer/balancer_liquidity_macro.sql b/dbt_macros/shared/balancer/balancer_liquidity_macro.sql index 0f893a0f561..ee14b2bf6b9 100644 --- a/dbt_macros/shared/balancer/balancer_liquidity_macro.sql +++ b/dbt_macros/shared/balancer/balancer_liquidity_macro.sql @@ -31,10 +31,10 @@ WITH pool_labels AS ( approx_percentile(median_price, 0.5) AS price, sum(sample_size) AS sample_size FROM {{ source('dex', 'prices') }} - WHERE - ('{{blockchain}}' != 'fantom' OR - ('{{blockchain}}' = 'fantom' AND contract_address NOT IN (0xde1e704dae0b4051e80dabb26ab6ad6c12262da0, 0x5ddb92a5340fd0ead3987d3661afcd6104c3b757))) --broken price feeds - AND blockchain = '{{blockchain}}' + WHERE + (('{{blockchain}}' = 'sonic' AND contract_address != 0x039e2fb66102314ce7b64ce5ce3e5183bc94ad38) + OR ('{{blockchain}}' = 'fantom' AND contract_address NOT IN (0xde1e704dae0b4051e80dabb26ab6ad6c12262da0, 0x5ddb92a5340fd0ead3987d3661afcd6104c3b757))) + AND blockchain = '{{blockchain}}' GROUP BY 1, 2 HAVING sum(sample_size) > 3 ), @@ -339,10 +339,10 @@ WITH pool_labels AS ( approx_percentile(median_price, 0.5) AS price, sum(sample_size) AS sample_size FROM {{ source('dex', 'prices') }} - WHERE - ('{{blockchain}}' != 'fantom' OR - ('{{blockchain}}' = 'fantom' AND contract_address NOT IN (0xde1e704dae0b4051e80dabb26ab6ad6c12262da0, 0x5ddb92a5340fd0ead3987d3661afcd6104c3b757))) --broken price feeds - AND blockchain = '{{blockchain}}' + WHERE + (('{{blockchain}}' = 'sonic' AND contract_address != 0x039e2fb66102314ce7b64ce5ce3e5183bc94ad38) + OR ('{{blockchain}}' = 'fantom' AND contract_address NOT IN (0xde1e704dae0b4051e80dabb26ab6ad6c12262da0, 0x5ddb92a5340fd0ead3987d3661afcd6104c3b757))) + AND blockchain = '{{blockchain}}' GROUP BY 1, 2 HAVING sum(sample_size) > 3 ), @@ -394,7 +394,7 @@ WITH pool_labels AS ( decimals, APPROX_PERCENTILE(median_price, 0.5) AS price, DATE_TRUNC ('day', next_change) AS next_change - FROM {{ ref('balancer_v3_erc4626_token_prices') }} + FROM {{ source('balancer_v3' , 'erc4626_token_prices') }} WHERE blockchain = '{{blockchain}}' GROUP BY 1, 2, 3, 5 ), diff --git a/dbt_macros/shared/balancer/balancer_protocol_fee_macro.sql b/dbt_macros/shared/balancer/balancer_protocol_fee_macro.sql index eb5f72e13fb..4abba59002c 100644 --- a/dbt_macros/shared/balancer/balancer_protocol_fee_macro.sql +++ b/dbt_macros/shared/balancer/balancer_protocol_fee_macro.sql @@ -31,12 +31,15 @@ WITH pool_labels AS ( dex_prices_1 AS ( SELECT - date_trunc('day', hour) AS DAY, + date_trunc('day', HOUR) AS DAY, contract_address AS token, approx_percentile(median_price, 0.5) AS price, sum(sample_size) AS sample_size FROM {{ source('dex', 'prices') }} - WHERE blockchain = '{{blockchain}}' + WHERE + (('{{blockchain}}' = 'sonic' AND contract_address != 0x039e2fb66102314ce7b64ce5ce3e5183bc94ad38) + OR ('{{blockchain}}' = 'fantom' AND contract_address NOT IN (0xde1e704dae0b4051e80dabb26ab6ad6c12262da0, 0x5ddb92a5340fd0ead3987d3661afcd6104c3b757))) + AND blockchain = '{{blockchain}}' GROUP BY 1, 2 HAVING sum(sample_size) > 3 ), @@ -146,7 +149,7 @@ WITH pool_labels AS ( WHEN day < DATE '2022-07-03' THEN 0.25 -- veBAL release WHEN day >= DATE '2022-07-03' AND day < DATE '2023-01-23' THEN 0.25 -- BIP 19 WHEN day >= DATE '2023-01-23' AND day < DATE '2023-07-24' THEN 0.35 -- BIP 161 - WHEN day >= DATE '2023-07-24' THEN 0.175 -- BIP 371 + WHEN day >= DATE '2023-07-24' THEN 0.175 -- BIP 371 and BIP 734 END AS treasury_share FROM UNNEST(SEQUENCE(DATE '2022-03-01', CURRENT_DATE, INTERVAL '1' DAY)) AS date(day) ) @@ -155,19 +158,20 @@ WITH pool_labels AS ( SELECT f.day, f.pool_id, - BYTEARRAY_SUBSTRING(f.pool_id,1,20) as pool_address, + BYTEARRAY_SUBSTRING(f.pool_id,1,20) AS pool_address, l.name AS pool_symbol, - '{{version}}' as version, - '{{blockchain}}' as blockchain, + '{{version}}' AS version, + '{{blockchain}}' AS blockchain, l.pool_type, 'v2' AS fee_type, f.token_address, f.token_symbol, - SUM(f.token_amount_raw) as token_amount_raw, - SUM(f.token_amount) as token_amount, - SUM(f.protocol_fee_collected_usd) as protocol_fee_collected_usd, + SUM(f.token_amount_raw) AS token_amount_raw, + SUM(f.token_amount) AS token_amount, + SUM(f.protocol_fee_collected_usd) AS protocol_fee_collected_usd, r.treasury_share, - SUM(f.protocol_fee_collected_usd) * r.treasury_share as treasury_revenue_usd + SUM(f.protocol_fee_collected_usd) * r.treasury_share AS treasury_fee_usd, + SUM(f.protocol_fee_collected_usd) AS lp_fee_collected_usd FROM decorated_protocol_fee f INNER JOIN revenue_share r ON r.day = f.day @@ -212,12 +216,15 @@ WITH pool_labels AS ( dex_prices_1 AS ( SELECT - date_trunc('day', hour) AS DAY, + date_trunc('day', HOUR) AS DAY, contract_address AS token, approx_percentile(median_price, 0.5) AS price, sum(sample_size) AS sample_size FROM {{ source('dex', 'prices') }} - WHERE blockchain = '{{blockchain}}' + WHERE + (('{{blockchain}}' = 'sonic' AND contract_address != 0x039e2fb66102314ce7b64ce5ce3e5183bc94ad38) + OR ('{{blockchain}}' = 'fantom' AND contract_address NOT IN (0xde1e704dae0b4051e80dabb26ab6ad6c12262da0, 0x5ddb92a5340fd0ead3987d3661afcd6104c3b757))) + AND blockchain = '{{blockchain}}' GROUP BY 1, 2 HAVING sum(sample_size) > 3 ), @@ -272,7 +279,7 @@ WITH pool_labels AS ( decimals, APPROX_PERCENTILE(median_price, 0.5) AS price, DATE_TRUNC ('day', next_change) AS next_change - FROM {{ ref('balancer_v3_erc4626_token_prices') }} + FROM {{ source('balancer_v3' , 'erc4626_token_prices') }} WHERE blockchain = '{{blockchain}}' GROUP BY 1, 2, 3, 5 ), @@ -342,12 +349,9 @@ WITH pool_labels AS ( SELECT day, CASE - WHEN day < DATE '2022-07-03' THEN 0.25 -- veBAL release - WHEN day >= DATE '2022-07-03' AND day < DATE '2023-01-23' THEN 0.25 -- BIP 19 - WHEN day >= DATE '2023-01-23' AND day < DATE '2023-07-24' THEN 0.35 -- BIP 161 - WHEN day >= DATE '2023-07-24' THEN 0.175 -- BIP 371 + WHEN day >= DATE '2024-12-01' THEN 0.175 -- BIP 734 END AS treasury_share - FROM UNNEST(SEQUENCE(DATE '2022-03-01', CURRENT_DATE, INTERVAL '1' DAY)) AS date(day) + FROM UNNEST(SEQUENCE(DATE '2024-12-01', CURRENT_DATE, INTERVAL '1' DAY)) AS date(day) ) @@ -366,7 +370,10 @@ WITH pool_labels AS ( SUM(f.token_amount) as token_amount, SUM(f.protocol_fee_collected_usd) as protocol_fee_collected_usd, r.treasury_share, - SUM(f.protocol_fee_collected_usd) * r.treasury_share as treasury_revenue_usd + SUM(f.protocol_fee_collected_usd) * r.treasury_share as treasury_fee_usd, + SUM(CASE WHEN f.fee_type = 'swap_fee' THEN f.protocol_fee_collected_usd + WHEN f.fee_type = 'yield_fee' THEN f.protocol_fee_collected_usd * 9 END) + AS lp_fee_collected_usd FROM decorated_protocol_fee f INNER JOIN revenue_share r ON r.day = f.day diff --git a/dbt_macros/shared/balancer/balancer_token_balance_changes_daily_agg_macro.sql b/dbt_macros/shared/balancer/balancer_token_balance_changes_daily_agg_macro.sql index 2d177e5d182..1c45231acf5 100644 --- a/dbt_macros/shared/balancer/balancer_token_balance_changes_daily_agg_macro.sql +++ b/dbt_macros/shared/balancer/balancer_token_balance_changes_daily_agg_macro.sql @@ -25,8 +25,12 @@ WITH approx_percentile(median_price, 0.5) AS price, sum(sample_size) AS sample_size FROM {{ source('dex', 'prices') }} + WHERE + (('{{blockchain}}' = 'sonic' AND contract_address != 0x039e2fb66102314ce7b64ce5ce3e5183bc94ad38) + OR ('{{blockchain}}' = 'fantom' AND contract_address NOT IN (0xde1e704dae0b4051e80dabb26ab6ad6c12262da0, 0x5ddb92a5340fd0ead3987d3661afcd6104c3b757))) + AND blockchain = '{{blockchain}}' {% if is_incremental() %} - WHERE {{ incremental_predicate('hour') }} + AND {{ incremental_predicate('hour') }} {% endif %} GROUP BY 1, 2 HAVING sum(sample_size) > 3 @@ -212,8 +216,12 @@ WITH approx_percentile(median_price, 0.5) AS price, sum(sample_size) AS sample_size FROM {{ source('dex', 'prices') }} + WHERE + (('{{blockchain}}' = 'sonic' AND contract_address != 0x039e2fb66102314ce7b64ce5ce3e5183bc94ad38) + OR ('{{blockchain}}' = 'fantom' AND contract_address NOT IN (0xde1e704dae0b4051e80dabb26ab6ad6c12262da0, 0x5ddb92a5340fd0ead3987d3661afcd6104c3b757))) + AND blockchain = '{{blockchain}}' {% if is_incremental() %} - WHERE {{ incremental_predicate('hour') }} + AND {{ incremental_predicate('hour') }} {% endif %} GROUP BY 1, 2 HAVING sum(sample_size) > 3 @@ -271,7 +279,7 @@ WITH decimals, APPROX_PERCENTILE(median_price, 0.5) AS price, DATE_TRUNC ('day', next_change) AS next_change - FROM {{ ref('balancer_v3_erc4626_token_prices') }} + FROM {{ source('balancer_v3' , 'erc4626_token_prices') }} WHERE blockchain = '{{blockchain}}' GROUP BY 1, 2, 3, 5 ), diff --git a/dbt_subprojects/daily_spellbook/README.md b/dbt_subprojects/daily_spellbook/README.md index 284f462bfd6..ed24c86402d 100644 --- a/dbt_subprojects/daily_spellbook/README.md +++ b/dbt_subprojects/daily_spellbook/README.md @@ -1,3 +1,3 @@ ## Daily Spellbook -This is a DBT sub project for the the main models of Spellbook that runs on a daily candence. +This is a DBT sub project for the main models of Spellbook that runs on a daily cadence. diff --git a/dbt_subprojects/daily_spellbook/models/_projects/fantasy/fantasy_events.sql b/dbt_subprojects/daily_spellbook/models/_projects/fantasy/fantasy_events.sql index 63233f8b65b..73176afdcff 100644 --- a/dbt_subprojects/daily_spellbook/models/_projects/fantasy/fantasy_events.sql +++ b/dbt_subprojects/daily_spellbook/models/_projects/fantasy/fantasy_events.sql @@ -18,7 +18,7 @@ WITH fantasy_configs AS ( , requiresWhitelist AS whitelist , maxPacksPerAddress AS max_pack_per_address , fixedPrice/POWER(10, 18) AS token_amount - , NULL AS traded_with + , CAST(NULL AS varbinary) AS traded_with , paymentToken AS token_address , maxPacks AS max_packs , cardsPerPack AS cards_per_pack @@ -30,7 +30,7 @@ WITH fantasy_configs AS ( , evt_tx_hash AS tx_hash , evt_index , contract_address - , NULL AS is_wash_trade + , CAST(NULL AS boolean) AS is_wash_trade FROM {{ source('fantasy_blast', 'Minter_evt_NewMintConfig')}} ) @@ -56,15 +56,15 @@ SELECT m.evt_block_time AS block_time , m.firstTokenId+80, m.firstTokenId+81, m.firstTokenId+82, m.firstTokenId+83, m.firstTokenId+84, m.firstTokenId+85, m.firstTokenId+86, m.firstTokenId+87, m.firstTokenId+88, m.firstTokenId+89 , m.firstTokenId+90, m.firstTokenId+91, m.firstTokenId+92, m.firstTokenId+93, m.firstTokenId+94, m.firstTokenId+95, m.firstTokenId+96, m.firstTokenId+97, m.firstTokenId+98, m.firstTokenId+99 ], x -> x <= lastTokenId) AS minted_ids -, NULL AS burned_ids -, NULL AS traded_ids -, NULL AS traded_with +, CAST(NULL AS ARRAY) AS burned_ids +, CAST(NULL AS DOUBLE) AS traded_ids +, CAST(NULL AS varbinary) AS traded_with , m.evt_tx_from AS tx_from , m.evt_tx_to AS tx_to , m.evt_tx_hash AS tx_hash , m.evt_tx_index AS tx_index , m.contract_address -, NULL AS is_wash_trade +, CAST(NULL AS boolean) AS is_wash_trade , 'WETH' AS token_symbol , 0x4300000000000000000000000000000000000004 AS token_address , m.price/POWER(10, 18) AS token_amount @@ -88,21 +88,21 @@ SELECT evt_block_time AS block_time , evt_block_date AS block_date , 'Level Up' AS evt_type , caller AS user_address -, NULL AS whitelist +, CAST(NULL AS boolean) AS whitelist , collection , CAST(1 AS double) AS cards_minted , CAST(cardinality(burntTokenIds) AS double) AS cards_burned , ARRAY[mintedTokenId] AS minted_ids , burntTokenIds AS burned_ids -, NULL AS traded_ids -, NULL AS traded_with +, CAST(NULL AS DOUBLE) AS traded_ids +, CAST(NULL AS varbinary) AS traded_with , evt_tx_from AS tx_from , evt_tx_to AS tx_to , evt_tx_hash AS tx_hash , evt_tx_index AS tx_index , contract_address -, NULL AS is_wash_trade -, NULL AS token_symbol +, CAST(NULL AS boolean) AS is_wash_trade +, CAST(NULL AS varchar) AS token_symbol , CAST(NULL AS varbinary) AS token_address , 0 AS token_amount , 0 AS price_usd @@ -121,21 +121,21 @@ SELECT evt_block_time AS block_time , evt_block_date AS block_date , 'Burn to Draw' AS evt_type , caller AS user_address -, NULL AS whitelist +, CAST(NULL AS boolean) AS whitelist , collection , CAST(cardinality(mintedTokenIds) AS double) AS cards_minted , CAST(cardinality(burntTokenIds) AS double) AS cards_burned , mintedTokenIds AS minted_ids , burntTokenIds AS burned_ids -, NULL AS traded_ids -, NULL AS traded_with +, CAST(NULL AS DOUBLE) AS traded_ids +, CAST(NULL AS varbinary) AS traded_with , evt_tx_from AS tx_from , evt_tx_to AS tx_to , evt_tx_hash AS tx_hash , evt_tx_index AS tx_index , contract_address -, NULL AS is_wash_trade -, NULL AS token_symbol +, CAST(NULL AS boolean) AS is_wash_trade +, CAST(NULL AS varchar) AS token_symbol , CAST(NULL AS varbinary) AS token_address , 0 AS token_amount , 0 AS price_usd @@ -158,8 +158,8 @@ SELECT nftt.block_time , nftt.nft_contract_address AS collection , CAST(0 AS double) AS cards_minted , CAST(0 AS double) AS cards_burned -, NULL AS minted_ids -, NULL AS burned_ids +, CAST(NULL AS ARRAY) AS minted_ids +, CAST(NULL AS ARRAY) AS burned_ids , nftt.token_id AS traded_ids , CASE WHEN nftt.trade_category='Buy' THEN nftt.seller ELSE nftt.buyer END AS traded_with , nftt.tx_from @@ -195,19 +195,19 @@ SELECT block_time , 'Tactics Purchase' AS evt_type , tx_from AS user_address , false AS whitelist -, NULL AS collection +, CAST(NULL AS varbinary) AS collection , CAST(0 AS double) AS cards_minted , CAST(0 AS double) AS cards_burned -, NULL AS minted_ids -, NULL AS burned_ids -, NULL AS traded_ids -, NULL AS traded_with +, CAST(NULL AS ARRAY) AS minted_ids +, CAST(NULL AS ARRAY) AS burned_ids +, CAST(NULL AS DOUBLE) AS traded_ids +, CAST(NULL AS varbinary) AS traded_with , tx_from , tx_to , tx_hash , tx_index -, NULL AS contract_address -, NULL AS is_wash_trade +, CAST(NULL AS varbinary) AS contract_address +, CAST(NULL AS boolean) AS is_wash_trade , symbol AS token_symbol , contract_address AS token_address , amount AS token_amount diff --git a/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/arbitrum/gmx_v2_arbitrum_event_schema.yml b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/arbitrum/gmx_v2_arbitrum_event_schema.yml index 36a4e868118..282257410ac 100644 --- a/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/arbitrum/gmx_v2_arbitrum_event_schema.yml +++ b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/arbitrum/gmx_v2_arbitrum_event_schema.yml @@ -2275,3 +2275,97 @@ models: description: The funding fee amount associated with the update. - name: is_long description: A boolean indicating if the position is a long position (`True` for long, `False` for short). + + - name: gmx_v2_arbitrum_swap_fees_collected + meta: + blockchain: arbitrum + sector: dex + project: gmx + contributors: ai_data_master, gmx-io + config: + tags: ['arbitrum', 'gmx', 'event', 'swap_fee'] + description: | + Processes decoded event data for `SwapFeesCollected` events on the GMX platform across the Arbitrum blockchain. + This model extracts key details such as fee amounts, trade keys, and fee types for analyzing swap fee collection behavior. + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - index + columns: + - *blockchain + - *block_time + - *block_date + - *block_number + - *tx_hash + - *index + - *contract_address + - name: tx_from + description: The address initiating the transaction. + - name: tx_to + description: The recipient address of the transaction. + - name: event_name + description: The name of the event emitted, always `SwapFeesCollected`. + - *msg_sender + - name: ui_fee_receiver + description: The address receiving the UI fee. + - name: market + description: The specific GMX market where the swap occurred. + - name: token + description: The token involved in the swap transaction. + - name: token_price + description: The price of the token at the time of the swap. + - name: fee_receiver_amount + description: The amount received by the fee receiver. + - name: fee_amount_for_pool + description: The amount of fees sent to the pool. + - name: amount_after_fees + description: The amount remaining after fees were deducted. + - name: ui_fee_receiver_factor + description: The factor used to calculate the UI fee. + - name: ui_fee_amount + description: The total UI fee amount deducted from the transaction. + - name: trade_key + description: A unique identifier for the trade. + - name: swap_fee_type + description: The type of fee associated with the swap. + - name: action_type + description: The action performed in the swap event (e.g., deposit, withdrawal, or swap). + + - name: gmx_v2_arbitrum_position_impact_pool_distributed + meta: + blockchain: arbitrum + sector: dex + project: gmx + contributors: ai_data_master, gmx-io + config: + tags: ['arbitrum', 'gmx', 'event', 'position_impact'] + description: | + Processes decoded event data for `PositionImpactPoolDistributed` events on the GMX platform across the Arbitrum blockchain. + This model extracts key details such as distribution amounts and pool impact metrics to analyze the effect of position impact distribution. + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - index + columns: + - *blockchain + - *block_time + - *block_date + - *block_number + - *tx_hash + - *index + - *contract_address + - name: tx_from + description: The address initiating the transaction. + - name: tx_to + description: The recipient address of the transaction. + - name: event_name + description: The name of the event emitted, always `PositionImpactPoolDistributed`. + - *msg_sender + - name: market + description: The specific GMX market where the position impact occurred. + - name: distribution_amount + description: The amount distributed to the impact pool. + - name: next_position_impact_pool_amount + description: The updated position impact pool amount after the event. diff --git a/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/arbitrum/gmx_v2_arbitrum_position_fees_collected.sql b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/arbitrum/gmx_v2_arbitrum_position_fees_collected.sql index 7ef09cf95a9..4beb4de3754 100644 --- a/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/arbitrum/gmx_v2_arbitrum_position_fees_collected.sql +++ b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/arbitrum/gmx_v2_arbitrum_position_fees_collected.sql @@ -302,9 +302,9 @@ WITH evt_data_1 AS ( collateral_token_price_min / POWER(10, 30 - collateral_token_decimals) AS collateral_token_price_min, collateral_token_price_max / POWER(10, 30 - collateral_token_decimals) AS collateral_token_price_max, trade_size_usd / POWER(10, 30) AS trade_size_usd, - funding_fee_amount / POWER(10, collateral_token_decimals + 15) AS funding_fee_amount, - claimable_long_token_amount / POWER(10, long_token_decimals + 15) AS claimable_long_token_amount, - claimable_short_token_amount / POWER(10, short_token_decimals + 15) AS claimable_short_token_amount, + funding_fee_amount / POWER(10, collateral_token_decimals) AS funding_fee_amount, + claimable_long_token_amount / POWER(10, long_token_decimals) AS claimable_long_token_amount, + claimable_short_token_amount / POWER(10, short_token_decimals) AS claimable_short_token_amount, latest_funding_fee_amount_per_size / POWER(10, collateral_token_decimals + 15) AS latest_funding_fee_amount_per_size, latest_long_token_claimable_funding_amount_per_size / POWER(10, long_token_decimals + 15) AS latest_long_token_claimable_funding_amount_per_size, latest_short_token_claimable_funding_amount_per_size / POWER(10, short_token_decimals + 15) AS latest_short_token_claimable_funding_amount_per_size, diff --git a/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/arbitrum/gmx_v2_arbitrum_position_fees_info.sql b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/arbitrum/gmx_v2_arbitrum_position_fees_info.sql index 355dc8b647d..f4cb92fae17 100644 --- a/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/arbitrum/gmx_v2_arbitrum_position_fees_info.sql +++ b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/arbitrum/gmx_v2_arbitrum_position_fees_info.sql @@ -303,9 +303,9 @@ WITH evt_data_1 AS ( collateral_token_price_min / POWER(10, 30 - collateral_token_decimals) AS collateral_token_price_min, collateral_token_price_max / POWER(10, 30 - collateral_token_decimals) AS collateral_token_price_max, trade_size_usd / POWER(10, 30) AS trade_size_usd, - funding_fee_amount / POWER(10, collateral_token_decimals + 15) AS funding_fee_amount, - claimable_long_token_amount / POWER(10, long_token_decimals + 15) AS claimable_long_token_amount, - claimable_short_token_amount / POWER(10, short_token_decimals + 15) AS claimable_short_token_amount, + funding_fee_amount / POWER(10, collateral_token_decimals) AS funding_fee_amount, + claimable_long_token_amount / POWER(10, long_token_decimals) AS claimable_long_token_amount, + claimable_short_token_amount / POWER(10, short_token_decimals) AS claimable_short_token_amount, latest_funding_fee_amount_per_size / POWER(10, collateral_token_decimals + 15) AS latest_funding_fee_amount_per_size, latest_long_token_claimable_funding_amount_per_size / POWER(10, long_token_decimals + 15) AS latest_long_token_claimable_funding_amount_per_size, latest_short_token_claimable_funding_amount_per_size / POWER(10, short_token_decimals + 15) AS latest_short_token_claimable_funding_amount_per_size, diff --git a/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/arbitrum/gmx_v2_arbitrum_position_impact_pool_distributed.sql b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/arbitrum/gmx_v2_arbitrum_position_impact_pool_distributed.sql new file mode 100644 index 00000000000..960a35ad7e1 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/arbitrum/gmx_v2_arbitrum_position_impact_pool_distributed.sql @@ -0,0 +1,174 @@ +{{ + config( + schema = 'gmx_v2_arbitrum', + alias = 'position_impact_pool_distributed', + materialized = 'incremental', + unique_key = ['tx_hash', 'index'], + incremental_strategy = 'merge' + ) +}} + +{%- set event_name = 'PositionImpactPoolDistributed' -%} +{%- set blockchain_name = 'arbitrum' -%} + +WITH evt_data_1 AS ( + SELECT + -- Main Variables + '{{ blockchain_name }}' AS blockchain, + evt_block_time AS block_time, + evt_block_number AS block_number, + evt_tx_hash AS tx_hash, + evt_index AS index, + contract_address, + eventName AS event_name, + eventData AS data, + msgSender AS msg_sender + FROM {{ source('gmx_v2_arbitrum','EventEmitter_evt_EventLog1')}} + WHERE eventName = '{{ event_name }}' + {% if is_incremental() %} + AND {{ incremental_predicate('evt_block_time') }} + {% endif %} +) + +, evt_data_2 AS ( + SELECT + -- Main Variables + '{{ blockchain_name }}' AS blockchain, + evt_block_time AS block_time, + evt_block_number AS block_number, + evt_tx_hash AS tx_hash, + evt_index AS index, + contract_address, + eventName AS event_name, + eventData AS data, + msgSender AS msg_sender + FROM {{ source('gmx_v2_arbitrum','EventEmitter_evt_EventLog2')}} + WHERE eventName = '{{ event_name }}' + {% if is_incremental() %} + AND {{ incremental_predicate('evt_block_time') }} + {% endif %} +) + +-- unite 2 tables +, evt_data AS ( + SELECT * + FROM evt_data_1 + UNION ALL + SELECT * + FROM evt_data_2 +) + +, parsed_data AS ( + SELECT + tx_hash, + index, + json_query(data, 'lax $.addressItems' OMIT QUOTES) AS address_items, + json_query(data, 'lax $.uintItems' OMIT QUOTES) AS uint_items + FROM + evt_data +) + +, address_items_parsed AS ( + SELECT + tx_hash, + index, + json_extract_scalar(CAST(item AS VARCHAR), '$.key') AS key_name, + json_extract_scalar(CAST(item AS VARCHAR), '$.value') AS value + FROM + parsed_data, + UNNEST( + CAST(json_extract(address_items, '$.items') AS ARRAY(JSON)) + ) AS t(item) +) + +, uint_items_parsed AS ( + SELECT + tx_hash, + index, + json_extract_scalar(CAST(item AS VARCHAR), '$.key') AS key_name, + json_extract_scalar(CAST(item AS VARCHAR), '$.value') AS value + FROM + parsed_data, + UNNEST( + CAST(json_extract(uint_items, '$.items') AS ARRAY(JSON)) + ) AS t(item) +) + +, combined AS ( + SELECT * + FROM address_items_parsed + UNION ALL + SELECT * + FROM uint_items_parsed +) + +, evt_data_parsed AS ( + SELECT + tx_hash, + index, + + MAX(CASE WHEN key_name = 'market' THEN value END) AS market, + MAX(CASE WHEN key_name = 'distributionAmount' THEN value END) AS distribution_amount, + MAX(CASE WHEN key_name = 'nextPositionImpactPoolAmount' THEN value END) AS next_position_impact_pool_amount + + FROM + combined + GROUP BY tx_hash, index +) + +, event_data AS ( + SELECT + blockchain, + block_time, + block_number, + ED.tx_hash, + ED.index, + contract_address, + event_name, + msg_sender, + + from_hex(market) AS market, + TRY_CAST(distribution_amount AS DOUBLE) AS distribution_amount, + TRY_CAST(next_position_impact_pool_amount AS DOUBLE) AS next_position_impact_pool_amount + + FROM evt_data AS ED + LEFT JOIN evt_data_parsed AS EDP + ON ED.tx_hash = EDP.tx_hash + AND ED.index = EDP.index +) + +, full_data AS ( + SELECT + ED.blockchain, + block_time, + DATE(block_time) AS block_date, + block_number, + tx_hash, + index, + ED.contract_address, + event_name, + msg_sender, + + ED.market, + CASE + WHEN distribution_amount = 0 THEN 0 + ELSE distribution_amount / POWER(10, MD.index_token_decimals) + END AS distribution_amount, + CASE + WHEN next_position_impact_pool_amount = 0 THEN 0 + ELSE next_position_impact_pool_amount / POWER(10, MD.index_token_decimals) + END AS next_position_impact_pool_amount + + FROM event_data AS ED + LEFT JOIN {{ ref('gmx_v2_arbitrum_markets_data') }} AS MD + ON ED.market = MD.market +) + +--can be removed once decoded tables are fully denormalized +{{ + add_tx_columns( + model_cte = 'full_data' + , blockchain = blockchain_name + , columns = ['from', 'to'] + ) +}} \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/arbitrum/gmx_v2_arbitrum_swap_fees_collected.sql b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/arbitrum/gmx_v2_arbitrum_swap_fees_collected.sql new file mode 100644 index 00000000000..025534e9c9e --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/arbitrum/gmx_v2_arbitrum_swap_fees_collected.sql @@ -0,0 +1,220 @@ +{{ + config( + schema = 'gmx_v2_arbitrum', + alias = 'swap_fees_collected', + materialized = 'incremental', + unique_key = ['tx_hash', 'index'], + incremental_strategy = 'merge' + ) +}} + +{%- set event_name = 'SwapFeesCollected' -%} +{%- set blockchain_name = 'arbitrum' -%} + +WITH evt_data_1 AS ( + SELECT + -- Main Variables + '{{ blockchain_name }}' AS blockchain, + evt_block_time AS block_time, + evt_block_number AS block_number, + evt_tx_hash AS tx_hash, + evt_index AS index, + contract_address, + eventName AS event_name, + eventData AS data, + msgSender AS msg_sender + FROM {{ source('gmx_v2_arbitrum','EventEmitter_evt_EventLog1')}} + WHERE eventName = '{{ event_name }}' + {% if is_incremental() %} + AND {{ incremental_predicate('evt_block_time') }} + {% endif %} +) + +, evt_data_2 AS ( + SELECT + -- Main Variables + '{{ blockchain_name }}' AS blockchain, + evt_block_time AS block_time, + evt_block_number AS block_number, + evt_tx_hash AS tx_hash, + evt_index AS index, + contract_address, + eventName AS event_name, + eventData AS data, + msgSender AS msg_sender + FROM {{ source('gmx_v2_arbitrum','EventEmitter_evt_EventLog2')}} + WHERE eventName = '{{ event_name }}' + {% if is_incremental() %} + AND {{ incremental_predicate('evt_block_time') }} + {% endif %} +) + +-- unite 2 tables +, evt_data AS ( + SELECT * + FROM evt_data_1 + UNION ALL + SELECT * + FROM evt_data_2 +) + +, parsed_data AS ( + SELECT + tx_hash, + index, + json_query(data, 'lax $.addressItems' OMIT QUOTES) AS address_items, + json_query(data, 'lax $.uintItems' OMIT QUOTES) AS uint_items, + json_query(data, 'lax $.bytes32Items' OMIT QUOTES) AS bytes32_items + FROM + evt_data +) + +, address_items_parsed AS ( + SELECT + tx_hash, + index, + json_extract_scalar(CAST(item AS VARCHAR), '$.key') AS key_name, + json_extract_scalar(CAST(item AS VARCHAR), '$.value') AS value + FROM + parsed_data, + UNNEST( + CAST(json_extract(address_items, '$.items') AS ARRAY(JSON)) + ) AS t(item) +) + +, uint_items_parsed AS ( + SELECT + tx_hash, + index, + json_extract_scalar(CAST(item AS VARCHAR), '$.key') AS key_name, + json_extract_scalar(CAST(item AS VARCHAR), '$.value') AS value + FROM + parsed_data, + UNNEST( + CAST(json_extract(uint_items, '$.items') AS ARRAY(JSON)) + ) AS t(item) +) + +, bytes32_items_parsed AS ( + SELECT + tx_hash, + index, + json_extract_scalar(CAST(item AS VARCHAR), '$.key') AS key_name, + json_extract_scalar(CAST(item AS VARCHAR), '$.value') AS value + FROM + parsed_data, + UNNEST( + CAST(json_extract(bytes32_items, '$.items') AS ARRAY(JSON)) + ) AS t(item) +) + +, combined AS ( + SELECT * + FROM address_items_parsed + UNION ALL + SELECT * + FROM uint_items_parsed + UNION ALL + SELECT * + FROM bytes32_items_parsed +) + +, evt_data_parsed AS ( + SELECT + tx_hash, + index, + + MAX(CASE WHEN key_name = 'uiFeeReceiver' THEN value END) AS ui_fee_receiver, + MAX(CASE WHEN key_name = 'market' THEN value END) AS market, + MAX(CASE WHEN key_name = 'token' THEN value END) AS token, + + MAX(CASE WHEN key_name = 'tokenPrice' THEN value END) AS token_price, + MAX(CASE WHEN key_name = 'feeReceiverAmount' THEN value END) AS fee_receiver_amount, + MAX(CASE WHEN key_name = 'feeAmountForPool' THEN value END) AS fee_amount_for_pool, + MAX(CASE WHEN key_name = 'amountAfterFees' THEN value END) AS amount_after_fees, + MAX(CASE WHEN key_name = 'uiFeeReceiverFactor' THEN value END) AS ui_fee_receiver_factor, + MAX(CASE WHEN key_name = 'uiFeeAmount' THEN value END) AS ui_fee_amount, + + MAX(CASE WHEN key_name = 'tradeKey' THEN value END) AS trade_key, + MAX(CASE WHEN key_name = 'swapFeeType' THEN value END) AS swap_fee_type + + FROM + combined + GROUP BY tx_hash, index +) + +, event_data AS ( + SELECT + blockchain, + block_time, + block_number, + ED.tx_hash, + ED.index, + contract_address, + event_name, + msg_sender, + + from_hex(ui_fee_receiver) AS ui_fee_receiver, + from_hex(market) AS market, + from_hex(token) AS token, + + TRY_CAST(token_price AS DOUBLE) token_price, + TRY_CAST(fee_receiver_amount AS DOUBLE) fee_receiver_amount, + TRY_CAST(fee_amount_for_pool AS DOUBLE) fee_amount_for_pool, + TRY_CAST(amount_after_fees AS DOUBLE) amount_after_fees, + TRY_CAST(ui_fee_receiver_factor AS DOUBLE) ui_fee_receiver_factor, + TRY_CAST(ui_fee_amount AS DOUBLE) ui_fee_amount, + + from_hex(trade_key) AS trade_key, + from_hex(swap_fee_type) AS swap_fee_type + + FROM evt_data AS ED + LEFT JOIN evt_data_parsed AS EDP + ON ED.tx_hash = EDP.tx_hash + AND ED.index = EDP.index +) + +, full_data AS ( + SELECT + ED.blockchain, + block_time, + DATE(block_time) AS block_date, + block_number, + tx_hash, + index, + ED.contract_address, + event_name, + msg_sender, + + ui_fee_receiver, + market, + ED.token, + + token_price / POWER(10, 30 - ERC20.decimals) AS token_price, + fee_receiver_amount / POWER(10, ERC20.decimals) AS fee_receiver_amount, + fee_amount_for_pool / POWER(10, ERC20.decimals) AS fee_amount_for_pool, + amount_after_fees / POWER(10, ERC20.decimals) AS amount_after_fees, + ui_fee_receiver_factor / POWER(10, 30) AS ui_fee_receiver_factor, + ui_fee_amount / POWER(10, ERC20.decimals) AS ui_fee_amount, + + trade_key, + swap_fee_type, + CASE + WHEN swap_fee_type = 0x39226eb4fed85317aa310fa53f734c7af59274c49325ab568f9c4592250e8cc5 THEN 'deposit' + WHEN swap_fee_type = 0xda1ac8fcb4f900f8ab7c364d553e5b6b8bdc58f74160df840be80995056f3838 THEN 'withdrawal' + WHEN swap_fee_type = 0x7ad0b6f464d338ea140ff9ef891b4a69cf89f107060a105c31bb985d9e532214 THEN 'swap' + END AS action_type + + FROM event_data AS ED + LEFT JOIN {{ ref('gmx_v2_arbitrum_erc20') }} AS ERC20 + ON ED.token = ERC20.contract_address +) + +--can be removed once decoded tables are fully denormalized +{{ + add_tx_columns( + model_cte = 'full_data' + , blockchain = blockchain_name + , columns = ['from', 'to'] + ) +}} \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/avalanche_c/gmx_v2_avalanche_c_event_schema.yml b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/avalanche_c/gmx_v2_avalanche_c_event_schema.yml index f8c25f3763c..1e0c0276163 100644 --- a/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/avalanche_c/gmx_v2_avalanche_c_event_schema.yml +++ b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/avalanche_c/gmx_v2_avalanche_c_event_schema.yml @@ -2275,3 +2275,97 @@ models: description: The funding fee amount associated with the update. - name: is_long description: A boolean indicating if the position is a long position (`True` for long, `False` for short). + + - name: gmx_v2_avalanche_c_swap_fees_collected + meta: + blockchain: avalanche_c + sector: dex + project: gmx + contributors: ai_data_master, gmx-io + config: + tags: ['avalanche_c', 'gmx', 'event', 'swap_fee'] + description: | + Processes decoded event data for `SwapFeesCollected` events on the GMX platform across the Avalanche blockchain. + This model extracts key details such as fee amounts, trade keys, and fee types for analyzing swap fee collection behavior. + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - index + columns: + - *blockchain + - *block_time + - *block_date + - *block_number + - *tx_hash + - *index + - *contract_address + - name: tx_from + description: The address initiating the transaction. + - name: tx_to + description: The recipient address of the transaction. + - name: event_name + description: The name of the event emitted, always `SwapFeesCollected`. + - *msg_sender + - name: ui_fee_receiver + description: The address receiving the UI fee. + - name: market + description: The specific GMX market where the swap occurred. + - name: token + description: The token involved in the swap transaction. + - name: token_price + description: The price of the token at the time of the swap. + - name: fee_receiver_amount + description: The amount received by the fee receiver. + - name: fee_amount_for_pool + description: The amount of fees sent to the pool. + - name: amount_after_fees + description: The amount remaining after fees were deducted. + - name: ui_fee_receiver_factor + description: The factor used to calculate the UI fee. + - name: ui_fee_amount + description: The total UI fee amount deducted from the transaction. + - name: trade_key + description: A unique identifier for the trade. + - name: swap_fee_type + description: The type of fee associated with the swap. + - name: action_type + description: The action performed in the swap event (e.g., deposit, withdrawal, or swap). + + - name: gmx_v2_avalanche_c_position_impact_pool_distributed + meta: + blockchain: avalanche_c + sector: dex + project: gmx + contributors: ai_data_master, gmx-io + config: + tags: ['avalanche_c', 'gmx', 'event', 'position_impact'] + description: | + Processes decoded event data for `PositionImpactPoolDistributed` events on the GMX platform across the Avalanche blockchain. + This model extracts key details such as distribution amounts and pool impact metrics to analyze the effect of position impact distribution. + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - index + columns: + - *blockchain + - *block_time + - *block_date + - *block_number + - *tx_hash + - *index + - *contract_address + - name: tx_from + description: The address initiating the transaction. + - name: tx_to + description: The recipient address of the transaction. + - name: event_name + description: The name of the event emitted, always `PositionImpactPoolDistributed`. + - *msg_sender + - name: market + description: The specific GMX market where the position impact occurred. + - name: distribution_amount + description: The amount distributed to the impact pool. + - name: next_position_impact_pool_amount + description: The updated position impact pool amount after the event. diff --git a/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/avalanche_c/gmx_v2_avalanche_c_position_fees_collected.sql b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/avalanche_c/gmx_v2_avalanche_c_position_fees_collected.sql index d138becbf80..850b7d48214 100644 --- a/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/avalanche_c/gmx_v2_avalanche_c_position_fees_collected.sql +++ b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/avalanche_c/gmx_v2_avalanche_c_position_fees_collected.sql @@ -302,9 +302,9 @@ WITH evt_data_1 AS ( collateral_token_price_min / POWER(10, 30 - collateral_token_decimals) AS collateral_token_price_min, collateral_token_price_max / POWER(10, 30 - collateral_token_decimals) AS collateral_token_price_max, trade_size_usd / POWER(10, 30) AS trade_size_usd, - funding_fee_amount / POWER(10, collateral_token_decimals + 15) AS funding_fee_amount, - claimable_long_token_amount / POWER(10, long_token_decimals + 15) AS claimable_long_token_amount, - claimable_short_token_amount / POWER(10, short_token_decimals + 15) AS claimable_short_token_amount, + funding_fee_amount / POWER(10, collateral_token_decimals) AS funding_fee_amount, + claimable_long_token_amount / POWER(10, long_token_decimals) AS claimable_long_token_amount, + claimable_short_token_amount / POWER(10, short_token_decimals) AS claimable_short_token_amount, latest_funding_fee_amount_per_size / POWER(10, collateral_token_decimals + 15) AS latest_funding_fee_amount_per_size, latest_long_token_claimable_funding_amount_per_size / POWER(10, long_token_decimals + 15) AS latest_long_token_claimable_funding_amount_per_size, latest_short_token_claimable_funding_amount_per_size / POWER(10, short_token_decimals + 15) AS latest_short_token_claimable_funding_amount_per_size, diff --git a/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/avalanche_c/gmx_v2_avalanche_c_position_fees_info.sql b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/avalanche_c/gmx_v2_avalanche_c_position_fees_info.sql index 092bf293fdf..4acc7ff834c 100644 --- a/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/avalanche_c/gmx_v2_avalanche_c_position_fees_info.sql +++ b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/avalanche_c/gmx_v2_avalanche_c_position_fees_info.sql @@ -303,9 +303,9 @@ WITH evt_data_1 AS ( collateral_token_price_min / POWER(10, 30 - collateral_token_decimals) AS collateral_token_price_min, collateral_token_price_max / POWER(10, 30 - collateral_token_decimals) AS collateral_token_price_max, trade_size_usd / POWER(10, 30) AS trade_size_usd, - funding_fee_amount / POWER(10, collateral_token_decimals + 15) AS funding_fee_amount, - claimable_long_token_amount / POWER(10, long_token_decimals + 15) AS claimable_long_token_amount, - claimable_short_token_amount / POWER(10, short_token_decimals + 15) AS claimable_short_token_amount, + funding_fee_amount / POWER(10, collateral_token_decimals) AS funding_fee_amount, + claimable_long_token_amount / POWER(10, long_token_decimals) AS claimable_long_token_amount, + claimable_short_token_amount / POWER(10, short_token_decimals) AS claimable_short_token_amount, latest_funding_fee_amount_per_size / POWER(10, collateral_token_decimals + 15) AS latest_funding_fee_amount_per_size, latest_long_token_claimable_funding_amount_per_size / POWER(10, long_token_decimals + 15) AS latest_long_token_claimable_funding_amount_per_size, latest_short_token_claimable_funding_amount_per_size / POWER(10, short_token_decimals + 15) AS latest_short_token_claimable_funding_amount_per_size, diff --git a/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/avalanche_c/gmx_v2_avalanche_c_position_impact_pool_distributed.sql b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/avalanche_c/gmx_v2_avalanche_c_position_impact_pool_distributed.sql new file mode 100644 index 00000000000..abcf3aa54da --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/avalanche_c/gmx_v2_avalanche_c_position_impact_pool_distributed.sql @@ -0,0 +1,174 @@ +{{ + config( + schema = 'gmx_v2_avalanche_c', + alias = 'position_impact_pool_distributed', + materialized = 'incremental', + unique_key = ['tx_hash', 'index'], + incremental_strategy = 'merge' + ) +}} + +{%- set event_name = 'PositionImpactPoolDistributed' -%} +{%- set blockchain_name = 'avalanche_c' -%} + +WITH evt_data_1 AS ( + SELECT + -- Main Variables + '{{ blockchain_name }}' AS blockchain, + evt_block_time AS block_time, + evt_block_number AS block_number, + evt_tx_hash AS tx_hash, + evt_index AS index, + contract_address, + eventName AS event_name, + eventData AS data, + msgSender AS msg_sender + FROM {{ source('gmx_v2_avalanche_c','EventEmitter_evt_EventLog1')}} + WHERE eventName = '{{ event_name }}' + {% if is_incremental() %} + AND {{ incremental_predicate('evt_block_time') }} + {% endif %} +) + +, evt_data_2 AS ( + SELECT + -- Main Variables + '{{ blockchain_name }}' AS blockchain, + evt_block_time AS block_time, + evt_block_number AS block_number, + evt_tx_hash AS tx_hash, + evt_index AS index, + contract_address, + eventName AS event_name, + eventData AS data, + msgSender AS msg_sender + FROM {{ source('gmx_v2_avalanche_c','EventEmitter_evt_EventLog2')}} + WHERE eventName = '{{ event_name }}' + {% if is_incremental() %} + AND {{ incremental_predicate('evt_block_time') }} + {% endif %} +) + +-- unite 2 tables +, evt_data AS ( + SELECT * + FROM evt_data_1 + UNION ALL + SELECT * + FROM evt_data_2 +) + +, parsed_data AS ( + SELECT + tx_hash, + index, + json_query(data, 'lax $.addressItems' OMIT QUOTES) AS address_items, + json_query(data, 'lax $.uintItems' OMIT QUOTES) AS uint_items + FROM + evt_data +) + +, address_items_parsed AS ( + SELECT + tx_hash, + index, + json_extract_scalar(CAST(item AS VARCHAR), '$.key') AS key_name, + json_extract_scalar(CAST(item AS VARCHAR), '$.value') AS value + FROM + parsed_data, + UNNEST( + CAST(json_extract(address_items, '$.items') AS ARRAY(JSON)) + ) AS t(item) +) + +, uint_items_parsed AS ( + SELECT + tx_hash, + index, + json_extract_scalar(CAST(item AS VARCHAR), '$.key') AS key_name, + json_extract_scalar(CAST(item AS VARCHAR), '$.value') AS value + FROM + parsed_data, + UNNEST( + CAST(json_extract(uint_items, '$.items') AS ARRAY(JSON)) + ) AS t(item) +) + +, combined AS ( + SELECT * + FROM address_items_parsed + UNION ALL + SELECT * + FROM uint_items_parsed +) + +, evt_data_parsed AS ( + SELECT + tx_hash, + index, + + MAX(CASE WHEN key_name = 'market' THEN value END) AS market, + MAX(CASE WHEN key_name = 'distributionAmount' THEN value END) AS distribution_amount, + MAX(CASE WHEN key_name = 'nextPositionImpactPoolAmount' THEN value END) AS next_position_impact_pool_amount + + FROM + combined + GROUP BY tx_hash, index +) + +, event_data AS ( + SELECT + blockchain, + block_time, + block_number, + ED.tx_hash, + ED.index, + contract_address, + event_name, + msg_sender, + + from_hex(market) AS market, + TRY_CAST(distribution_amount AS DOUBLE) AS distribution_amount, + TRY_CAST(next_position_impact_pool_amount AS DOUBLE) AS next_position_impact_pool_amount + + FROM evt_data AS ED + LEFT JOIN evt_data_parsed AS EDP + ON ED.tx_hash = EDP.tx_hash + AND ED.index = EDP.index +) + +, full_data AS ( + SELECT + ED.blockchain, + block_time, + DATE(block_time) AS block_date, + block_number, + tx_hash, + index, + ED.contract_address, + event_name, + msg_sender, + + ED.market, + CASE + WHEN distribution_amount = 0 THEN 0 + ELSE distribution_amount / POWER(10, MD.index_token_decimals) + END AS distribution_amount, + CASE + WHEN next_position_impact_pool_amount = 0 THEN 0 + ELSE next_position_impact_pool_amount / POWER(10, MD.index_token_decimals) + END AS next_position_impact_pool_amount + + FROM event_data AS ED + LEFT JOIN {{ ref('gmx_v2_avalanche_c_markets_data') }} AS MD + ON ED.market = MD.market +) + +--can be removed once decoded tables are fully denormalized +{{ + add_tx_columns( + model_cte = 'full_data' + , blockchain = blockchain_name + , columns = ['from', 'to'] + ) +}} \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/avalanche_c/gmx_v2_avalanche_c_swap_fees_collected.sql b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/avalanche_c/gmx_v2_avalanche_c_swap_fees_collected.sql new file mode 100644 index 00000000000..047bbbd064b --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/avalanche_c/gmx_v2_avalanche_c_swap_fees_collected.sql @@ -0,0 +1,220 @@ +{{ + config( + schema = 'gmx_v2_avalanche_c', + alias = 'swap_fees_collected', + materialized = 'incremental', + unique_key = ['tx_hash', 'index'], + incremental_strategy = 'merge' + ) +}} + +{%- set event_name = 'SwapFeesCollected' -%} +{%- set blockchain_name = 'avalanche_c' -%} + +WITH evt_data_1 AS ( + SELECT + -- Main Variables + '{{ blockchain_name }}' AS blockchain, + evt_block_time AS block_time, + evt_block_number AS block_number, + evt_tx_hash AS tx_hash, + evt_index AS index, + contract_address, + eventName AS event_name, + eventData AS data, + msgSender AS msg_sender + FROM {{ source('gmx_v2_avalanche_c','EventEmitter_evt_EventLog1')}} + WHERE eventName = '{{ event_name }}' + {% if is_incremental() %} + AND {{ incremental_predicate('evt_block_time') }} + {% endif %} +) + +, evt_data_2 AS ( + SELECT + -- Main Variables + '{{ blockchain_name }}' AS blockchain, + evt_block_time AS block_time, + evt_block_number AS block_number, + evt_tx_hash AS tx_hash, + evt_index AS index, + contract_address, + eventName AS event_name, + eventData AS data, + msgSender AS msg_sender + FROM {{ source('gmx_v2_avalanche_c','EventEmitter_evt_EventLog2')}} + WHERE eventName = '{{ event_name }}' + {% if is_incremental() %} + AND {{ incremental_predicate('evt_block_time') }} + {% endif %} +) + +-- unite 2 tables +, evt_data AS ( + SELECT * + FROM evt_data_1 + UNION ALL + SELECT * + FROM evt_data_2 +) + +, parsed_data AS ( + SELECT + tx_hash, + index, + json_query(data, 'lax $.addressItems' OMIT QUOTES) AS address_items, + json_query(data, 'lax $.uintItems' OMIT QUOTES) AS uint_items, + json_query(data, 'lax $.bytes32Items' OMIT QUOTES) AS bytes32_items + FROM + evt_data +) + +, address_items_parsed AS ( + SELECT + tx_hash, + index, + json_extract_scalar(CAST(item AS VARCHAR), '$.key') AS key_name, + json_extract_scalar(CAST(item AS VARCHAR), '$.value') AS value + FROM + parsed_data, + UNNEST( + CAST(json_extract(address_items, '$.items') AS ARRAY(JSON)) + ) AS t(item) +) + +, uint_items_parsed AS ( + SELECT + tx_hash, + index, + json_extract_scalar(CAST(item AS VARCHAR), '$.key') AS key_name, + json_extract_scalar(CAST(item AS VARCHAR), '$.value') AS value + FROM + parsed_data, + UNNEST( + CAST(json_extract(uint_items, '$.items') AS ARRAY(JSON)) + ) AS t(item) +) + +, bytes32_items_parsed AS ( + SELECT + tx_hash, + index, + json_extract_scalar(CAST(item AS VARCHAR), '$.key') AS key_name, + json_extract_scalar(CAST(item AS VARCHAR), '$.value') AS value + FROM + parsed_data, + UNNEST( + CAST(json_extract(bytes32_items, '$.items') AS ARRAY(JSON)) + ) AS t(item) +) + +, combined AS ( + SELECT * + FROM address_items_parsed + UNION ALL + SELECT * + FROM uint_items_parsed + UNION ALL + SELECT * + FROM bytes32_items_parsed +) + +, evt_data_parsed AS ( + SELECT + tx_hash, + index, + + MAX(CASE WHEN key_name = 'uiFeeReceiver' THEN value END) AS ui_fee_receiver, + MAX(CASE WHEN key_name = 'market' THEN value END) AS market, + MAX(CASE WHEN key_name = 'token' THEN value END) AS token, + + MAX(CASE WHEN key_name = 'tokenPrice' THEN value END) AS token_price, + MAX(CASE WHEN key_name = 'feeReceiverAmount' THEN value END) AS fee_receiver_amount, + MAX(CASE WHEN key_name = 'feeAmountForPool' THEN value END) AS fee_amount_for_pool, + MAX(CASE WHEN key_name = 'amountAfterFees' THEN value END) AS amount_after_fees, + MAX(CASE WHEN key_name = 'uiFeeReceiverFactor' THEN value END) AS ui_fee_receiver_factor, + MAX(CASE WHEN key_name = 'uiFeeAmount' THEN value END) AS ui_fee_amount, + + MAX(CASE WHEN key_name = 'tradeKey' THEN value END) AS trade_key, + MAX(CASE WHEN key_name = 'swapFeeType' THEN value END) AS swap_fee_type + + FROM + combined + GROUP BY tx_hash, index +) + +, event_data AS ( + SELECT + blockchain, + block_time, + block_number, + ED.tx_hash, + ED.index, + contract_address, + event_name, + msg_sender, + + from_hex(ui_fee_receiver) AS ui_fee_receiver, + from_hex(market) AS market, + from_hex(token) AS token, + + TRY_CAST(token_price AS DOUBLE) token_price, + TRY_CAST(fee_receiver_amount AS DOUBLE) fee_receiver_amount, + TRY_CAST(fee_amount_for_pool AS DOUBLE) fee_amount_for_pool, + TRY_CAST(amount_after_fees AS DOUBLE) amount_after_fees, + TRY_CAST(ui_fee_receiver_factor AS DOUBLE) ui_fee_receiver_factor, + TRY_CAST(ui_fee_amount AS DOUBLE) ui_fee_amount, + + from_hex(trade_key) AS trade_key, + from_hex(swap_fee_type) AS swap_fee_type + + FROM evt_data AS ED + LEFT JOIN evt_data_parsed AS EDP + ON ED.tx_hash = EDP.tx_hash + AND ED.index = EDP.index +) + +, full_data AS ( + SELECT + ED.blockchain, + block_time, + DATE(block_time) AS block_date, + block_number, + tx_hash, + index, + ED.contract_address, + event_name, + msg_sender, + + ui_fee_receiver, + market, + ED.token, + + token_price / POWER(10, 30 - ERC20.decimals) AS token_price, + fee_receiver_amount / POWER(10, ERC20.decimals) AS fee_receiver_amount, + fee_amount_for_pool / POWER(10, ERC20.decimals) AS fee_amount_for_pool, + amount_after_fees / POWER(10, ERC20.decimals) AS amount_after_fees, + ui_fee_receiver_factor / POWER(10, 30) AS ui_fee_receiver_factor, + ui_fee_amount / POWER(10, ERC20.decimals) AS ui_fee_amount, + + trade_key, + swap_fee_type, + CASE + WHEN swap_fee_type = 0x39226eb4fed85317aa310fa53f734c7af59274c49325ab568f9c4592250e8cc5 THEN 'deposit' + WHEN swap_fee_type = 0xda1ac8fcb4f900f8ab7c364d553e5b6b8bdc58f74160df840be80995056f3838 THEN 'withdrawal' + WHEN swap_fee_type = 0x7ad0b6f464d338ea140ff9ef891b4a69cf89f107060a105c31bb985d9e532214 THEN 'swap' + END AS action_type + + FROM event_data AS ED + LEFT JOIN {{ ref('gmx_v2_avalanche_c_erc20') }} AS ERC20 + ON ED.token = ERC20.contract_address +) + +--can be removed once decoded tables are fully denormalized +{{ + add_tx_columns( + model_cte = 'full_data' + , blockchain = blockchain_name + , columns = ['from', 'to'] + ) +}} \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/gmx_v2_event_schema.yml b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/gmx_v2_event_schema.yml index f6783776688..bb3071fcdb7 100644 --- a/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/gmx_v2_event_schema.yml +++ b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/gmx_v2_event_schema.yml @@ -2141,3 +2141,89 @@ models: description: The funding fee amount associated with the update. - name: is_long description: A boolean indicating if the position is a long position (`True` for long, `False` for short). + + - name: gmx_v2_swap_fees_collected + meta: + blockchain: arbitrum, avalanche_c + sector: dex + project: gmx + contributors: ai_data_master, gmx-io + config: + tags: ['arbitrum', 'avalanche_c', 'gmx', 'event', 'swap_fee'] + description: | + Processes decoded event data for `SwapFeesCollected` events on the GMX platform across the Arbitrum and Avalanche blockchains. + This model extracts key details such as fee amounts, trade keys, and fee types for analyzing swap fee collection behavior. + + columns: + - *blockchain + - *block_time + - *block_date + - *block_number + - *tx_hash + - *index + - *contract_address + - name: tx_from + description: The address initiating the transaction. + - name: tx_to + description: The recipient address of the transaction. + - name: event_name + description: The name of the event emitted, always `SwapFeesCollected`. + - *msg_sender + - name: ui_fee_receiver + description: The address receiving the UI fee. + - name: market + description: The specific GMX market where the swap occurred. + - name: token + description: The token involved in the swap transaction. + - name: token_price + description: The price of the token at the time of the swap. + - name: fee_receiver_amount + description: The amount received by the fee receiver. + - name: fee_amount_for_pool + description: The amount of fees sent to the pool. + - name: amount_after_fees + description: The amount remaining after fees were deducted. + - name: ui_fee_receiver_factor + description: The factor used to calculate the UI fee. + - name: ui_fee_amount + description: The total UI fee amount deducted from the transaction. + - name: trade_key + description: A unique identifier for the trade. + - name: swap_fee_type + description: The type of fee associated with the swap. + - name: action_type + description: The action performed in the swap event (e.g., deposit, withdrawal, or swap). + + - name: gmx_v2_position_impact_pool_distributed + meta: + blockchain: arbitrum, avalanche_c + sector: dex + project: gmx + contributors: ai_data_master, gmx-io + config: + tags: ['arbitrum', 'avalanche_c', 'gmx', 'event', 'position_impact'] + description: | + Processes decoded event data for `PositionImpactPoolDistributed` events on the GMX platform across the Arbitrum and Avalanche blockchains. + This model extracts key details such as distribution amounts and pool impact metrics to analyze the effect of position impact distribution. + + columns: + - *blockchain + - *block_time + - *block_date + - *block_number + - *tx_hash + - *index + - *contract_address + - name: tx_from + description: The address initiating the transaction. + - name: tx_to + description: The recipient address of the transaction. + - name: event_name + description: The name of the event emitted, always `PositionImpactPoolDistributed`. + - *msg_sender + - name: market + description: The specific GMX market where the position impact occurred. + - name: distribution_amount + description: The amount distributed to the impact pool. + - name: next_position_impact_pool_amount + description: The updated position impact pool amount after the event. \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/gmx_v2_position_impact_pool_distributed.sql b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/gmx_v2_position_impact_pool_distributed.sql new file mode 100644 index 00000000000..377bece5a54 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/gmx_v2_position_impact_pool_distributed.sql @@ -0,0 +1,36 @@ +{{ config( + schema='gmx_v2', + alias = 'position_impact_pool_distributed', + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c"]\', + spell_type = "project", + spell_name = "gmx", + contributors = \'["ai_data_master","gmx-io"]\') }}' + ) +}} + +{%- set chains = [ + 'arbitrum', + 'avalanche_c', +] -%} + +{%- for chain in chains -%} +SELECT + blockchain, + block_time, + block_date, + block_number, + tx_hash, + index, + contract_address, + tx_from, + tx_to, + event_name, + msg_sender, + market, + distribution_amount, + next_position_impact_pool_amount +FROM {{ ref('gmx_v2_' ~ chain ~ '_position_impact_pool_distributed') }} +{% if not loop.last %} +UNION ALL +{% endif %} +{%- endfor -%} \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/gmx_v2_swap_fees_collected.sql b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/gmx_v2_swap_fees_collected.sql new file mode 100644 index 00000000000..5d262d41967 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_projects/gmx/event/gmx_v2_swap_fees_collected.sql @@ -0,0 +1,45 @@ +{{ config( + schema='gmx_v2', + alias = 'swap_fees_collected', + post_hook='{{ expose_spells(blockchains = \'["arbitrum", "avalanche_c"]\', + spell_type = "project", + spell_name = "gmx", + contributors = \'["ai_data_master","gmx-io"]\') }}' + ) +}} + +{%- set chains = [ + 'arbitrum', + 'avalanche_c', +] -%} + +{%- for chain in chains -%} +SELECT + blockchain, + block_time, + block_date, + block_number, + tx_hash, + index, + contract_address, + tx_from, + tx_to, + event_name, + msg_sender, + ui_fee_receiver, + market, + token, + token_price, + fee_receiver_amount, + fee_amount_for_pool, + amount_after_fees, + ui_fee_receiver_factor, + ui_fee_amount, + trade_key, + swap_fee_type, + action_type +FROM {{ ref('gmx_v2_' ~ chain ~ '_swap_fees_collected') }} +{% if not loop.last %} +UNION ALL +{% endif %} +{%- endfor -%} \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/dex/pools/optimism/uniswap/_schema.yml b/dbt_subprojects/daily_spellbook/models/_sector/dex/pools/optimism/uniswap/_schema.yml new file mode 100644 index 00000000000..c6eecee085d --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_sector/dex/pools/optimism/uniswap/_schema.yml @@ -0,0 +1,17 @@ +version: 2 + +models: + - name: uniswap_pools_optimism_balances + description: "Tracks OP token balances in Uniswap pools on Optimism." + meta: + blockchain: optimism + sector: DEX + project: uniswap + contributors: jason + config: + tags: ['optimism', 'op_token', 'balances', 'uniswap','pools'] + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - pool_address + - snapshot_day \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/dex/pools/optimism/uniswap/uniswap_pools_optimism_balances.sql b/dbt_subprojects/daily_spellbook/models/_sector/dex/pools/optimism/uniswap/uniswap_pools_optimism_balances.sql new file mode 100644 index 00000000000..0d87929022f --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_sector/dex/pools/optimism/uniswap/uniswap_pools_optimism_balances.sql @@ -0,0 +1,47 @@ +{{ + config( + schema = 'uniswap_pools_optimism', + alias = 'balances', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['pool_address', 'snapshot_day'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.snapshot_day')] + ) +}} + +with op_addresses as ( + select + pool as address, + token0, + token1, + 0x4200000000000000000000000000000000000042 as token_address, + fee as fee_tier, + creation_block_time as creation_time + from + {{ source('uniswap_v3_optimism', 'pools') }} + where + token0 = 0x4200000000000000000000000000000000000042 + or token1 = 0x4200000000000000000000000000000000000042 +), + +filtered_balances as ( + {{ balances_incremental_subset_daily( + blockchain='optimism', + start_date='2021-11-11', + address_token_list = 'op_addresses' + ) }} +) + +select + p.address as pool_address, + p.token0 as token0, + p.token1 as token1, + p.fee_tier, + p.creation_time, + coalesce(b.balance, 0) as op_balance, + coalesce(b.day, current_date) as snapshot_day +from + filtered_balances b +left join + op_addresses p on b.address = p.address \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges.sql similarity index 64% rename from dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges.sql rename to dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges.sql index cf8e359cbde..92b41dc3d1a 100644 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges.sql +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges.sql @@ -1,20 +1,19 @@ {{config( - - alias = 'balancer_v2_gauges', + alias = 'balancer_gauges', post_hook='{{ expose_spells(\'["ethereum", "arbitrum", "optimism", "polygon", "avalanche_c", "base", "gnosis", "zkevm"]\', "sector", "labels", \'["jacektrocinski", "viniabussafi"]\') }}')}} {% set gauges_models = [ - ref('labels_balancer_v2_gauges_ethereum') - , ref('labels_balancer_v2_gauges_polygon') - , ref('labels_balancer_v2_gauges_arbitrum') - , ref('labels_balancer_v2_gauges_optimism') - , ref('labels_balancer_v2_gauges_avalanche_c') - , ref('labels_balancer_v2_gauges_base') - , ref('labels_balancer_v2_gauges_gnosis') - , ref('labels_balancer_v2_gauges_zkevm') + ref('labels_balancer_gauges_ethereum') + , ref('labels_balancer_gauges_polygon') + , ref('labels_balancer_gauges_arbitrum') + , ref('labels_balancer_gauges_optimism') + , ref('labels_balancer_gauges_avalanche_c') + , ref('labels_balancer_gauges_base') + , ref('labels_balancer_gauges_gnosis') + , ref('labels_balancer_gauges_zkevm') ] %} SELECT * diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_arbitrum.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_arbitrum.sql similarity index 56% rename from dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_arbitrum.sql rename to dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_arbitrum.sql index 9319de28db5..bf112cadb9f 100644 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_arbitrum.sql +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_arbitrum.sql @@ -1,6 +1,5 @@ {{config( - - alias = 'balancer_v2_gauges_arbitrum', + alias = 'balancer_gauges_arbitrum', post_hook='{{ expose_spells(\'["arbitrum"]\', "sector", "labels", @@ -13,12 +12,12 @@ SELECT distinct pools.address AS pool_address, streamer.gauge AS child_gauge_address, 'arb:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_arbitrum' AS model_name, + 'balancer_gauges_arbitrum' AS model_name, 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'ArbitrumRootGaugeFactory_evt_ArbitrumRootGaugeCreated') }} gauge @@ -34,12 +33,12 @@ SELECT distinct pools.address AS pool_address, streamer.gauge AS child_gauge_address, 'arb:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_arbitrum' AS model_name, + 'balancer_gauges_arbitrum' AS model_name, 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'CappedArbitrumRootGaugeFactory_evt_GaugeCreated') }} gauge @@ -55,46 +54,104 @@ SELECT distinct pools.address AS pool_address, child.output_0 AS child_gauge_address, 'arb:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_arbitrum' AS model_name, + 'balancer_gauges_arbitrum' AS model_name, 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'CappedArbitrumRootGaugeFactory_call_create') }} call LEFT JOIN {{ source('balancer_arbitrum', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient LEFT JOIN {{ source('labels', 'balancer_v2_pools_arbitrum') }} pools ON pools.address = child.pool), gauges AS( -SELECT * FROM reward_gauges -WHERE name IS NOT NULL -UNION ALL -SELECT * FROM child_gauges -WHERE name IS NOT NULL), - -controller AS( --to allow filtering for active gauges only -SELECT - c.evt_tx_hash, - c.evt_index, - c.evt_block_time, - c.evt_block_number, - c.addr AS address, - ROW_NUMBER() OVER (PARTITION BY g.pool_address ORDER BY evt_block_time DESC) AS rn -FROM {{ source('balancer_ethereum', 'GaugeController_evt_NewGauge') }} c -INNER JOIN gauges g ON g.address = c.addr -) + SELECT + * + FROM reward_gauges + WHERE name IS NOT NULL + + UNION ALL + + SELECT + * + FROM child_gauges + WHERE name IS NOT NULL), + +kill_unkill_1 AS( + SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'ArbitrumRootGauge_call_killGauge') }} + WHERE call_success + + UNION ALL SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'CappedArbitrumRootGauge_call_killGauge') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'ArbitrumRootGauge_call_initialize') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'CappedArbitrumRootGauge_call_initialize') }} + WHERE call_success + + UNION ALL + + SELECT + target AS contract_address, + evt_block_time AS call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'AuthorizerAdaptorEntrypoint_evt_ActionPerformed') }} + WHERE data = 0xab8f0945 + + UNION ALL + + SELECT + target AS contract_address, + evt_block_time AS call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'AuthorizerAdaptorEntrypoint_evt_ActionPerformed') }} + WHERE data = 0xd34fb267 +), + +kill_unkill AS( + SELECT + contract_address, + call_block_time, + action, + ROW_NUMBER() OVER(PARTITION BY contract_address ORDER BY call_block_time DESC) AS rn + FROM kill_unkill_1 +) + SELECT DISTINCT g.blockchain , g.address , g.pool_address , g.child_gauge_address , g.name - , CASE WHEN c.rn = 1 + , CASE WHEN k.action = 'kill' + THEN 'inactive' + WHEN k.action = 'unkill' THEN 'active' - ELSE 'inactive' - END AS status + ELSE 'active' + END AS status , g.category , g.contributor , g.source @@ -103,4 +160,4 @@ INNER JOIN gauges g ON g.address = c.addr , g.model_name , g.label_type FROM gauges g - INNER JOIN controller c ON g.address = c.address \ No newline at end of file + LEFT JOIN kill_unkill k ON g.address = k.contract_address AND k.rn = 1 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_avalanche_c.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_avalanche_c.sql new file mode 100644 index 00000000000..25d3f91a6b4 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_avalanche_c.sql @@ -0,0 +1,92 @@ +{{config( + alias = 'balancer_gauges_avalanche_c', + post_hook='{{ expose_spells(\'["avalanche_c"]\', + "sector", + "labels", + \'["viniabussafi"]\') }}')}} + +WITH gauges AS( +SELECT distinct + 'avalanche_c' AS blockchain, + call.output_0 AS address, + pools.address AS pool_address, + child.output_0 AS child_gauge_address, + 'ava:' || pools.name AS name, + 'balancer_gauges' AS category, + 'balancerlabs' AS contributor, + 'query' AS source, + TIMESTAMP '2022-01-13' AS created_at, + NOW() AS updated_at, + 'balancer_gauges_avalanche_c' AS model_name, + 'identifier' AS label_type +FROM {{ source('balancer_ethereum', 'AvalancheRootGaugeFactory_call_create') }} call + LEFT JOIN {{ source('balancer_avalanche_c', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient + LEFT JOIN {{ source('labels', 'balancer_v2_pools_avalanche_c') }} pools ON pools.address = child.pool), + +kill_unkill_1 AS( + SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'AvalancheRootGauge_call_killGauge') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'AvalancheRootGauge_call_initialize') }} + WHERE call_success + + UNION ALL + + SELECT + target AS contract_address, + evt_block_time AS call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'AuthorizerAdaptorEntrypoint_evt_ActionPerformed') }} + WHERE data = 0xab8f0945 + + UNION ALL + + SELECT + target AS contract_address, + evt_block_time AS call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'AuthorizerAdaptorEntrypoint_evt_ActionPerformed') }} + WHERE data = 0xd34fb267 + +), + +kill_unkill AS( + SELECT + contract_address, + call_block_time, + action, + ROW_NUMBER() OVER(PARTITION BY contract_address ORDER BY call_block_time DESC) AS rn + FROM kill_unkill_1 +) + + SELECT DISTINCT + g.blockchain + , g.address + , g.pool_address + , g.child_gauge_address + , g.name + , CASE WHEN k.action = 'kill' + THEN 'inactive' + WHEN k.action = 'unkill' + THEN 'active' + ELSE 'active' + END AS status + , g.category + , g.contributor + , g.source + , g.created_at + , g.updated_at + , g.model_name + , g.label_type + FROM gauges g + LEFT JOIN kill_unkill k ON g.address = k.contract_address AND k.rn = 1 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_base.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_base.sql new file mode 100644 index 00000000000..0719e1fed76 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_base.sql @@ -0,0 +1,91 @@ +{{config( + alias = 'balancer_gauges_base', + post_hook='{{ expose_spells(\'["base"]\', + "sector", + "labels", + \'["viniabussafi"]\') }}')}} + +WITH gauges AS( +SELECT distinct + 'base' AS blockchain, + call.output_0 AS address, + pools.address AS pool_address, + child.output_0 AS child_gauge_address, + 'base:' || pools.name AS name, + 'balancer_gauges' AS category, + 'balancerlabs' AS contributor, + 'query' AS source, + TIMESTAMP '2022-01-13' AS created_at, + NOW() AS updated_at, + 'balancer_gauges_base' AS model_name, + 'identifier' AS label_type +FROM {{ source('balancer_ethereum', 'BaseRootGaugeFactory_call_create') }} call + LEFT JOIN {{ source('balancer_base', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient + LEFT JOIN {{ source('labels', 'balancer_v2_pools_base') }} pools ON pools.address = child.pool), + +kill_unkill_1 AS( + SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'BaseRootGauge_call_killGauge') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'BaseRootGauge_call_initialize') }} + WHERE call_success + + UNION ALL + + SELECT + target AS contract_address, + evt_block_time AS call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'AuthorizerAdaptorEntrypoint_evt_ActionPerformed') }} + WHERE data = 0xab8f0945 + + UNION ALL + + SELECT + target AS contract_address, + evt_block_time AS call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'AuthorizerAdaptorEntrypoint_evt_ActionPerformed') }} + WHERE data = 0xd34fb267 +), + +kill_unkill AS( + SELECT + contract_address, + call_block_time, + action, + ROW_NUMBER() OVER(PARTITION BY contract_address ORDER BY call_block_time DESC) AS rn + FROM kill_unkill_1 +) + + SELECT DISTINCT + g.blockchain + , g.address + , g.pool_address + , g.child_gauge_address + , g.name + , CASE WHEN k.action = 'kill' + THEN 'inactive' + WHEN k.action = 'unkill' + THEN 'active' + ELSE 'active' + END AS status + , g.category + , g.contributor + , g.source + , g.created_at + , g.updated_at + , g.model_name + , g.label_type + FROM gauges g + LEFT JOIN kill_unkill k ON g.address = k.contract_address AND k.rn = 1 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_ethereum.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_ethereum.sql new file mode 100644 index 00000000000..2e9dfe72986 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_ethereum.sql @@ -0,0 +1,159 @@ +{{config( + alias = 'balancer_gauges_ethereum', + post_hook='{{ expose_spells(\'["ethereum"]\', + "sector", + "labels", + \'["jacektrocinski", "viniabussafi"]\') }}')}} + +WITH gauges AS( +SELECT + 'ethereum' AS blockchain, + gauge AS address, + COALESCE(v2pools.address, v3pools.address) AS pool_address, + CAST(NULL AS VARBINARY) AS child_gauge_address, + 'eth:' || COALESCE(v2pools.name, v3pools.name) AS name, + 'balancer_gauges' AS category, + 'balancerlabs' AS contributor, + 'query' AS source, + TIMESTAMP '2022-01-13' AS created_at, + NOW() AS updated_at, + 'balancer_gauges_ethereum' AS model_name, + 'identifier' AS label_type +FROM + {{ source('balancer_ethereum', 'LiquidityGaugeFactory_evt_GaugeCreated') }} gauge + LEFT JOIN {{ source('labels', 'balancer_v2_pools_ethereum') }} v2pools ON v2pools.address = gauge.pool + LEFT JOIN {{ source('labels', 'balancer_v3_pools_ethereum') }} v3pools ON v3pools.address = gauge.pool + +UNION ALL + +SELECT + 'ethereum' AS blockchain, + gauge AS address, + COALESCE(v2pools.address, v3pools.address) AS pool_address, + CAST(NULL AS VARBINARY) AS child_gauge_address, + 'eth:' || COALESCE(v2pools.name, v3pools.name) AS name, + 'balancer_gauges' AS category, + 'balancerlabs' AS contributor, + 'query' AS source, + TIMESTAMP '2022-01-13' AS created_at, + NOW() AS updated_at, + 'balancer_gauges_ethereum' AS model_name, + 'identifier' AS label_type +FROM + {{ source('balancer_ethereum', 'CappedLiquidityGaugeFactory_evt_GaugeCreated') }} evt + INNER JOIN {{ source('balancer_ethereum', 'CappedLiquidityGaugeFactory_call_create') }} call ON call.call_tx_hash = evt.evt_tx_hash + LEFT JOIN {{ source('labels', 'balancer_v2_pools_ethereum') }} v2pools ON v2pools.address = call.pool + LEFT JOIN {{ source('labels', 'balancer_v3_pools_ethereum') }} v3pools ON v3pools.address = call.pool + +UNION ALL + +SELECT + 'ethereum' AS blockchain, + gauge_address AS address, + BYTEARRAY_SUBSTRING(pool_id, 1,20) AS pool_address, + CAST(NULL AS VARBINARY) AS child_gauge_address, + 'eth:' || project AS name, + 'balancer_gauges' AS category, + 'balancerlabs' AS contributor, + 'query' AS source, + TIMESTAMP '2022-01-13' AS created_at, + NOW() AS updated_at, + 'balancer_gauges_ethereum' AS model_name, + 'identifier' AS label_type +FROM + {{ source('balancer','single_recipient_gauges') }} +WHERE + blockchain = 'ethereum'), + +kill_unkill_1 AS( + SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'LiquidityGauge_call_killGauge') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'LiquidityGaugeV5_call_killGauge') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'LiquidityGauge_call_initialize') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'LiquidityGaugeV5_call_initialize') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'CappedLiquidityGaugeV5_call_initialize') }} + WHERE call_success + + UNION ALL + + SELECT + target AS contract_address, + evt_block_time AS call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'AuthorizerAdaptorEntrypoint_evt_ActionPerformed') }} + WHERE data = 0xab8f0945 + + UNION ALL + + SELECT + target AS contract_address, + evt_block_time AS call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'AuthorizerAdaptorEntrypoint_evt_ActionPerformed') }} + WHERE data = 0xd34fb267 +), + +kill_unkill AS( + SELECT + contract_address, + call_block_time, + action, + ROW_NUMBER() OVER(PARTITION BY contract_address ORDER BY call_block_time DESC) AS rn + FROM kill_unkill_1 +) + SELECT DISTINCT + g.blockchain + , g.address + , g.pool_address + , g.child_gauge_address + , g.name + , CASE WHEN k.action = 'kill' + THEN 'inactive' + WHEN k.action = 'unkill' + THEN 'active' + ELSE 'active' + END AS status + , g.category + , g.contributor + , g.source + , g.created_at + , g.updated_at + , g.model_name + , g.label_type + FROM gauges g + LEFT JOIN kill_unkill k ON g.address = k.contract_address AND k.rn = 1 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_gnosis.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_gnosis.sql new file mode 100644 index 00000000000..21833b60a68 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_gnosis.sql @@ -0,0 +1,92 @@ +{{config( + alias = 'balancer_gauges_gnosis', + post_hook='{{ expose_spells(\'["gnosis"]\', + "sector", + "labels", + \'["viniabussafi"]\') }}')}} + +WITH gauges AS( +SELECT distinct + 'gnosis' AS blockchain, + call.output_0 AS address, + COALESCE(v2pools.address, v3pools.address) AS pool_address, + child.output_0 AS child_gauge_address, + 'gno:' || COALESCE(v2pools.name, v3pools.name) AS name, + 'balancer_gauges' AS category, + 'balancerlabs' AS contributor, + 'query' AS source, + TIMESTAMP '2022-01-13' AS created_at, + NOW() AS updated_at, + 'balancer_gauges_gnosis' AS model_name, + 'identifier' AS label_type +FROM {{ source('balancer_ethereum', 'GnosisRootGaugeFactory_call_create') }} call + LEFT JOIN {{ source('balancer_gnosis', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient + LEFT JOIN {{ source('labels', 'balancer_v2_pools_gnosis') }} v2pools ON v2pools.address = child.pool + LEFT JOIN {{ source('labels', 'balancer_v3_pools_gnosis') }} v3pools ON v3pools.address = child.pool), + +kill_unkill_1 AS( + SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'GnosisRootGauge_call_killGauge') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'GnosisRootGauge_call_initialize') }} + WHERE call_success + + UNION ALL + + SELECT + target AS contract_address, + evt_block_time AS call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'AuthorizerAdaptorEntrypoint_evt_ActionPerformed') }} + WHERE data = 0xab8f0945 + + UNION ALL + + SELECT + target AS contract_address, + evt_block_time AS call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'AuthorizerAdaptorEntrypoint_evt_ActionPerformed') }} + WHERE data = 0xd34fb267 +), + +kill_unkill AS( + SELECT + contract_address, + call_block_time, + action, + ROW_NUMBER() OVER(PARTITION BY contract_address ORDER BY call_block_time DESC) AS rn + FROM kill_unkill_1 +) + + SELECT DISTINCT + g.blockchain + , g.address + , g.pool_address + , g.child_gauge_address + , g.name + , CASE WHEN k.action = 'kill' + THEN 'inactive' + WHEN k.action = 'unkill' + THEN 'active' + ELSE 'active' + END AS status + , g.category + , g.contributor + , g.source + , g.created_at + , g.updated_at + , g.model_name + , g.label_type + FROM gauges g + LEFT JOIN kill_unkill k ON g.address = k.contract_address AND k.rn = 1 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_optimism.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_optimism.sql similarity index 55% rename from dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_optimism.sql rename to dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_optimism.sql index 774f14f2c17..ca72d7f0e95 100644 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_optimism.sql +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_optimism.sql @@ -1,6 +1,5 @@ {{config( - - alias = 'balancer_v2_gauges_optimism', + alias = 'balancer_gauges_optimism', post_hook='{{ expose_spells(\'["optimism"]\', "sector", "labels", @@ -13,12 +12,12 @@ SELECT pools.address AS pool_address, streamer.gauge AS child_gauge_address, 'op:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_optimism' AS model_name, + 'balancer_gauges_optimism' AS model_name, 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'OptimismRootGaugeFactory_evt_OptimismRootGaugeCreated') }} gauge @@ -33,12 +32,12 @@ SELECT pools.address AS pool_address, streamer.gauge AS child_gauge_address, 'op:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_optimism' AS model_name, + 'balancer_gauges_optimism' AS model_name, 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'CappedOptimismRootGaugeFactory_evt_GaugeCreated') }} gauge @@ -53,46 +52,104 @@ SELECT distinct pools.address AS pool_address, child.output_0 AS child_gauge_address, 'opt:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_optimism' AS model_name, + 'balancer_gauges_optimism' AS model_name, 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'CappedOptimismRootGaugeFactory_call_create') }} call LEFT JOIN {{ source('balancer_optimism', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient LEFT JOIN {{ source('labels', 'balancer_v2_pools_optimism') }} pools ON pools.address = child.pool), gauges AS( -SELECT * FROM reward_gauges -WHERE name IS NOT NULL -UNION ALL -SELECT * FROM child_gauges -WHERE name IS NOT NULL), + SELECT + * + FROM reward_gauges + WHERE name IS NOT NULL + + UNION ALL -controller AS( --to allow filtering for active gauges only -SELECT - c.evt_tx_hash, - c.evt_index, - c.evt_block_time, - c.evt_block_number, - c.addr AS address, - ROW_NUMBER() OVER (PARTITION BY g.pool_address ORDER BY evt_block_time DESC) AS rn -FROM {{ source('balancer_ethereum', 'GaugeController_evt_NewGauge') }} c -INNER JOIN gauges g ON g.address = c.addr -) + SELECT + * + FROM child_gauges + WHERE name IS NOT NULL), + +kill_unkill_1 AS( + SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'OptimismRootGauge_call_killGauge') }} + WHERE call_success + + UNION ALL SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'CappedOptimismRootGauge_call_killGauge') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'OptimismRootGauge_call_initialize') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'CappedOptimismRootGauge_call_initialize') }} + WHERE call_success + + UNION ALL + + SELECT + target AS contract_address, + evt_block_time AS call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'AuthorizerAdaptorEntrypoint_evt_ActionPerformed') }} + WHERE data = 0xab8f0945 + + UNION ALL + + SELECT + target AS contract_address, + evt_block_time AS call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'AuthorizerAdaptorEntrypoint_evt_ActionPerformed') }} + WHERE data = 0xd34fb267 +), + +kill_unkill AS( + SELECT + contract_address, + call_block_time, + action, + ROW_NUMBER() OVER(PARTITION BY contract_address ORDER BY call_block_time DESC) AS rn + FROM kill_unkill_1 +) + SELECT DISTINCT g.blockchain , g.address , g.pool_address , g.child_gauge_address , g.name - , CASE WHEN c.rn = 1 + , CASE WHEN k.action = 'kill' + THEN 'inactive' + WHEN k.action = 'unkill' THEN 'active' - ELSE 'inactive' - END AS status + ELSE 'active' + END AS status , g.category , g.contributor , g.source @@ -101,4 +158,4 @@ INNER JOIN gauges g ON g.address = c.addr , g.model_name , g.label_type FROM gauges g - INNER JOIN controller c ON g.address = c.address \ No newline at end of file + LEFT JOIN kill_unkill k ON g.address = k.contract_address AND k.rn = 1 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_polygon.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_polygon.sql similarity index 55% rename from dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_polygon.sql rename to dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_polygon.sql index bca23a0c63a..b51e160109f 100644 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_polygon.sql +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_polygon.sql @@ -1,6 +1,5 @@ {{config( - - alias = 'balancer_v2_gauges_polygon', + alias = 'balancer_gauges_polygon', post_hook='{{ expose_spells(\'["polygon"]\', "sector", "labels", @@ -13,12 +12,12 @@ SELECT pools.address AS pool_address, streamer.gauge AS child_gauge_address, 'pol:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_polygon' AS model_name, + 'balancer_gauges_polygon' AS model_name, 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'PolygonRootGaugeFactory_evt_PolygonRootGaugeCreated') }} gauge @@ -33,12 +32,12 @@ SELECT pools.address AS pool_address, streamer.gauge AS child_gauge_address, 'pol:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_polygon' AS model_name, + 'balancer_gauges_polygon' AS model_name, 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'CappedPolygonRootGaugeFactory_evt_GaugeCreated') }} gauge @@ -53,46 +52,104 @@ SELECT distinct pools.address AS pool_address, child.output_0 AS child_gauge_address, 'pol:' || pools.name AS name, - 'balancer_v2_gauges' AS category, + 'balancer_gauges' AS category, 'balancerlabs' AS contributor, 'query' AS source, TIMESTAMP '2022-01-13' AS created_at, NOW() AS updated_at, - 'balancer_v2_gauges_polygon' AS model_name, + 'balancer_gauges_polygon' AS model_name, 'identifier' AS label_type FROM {{ source('balancer_ethereum', 'CappedPolygonRootGaugeFactory_call_create') }} call LEFT JOIN {{ source('balancer_polygon', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient LEFT JOIN {{ source('labels', 'balancer_v2_pools_polygon') }} pools ON pools.address = child.pool), gauges AS( -SELECT * FROM reward_gauges -WHERE name IS NOT NULL -UNION ALL -SELECT * FROM child_gauges -WHERE name IS NOT NULL), + SELECT + * + FROM reward_gauges + WHERE name IS NOT NULL + + UNION ALL -controller AS( --to allow filtering for active gauges only -SELECT - c.evt_tx_hash, - c.evt_index, - c.evt_block_time, - c.evt_block_number, - c.addr AS address, - ROW_NUMBER() OVER (PARTITION BY g.pool_address ORDER BY evt_block_time DESC) AS rn -FROM {{ source('balancer_ethereum', 'GaugeController_evt_NewGauge') }} c -INNER JOIN gauges g ON g.address = c.addr -) + SELECT + * + FROM child_gauges + WHERE name IS NOT NULL), + +kill_unkill_1 AS( + SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'PolygonRootGauge_call_killGauge') }} + WHERE call_success + + UNION ALL SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'CappedPolygonRootGauge_call_killGauge') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'PolygonRootGauge_call_initialize') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'CappedPolygonRootGauge_call_initialize') }} + WHERE call_success + + UNION ALL + + SELECT + target AS contract_address, + evt_block_time AS call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'AuthorizerAdaptorEntrypoint_evt_ActionPerformed') }} + WHERE data = 0xab8f0945 + + UNION ALL + + SELECT + target AS contract_address, + evt_block_time AS call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'AuthorizerAdaptorEntrypoint_evt_ActionPerformed') }} + WHERE data = 0xd34fb267 +), + +kill_unkill AS( + SELECT + contract_address, + call_block_time, + action, + ROW_NUMBER() OVER(PARTITION BY contract_address ORDER BY call_block_time DESC) AS rn + FROM kill_unkill_1 +) + SELECT DISTINCT g.blockchain , g.address , g.pool_address , g.child_gauge_address , g.name - , CASE WHEN c.rn = 1 + , CASE WHEN k.action = 'kill' + THEN 'inactive' + WHEN k.action = 'unkill' THEN 'active' - ELSE 'inactive' - END AS status + ELSE 'active' + END AS status , g.category , g.contributor , g.source @@ -101,4 +158,4 @@ INNER JOIN gauges g ON g.address = c.addr , g.model_name , g.label_type FROM gauges g - INNER JOIN controller c ON g.address = c.address \ No newline at end of file + LEFT JOIN kill_unkill k ON g.address = k.contract_address AND k.rn = 1 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_zkevm.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_zkevm.sql new file mode 100644 index 00000000000..d0f6e0fde40 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_gauges_zkevm.sql @@ -0,0 +1,91 @@ +{{config( + alias = 'balancer_gauges_zkevm', + post_hook='{{ expose_spells(\'["zkevm"]\', + "sector", + "labels", + \'["jacektrocinski", "viniabussafi"]\') }}')}} + +WITH gauges AS( +SELECT distinct + 'zkevm' AS blockchain, + call.output_0 AS address, + pools.address AS pool_address, + child.output_0 AS child_gauge_address, + 'zk:' || pools.name AS name, + 'balancer_gauges' AS category, + 'balancerlabs' AS contributor, + 'query' AS source, + TIMESTAMP '2022-01-13' AS created_at, + NOW() AS updated_at, + 'balancer_gauges_zkevm' AS model_name, + 'identifier' AS label_type +FROM {{ source('balancer_ethereum', 'PolygonZkEVMRootGaugeFactory_call_create') }} call + LEFT JOIN {{ source('balancer_zkevm', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient + LEFT JOIN {{ source('labels', 'balancer_v2_pools_zkevm') }} pools ON pools.address = child.pool), + +kill_unkill_1 AS( + SELECT + contract_address, + call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'PolygonZkEVMRootGauge_call_killGauge') }} + WHERE call_success + + UNION ALL + + SELECT + contract_address, + call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'PolygonZkEVMRootGauge_call_initialize') }} + WHERE call_success + + UNION ALL + + SELECT + target AS contract_address, + evt_block_time AS call_block_time, + 'kill' AS action + FROM {{ source('balancer_ethereum', 'AuthorizerAdaptorEntrypoint_evt_ActionPerformed') }} + WHERE data = 0xab8f0945 + + UNION ALL + + SELECT + target AS contract_address, + evt_block_time AS call_block_time, + 'unkill' AS action + FROM {{ source('balancer_ethereum', 'AuthorizerAdaptorEntrypoint_evt_ActionPerformed') }} + WHERE data = 0xd34fb267 +), + +kill_unkill AS( + SELECT + contract_address, + call_block_time, + action, + ROW_NUMBER() OVER(PARTITION BY contract_address ORDER BY call_block_time DESC) AS rn + FROM kill_unkill_1 +) + + SELECT DISTINCT + g.blockchain + , g.address + , g.pool_address + , g.child_gauge_address + , g.name + , CASE WHEN k.action = 'kill' + THEN 'inactive' + WHEN k.action = 'unkill' + THEN 'active' + ELSE 'active' + END AS status + , g.category + , g.contributor + , g.source + , g.created_at + , g.updated_at + , g.model_name + , g.label_type + FROM gauges g + LEFT JOIN kill_unkill k ON g.address = k.contract_address AND k.rn = 1 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_schema.yml b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_schema.yml similarity index 73% rename from dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_schema.yml rename to dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_schema.yml index 8103fae3ea0..3e7f70b74cb 100644 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_schema.yml +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer/labels_balancer_schema.yml @@ -1,15 +1,20 @@ version: 2 models: - - name: labels_balancer_v2_gauges + - name: labels_balancer_gauges meta: blockchain: ethereum, polygon, optimism, arbitrum, avalanche_c, base, gnosis, zkevm sector: labels - project: balancer_v2 + project: balancer contributors: jacektrocinski, viniabussafi config: tags: ['labels', 'ethereum', 'polygon', 'optimism', 'arbitrum', 'avalanche_c', 'base', 'gnosis', 'zkevm', 'gauges'] - description: 'Balancer v2 gauge labels.' + description: 'Balancer gauge labels.' + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - address columns: - &blockchain name: blockchain @@ -50,19 +55,15 @@ models: name: label_type description: "Type of label (see labels overall readme)" - - name: labels_balancer_v2_gauges_ethereum + - name: labels_balancer_gauges_ethereum meta: blockchain: ethereum sector: labels - project: balancer_v2 + project: balancer contributors: jacektrocinski, viniabussafi config: tags: ['labels', 'ethereum', 'gauges'] - description: 'Balancer v2 gauge labels.' - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address + description: 'Balancer gauge labels.' columns: - *blockchain - *address @@ -78,19 +79,15 @@ models: - *model_name - *label_type - - name: labels_balancer_v2_gauges_polygon + - name: labels_balancer_gauges_polygon meta: blockchain: polygon sector: labels - project: balancer_v2 + project: balancer contributors: jacektrocinski, viniabussafi config: tags: ['labels', 'polygon', 'gauges'] - description: 'Balancer v2 gauge labels.' - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address + description: 'Balancer gauge labels.' columns: - *blockchain - *address @@ -106,19 +103,15 @@ models: - *model_name - *label_type - - name: labels_balancer_v2_gauges_arbitrum + - name: labels_balancer_gauges_arbitrum meta: blockchain: arbitrum sector: labels - project: balancer_v2 + project: balancer contributors: jacektrocinski, viniabussafi config: tags: ['labels', 'arbitrum', 'gauges'] - description: 'Balancer v2 gauge labels.' - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address + description: 'Balancer gauge labels.' columns: - *blockchain - *address @@ -134,19 +127,15 @@ models: - *model_name - *label_type - - name: labels_balancer_v2_gauges_optimism + - name: labels_balancer_gauges_optimism meta: blockchain: optimism sector: labels - project: balancer_v2 + project: balancer contributors: jacektrocinski, viniabussafi config: tags: ['labels', 'optimism', 'gauges'] - description: 'Balancer v2 gauge labels.' - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address + description: 'Balancer gauge labels.' columns: - *blockchain - *address @@ -162,19 +151,15 @@ models: - *model_name - *label_type - - name: labels_balancer_v2_gauges_avalanche_c + - name: labels_balancer_gauges_avalanche_c meta: blockchain: avalanche_c sector: labels - project: balancer_v2 + project: balancer contributors: viniabussafi config: tags: ['labels', 'avalanche_c', 'gauges'] - description: 'Balancer v2 gauge labels.' - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address + description: 'Balancer gauge labels.' columns: - *blockchain - *address @@ -190,19 +175,15 @@ models: - *model_name - *label_type - - name: labels_balancer_v2_gauges_base + - name: labels_balancer_gauges_base meta: blockchain: base sector: labels - project: balancer_v2 + project: balancer contributors: viniabussafi config: tags: ['labels', 'base', 'gauges'] - description: 'Balancer v2 gauge labels.' - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address + description: 'Balancer gauge labels.' columns: - *blockchain - *address @@ -218,19 +199,15 @@ models: - *model_name - *label_type - - name: labels_balancer_v2_gauges_gnosis + - name: labels_balancer_gauges_gnosis meta: blockchain: gnosis sector: labels - project: balancer_v2 + project: balancer contributors: viniabussafi config: tags: ['labels', 'gnosis', 'gauges'] - description: 'Balancer v2 gauge labels.' - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address + description: 'Balancer gauge labels.' columns: - *blockchain - *address @@ -246,19 +223,15 @@ models: - *model_name - *label_type - - name: labels_balancer_v2_gauges_zkevm + - name: labels_balancer_gauges_zkevm meta: blockchain: zkevm sector: labels - project: balancer_v2 + project: balancer contributors: viniabussafi config: tags: ['labels', 'zkevm', 'gauges'] - description: 'Balancer v2 gauge labels.' - data_tests: - - dbt_utils.unique_combination_of_columns: - combination_of_columns: - - address + description: 'Balancer gauge labels.' columns: - *blockchain - *address diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_avalanche_c.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_avalanche_c.sql deleted file mode 100644 index 080d9e04325..00000000000 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_avalanche_c.sql +++ /dev/null @@ -1,57 +0,0 @@ -{{config( - - alias = 'balancer_v2_gauges_avalanche_c', - post_hook='{{ expose_spells(\'["avalanche_c"]\', - "sector", - "labels", - \'["viniabussafi"]\') }}')}} - -WITH gauges AS( -SELECT distinct - 'avalanche_c' AS blockchain, - call.output_0 AS address, - pools.address AS pool_address, - child.output_0 AS child_gauge_address, - 'ava:' || pools.name AS name, - 'balancer_v2_gauges' AS category, - 'balancerlabs' AS contributor, - 'query' AS source, - TIMESTAMP '2022-01-13' AS created_at, - NOW() AS updated_at, - 'balancer_v2_gauges_avalanche_c' AS model_name, - 'identifier' AS label_type -FROM {{ source('balancer_ethereum', 'AvalancheRootGaugeFactory_call_create') }} call - LEFT JOIN {{ source('balancer_avalanche_c', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient - LEFT JOIN {{ source('labels', 'balancer_v2_pools_avalanche_c') }} pools ON pools.address = child.pool), - -controller AS( --to allow filtering for active gauges only -SELECT - c.evt_tx_hash, - c.evt_index, - c.evt_block_time, - c.evt_block_number, - c.addr AS address, - ROW_NUMBER() OVER (PARTITION BY g.pool_address ORDER BY evt_block_time DESC) AS rn -FROM {{ source('balancer_ethereum', 'GaugeController_evt_NewGauge') }} c -INNER JOIN gauges g ON g.address = c.addr -) - - SELECT - g.blockchain - , g.address - , g.pool_address - , g.child_gauge_address - , g.name - , CASE WHEN c.rn = 1 - THEN 'active' - ELSE 'inactive' - END AS status - , g.category - , g.contributor - , g.source - , g.created_at - , g.updated_at - , g.model_name - , g.label_type - FROM gauges g - INNER JOIN controller c ON g.address = c.address diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_base.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_base.sql deleted file mode 100644 index f93f6b89499..00000000000 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_base.sql +++ /dev/null @@ -1,57 +0,0 @@ -{{config( - - alias = 'balancer_v2_gauges_base', - post_hook='{{ expose_spells(\'["base"]\', - "sector", - "labels", - \'["viniabussafi"]\') }}')}} - -WITH gauges AS( -SELECT distinct - 'base' AS blockchain, - call.output_0 AS address, - pools.address AS pool_address, - child.output_0 AS child_gauge_address, - 'base:' || pools.name AS name, - 'balancer_v2_gauges' AS category, - 'balancerlabs' AS contributor, - 'query' AS source, - TIMESTAMP '2022-01-13' AS created_at, - NOW() AS updated_at, - 'balancer_v2_gauges_base' AS model_name, - 'identifier' AS label_type -FROM {{ source('balancer_ethereum', 'BaseRootGaugeFactory_call_create') }} call - LEFT JOIN {{ source('balancer_base', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient - LEFT JOIN {{ source('labels', 'balancer_v2_pools_base') }} pools ON pools.address = child.pool), - -controller AS( --to allow filtering for active gauges only -SELECT - c.evt_tx_hash, - c.evt_index, - c.evt_block_time, - c.evt_block_number, - c.addr AS address, - ROW_NUMBER() OVER (PARTITION BY g.pool_address ORDER BY evt_block_time DESC) AS rn -FROM {{ source('balancer_ethereum', 'GaugeController_evt_NewGauge') }} c -INNER JOIN gauges g ON g.address = c.addr -) - - SELECT - g.blockchain - , g.address - , g.pool_address - , g.child_gauge_address - , g.name - , CASE WHEN c.rn = 1 - THEN 'active' - ELSE 'inactive' - END AS status - , g.category - , g.contributor - , g.source - , g.created_at - , g.updated_at - , g.model_name - , g.label_type - FROM gauges g - INNER JOIN controller c ON g.address = c.address diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_ethereum.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_ethereum.sql deleted file mode 100644 index 07b9abcaf31..00000000000 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_ethereum.sql +++ /dev/null @@ -1,97 +0,0 @@ -{{config( - - alias = 'balancer_v2_gauges_ethereum', - post_hook='{{ expose_spells(\'["ethereum"]\', - "sector", - "labels", - \'["jacektrocinski", "viniabussafi"]\') }}')}} - -WITH gauges AS( -SELECT - 'ethereum' AS blockchain, - gauge AS address, - pools.address AS pool_address, - CAST(NULL AS VARBINARY) AS child_gauge_address, - 'eth:' || pools.name AS name, - 'balancer_v2_gauges' AS category, - 'balancerlabs' AS contributor, - 'query' AS source, - TIMESTAMP '2022-01-13' AS created_at, - NOW() AS updated_at, - 'balancer_v2_gauges_ethereum' AS model_name, - 'identifier' AS label_type -FROM - {{ source('balancer_ethereum', 'LiquidityGaugeFactory_evt_GaugeCreated') }} gauge - LEFT JOIN {{ source('labels', 'balancer_v2_pools_ethereum') }} pools ON pools.address = gauge.pool - -UNION ALL - -SELECT - 'ethereum' AS blockchain, - gauge AS address, - pools.address AS pool_address, - CAST(NULL AS VARBINARY) AS child_gauge_address, - 'eth:' || pools.name AS name, - 'balancer_v2_gauges' AS category, - 'balancerlabs' AS contributor, - 'query' AS source, - TIMESTAMP '2022-01-13' AS created_at, - NOW() AS updated_at, - 'balancer_v2_gauges_ethereum' AS model_name, - 'identifier' AS label_type -FROM - {{ source('balancer_ethereum', 'CappedLiquidityGaugeFactory_evt_GaugeCreated') }} evt - INNER JOIN {{ source('balancer_ethereum', 'CappedLiquidityGaugeFactory_call_create') }} call ON call.call_tx_hash = evt.evt_tx_hash - LEFT JOIN {{ source('labels', 'balancer_v2_pools_ethereum') }} pools ON pools.address = call.pool - -UNION ALL - -SELECT - 'ethereum' AS blockchain, - gauge_address AS address, - BYTEARRAY_SUBSTRING(pool_id, 1,20) AS pool_address, - CAST(NULL AS VARBINARY) AS child_gauge_address, - 'eth:' || project AS name, - 'balancer_v2_gauges' AS category, - 'balancerlabs' AS contributor, - 'query' AS source, - TIMESTAMP '2022-01-13' AS created_at, - NOW() AS updated_at, - 'balancer_v2_gauges_ethereum' AS model_name, - 'identifier' AS label_type -FROM - {{ source('balancer','single_recipient_gauges') }} -WHERE - blockchain = 'ethereum'), - -controller AS( --to allow filtering for active gauges only -SELECT - c.evt_tx_hash, - c.evt_index, - c.evt_block_time, - c.evt_block_number, - c.addr AS address, - ROW_NUMBER() OVER (PARTITION BY g.pool_address ORDER BY evt_block_time DESC) AS rn -FROM {{ source('balancer_ethereum', 'GaugeController_evt_NewGauge') }} c -INNER JOIN gauges g ON g.address = c.addr -) - - SELECT - g.blockchain - , g.address - , g.pool_address - , g.child_gauge_address - , g.name - , CASE WHEN c.rn = 1 - THEN 'active' - ELSE 'inactive' - END AS status - , g.category - , g.contributor - , g.source - , g.created_at - , g.updated_at - , g.model_name - , g.label_type - FROM gauges g - INNER JOIN controller c ON g.address = c.address diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_gnosis.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_gnosis.sql deleted file mode 100644 index 800e03f266d..00000000000 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_gnosis.sql +++ /dev/null @@ -1,57 +0,0 @@ -{{config( - - alias = 'balancer_v2_gauges_gnosis', - post_hook='{{ expose_spells(\'["gnosis"]\', - "sector", - "labels", - \'["viniabussafi"]\') }}')}} - -WITH gauges AS( -SELECT distinct - 'gnosis' AS blockchain, - call.output_0 AS address, - pools.address AS pool_address, - child.output_0 AS child_gauge_address, - 'gno:' || pools.name AS name, - 'balancer_v2_gauges' AS category, - 'balancerlabs' AS contributor, - 'query' AS source, - TIMESTAMP '2022-01-13' AS created_at, - NOW() AS updated_at, - 'balancer_v2_gauges_gnosis' AS model_name, - 'identifier' AS label_type -FROM {{ source('balancer_ethereum', 'GnosisRootGaugeFactory_call_create') }} call - LEFT JOIN {{ source('balancer_gnosis', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient - LEFT JOIN {{ source('labels', 'balancer_v2_pools_gnosis') }} pools ON pools.address = child.pool), - -controller AS( --to allow filtering for active gauges only -SELECT - c.evt_tx_hash, - c.evt_index, - c.evt_block_time, - c.evt_block_number, - c.addr AS address, - ROW_NUMBER() OVER (PARTITION BY g.pool_address ORDER BY evt_block_time DESC) AS rn -FROM {{ source('balancer_ethereum', 'GaugeController_evt_NewGauge') }} c -INNER JOIN gauges g ON g.address = c.addr -) - - SELECT - g.blockchain - , g.address - , g.pool_address - , g.child_gauge_address - , g.name - , CASE WHEN c.rn = 1 - THEN 'active' - ELSE 'inactive' - END AS status - , g.category - , g.contributor - , g.source - , g.created_at - , g.updated_at - , g.model_name - , g.label_type - FROM gauges g - INNER JOIN controller c ON g.address = c.address diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_zkevm.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_zkevm.sql deleted file mode 100644 index 1e1b946e5ae..00000000000 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_gauges_zkevm.sql +++ /dev/null @@ -1,56 +0,0 @@ -{{config( - alias = 'balancer_v2_gauges_zkevm', - post_hook='{{ expose_spells(\'["zkevm"]\', - "sector", - "labels", - \'["jacektrocinski", "viniabussafi"]\') }}')}} - -WITH gauges AS( -SELECT distinct - 'zkevm' AS blockchain, - call.output_0 AS address, - pools.address AS pool_address, - child.output_0 AS child_gauge_address, - 'zk:' || pools.name AS name, - 'balancer_v2_gauges' AS category, - 'balancerlabs' AS contributor, - 'query' AS source, - TIMESTAMP '2022-01-13' AS created_at, - NOW() AS updated_at, - 'balancer_v2_gauges_zkevm' AS model_name, - 'identifier' AS label_type -FROM {{ source('balancer_ethereum', 'PolygonZkEVMRootGaugeFactory_call_create') }} call - LEFT JOIN {{ source('balancer_zkevm', 'ChildChainGaugeFactory_call_create') }} child ON child.output_0 = call.recipient - LEFT JOIN {{ source('labels', 'balancer_v2_pools_zkevm') }} pools ON pools.address = child.pool), - -controller AS( --to allow filtering for active gauges only -SELECT - c.evt_tx_hash, - c.evt_index, - c.evt_block_time, - c.evt_block_number, - c.addr AS address, - ROW_NUMBER() OVER (PARTITION BY g.pool_address ORDER BY evt_block_time DESC) AS rn -FROM {{ source('balancer_ethereum', 'GaugeController_evt_NewGauge') }} c -INNER JOIN gauges g ON g.address = c.addr -) - - SELECT - g.blockchain - , g.address - , g.pool_address - , g.child_gauge_address - , g.name - , CASE WHEN c.rn = 1 - THEN 'active' - ELSE 'inactive' - END AS status - , g.category - , g.contributor - , g.source - , g.created_at - , g.updated_at - , g.model_name - , g.label_type - FROM gauges g - INNER JOIN controller c ON g.address = c.address \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/beets/labels_beets_pools_sonic.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/beets/labels_beets_pools_sonic.sql index f1a8903fbcf..c7b47e980bc 100644 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/beets/labels_beets_pools_sonic.sql +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/addresses/__single_category_labels__/beets/labels_beets_pools_sonic.sql @@ -47,6 +47,22 @@ WITH v2_pools AS( ON c.evt_tx_hash = cc.call_tx_hash AND bytearray_substring(c.poolId, 1, 20) = cc.output_0 CROSS JOIN UNNEST(cc.tokens) AS t(tokens) + + UNION ALL + + SELECT + c.poolId AS pool_id, + t.tokens AS token_address, + 0 AS normalized_weight, + cc.symbol, + 'ECLP' AS pool_type, + cc.name + FROM {{ source('beethoven_x_v2_sonic', 'Vault_evt_PoolRegistered') }} c + INNER JOIN {{ source('gyroscope_sonic', 'GyroECLPPoolFactory_call_create') }} cc + ON c.evt_tx_hash = cc.call_tx_hash + AND bytearray_substring(c.poolId, 1, 20) = cc.output_0 + CROSS JOIN UNNEST(cc.tokens) AS t(tokens) + ), settings AS ( @@ -65,7 +81,7 @@ settings AS ( SELECT 'sonic' AS blockchain, bytearray_substring(pool_id, 1, 20) AS address, - CASE WHEN pool_type IN ('stable') + CASE WHEN pool_type IN ('stable', 'ECLP') THEN lower(pool_symbol) ELSE lower(concat(array_join(array_agg(token_symbol ORDER BY token_symbol), '/'), ' ', array_join(array_agg(cast(norm_weight AS varchar) ORDER BY token_symbol), '/'))) diff --git a/dbt_subprojects/daily_spellbook/models/_sector/labels/labels_addresses.sql b/dbt_subprojects/daily_spellbook/models/_sector/labels/labels_addresses.sql index 3d3047c5079..7eb98fbfc0e 100644 --- a/dbt_subprojects/daily_spellbook/models/_sector/labels/labels_addresses.sql +++ b/dbt_subprojects/daily_spellbook/models/_sector/labels/labels_addresses.sql @@ -16,7 +16,7 @@ , source('labels', 'balancer_v2_pools') , source('labels', 'balancer_v3_pools') , source('labels', 'balancer_cowswap_amm_pools') - , ref('labels_balancer_v2_gauges') + , ref('labels_balancer_gauges') , ref('labels_cex') , ref('labels_contracts') , ref('labels_hackers_ethereum') diff --git a/dbt_subprojects/daily_spellbook/models/_sector/rwa/ethereum/rwa_ethereum_balances.sql b/dbt_subprojects/daily_spellbook/models/_sector/rwa/ethereum/rwa_ethereum_balances.sql new file mode 100644 index 00000000000..73b28c870b9 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_sector/rwa/ethereum/rwa_ethereum_balances.sql @@ -0,0 +1,38 @@ +{{ + config( + schema = 'rwa_ethereum', + alias = 'balances', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['day', 'address', 'token_address', 'blockchain'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.day')] + ) +}} + +with +rwa_tokens as ( + select + symbol, + contract_address as token_address + from + {{ source('tokens_ethereum', 'rwa')}} +) + +,balances as ( + {{ + balances_incremental_subset_daily( + blockchain = 'ethereum', + token_list = 'rwa_tokens', + start_date = '2020-01-01' + ) + }} +) + +select + t.symbol + ,b.* +from balances b +left join rwa_tokens t + on b.token_address = t.token_address + \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/rwa/ethereum/rwa_ethereum_schema.yml b/dbt_subprojects/daily_spellbook/models/_sector/rwa/ethereum/rwa_ethereum_schema.yml new file mode 100644 index 00000000000..9f5802e9e4b --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_sector/rwa/ethereum/rwa_ethereum_schema.yml @@ -0,0 +1,62 @@ +version: 2 + +models: + - name: rwa_ethereum_balances + + meta: + blockchain: ethereum + sector: rwa + project: rwa + contributors: synthquest + + config: + tags: ['rwa', 'balances'] + description: "Balances of rwa token holders" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - address + - token_address + columns: + - &blockchain + name: blockchain + description: "Blockchain for the token" + - &symbol + name: symbol + description: "Symbol for the token" + - &version + name: version + description: "Version of the token" + - &day + name: day + description: "Date on which the token balance is logged" + - &address + name: address + description: "Address for the token holder" + - &token_symbol + name: token_symbol + description: "Symbol for the token" + - &token_address + name: token_address + description: "Address for the token" + - &token_standard + name: token_standard + description: "Standard for the token" + - &token_id + name: token_id + description: "ID for the token" + - &balance + name: balance + description: "Balance for the user" + - &balance_usd + name: balance_usd + description: "USD value of balance for the user" + - &last_updated + name: last_updated + description: "UTC timestamp when data was last updated" + - &next_update + name: next_update + description: "UTC timestamp when data is next updated" + + \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/aave/base/aave_base_interest_rates.sql b/dbt_subprojects/daily_spellbook/models/aave/base/aave_base_interest_rates.sql new file mode 100644 index 00000000000..236a5883414 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/aave/base/aave_base_interest_rates.sql @@ -0,0 +1,26 @@ +{{ config( + schema = 'aave_base' + , alias = 'interest_rates' + , post_hook='{{ expose_spells(blockchains = \'["base"]\', + spell_type = "project", + spell_name = "aave", + contributors = \'["mikeghen1","batwayne", "chuxin"]\') }}' + ) +}} + +SELECT * +FROM +( + SELECT + reserve, + symbol, + hour, + deposit_apy, + stable_borrow_apy, + variable_borrow_apy + FROM {{ ref('aave_v3_base_interest_rates') }} + /* + UNION ALL + < add new version as needed + */ +) diff --git a/dbt_subprojects/daily_spellbook/models/aave/base/aave_base_schema.yml b/dbt_subprojects/daily_spellbook/models/aave/base/aave_base_schema.yml index d08a831c95d..4b7197c5e8b 100644 --- a/dbt_subprojects/daily_spellbook/models/aave/base/aave_base_schema.yml +++ b/dbt_subprojects/daily_spellbook/models/aave/base/aave_base_schema.yml @@ -54,3 +54,59 @@ models: - &evt_index name: evt_index description: "Event index" + + - name: aave_v3_base_interest_rates + meta: + blockchain: base + sector: lending + project: aave_v3 + contributors: mikeghen1, batwayne, chuxin + config: + tags: ['base', 'aave_v3', 'interest', 'aave', 'lending'] + description: "Hourly aave interest rates on base" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - reserve + - symbol + - hour + columns: + - &reserve + name: reserve + description: "Aave reserve contract address" + - *symbol + - &hour + name: hour + description: "Block timestamp truncated to hours" + - &deposit_apy + name: deposit_apy + description: "Hourly deposit interest rate value of the reserve" + - &stable_borrow_apy + name: stable_borrow_apy + description: "Hourly stable borrow interest rate value of the reserve" + - &variable_borrow_apy + name: variable_borrow_apy + description: "Hourly variable borrow interest rate value of the reserve" + + - name: aave_base_interest_rates + meta: + blockchain: base + sector: lending + project: aave + contributors: mikeghen1, batwayne, chuxin + config: + tags: ['base', 'aave_v3', 'interest', 'aave', 'lending'] + description: "Hourly aave interest rates on base" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - reserve + - symbol + - hour + columns: + - *reserve + - *symbol + - *hour + - *deposit_apy + - *stable_borrow_apy + - *variable_borrow_apy diff --git a/dbt_subprojects/daily_spellbook/models/aave/base/aave_v3_base_interest_rates.sql b/dbt_subprojects/daily_spellbook/models/aave/base/aave_v3_base_interest_rates.sql new file mode 100644 index 00000000000..195450220e4 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/aave/base/aave_v3_base_interest_rates.sql @@ -0,0 +1,28 @@ +{{ config( + schema = 'aave_v3_base' + , alias = 'interest_rates' + , materialized = 'incremental' + , file_format = 'delta' + , incremental_strategy = 'merge' + , unique_key = ['reserve', 'symbol', 'hour'] + , post_hook='{{ expose_spells(blockchains = \'["base"]\', + spell_type = "project", + spell_name = "aave_v3", + contributors = \'["mikeghen1","batwayne", "chuxin"]\') }}' + ) +}} + +select + a.reserve, + t.symbol, + date_trunc('hour',a.evt_block_time) as hour, + avg(CAST(a.liquidityRate AS DOUBLE)) / 1e27 as deposit_apy, + avg(CAST(a.stableBorrowRate AS DOUBLE)) / 1e27 as stable_borrow_apy, + avg(CAST(a.variableBorrowRate AS DOUBLE)) / 1e27 as variable_borrow_apy +from {{ source('aave_v3_base', 'L2Pool_evt_ReserveDataUpdated') }} a +left join {{ source('tokens', 'erc20') }} t +on a.reserve = t.contract_address and t.blockchain = 'base' +{% if is_incremental() %} + WHERE {{ incremental_predicate('evt_block_time') }} +{% endif %} +group by 1,2,3 diff --git a/dbt_subprojects/daily_spellbook/models/beethoven_x/fantom/beethoven_x_fantom_schema.yml b/dbt_subprojects/daily_spellbook/models/beethoven_x/fantom/beethoven_x_fantom_schema.yml index 0145f61813a..5c1313a53ec 100644 --- a/dbt_subprojects/daily_spellbook/models/beethoven_x/fantom/beethoven_x_fantom_schema.yml +++ b/dbt_subprojects/daily_spellbook/models/beethoven_x/fantom/beethoven_x_fantom_schema.yml @@ -102,10 +102,13 @@ models: description: "Fee collected in the pool in USD" - &treasury_share name: treasury_share - description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd + description: "Share of total fee that is directed to Beethoven DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_fee_usd name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" + description: "USD value of fee directed to Beethoven X DAO's treasury" + - &lp_fee_collected_usd + name: lp_fee_collected_usd + description: "USD value of the fee returned to liquidity providers" - name: beethoven_x_fantom_bpt_supply meta: @@ -115,7 +118,7 @@ models: config: tags: ['fantom', 'bpt', 'supply'] description: > - Balancer Pool Token (BPT) supply for Beethoven X pools built on Balancer. + Balancer Pool Token (BPT) supply for Beethoven X pools built on Beethoven X. data_tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: diff --git a/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_bpt_prices.sql b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_bpt_prices.sql new file mode 100644 index 00000000000..85cdf31bdf2 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_bpt_prices.sql @@ -0,0 +1,38 @@ +{{ + config( + schema = 'beets', + alias = 'bpt_prices', + materialized = 'table', + file_format = 'delta' + ) +}} + + +WITH v2 AS( +{{ + balancer_v2_compatible_bpt_prices_macro( + blockchain = 'sonic', + version = '2', + project_decoded_as = 'beethoven_x_v2', + base_spells_namespace = 'beets', + pool_labels_spell = ref('labels_beets_pools_sonic') + ) +}}), + +v3 AS( +{{ + balancer_v3_compatible_bpt_prices_macro( + blockchain = 'sonic', + version = '3', + project_decoded_as = 'beethoven_x_v3', + base_spells_namespace = 'beets', + pool_labels_spell = ref('labels_beets_pools_sonic') + ) +}} +) + +SELECT * FROM v2 + +UNION + +SELECT * FROM v3 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_bpt_supply.sql b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_bpt_supply.sql new file mode 100644 index 00000000000..f21d783be1e --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_bpt_supply.sql @@ -0,0 +1,34 @@ +{{ config( + schema = 'beets', + alias = 'bpt_supply', + materialized = 'table', + file_format = 'delta' + ) +}} + +WITH v2 AS( +{{ + balancer_v2_compatible_bpt_supply_macro( + blockchain = 'sonic', + version = '2', + project_decoded_as = 'beethoven_x_v2', + base_spells_namespace = 'beets', + pool_labels_spell = ref('labels_beets_pools_sonic') + ) +}}), + +v3 AS({{ + balancer_v3_compatible_bpt_supply_macro( + blockchain = 'sonic', + version = '3', + project_decoded_as = 'beethoven_x_v3', + base_spells_namespace = 'beets', + pool_labels_spell = ref('labels_beets_pools_sonic') + ) +}}) + +SELECT * FROM v2 + +UNION + +SELECT * FROM v3 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_bpt_supply_changes.sql b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_bpt_supply_changes.sql new file mode 100644 index 00000000000..bb72023ec7f --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_bpt_supply_changes.sql @@ -0,0 +1,39 @@ +{{ + config( + schema = 'beets_sonic', + alias = 'bpt_supply_changes', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index', 'label'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +WITH v2 AS( +{{ + balancer_v2_compatible_bpt_supply_changes_macro( + blockchain = 'sonic', + version = '2', + project_decoded_as = 'beethoven_x_v2', + base_spells_namespace = 'beets', + pool_labels_spell = ref('labels_beets_pools_sonic') + ) +}}), + +v3 AS( +{{ + balancer_v3_compatible_bpt_supply_changes_macro( + blockchain = 'sonic', + version = '3', + project_decoded_as = 'beethoven_x_v3', + base_spells_namespace = 'beets', + pool_labels_spell = ref('labels_beets_pools_sonic') + ) +}}) + +SELECT * FROM v2 + +UNION + +SELECT * FROM v3 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_bpt_supply_changes_daily.sql b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_bpt_supply_changes_daily.sql new file mode 100644 index 00000000000..36b2e0328fd --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_bpt_supply_changes_daily.sql @@ -0,0 +1,34 @@ +{{ + config( + schema = 'beets_sonic', + alias = 'bpt_supply_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +WITH v2 AS( +{{ + balancer_v2_compatible_bpt_supply_changes_daily_agg_macro( + blockchain = 'sonic', + version = '2', + project_decoded_as = 'beethoven_x_v2', + base_spells_namespace = 'beets' + ) +}}), + +v3 AS( +{{ + balancer_v3_compatible_bpt_supply_changes_daily_agg_macro( + blockchain = 'sonic', + version = '3', + project_decoded_as = 'beethoven_x_v3', + base_spells_namespace = 'beets' + ) +}}) + +SELECT * FROM v2 + +UNION + +SELECT * FROM v3 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_liquidity.sql b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_liquidity.sql new file mode 100644 index 00000000000..7d18a387fc8 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_liquidity.sql @@ -0,0 +1,39 @@ +{% set blockchain = 'sonic' %} + +{{ + config( + schema = 'beets', + alias = 'liquidity', + materialized = 'table', + file_format = 'delta' + ) +}} + +WITH v2 AS( +{{ + balancer_v2_compatible_liquidity_macro( + blockchain = blockchain, + version = '2', + project_decoded_as = 'beethoven_x_v2', + base_spells_namespace = 'beets', + pool_labels_spell = ref('labels_beets_pools_sonic') + ) +}}), + +v3 AS( +{{ + balancer_v3_compatible_liquidity_macro( + blockchain = blockchain, + version = '3', + project_decoded_as = 'beethoven_x_v3', + base_spells_namespace = 'beets', + pool_labels_spell = ref('labels_beets_pools_sonic') + ) +}}) + + +SELECT * FROM v2 + +UNION + +SELECT * FROM v3 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_pools_metrics_daily.sql b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_pools_metrics_daily.sql new file mode 100644 index 00000000000..476e8cc33fd --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_pools_metrics_daily.sql @@ -0,0 +1,82 @@ +{{ config( + schema = 'beets', + alias = 'pools_metrics_daily', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'blockchain', 'project', 'version', 'project_contract_address'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_date')], + post_hook='{{ expose_spells(blockchains = \'["sonic"]\', + spell_type = "project", + spell_name = "beets", + contributors = \'["viniabussafi"]\') }}' + ) +}} + + +WITH +trades AS( + SELECT + block_date, + version, + blockchain, + project_contract_address, + sum(amount_usd) AS swap_amount_usd + FROM {{ source('beets', 'trades') }} + {% if is_incremental() %} + WHERE {{incremental_predicate('block_date')}} + {% endif %} + GROUP BY 1, 2, 3, 4 +), + +liquidity AS( + SELECT + day AS block_date, + blockchain, + version, + pool_address AS project_contract_address, + pool_type, + pool_symbol, + sum(pool_liquidity_usd) AS tvl_usd, + sum(pool_liquidity_eth) AS tvl_eth + FROM {{ ref('beets_liquidity') }} + {% if is_incremental() %} + WHERE {{incremental_predicate('day')}} + {% endif %} + GROUP BY 1, 2, 3, 4, 5, 6 +), + +fees AS( + SELECT + day, + version, + blockchain, + pool_address, + sum(protocol_fee_collected_usd) AS fee_amount_usd + FROM {{ ref('beets_protocol_fee') }} + {% if is_incremental() %} + WHERE {{incremental_predicate('day')}} + {% endif %} + GROUP BY 1, 2, 3, 4 +) + +SELECT + l.blockchain, + 'beets' AS project, + l.version, + l.block_date, + l.project_contract_address, + l.pool_symbol, + l.pool_type, + t.swap_amount_usd, + l.tvl_usd, + l.tvl_eth, + f.fee_amount_usd +FROM liquidity l +LEFT JOIN trades t ON l.block_date = t.block_date +AND l.project_contract_address = t.project_contract_address +AND l.blockchain = t.blockchain +LEFT JOIN fees f ON l.block_date = f.day +AND l.project_contract_address = f.pool_address +AND l.blockchain = f.blockchain +ORDER BY 1 DESC, 7 DESC diff --git a/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_pools_tokens_weights.sql b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_pools_tokens_weights.sql new file mode 100644 index 00000000000..2473176fca0 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_pools_tokens_weights.sql @@ -0,0 +1,107 @@ +{{ + config( + schema='beets', + alias = 'pools_tokens_weights', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['pool_id', 'token_address'] + ) +}} + +WITH v2 AS( +WITH registered AS ( + SELECT + poolID AS pool_id, + evt_block_time + FROM {{ source('beethoven_x_v2_sonic', 'Vault_evt_PoolRegistered') }} + {% if is_incremental() %} + WHERE evt_block_time >= date_trunc('day', now() - interval '7' day) + {% endif %} +), +weighted_pool_factory AS ( + SELECT + call_create.output_0 AS pool_id, + t.pos AS pos, + t.token_address AS token_address, + t2.normalized_weight AS normalized_weight + FROM {{ source('beethoven_x_v2_sonic', 'WeightedPoolFactory_call_create') }} AS call_create + CROSS JOIN UNNEST(call_create.tokens) WITH ORDINALITY t(token_address, pos) + CROSS JOIN UNNEST(call_create.normalizedWeights) WITH ORDINALITY t2(normalized_weight, pos) + WHERE t.pos = t2.pos + {% if is_incremental() %} + AND call_create.call_block_time >= date_trunc('day', now() - interval '7' day) + {% endif %} +), + +normalized_weights AS ( + SELECT + pool_id, + token_address, + normalized_weight / POWER(10, 18) AS normalized_weight + FROM weighted_pool_factory +) + +SELECT + 'sonic' AS blockchain, + '2' AS version, + r.pool_id, + w.token_address, + w.normalized_weight +FROM normalized_weights w +LEFT JOIN registered r ON BYTEARRAY_SUBSTRING(r.pool_id,1,20) = w.pool_id +WHERE w.pool_id IS NOT NULL), + +v3 AS( +WITH token_data AS ( + SELECT + pool, + ARRAY_AGG(FROM_HEX(json_extract_scalar(token, '$.token')) ORDER BY token_index) AS tokens + FROM ( + SELECT + pool, + tokenConfig, + SEQUENCE(1, CARDINALITY(tokenConfig)) AS token_index_array + FROM {{ source('beethoven_x_v3_sonic', 'Vault_evt_PoolRegistered') }} + ) AS pool_data + CROSS JOIN UNNEST(tokenConfig, token_index_array) AS t(token, token_index) + GROUP BY 1 + ), + +weighted_pool_factory AS ( + SELECT + call_create.output_pool AS pool_id, + t.pos AS pos, + t.token_address AS token_address, + t2.normalized_weight AS normalized_weight + FROM {{ source('beethoven_x_v3_sonic', 'WeightedPoolFactory_call_create') }} AS call_create + JOIN token_data td ON td.pool = call_create.output_pool + CROSS JOIN UNNEST(td.tokens) WITH ORDINALITY t(token_address, pos) + CROSS JOIN UNNEST(call_create.normalizedWeights) WITH ORDINALITY t2(normalized_weight, pos) + WHERE t.pos = t2.pos + {% if is_incremental() %} + AND call_create.call_block_time >= date_trunc('day', now() - interval '7' day) + {% endif %} +), + +normalized_weights AS ( + SELECT + pool_id, + token_address, + normalized_weight / POWER(10, 18) AS normalized_weight + FROM weighted_pool_factory +) + +SELECT + 'sonic' AS blockchain, + '3' AS version, + w.pool_id, + w.token_address, + w.normalized_weight +FROM normalized_weights w +WHERE w.pool_id IS NOT NULL +) + +SELECT * FROM v2 +UNION +SELECT * FROM v3 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_protocol_fee.sql b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_protocol_fee.sql new file mode 100644 index 00000000000..e9267173dfe --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_protocol_fee.sql @@ -0,0 +1,38 @@ +{{ + config( + schema = 'beets', + alias = 'protocol_fee', + materialized = 'table', + file_format = 'delta' + ) +}} + +WITH v2 AS( +{{ + balancer_v2_compatible_protocol_fee_macro( + blockchain = 'sonic', + version = '2', + project_decoded_as = 'beethoven_x_v2', + base_spells_namespace = 'beets', + pool_labels_spell = ref('labels_beets_pools_sonic') + + ) +}}), + +v3 AS( +{{ + balancer_v3_compatible_protocol_fee_macro( + blockchain = 'sonic', + version = '3', + project_decoded_as = 'beethoven_x_v3', + base_spells_namespace = 'beets', + pool_labels_spell = ref('labels_beets_pools_sonic') + + ) +}}) + +SELECT * FROM v2 + +UNION + +SELECT * FROM v3 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_schema.yml b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_schema.yml new file mode 100644 index 00000000000..91d97ae47a1 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_schema.yml @@ -0,0 +1,372 @@ +version: 2 + +models: + - name: beets_pools_tokens_weights + meta: + blockchain: sonic + project: beethoven_x + contributors: viniabussafi + config: + tags: ['sonic', 'beethoven_x', 'pools', 'tokens', 'weights'] + description: > + Token weights in Beethoven X pools. + columns: + - &blockchain + name: blockchain + description: "Blockchain which the DEX is deployed" + - &pool_id + name: pool_id + description: 'Unique encoded identifier that refers to each pool' + data_tests: + - not_null + - &token_address + name: token_address + description: 'Contract address for the token' + - &normalized_weight + name: normalized_weight + description: 'Weight of the token in the pool.' + + - name: beets_liquidity + meta: + blockchain: sonic + project: beethoven_x + contributors: viniabussafi + config: + tags: ['sonic', 'balancer', 'pools', 'liquidity'] + description: > + Beethoven X pools liquidity by token in sonic. + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + description: 'UTC event block time truncated to the day mark' + - *pool_id + - name: pool_address + - name: pool_symbol + description: 'Symbol of the pool, consisting of the symbol of its tokens and their respective weights' + - name: version + description: "Version of Balancer where the liquidity pool is deployed" + - name: blockchain + description: 'Blockchain in which pool was deployed' + - name: pool_type + - *token_address + - name: token_symbol + description: 'Symbol of the token' + - name: token_balance_raw + description: 'Raw balance of the token in the pool' + - name: token_balance + description: 'Scaled balance of the token in the pool' + - name: protocol_liquidity_usd + description: 'Liquidity of the token in the pool in USD, except BPTs' + - name: protocol_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, except BPTs' + - name: pool_liquidity_usd + description: 'Liquidity of the token in the pool in USD, including BPTs' + - name: pool_liquidity_eth + description: 'Liquidity of the token in the pool in ETH, including BPTs' + + - name: beets_protocol_fee + meta: + blockchain: sonic + project: beethoven_x + contributors: viniabussafi + config: + tags: ['sonic', 'revenue', 'fees'] + description: > + Daily Protocol Fee collected and Revenue by pool on Beethoven X, an automated portfolio manager and trading platform built on Balancer. + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - pool_id + - token_address + columns: + - name: day + - name: pool_id + - name: pool_address + - name: pool_symbol + - name: blockchain + - name: version + - name: pool_type + - name: token_address + - name: token_symbol + - name: token_amount_raw + description: "Raw amount of revenues of the token in the pool" + - name: token_amount + description: "Amount of revenues of the token in the pool" + - name: protocol_fee_collected_usd + description: "Fee collected in the pool in USD" + - &treasury_share + name: treasury_share + description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" + - &treasury_fee_usd + name: treasury_revenue_usd + description: "USD value of fee directed to Beets DAO's treasury" + - &lp_fee_collected_usd + name: lp_fee_collected_usd + description: "USD value of the fee returned to liquidity providers" + + - name: beets_bpt_supply + meta: + blockchain: sonic + project: beethoven_x + contributors: viniabussafi + config: + tags: ['sonic', 'bpt', 'supply'] + description: > + Balancer Pool Token (BPT) supply for Beethoven X pools built on Balancer. + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - day + - blockchain + - token_address + columns: + - name: day + - name: pool_type + - name: blockchain + - name: version + - name: token_address + - name: supply + + - name: beets_bpt_prices + meta: + blockchain: sonic + project: beethoven_x + contributors: viniabussafi + config: + tags: ['sonic', 'bpt', 'prices'] + description: > + Balancer Pool Token (BPT) daily price by pool on Beethoven X, an automated portfolio manager and trading platform built on Balancer. + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - blockchain + - day + - contract_address + columns: + - name: blockchain + - name: version + - name: day + - name: decimals + - name: contract_address + - name: pool_type + - name: bpt_price + + - name: beets_transfers_bpt + meta: + blockchain: sonic + project: beethoven_x + contributors: viniabussafi + config: + tags: ['sonic', 'bpt', 'transfers'] + description: > + Balancer Pool Token (BPT) transfer logs on Beethoven X, an automated portfolio manager and trading platform built on Balancer. + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - evt_tx_hash + - evt_index + - block_date + columns: + - name: blockchain + - name: contract_address + - name: block_date + - name: block_month + - name: evt_tx_hash + - name: evt_index + - name: evt_block_time + - name: evt_block_number + - name: from + - name: to + - name: value + + - name: beets_token_balance_changes + meta: + blockchain: sonic + project: beethoven_x + contributors: viniabussafi + config: + tags: ['sonic', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Beethoven X Pools. + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - token_address + columns: + - name: block_date + description: "UTC event block date of each DEX trade" + - name: evt_block_time + description: 'Block time of transfer event' + - name: evt_block_number + description: 'Block number of transfer event' + - name: blockchain + description: "Blockchain" + - name: evt_tx_hash + description: 'Transaction hash of transfer event' + - name: evt_index + description: 'Event index' + - name: pool_id + description: "Unique encoded identifier that refers to each pool" + - name: pool_address + description: "Pool address" + - name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - name: pool_type + description: "Pool attributes, determined by the pool's factory" + - name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - name: token_address + description: "Contract address of the token" + - name: token_symbol + description: "Token symbol" + - name: delta_amount_raw + description: "Raw value of the transaction at the time of execution in the original currency" + - name: delta_amount + description: "Normalized value of the transaction at the time of execution in the original currency" + + - name: beets_token_balance_changes_daily + meta: + blockchain: sonic + project: beethoven_x + contributors: viniabussafi + config: + tags: ['sonic', 'bpt', 'supply', 'changes'] + description: > + Token Balance Changes on Beethoven X Pools, grouped by day. + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - pool_id + - token_address + columns: + - name: block_date + - name: pool_id + - name: pool_address + - name: pool_symbol + - name: version + - name: blockchain + - name: pool_type + - name: token_address + - name: token_symbol + - &daily_delta + name: daily_delta + description: "Daily total impact on token balance" + - &daily_delta_usd + name: daily_delta_usd + description: "Daily total impact on token balance, in USD" + - &daily_delta_eth + name: daily_delta_eth + description: "Daily total impact on token balance, in eth" + + - name: beets_bpt_supply_changes + meta: + blockchain: sonic + project: beethoven_x + contributors: viniabussafi + config: + tags: ['sonic', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events on Beethoven X. + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - evt_tx_hash + - evt_index + - label + columns: + - name: block_date + - name: evt_block_time + - name: evt_block_number + - name: blockchain + - name: evt_tx_hash + - name: evt_index + - name: pool_type + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - name: version + - &label + name: label + description: "Nature of the transaction (Join/Exit via swap or Mint/Burn via transfer)" + - *token_address + - &delta_amount_raw + name: delta_amount_raw + description: "Raw value of the transaction on token supply at the time of execution in the original currency" + - &delta_amount + name: delta_amount + description: "Normalized value of the transaction on token supply at the time of execution in the original currency" + + - name: beets_bpt_supply_changes_daily + meta: + blockchain: sonic + project: beethoven_x + contributors: viniabussafi + config: + tags: ['sonic', 'bpt', 'supply', 'changes'] + description: > + Balancer Pool Token (BPT) supply change events on Beethoven X, grouped by day + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - token_address + columns: + - name: block_date + - name: blockchain + - name: pool_type + - name: pool_symbol + - name: version + - name: token_address + - name: daily_delta + description: "Daily total impact on BPT supply" + + - name: beets_pools_metrics_daily + meta: + blockchain: sonic + contributors: viniabussafi, metacrypto + config: + tags: ['sonic', 'jelly_swap', 'pool', 'stats', 'volume', 'tvl', 'fee'] + description: > + This spell aggregates data from the trades, liquidity and protocol fees spells, by day and pool, while also displaying some basic information about the pool + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - project_contract_address + columns: + - *blockchain + - name: project + - name: version + - name: block_date + - &project_contract_address + name: project_contract_address + description: "Pool address" + - *pool_symbol + - name: pool_type + - &swap_amount_usd + name: swap_amount_usd + description: "Daily swap volume on a pool, in USD" + - &tvl_usd + name: tvl_usd + description: "Total Value Locked on a pool, in USD" + - &tvl_eth + name: tvl_eth + description: "Total Value Locked on a pool, in eth" + - &fee_amount_usd + name: fee_amount_usd + description: "Daily fees collected on a pool, in USD" \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_token_balance_changes.sql b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_token_balance_changes.sql new file mode 100644 index 00000000000..8a488b178d7 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_token_balance_changes.sql @@ -0,0 +1,36 @@ +{{ config( + schema = 'beets', + alias = 'token_balance_changes', + materialized = 'table', + file_format = 'delta' + ) +}} + +WITH v2 AS( +{{ + balancer_v2_compatible_token_balance_changes_macro( + blockchain = 'sonic', + version = '2', + project_decoded_as = 'beethoven_x_v2', + base_spells_namespace = 'beets', + pool_labels_spell = ref('labels_beets_pools_sonic') + ) +}}), + +v3 AS( +{{ + balancer_v3_compatible_token_balance_changes_macro( + blockchain = 'sonic', + version = '3', + project_decoded_as = 'beethoven_x_v3', + base_spells_namespace = 'beets', + pool_labels_spell = ref('labels_beets_pools_sonic') + ) +}} +) + +SELECT * FROM v2 + +UNION + +SELECT * FROM v3 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_token_balance_changes_daily.sql b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_token_balance_changes_daily.sql new file mode 100644 index 00000000000..b5bae1d7789 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_token_balance_changes_daily.sql @@ -0,0 +1,34 @@ +{{ + config( + schema = 'beets', + alias = 'token_balance_changes_daily', + materialized = 'table', + file_format = 'delta' + ) +}} + +WITH v2 AS( +{{ + balancer_v2_compatible_token_balance_changes_daily_agg_macro( + blockchain = 'sonic', + version = '2', + project_decoded_as = 'beethoven_x_v2', + base_spells_namespace = 'beets' + ) +}}), + +v3 AS( +{{ + balancer_v3_compatible_token_balance_changes_daily_agg_macro( + blockchain = 'sonic', + version = '3', + project_decoded_as = 'beethoven_x_v3', + base_spells_namespace = 'beets' + ) +}}) + +SELECT * FROM v2 + +UNION + +SELECT * FROM v3 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_transfers_bpt.sql b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_transfers_bpt.sql new file mode 100644 index 00000000000..4456198f7ec --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/beets/sonic/beets_transfers_bpt.sql @@ -0,0 +1,36 @@ +{{ + config( + schema = 'beets', + alias = 'transfers_bpt', + partition_by = ['block_month'], + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_date', 'evt_tx_hash', 'evt_index'], + incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.evt_block_time')] + ) +}} + +WITH v2 AS( +{{ + balancer_v2_compatible_transfers_bpt_macro( + blockchain = 'sonic', + version = '2', + project_decoded_as = 'beethoven_x_v2' + ) +}}), + +v3 AS ( +{{ + balancer_v3_compatible_transfers_bpt_macro( + blockchain = 'sonic', + version = '3', + project_decoded_as = 'beethoven_x_v3' + ) +}}) + +SELECT * FROM v2 + +UNION + +SELECT * FROM v3 \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql index 9a2a98639a3..dbf58c2914a 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_info.sql @@ -10,10 +10,12 @@ , "bnb" , "boba" , "celo" + , "corn" , "ethereum" , "fantom" , "flare" , "gnosis" + , "ink" , "kaia" , "linea" , "nova" @@ -22,6 +24,7 @@ , "ronin" , "scroll" , "sei" + , "sonic" , "viction" , "worldchain" , "zksync" @@ -95,4 +98,8 @@ FROM ( , (2020, 'ronin', 'Ronin', 'Layer 1', null, 'RON', 0xe514d9deb7966c8be0ca922de8a064264ea6bcd4, 'https://app.roninchain.com/', timestamp '2021-01-25 10:49', NULL, NULL, NULL, true) , (14, 'flare', 'Flare', 'Layer 1', NULL, 'FLR', NULL, 'https://flare-explorer.flare.network/', timestamp '2022-07-13 15:32', NULL, NULL, NULL, true) , (88, 'viction', 'Viction', 'Layer 1', NULL, 'VIC', 0xC054751BdBD24Ae713BA3Dc9Bd9434aBe2abc1ce, 'https://vicscan.xyz/', timestamp '2018-12-14 07:50:20', NULL, NULL, NULL, true) + , (21000000, 'corn', 'Corn', 'Layer 1', NULL, 'BTCN', NULL, 'https://cornscan.io/', timestamp '2024-11-19 10:29:11', NULL, NULL, NULL, true) + , (146, 'sonic', 'Sonic', 'Layer 1', NULL, 'SONIC', NULL, 'https://sonicscan.org/', timestamp '2024-12-01 00:00', NULL, NULL, NULL, true) + , (57073, 'ink', 'Ink', 'Layer 2', 'Optimistic Rollup', 'ETH', 0x4200000000000000000000000000000000000006, 'https://explorer.inkonchain.com/', timestamp '2024-12-06 15:20', 'OP Stack', 'Ethereum Blobs', 'Ethereum', true) ) AS temp_table (chain_id, blockchain, name, chain_type, rollup_type, native_token_symbol, wrapped_native_token_address, explorer_link, first_block_time, codebase, data_availability, settlement, is_on_dune) + diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_schema.yml b/dbt_subprojects/daily_spellbook/models/evms/evms_schema.yml index 2ba49ad153e..064bcc94308 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_schema.yml +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_schema.yml @@ -484,7 +484,7 @@ models: - name: evms_info meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, mode, sei, ronin + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, mode, sei, ronin, ink sector: evms contributors: hildobby config: diff --git a/dbt_subprojects/daily_spellbook/models/jelly_swap/sei/jelly_swap_sei_schema.yml b/dbt_subprojects/daily_spellbook/models/jelly_swap/sei/jelly_swap_sei_schema.yml index b3d1c0fbbb7..4f7ff928e57 100644 --- a/dbt_subprojects/daily_spellbook/models/jelly_swap/sei/jelly_swap_sei_schema.yml +++ b/dbt_subprojects/daily_spellbook/models/jelly_swap/sei/jelly_swap_sei_schema.yml @@ -77,7 +77,7 @@ models: config: tags: ['sei', 'revenue', 'fees'] description: > - Daily Protocol Fee collected and Revenue by pool on JellySwap, an automated portfolio manager and trading platform built on jelly_swap. + Daily Protocol Fee collected and Revenue by pool on JellySwap, an automated portfolio manager and trading platform, Friendly Fork of Balancer. data_tests: - dbt_utils.unique_combination_of_columns: combination_of_columns: @@ -103,9 +103,12 @@ models: - &treasury_share name: treasury_share description: "Share of total fee that is directed to jelly_swap DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd + - &treasury_fee_usd name: treasury_revenue_usd - description: "USD value of fee directed to jelly_swap DAO's treasury" + description: "USD value of fee directed to Jelly Swap DAO's treasury" + - &lp_fee_collected_usd + name: lp_fee_collected_usd + description: "USD value of the fee returned to liquidity providers" - name: jelly_swap_sei_bpt_supply meta: diff --git a/dbt_subprojects/daily_spellbook/tests/aave/base/aave_base_interests_test.sql b/dbt_subprojects/daily_spellbook/tests/aave/base/aave_base_interests_test.sql new file mode 100644 index 00000000000..829be379215 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/tests/aave/base/aave_base_interests_test.sql @@ -0,0 +1,25 @@ +with unit_test1 + as (select case + when abs(variable_borrow_apy - 0.10808360395679557) / 0.10808360395679557 < 0.001 + then true + else false + end as test + from {{ ref('aave_v3_base_interest_rates' )}} + where reserve = 0x833589fcd6edb6e08f4c7c32d4f71b54bda02913 -- USDC + and hour = TIMESTAMP '2025-01-02 20:00'), + unit_test2 + as (select case + when abs(deposit_apy - 0.015712521763084) / 0.015712521763084 < 0.001 + then true + else false + end as test + from {{ ref('aave_v3_base_interest_rates' )}} + where symbol = 'WETH' -- 0x4200000000000000000000000000000000000006 + and hour = TIMESTAMP '2024-08-21 03:00') +select * +from (select * + from unit_test1 + union + select * + from unit_test2) +where test = false \ No newline at end of file diff --git a/dbt_subprojects/dex/macros/models/_project/balancer_compatible_trades.sql b/dbt_subprojects/dex/macros/models/_project/balancer_compatible_trades.sql index 13aefc608b6..8ec5e879a01 100644 --- a/dbt_subprojects/dex/macros/models/_project/balancer_compatible_trades.sql +++ b/dbt_subprojects/dex/macros/models/_project/balancer_compatible_trades.sql @@ -253,4 +253,4 @@ SELECT dexs.pool_type FROM dexs -{% endmacro %} \ No newline at end of file +{% endmacro %} diff --git a/dbt_subprojects/dex/macros/models/_project/oneinch/CC/oneinch_escrow_cfg_factories_macro.sql b/dbt_subprojects/dex/macros/models/_project/oneinch/CC/oneinch_escrow_cfg_factories_macro.sql index c89daee18ed..01d430a9169 100644 --- a/dbt_subprojects/dex/macros/models/_project/oneinch/CC/oneinch_escrow_cfg_factories_macro.sql +++ b/dbt_subprojects/dex/macros/models/_project/oneinch/CC/oneinch_escrow_cfg_factories_macro.sql @@ -21,7 +21,7 @@ set contracts = { "EscrowFactoryV1": { "version": "1", - "blockchains": ["ethereum", "bnb", "polygon", "arbitrum", "avalanche_c", "gnosis", "optimism", "base"], + "blockchains": ["ethereum", "bnb", "polygon", "arbitrum", "avalanche_c", "gnosis", "optimism", "base", "zksync"], "start": "2024-08-20", "dst_creation": dict(immutables["v1"], method="createDstEscrow"), "src_created": dict(immutables["v1"], event="SrcEscrowCreated", diff --git a/dbt_subprojects/dex/macros/models/_project/oneinch/_meta/oneinch_blockchain_macro.sql b/dbt_subprojects/dex/macros/models/_project/oneinch/_meta/oneinch_blockchain_macro.sql index fc68e45b573..59652d6b208 100644 --- a/dbt_subprojects/dex/macros/models/_project/oneinch/_meta/oneinch_blockchain_macro.sql +++ b/dbt_subprojects/dex/macros/models/_project/oneinch/_meta/oneinch_blockchain_macro.sql @@ -96,7 +96,7 @@ "gnosis": "array[0xa7bcb4eac8964306f9e3764f67db6a7af6ddf99a]", "fantom": "array[]", "base": "array[0xa7bcb4eac8964306f9e3764f67db6a7af6ddf99a]", - "zksync": "array[]", + "zksync": "array[0x584aeab186d81dbb52a8a14820c573480c3d4773]", "aurora": "array[]", "klaytn": "array[]", }, diff --git a/dbt_subprojects/dex/models/_projects/bebop/arbitrum/bebop_jam_arbitrum_trades.sql b/dbt_subprojects/dex/models/_projects/bebop/arbitrum/bebop_jam_arbitrum_trades.sql index 5e7c56853a7..9b46960b503 100644 --- a/dbt_subprojects/dex/models/_projects/bebop/arbitrum/bebop_jam_arbitrum_trades.sql +++ b/dbt_subprojects/dex/models/_projects/bebop/arbitrum/bebop_jam_arbitrum_trades.sql @@ -31,7 +31,10 @@ bebop_jam_raw_data AS ( (SELECT evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num FROM {{ source('bebop_jam_arbitrum', 'JamSettlement_evt_Settlement') }} - ) evt + UNION ALL + SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('jam_v2_arbitrum', 'JamSettlement_evt_BebopJamOrderFilled') }}) evt LEFT JOIN (SELECT call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", @@ -42,6 +45,11 @@ bebop_jam_raw_data AS ( call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num FROM {{ source('bebop_jam_arbitrum', 'JamSettlement_call_settleWithPermitsSignatures') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('jam_v2_arbitrum', 'JamSettlement_call_settle') }} ) ex ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num WHERE ex.call_success = TRUE diff --git a/dbt_subprojects/dex/models/_projects/bebop/arbitrum/bebop_rfq_arbitrum_trades.sql b/dbt_subprojects/dex/models/_projects/bebop/arbitrum/bebop_rfq_arbitrum_trades.sql index 8ad2b992239..ba61af18666 100644 --- a/dbt_subprojects/dex/models/_projects/bebop/arbitrum/bebop_rfq_arbitrum_trades.sql +++ b/dbt_subprojects/dex/models/_projects/bebop/arbitrum/bebop_rfq_arbitrum_trades.sql @@ -10,7 +10,7 @@ {% set project_start_date = '2023-03-30' %} -WITH +WITH bebop_raw_data AS ( SELECT @@ -57,6 +57,8 @@ bebop_raw_data AS ( {% if is_incremental() %} AND {{ incremental_predicate('evt.evt_block_time') }} {% endif %} + AND json_array_length(json_extract((JSON_EXTRACT(ex."order", '$.maker_tokens')), '$[0]')) > 0 + AND json_array_length(json_extract((JSON_EXTRACT(ex."order", '$.taker_tokens')), '$[0]')) > 0 ), unnested_array_taker AS ( @@ -76,11 +78,11 @@ unnested_array_taker AS ( taker_length, maker_length, element_at(CAST(json_extract(taker_tokens_json, '$[0]') AS ARRAY), sequence_number) AS taker_token_address, - element_at(CAST(json_extract(taker_amounts_json, '$[0]') AS ARRAY), sequence_number) AS taker_token_amounts, + element_at(CAST(json_extract(taker_amounts_json, '$[0]') AS ARRAY), sequence_number) AS taker_token_amounts, sequence_number - 1 AS taker_index FROM bebop_raw_data CROSS JOIN UNNEST(sequence(1, json_array_length(json_extract(taker_tokens_json, '$[0]')))) AS t(sequence_number) -), +), unnested_array_maker AS ( SELECT @@ -102,43 +104,43 @@ unnested_array_maker AS ( taker_length, maker_length, element_at(CAST(json_extract(maker_tokens_json, '$[0]') AS ARRAY), sequence_number) AS maker_token_address, - element_at(CAST(json_extract(maker_amounts_json, '$[0]') AS ARRAY), sequence_number) AS maker_token_amounts, + element_at(CAST(json_extract(maker_amounts_json, '$[0]') AS ARRAY), sequence_number) AS maker_token_amounts, sequence_number - 1 AS maker_index FROM unnested_array_taker CROSS JOIN UNNEST(sequence(1, json_array_length(json_extract(maker_tokens_json, '$[0]')))) AS t(sequence_number) -), +), simple_trades as ( - SELECT - block_time, + SELECT + block_time, block_number, - contract_address, - tx_hash, + contract_address, + tx_hash, evt_index, - taker_address, + taker_address, maker_address, taker_length, maker_length, - CASE + CASE WHEN taker_length = 1 AND maker_length > 1 THEN CAST(array[taker_index, maker_index] as array) WHEN maker_length = 1 AND taker_length > 1 THEN CAST(array[maker_index, taker_index] as array) ELSE CAST(array[taker_index, maker_index] as array) END as trace_address, - CASE - WHEN taker_length = 1 AND maker_length > 1 THEN 'Multi-Buy' -- inverted - WHEN maker_length = 1 AND taker_length > 1 THEN 'Multi-Sell' -- inverted, noted below... + CASE + WHEN taker_length = 1 AND maker_length > 1 THEN 'Multi-Buy' -- inverted + WHEN maker_length = 1 AND taker_length > 1 THEN 'Multi-Sell' -- inverted, noted below... ELSE 'Simple-Swap' END as trade_type, from_hex(maker_token_address) as token_bought_address, -- for some weird reason, this is inverted, based on the spark version of this query & also on arbiscan - from_hex(taker_token_address) as token_sold_address, -- noted above + from_hex(taker_token_address) as token_sold_address, -- noted above CAST(maker_token_amounts as UINT256) as token_bought_amount_raw, CAST(maker_token_amounts as double) as token_bought_amount, CAST(taker_token_amounts as UINT256) as token_sold_amount_raw, CAST(taker_token_amounts as double) as token_sold_amount - FROM + FROM unnested_array_maker - WHERE maker_token_address IS NOT NULL - AND taker_token_address IS NOT NULL + WHERE maker_token_address IS NOT NULL + AND taker_token_address IS NOT NULL ) SELECT @@ -159,7 +161,7 @@ SELECT t.token_sold_amount / power(10, coalesce(t_sold.decimals, 0)) AS token_sold_amount, t.token_bought_amount_raw, t.token_sold_amount_raw, - CASE + CASE WHEN t.trade_type = 'Multi-Buy' THEN COALESCE( (t.token_bought_amount / power(10, t_bought.decimals)) * p_bought.price, (t.token_sold_amount / power(10, t_sold.decimals)) * p_sold.price / maker_length @@ -171,8 +173,8 @@ SELECT ELSE COALESCE( (t.token_bought_amount / power(10, t_bought.decimals)) * p_bought.price, (t.token_sold_amount / power(10, t_sold.decimals)) * p_sold.price - ) - END as amount_usd, -- when there's a Multi-trade, the usd value of the multi tokens traded is used as the amount_usd + ) + END as amount_usd, -- when there's a Multi-trade, the usd value of the multi tokens traded is used as the amount_usd t.token_bought_address, t.token_sold_address, t.taker_address AS taker, @@ -185,7 +187,7 @@ SELECT t.evt_index FROM simple_trades t -INNER JOIN +INNER JOIN {{ source('arbitrum', 'transactions')}} tx ON t.tx_hash = tx.hash {% if not is_incremental() %} @@ -194,16 +196,16 @@ INNER JOIN {% if is_incremental() %} AND {{ incremental_predicate('tx.block_time') }} {% endif %} - LEFT JOIN - {{ source('tokens', 'erc20') }} t_bought + LEFT JOIN + {{ source('tokens', 'erc20') }} t_bought ON t_bought.contract_address = t.token_bought_address AND t_bought.blockchain = 'arbitrum' - LEFT JOIN + LEFT JOIN {{ source('tokens', 'erc20') }} t_sold ON t_sold.contract_address = t.token_sold_address AND t_sold.blockchain = 'arbitrum' - LEFT JOIN - {{ source('prices', 'usd') }} p_bought + LEFT JOIN + {{ source('prices', 'usd') }} p_bought ON p_bought.minute = date_trunc('minute', t.block_time) AND p_bought.contract_address = t.token_bought_address AND p_bought.blockchain = 'arbitrum' @@ -213,8 +215,8 @@ INNER JOIN {% if is_incremental() %} AND {{ incremental_predicate('p_bought.minute') }} {% endif %} - LEFT JOIN - {{ source('prices', 'usd') }} p_sold + LEFT JOIN + {{ source('prices', 'usd') }} p_sold ON p_sold.minute = date_trunc('minute', t.block_time) AND p_sold.contract_address = t.token_sold_address AND p_sold.blockchain = 'arbitrum' @@ -223,4 +225,4 @@ INNER JOIN {% endif %} {% if is_incremental() %} AND {{ incremental_predicate('p_sold.minute') }} - {% endif %} \ No newline at end of file + {% endif %} diff --git a/dbt_subprojects/dex/models/_projects/bebop/base/bebop_jam_base_trades.sql b/dbt_subprojects/dex/models/_projects/bebop/base/bebop_jam_base_trades.sql index 29643125f66..0505b141c4b 100644 --- a/dbt_subprojects/dex/models/_projects/bebop/base/bebop_jam_base_trades.sql +++ b/dbt_subprojects/dex/models/_projects/bebop/base/bebop_jam_base_trades.sql @@ -31,7 +31,10 @@ bebop_jam_raw_data AS ( (SELECT evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num FROM {{ source('bebop_jam_base', 'JamSettlement_evt_Settlement') }} - ) evt + UNION ALL + SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('jam_v2_base', 'JamSettlement_evt_BebopJamOrderFilled') }}) evt LEFT JOIN (SELECT call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", @@ -42,6 +45,11 @@ bebop_jam_raw_data AS ( call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num FROM {{ source('bebop_jam_base', 'JamSettlement_call_settleWithPermitsSignatures') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('jam_v2_base', 'JamSettlement_call_settle') }} ) ex ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num WHERE ex.call_success = TRUE diff --git a/dbt_subprojects/dex/models/_projects/bebop/bnb/bebop_jam_bnb_trades.sql b/dbt_subprojects/dex/models/_projects/bebop/bnb/bebop_jam_bnb_trades.sql index b9f7368f9aa..e1ded32aec5 100644 --- a/dbt_subprojects/dex/models/_projects/bebop/bnb/bebop_jam_bnb_trades.sql +++ b/dbt_subprojects/dex/models/_projects/bebop/bnb/bebop_jam_bnb_trades.sql @@ -31,7 +31,10 @@ bebop_jam_raw_data AS ( (SELECT evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num FROM {{ source('bebop_jam_bnb', 'JamSettlement_evt_Settlement') }} - ) evt + UNION ALL + SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('jam_v2_bnb', 'JamSettlement_evt_BebopJamOrderFilled') }}) evt LEFT JOIN (SELECT call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", @@ -42,6 +45,11 @@ bebop_jam_raw_data AS ( call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num FROM {{ source('bebop_jam_bnb', 'JamSettlement_call_settleWithPermitsSignatures') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('jam_v2_bnb', 'JamSettlement_call_settle') }} ) ex ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num WHERE ex.call_success = TRUE diff --git a/dbt_subprojects/dex/models/_projects/bebop/ethereum/bebop_jam_ethereum_trades.sql b/dbt_subprojects/dex/models/_projects/bebop/ethereum/bebop_jam_ethereum_trades.sql index 65a7d07453e..3a8414bb2c9 100644 --- a/dbt_subprojects/dex/models/_projects/bebop/ethereum/bebop_jam_ethereum_trades.sql +++ b/dbt_subprojects/dex/models/_projects/bebop/ethereum/bebop_jam_ethereum_trades.sql @@ -31,7 +31,10 @@ bebop_jam_raw_data AS ( (SELECT evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num FROM {{ source('bebop_jam_ethereum', 'JamSettlement_evt_Settlement') }} - ) evt + UNION ALL + SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('jam_v2_ethereum', 'JamSettlement_evt_BebopJamOrderFilled') }}) evt LEFT JOIN (SELECT call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", @@ -42,6 +45,11 @@ bebop_jam_raw_data AS ( call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num FROM {{ source('bebop_jam_ethereum', 'JamSettlement_call_settleWithPermitsSignatures') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('jam_v2_ethereum', 'JamSettlement_call_settle') }} ) ex ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num WHERE ex.call_success = TRUE diff --git a/dbt_subprojects/dex/models/_projects/bebop/ethereum/bebop_rfq_ethereum_trades.sql b/dbt_subprojects/dex/models/_projects/bebop/ethereum/bebop_rfq_ethereum_trades.sql index 991f8fc07b4..f96dd8889a3 100644 --- a/dbt_subprojects/dex/models/_projects/bebop/ethereum/bebop_rfq_ethereum_trades.sql +++ b/dbt_subprojects/dex/models/_projects/bebop/ethereum/bebop_rfq_ethereum_trades.sql @@ -57,6 +57,8 @@ bebop_raw_data AS ( {% if is_incremental() %} AND {{ incremental_predicate('evt.evt_block_time') }} {% endif %} + AND json_array_length(json_extract((JSON_EXTRACT(ex."order", '$.maker_tokens')), '$[0]')) > 0 + AND json_array_length(json_extract((JSON_EXTRACT(ex."order", '$.taker_tokens')), '$[0]')) > 0 ), unnested_array_taker AS ( diff --git a/dbt_subprojects/dex/models/_projects/bebop/optimism/bebop_jam_optimism_trades.sql b/dbt_subprojects/dex/models/_projects/bebop/optimism/bebop_jam_optimism_trades.sql index deefa653ce1..7c2b28b347b 100644 --- a/dbt_subprojects/dex/models/_projects/bebop/optimism/bebop_jam_optimism_trades.sql +++ b/dbt_subprojects/dex/models/_projects/bebop/optimism/bebop_jam_optimism_trades.sql @@ -31,7 +31,10 @@ bebop_jam_raw_data AS ( (SELECT evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num FROM {{ source('bebop_jam_optimism', 'JamSettlement_evt_Settlement') }} - ) evt + UNION ALL + SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('jam_v2_optimism', 'JamSettlement_evt_BebopJamOrderFilled') }}) evt LEFT JOIN (SELECT call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", @@ -42,6 +45,11 @@ bebop_jam_raw_data AS ( call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num FROM {{ source('bebop_jam_optimism', 'JamSettlement_call_settleWithPermitsSignatures') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('jam_v2_optimism', 'JamSettlement_call_settle') }} ) ex ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num WHERE ex.call_success = TRUE diff --git a/dbt_subprojects/dex/models/_projects/bebop/optimism/bebop_rfq_optimism_trades.sql b/dbt_subprojects/dex/models/_projects/bebop/optimism/bebop_rfq_optimism_trades.sql index 7aa27dfd878..f01482ff868 100644 --- a/dbt_subprojects/dex/models/_projects/bebop/optimism/bebop_rfq_optimism_trades.sql +++ b/dbt_subprojects/dex/models/_projects/bebop/optimism/bebop_rfq_optimism_trades.sql @@ -50,6 +50,8 @@ bebop_raw_data AS ( {% if is_incremental() %} AND {{ incremental_predicate('evt.evt_block_time') }} {% endif %} + AND json_array_length(json_extract((JSON_EXTRACT(ex."order", '$.maker_tokens')), '$[0]')) > 0 + AND json_array_length(json_extract((JSON_EXTRACT(ex."order", '$.taker_tokens')), '$[0]')) > 0 ), unnested_array_taker AS ( diff --git a/dbt_subprojects/dex/models/_projects/bebop/polygon/bebop_jam_polygon_trades.sql b/dbt_subprojects/dex/models/_projects/bebop/polygon/bebop_jam_polygon_trades.sql index 061c633d9b7..fe802bde813 100644 --- a/dbt_subprojects/dex/models/_projects/bebop/polygon/bebop_jam_polygon_trades.sql +++ b/dbt_subprojects/dex/models/_projects/bebop/polygon/bebop_jam_polygon_trades.sql @@ -31,7 +31,10 @@ bebop_jam_raw_data AS ( (SELECT evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num FROM {{ source('bebop_jam_polygon', 'JamSettlement_evt_Settlement') }} - ) evt + UNION ALL + SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('jam_v2_polygon', 'JamSettlement_evt_BebopJamOrderFilled') }}) evt LEFT JOIN (SELECT call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", @@ -42,6 +45,11 @@ bebop_jam_raw_data AS ( call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num FROM {{ source('bebop_jam_polygon', 'JamSettlement_call_settleWithPermitsSignatures') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('jam_v2_polygon', 'JamSettlement_call_settle') }} ) ex ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num WHERE ex.call_success = TRUE diff --git a/dbt_subprojects/dex/models/_projects/bebop/polygon/bebop_rfq_polygon_trades.sql b/dbt_subprojects/dex/models/_projects/bebop/polygon/bebop_rfq_polygon_trades.sql index a2ed8dc0408..625aa4a23c7 100644 --- a/dbt_subprojects/dex/models/_projects/bebop/polygon/bebop_rfq_polygon_trades.sql +++ b/dbt_subprojects/dex/models/_projects/bebop/polygon/bebop_rfq_polygon_trades.sql @@ -57,6 +57,8 @@ bebop_raw_data AS ( {% if is_incremental() %} AND {{ incremental_predicate('evt.evt_block_time') }} {% endif %} + AND json_array_length(json_extract((JSON_EXTRACT(ex."order", '$.maker_tokens')), '$[0]')) > 0 + AND json_array_length(json_extract((JSON_EXTRACT(ex."order", '$.taker_tokens')), '$[0]')) > 0 ), unnested_array_taker AS ( diff --git a/dbt_subprojects/dex/models/_projects/bebop/scroll/bebop_jam_scroll_trades.sql b/dbt_subprojects/dex/models/_projects/bebop/scroll/bebop_jam_scroll_trades.sql index f7993a3bf2e..c21bd89c4a6 100644 --- a/dbt_subprojects/dex/models/_projects/bebop/scroll/bebop_jam_scroll_trades.sql +++ b/dbt_subprojects/dex/models/_projects/bebop/scroll/bebop_jam_scroll_trades.sql @@ -31,7 +31,10 @@ bebop_jam_raw_data AS ( (SELECT evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num FROM {{ source('bebop_jam_scroll', 'JamSettlement_evt_Settlement') }} - ) evt + UNION ALL + SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('jam_v2_scroll', 'JamSettlement_evt_BebopJamOrderFilled') }}) evt LEFT JOIN (SELECT call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", @@ -42,6 +45,11 @@ bebop_jam_raw_data AS ( call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num FROM {{ source('bebop_jam_scroll', 'JamSettlement_call_settleWithPermitsSignatures') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('jam_v2_scroll', 'JamSettlement_call_settle') }} ) ex ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num WHERE ex.call_success = TRUE diff --git a/dbt_subprojects/dex/models/_projects/bebop/zksync/bebop_jam_zksync_trades.sql b/dbt_subprojects/dex/models/_projects/bebop/zksync/bebop_jam_zksync_trades.sql index 283548feefd..3cb9174e8e5 100644 --- a/dbt_subprojects/dex/models/_projects/bebop/zksync/bebop_jam_zksync_trades.sql +++ b/dbt_subprojects/dex/models/_projects/bebop/zksync/bebop_jam_zksync_trades.sql @@ -31,7 +31,10 @@ bebop_jam_raw_data AS ( (SELECT evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num FROM {{ source('bebop_jam_zksync', 'JamSettlement_evt_Settlement') }} - ) evt + UNION ALL + SELECT + evt_index, evt_tx_hash, evt_block_time, ROW_NUMBER() OVER (PARTITION BY evt_tx_hash ORDER BY evt_index) AS row_num + FROM {{ source('jam_v2_zksync', 'JamSettlement_evt_BebopJamOrderFilled') }}) evt LEFT JOIN (SELECT call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", @@ -42,6 +45,11 @@ bebop_jam_raw_data AS ( call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num FROM {{ source('bebop_jam_zksync', 'JamSettlement_call_settleWithPermitsSignatures') }} + UNION ALL + SELECT + call_success, call_block_time, call_block_number, call_tx_hash, contract_address, "order", + ROW_NUMBER() OVER (PARTITION BY call_tx_hash ORDER BY call_block_number) AS row_num + FROM {{ source('jam_v2_zksync', 'JamSettlement_call_settle') }} ) ex ON ex.call_tx_hash = evt.evt_tx_hash and ex.row_num = evt.row_num WHERE ex.call_success = TRUE diff --git a/dbt_subprojects/dex/models/_projects/beets/_schema.yml b/dbt_subprojects/dex/models/_projects/beets/_schema.yml new file mode 100644 index 00000000000..9f25b45cb2e --- /dev/null +++ b/dbt_subprojects/dex/models/_projects/beets/_schema.yml @@ -0,0 +1,206 @@ +version: 2 + +models: + - name: beets_pools_fees + meta: + blockchain: sonic + project: beets + contributors: viniabussafi + config: + tags: ['sonic', 'beets', 'pools_fees'] + description: > + Beets swap fees stored at the pool level. + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &version + name: version + description: "Version of Balancer where the liquidity pool used in transaction is deployed" + - &contract_address + name: contract_address + description: 'zkevm address for the liquidity pool used in transaction' + data_tests: + - not_null + - &tx_hash + name: tx_hash + description: 'Transaction hash' + data_tests: + - not_null + - &index + name: index + description: 'Event Index' + data_tests: + - not_null + - &tx_index + name: tx_index + description: 'Transaction Index' + data_tests: + - not_null + - &block_time + name: block_time + description: 'Block time in UTC' + data_tests: + - not_null + - &block_number + name: block_number + description: 'Event Block Number' + data_tests: + - not_null + - &swap_fee_percentage + name: swap_fee_percentage + description: 'Swap fees for the pool, values are returned with 18 decimals (1e18 meaning 100%)' + data_tests: + - not_null + + - name: beethoven_x_v2_sonic_pools_fees + meta: + blockchain: sonic + project: beets + contributors: viniabussafi + config: + tags: ['sonic', 'beets', 'pools_fees'] + description: > + Beets v2 swap fees stored at the pool level. + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - *blockchain + - *version + - *contract_address + - *tx_hash + - *index + - *tx_index + - *block_time + - *block_number + - *swap_fee_percentage + + - name: beethoven_x_v3_sonic_pools_fees + meta: + blockchain: sonic + project: beets + contributors: viniabussafi + config: + tags: ['sonic', 'beets', 'pools_fees'] + description: > + Beets v3 swap fees stored at the pool level. + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_number + - tx_hash + - index + columns: + - *blockchain + - *version + - *contract_address + - *tx_hash + - *index + - *tx_index + - *block_time + - *block_number + - *swap_fee_percentage + + - name: beets_trades + meta: + blockchain: sonic + sector: dex + contributors: viniabussafi + config: + tags: ['beets', 'sonic', 'amm', 'trades', 'dex'] + description: > + DEX trades on beets on sonic + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - blockchain + - project + - version + - tx_hash + - evt_index + columns: + - *blockchain + - &project + name: project + description: "Project name (balancer)" + - *version + - &block_month + name: block_month + description: "Block month in UTC" + - &block_date + name: block_date + description: "Block date in UTC" + - *block_time + - *block_number + - &token_bought_symbol + name: token_bought_symbol + description: "Token symbol for token bought in the trade" + - &token_sold_symbol + name: token_sold_symbol + description: "Token symbol for token sold in the trade" + - &token_pair + name: token_pair + description: "Token symbol pair for each token involved in the trade" + - &token_bought_amount + name: token_bought_amount + description: "Value of the token bought at time of execution in the original currency" + - &token_sold_amount + name: token_sold_amount + description: "Value of the token sold at time of execution in the original currency" + - &token_bought_amount_raw + name: token_bought_amount_raw + description: "Raw value of the token bought at time of execution in the original currency" + - &token_sold_amount_raw + name: token_sold_amount_raw + description: "Raw value of the token sold at time of execution in the original currency" + - &amount_usd + name: amount_usd + description: "USD value of the trade at time of execution" + - &token_bought_address + name: token_bought_address + description: "Contract address of the token bought" + - &token_sold_address + name: token_sold_address + description: "Contract address of the token sold" + - &taker + name: taker + description: "Address of trader who purchased a token" + - &maker + name: maker + description: "Address of trader who sold a token" + - &pool_id + name: pool_id + description: "Unique encoded identifier that refers to each pool" + - &swap_fee + name: swap_fee + description: 'Swap fee' + - &project_contract_address + name: project_contract_address + description: "Pool address" + - &pool_symbol + name: pool_symbol + description: "Token symbols, followed by their respective weights, if applicable" + - &pool_type + name: pool_type + description: "Pool attributes, determined by the pool's factory" + - *tx_hash + - &tx_from + name: tx_from + description: "transaction.from" + - &tx_to + name: tx_to + description: "transaction.to" + - &evt_index + name: evt_index + description: 'Event index' \ No newline at end of file diff --git a/dbt_subprojects/dex/models/_projects/beets/beethoven_x_v2_sonic_pools_fees.sql b/dbt_subprojects/dex/models/_projects/beets/beethoven_x_v2_sonic_pools_fees.sql new file mode 100644 index 00000000000..14c737e2293 --- /dev/null +++ b/dbt_subprojects/dex/models/_projects/beets/beethoven_x_v2_sonic_pools_fees.sql @@ -0,0 +1,44 @@ +{{ + config( + schema = 'beethoven_x_v2_sonic', + alias = 'pools_fees', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_number', 'tx_hash', 'index'], + post_hook='{{ expose_spells(\'["sonic"]\', + "project", + "beethoven_x", + \'["viniabussafi"]\') }}' + )  +}} + +{% set event_signature = '0xa9ba3ffe0b6c366b81232caab38605a0699ad5398d6cce76f91ee809e322dafc' %} +{% set project_start_date = '2024-12-01' %} + + WITH registered_pools AS ( + SELECT + DISTINCT poolAddress AS pool_address + FROM + {{ source ('beethoven_x_v2_sonic', 'Vault_evt_PoolRegistered') }} + ) + SELECT + 'sonic' AS blockchain, + '2' AS version, + logs.contract_address, + logs.tx_hash, + logs.tx_index, + logs.index, + logs.block_time, + logs.block_number, + CAST(bytearray_to_uint256(bytearray_ltrim(logs.data)) AS DOUBLE) AS swap_fee_percentage + FROM + {{ source ('sonic', 'logs') }} + INNER JOIN registered_pools ON registered_pools.pool_address = logs.contract_address + WHERE logs.topic0 = {{ event_signature }} + {% if not is_incremental() %} + AND logs.block_time >= TIMESTAMP '{{ project_start_date }}' + {% endif %} + {% if is_incremental() %} + AND {{ incremental_predicate('logs.block_time') }} + {% endif %} \ No newline at end of file diff --git a/dbt_subprojects/dex/models/_projects/beets/beethoven_x_v3_sonic_pools_fees.sql b/dbt_subprojects/dex/models/_projects/beets/beethoven_x_v3_sonic_pools_fees.sql new file mode 100644 index 00000000000..84a2b9b0204 --- /dev/null +++ b/dbt_subprojects/dex/models/_projects/beets/beethoven_x_v3_sonic_pools_fees.sql @@ -0,0 +1,30 @@ +{{ + config( + schema = 'beethoven_x_v3_sonic', + alias = 'pools_fees', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['block_number', 'tx_hash', 'index'], + post_hook='{{ expose_spells(\'["sonic"]\', + "project", + "beethoven_x", + \'["viniabussafi"]\') }}' + )  +}} + + SELECT + 'sonic' AS blockchain, + '3' AS version, + pool AS contract_address, + evt_tx_hash AS tx_hash, + evt_index AS tx_index, + evt_index AS index, + evt_block_time AS block_time, + evt_block_number AS block_number, + swapFeePercentage AS swap_fee_percentage + FROM {{ source ('beethoven_x_v3_sonic', 'Vault_evt_SwapFeePercentageChanged') }} + WHERE 1 = 1 + {% if is_incremental() %} + AND {{ incremental_predicate('evt_block_time') }} + {% endif %} \ No newline at end of file diff --git a/dbt_subprojects/dex/models/_projects/beets/beets_pools_fees.sql b/dbt_subprojects/dex/models/_projects/beets/beets_pools_fees.sql new file mode 100644 index 00000000000..51342f44e8d --- /dev/null +++ b/dbt_subprojects/dex/models/_projects/beets/beets_pools_fees.sql @@ -0,0 +1,35 @@ +{{ config( + schema = 'beets', + alias = 'pools_fees', + post_hook='{{ expose_spells(blockchains = \'["sonic"]\', + spell_type = "project", + spell_name = "beets", + contributors = \'["viniabussafi"]\') }}' + ) +}} + +{% set balancer_models = [ + ref('beethoven_x_v2_sonic_pools_fees'), + ref('beethoven_x_v3_sonic_pools_fees') +] %} + + +SELECT * +FROM ( + {% for model in balancer_models %} + SELECT + blockchain + , version + , contract_address + , tx_hash + , index + , tx_index + , block_time + , block_number + , swap_fee_percentage + FROM {{ model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} +) \ No newline at end of file diff --git a/dbt_subprojects/dex/models/_projects/beets/beets_trades.sql b/dbt_subprojects/dex/models/_projects/beets/beets_trades.sql new file mode 100644 index 00000000000..34a7f8fc577 --- /dev/null +++ b/dbt_subprojects/dex/models/_projects/beets/beets_trades.sql @@ -0,0 +1,38 @@ +{{ config( + schema = 'beets', + alias = 'trades', + materialized = 'view', + post_hook='{{ expose_spells(blockchains = \'["sonic"]\', + spell_type = "project", + spell_name = "beets", + contributors = \'["viniabussafi"]\') }}' + ) +}} + + +SELECT blockchain + , project + , version + , block_month + , block_date + , block_time + , block_number + , token_bought_symbol + , token_sold_symbol + , token_pair + , token_bought_amount + , token_sold_amount + , token_bought_amount_raw + , token_sold_amount_raw + , amount_usd + , token_bought_address + , token_sold_address + , taker + , maker + , project_contract_address + , tx_hash + , tx_from + , tx_to + , evt_index +FROM {{ ref('dex_trades') }} +WHERE project = 'beets' \ No newline at end of file diff --git a/dbt_subprojects/dex/models/bot_trades/flokibot/bnb/flokibot_bnb_bot_trades.sql b/dbt_subprojects/dex/models/bot_trades/flokibot/bnb/flokibot_bnb_bot_trades.sql index 0ae3261690a..eadffd400e9 100644 --- a/dbt_subprojects/dex/models/bot_trades/flokibot/bnb/flokibot_bnb_bot_trades.sql +++ b/dbt_subprojects/dex/models/bot_trades/flokibot/bnb/flokibot_bnb_bot_trades.sql @@ -1,5 +1,6 @@ {{ config( + tags = ['prod_exclude'], alias='bot_trades', schema='flokibot_bnb', partition_by=['block_month'], diff --git a/dbt_subprojects/dex/models/dex_info.sql b/dbt_subprojects/dex/models/dex_info.sql index 8f68ddf7469..5c99e1ed15d 100644 --- a/dbt_subprojects/dex/models/dex_info.sql +++ b/dbt_subprojects/dex/models/dex_info.sql @@ -2,7 +2,7 @@ tags = [ 'static'], schema='dex', alias = 'info', - post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "solana", "zksync"]\', + post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "solana", "zksync", "boba"]\', "sector", "dex", \'["hildobby"]\') }}') @@ -194,6 +194,10 @@ FROM (VALUES , ('jetswap', 'JetSwap', 'Direct', 'Jetfuelfinance') , ('bridgers', 'Bridgers', 'Direct', 'Bridgersxyz') , ('levinswap', 'Levinswap', 'Direct', 'levinswap') + , ('sparkdex', 'SparkDEX', 'Direct', 'SparkDexAI') + , ('blazeswap', 'BlazeSwap', 'Direct', 'blazeswapdex') + , ('enosys', 'Enosys', 'Direct', 'enosys_global') , ('gravity_finance', 'GravityFinance', 'Direct', 'Gravity_Finance') , ('fluid', 'Fluid DEX', 'Direct', '0xfluid') + , ('beets', 'Beets DEX', 'Direct', 'beets_fi') ) AS temp_table (project, name, marketplace_type, x_username) diff --git a/dbt_subprojects/dex/models/trades/_schema.yml b/dbt_subprojects/dex/models/trades/_schema.yml index cb10cfb6b1d..27e026c9045 100644 --- a/dbt_subprojects/dex/models/trades/_schema.yml +++ b/dbt_subprojects/dex/models/trades/_schema.yml @@ -4,7 +4,7 @@ models: - name: dex_trades meta: docs_slug: /curated/trading/DEX/dex-trades - blockchain: arbitrum, avalanche_c, base, bnb, celo, ethereum, fantom, gnosis, kaia, optimism, polygon, scroll, zksync, linea, blast, sei, ronin + blockchain: arbitrum, avalanche_c, base, bnb, celo, ethereum, fantom, gnosis, kaia, optimism, polygon, scroll, zksync, linea, blast, sei, ronin, flare, boba, sonic, corn sector: dex short_description: The `dex.trades` table captures detailed data on trades executed via decentralized exchanges (DEXs). This table contains a detailed breakdown of trade execution containing one or many trades per transaction. contributors: 0xRob, hosuke, jeff-dude, tomfutago, viniabussafi @@ -102,7 +102,7 @@ models: - name: dex_base_trades meta: - blockchain: arbitrum, avalanche_c, base, bnb, celo, ethereum, fantom, gnosis, kaia,optimism, polygon, scroll, zksync, linea, blast, sei, ronin + blockchain: arbitrum, avalanche_c, base, bnb, celo, ethereum, fantom, gnosis, kaia,optimism, polygon, scroll, zksync, linea, blast, sei, ronin, sonic, flare sector: dex contributors: 0xRob, hosuke, jeff-dude, tomfutago, viniabussafi config: diff --git a/dbt_subprojects/dex/models/trades/base/_schema.yml b/dbt_subprojects/dex/models/trades/base/_schema.yml index fde1b6d7532..9648dedd6a4 100644 --- a/dbt_subprojects/dex/models/trades/base/_schema.yml +++ b/dbt_subprojects/dex/models/trades/base/_schema.yml @@ -46,7 +46,7 @@ models: blockchain: base sector: dex project: stablebase - contributors: principatel + contributors: principatel, hosuke config: tags: ["base", "dex", "trades", "stablebase"] description: stablebase base trades diff --git a/dbt_subprojects/dex/models/trades/base/platforms/stablebase_base_base_trades.sql b/dbt_subprojects/dex/models/trades/base/platforms/stablebase_base_base_trades.sql index f2c2df02aef..99adc687c28 100644 --- a/dbt_subprojects/dex/models/trades/base/platforms/stablebase_base_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/base/platforms/stablebase_base_base_trades.sql @@ -8,6 +8,11 @@ unique_key = ['block_date', 'blockchain', 'project', 'version', 'tx_hash', 'evt_index'] ) }} +-- Id mapping: +-- 0 USDbC https://basescan.org/token/0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca +-- 1 DAI https://basescan.org/token/0x50c5725949a6f0c72e6c4a641f24049a917db0cb +-- 2 axlUSDC https://basescan.org/token/0xeb466342c4d449bc9f53a865d5cb90586f405215 + WITH token_swaps AS ( SELECT evt_block_number AS block_number, @@ -16,8 +21,16 @@ WITH token_swaps AS ( evt_tx_to AS taker, tokensSold AS token_sold_amount_raw, tokensBought AS token_bought_amount_raw, - CAST(soldId AS varbinary) AS token_sold_address, - CAST(boughtId AS varbinary) AS token_bought_address, + CASE soldId + WHEN 0 THEN 0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca + WHEN 1 THEN 0x50c5725949a6f0c72e6c4a641f24049a917db0cb + WHEN 2 THEN 0xeb466342c4d449bc9f53a865d5cb90586f405215 + END AS token_sold_address, + CASE boughtId + WHEN 0 THEN 0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca + WHEN 1 THEN 0x50c5725949a6f0c72e6c4a641f24049a917db0cb + WHEN 2 THEN 0xeb466342c4d449bc9f53a865d5cb90586f405215 + END AS token_bought_address, contract_address AS project_contract_address, evt_tx_hash AS tx_hash, evt_index AS evt_index diff --git a/dbt_subprojects/dex/models/trades/boba/_schema.yml b/dbt_subprojects/dex/models/trades/boba/_schema.yml new file mode 100644 index 00000000000..e2589b08837 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/boba/_schema.yml @@ -0,0 +1,25 @@ +version: 2 + +models: + - name: dex_boba_base_trades + data_tests: + - check_dex_info_relationship + + - name: icecreamswap_boba_base_trades + meta: + blockchain: boba + sector: dex + project: icecreamswap + contributors: hosuke + config: + tags: ["boba", "dex", "trades", "icecreamswap"] + description: "IceCreamSwap boba 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('icecreamswap_boba_base_trades_seed') + filter: + version: 1 diff --git a/dbt_subprojects/dex/models/trades/boba/dex_boba_base_trades.sql b/dbt_subprojects/dex/models/trades/boba/dex_boba_base_trades.sql new file mode 100644 index 00000000000..206244de387 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/boba/dex_boba_base_trades.sql @@ -0,0 +1,48 @@ +{{ config( + schema = 'dex_boba' + , alias = 'base_trades' + , materialized = 'view' + ) +}} + +{% set base_models = [ + ref('icecreamswap_boba_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 = 'boba' + , columns = ['from', 'to', 'index'] + ) +}} diff --git a/dbt_subprojects/dex/models/trades/boba/platforms/icecreamswap_boba_base_trades.sql b/dbt_subprojects/dex/models/trades/boba/platforms/icecreamswap_boba_base_trades.sql new file mode 100644 index 00000000000..47657bc2b9b --- /dev/null +++ b/dbt_subprojects/dex/models/trades/boba/platforms/icecreamswap_boba_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'icecreamswap_boba', + 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 = 'boba', + project = 'icecreamswap', + version = '1', + Pair_evt_Swap = source('icecreamswap_boba', 'IceCreamSwapV2Pair_evt_Swap'), + Factory_evt_PairCreated = source('icecreamswap_boba', 'IceCreamSwapV2Factory_evt_PairCreated') + ) +}} diff --git a/dbt_subprojects/dex/models/trades/corn/_schema.yml b/dbt_subprojects/dex/models/trades/corn/_schema.yml new file mode 100644 index 00000000000..263251b8098 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/corn/_schema.yml @@ -0,0 +1,83 @@ +version: 2 + +models: + - name: dex_corn_base_trades + meta: + blockchain: corn + sector: dex + contributors: hosuke + config: + tags: ['corn', 'dex', 'trades'] + description: 'All DEX trades on Corn' + data_tests: + - check_dex_info_relationship + + - name: oku_corn_base_trades + meta: + blockchain: corn + sector: dex + project: oku + contributors: hosuke + config: + tags: ['corn', 'dex', 'trades', 'oku'] + description: 'Oku DEX trades on Corn' + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('oku_corn_base_trades_seed') + + - name: camelot_v2_corn_base_trades + meta: + blockchain: corn + sector: dex + project: camelot + contributors: hosuke + config: + tags: ['corn', 'dex', 'trades', 'camelot', 'v2'] + description: 'Camelot v2 DEX trades on Corn' + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + + - name: camelot_v3_corn_base_trades + meta: + blockchain: corn + sector: dex + project: camelot + contributors: hosuke + config: + tags: ['corn', 'dex', 'trades', 'camelot', 'v3'] + description: 'Camelot v3 DEX trades on Corn' + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('camelot_corn_base_trades_seed') + filter: + version: 3 + + - name: camelot_yak_corn_base_trades + meta: + blockchain: corn + sector: dex + project: camelot + contributors: hosuke + config: + tags: ['corn', 'dex', 'trades', 'camelot', 'yak'] + description: 'Camelot Yak DEX trades on Corn' + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('camelot_corn_base_trades_seed') + filter: + version: yak diff --git a/dbt_subprojects/dex/models/trades/corn/dex_corn_base_trades.sql b/dbt_subprojects/dex/models/trades/corn/dex_corn_base_trades.sql new file mode 100644 index 00000000000..b3586fa9733 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/corn/dex_corn_base_trades.sql @@ -0,0 +1,51 @@ +{{ config( + schema = 'dex_corn' + , alias = 'base_trades' + , materialized = 'view' + ) +}} + +{% set base_models = [ + ref('camelot_yak_corn_base_trades') + , ref('camelot_v2_corn_base_trades') + , ref('camelot_v3_corn_base_trades') + , ref('oku_corn_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 = 'corn' + , columns = ['from', 'to', 'index'] + ) +}} diff --git a/dbt_subprojects/dex/models/trades/corn/platforms/camelot_v2_corn_base_trades.sql b/dbt_subprojects/dex/models/trades/corn/platforms/camelot_v2_corn_base_trades.sql new file mode 100644 index 00000000000..ed89ecc7365 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/corn/platforms/camelot_v2_corn_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'camelot_v2_corn', + 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 = 'corn', + project = 'camelot', + version = '2', + Pair_evt_Swap = source('camelot_corn', 'CamelotPair_evt_Swap'), + Factory_evt_PairCreated = source('camelot_corn', 'CamelotFactory_evt_PairCreated') + ) +}} diff --git a/dbt_subprojects/dex/models/trades/corn/platforms/camelot_v3_corn_base_trades.sql b/dbt_subprojects/dex/models/trades/corn/platforms/camelot_v3_corn_base_trades.sql new file mode 100644 index 00000000000..a688ff838f2 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/corn/platforms/camelot_v3_corn_base_trades.sql @@ -0,0 +1,24 @@ +{{ + config( + schema = 'camelot_v3_corn', + 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 = 'corn', + project = 'camelot', + version = '3', + Pair_evt_Swap = source('camelot_corn', 'AlgebraPool_evt_Swap'), + Factory_evt_PoolCreated = source('camelot_corn', 'AlgebraFactory_evt_Pool'), + pair_column_name = 'pool', + taker_column_name = 'recipient', + optional_columns = [] + ) +}} diff --git a/dbt_subprojects/dex/models/trades/corn/platforms/camelot_yak_corn_base_trades.sql b/dbt_subprojects/dex/models/trades/corn/platforms/camelot_yak_corn_base_trades.sql new file mode 100644 index 00000000000..368798a661d --- /dev/null +++ b/dbt_subprojects/dex/models/trades/corn/platforms/camelot_yak_corn_base_trades.sql @@ -0,0 +1,49 @@ +{{ + config( + schema = 'camelot_yak_corn', + 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')] + ) +}} + +WITH dexs AS ( + SELECT + t.evt_block_number AS block_number, + t.evt_block_time AS block_time, + t.evt_tx_from AS taker, + t.contract_address AS maker, + t._amountOut AS token_bought_amount_raw, + t._amountIn AS token_sold_amount_raw, + t._tokenOut AS token_bought_address, + t._tokenIn AS token_sold_address, + t.contract_address AS project_contract_address, + t.evt_tx_hash AS tx_hash, + t.evt_index + FROM {{ source('camelot_corn', 'CamelotYakRouter_evt_YakSwap') }} t + {% if is_incremental() %} + WHERE {{ incremental_predicate('t.evt_block_time') }} + {% endif %} +) + +SELECT + 'corn' AS blockchain, + 'camelot' AS project, + 'yak' AS version, + CAST(date_trunc('month', dexs.block_time) AS date) AS block_month, + CAST(date_trunc('day', dexs.block_time) AS date) AS block_date, + dexs.block_time, + dexs.block_number, + dexs.token_bought_amount_raw, + dexs.token_sold_amount_raw, + dexs.token_bought_address, + dexs.token_sold_address, + dexs.taker, + dexs.maker, + dexs.project_contract_address, + dexs.tx_hash, + dexs.evt_index +FROM dexs diff --git a/dbt_subprojects/dex/models/trades/corn/platforms/oku_corn_base_trades.sql b/dbt_subprojects/dex/models/trades/corn/platforms/oku_corn_base_trades.sql new file mode 100644 index 00000000000..df981980fdc --- /dev/null +++ b/dbt_subprojects/dex/models/trades/corn/platforms/oku_corn_base_trades.sql @@ -0,0 +1,23 @@ +{{ + config( + schema = 'oku_corn', + 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 = 'corn', + project = 'oku', + version = '3', + Pair_evt_Swap = source('oku_corn', 'OkuV3Pair_evt_Swap'), + Factory_evt_PoolCreated = source('oku_corn', 'v3CoreFactoryAddress_evt_PoolCreated'), + pair_column_name = 'pool', + optional_columns = [] + ) +}} diff --git a/dbt_subprojects/dex/models/trades/dex_base_trades.sql b/dbt_subprojects/dex/models/trades/dex_base_trades.sql index 6a5a68bb734..0f192a95714 100644 --- a/dbt_subprojects/dex/models/trades/dex_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/dex_base_trades.sql @@ -16,9 +16,12 @@ , ref('dex_base_base_trades') , ref('dex_blast_base_trades') , ref('dex_bnb_base_trades') + , ref('dex_boba_base_trades') , ref('dex_celo_base_trades') + , ref('dex_corn_base_trades') , ref('dex_ethereum_base_trades') , ref('dex_fantom_base_trades') + , ref('dex_flare_base_trades') , ref('dex_gnosis_base_trades') , ref('dex_linea_base_trades') , ref('dex_kaia_base_trades') @@ -29,6 +32,7 @@ , ref('dex_ronin_base_trades') , ref('dex_scroll_base_trades') , ref('dex_sei_base_trades') + , ref('dex_sonic_base_trades') , ref('dex_worldchain_base_trades') , ref('dex_zkevm_base_trades') , ref('dex_zksync_base_trades') diff --git a/dbt_subprojects/dex/models/trades/dex_trades.sql b/dbt_subprojects/dex/models/trades/dex_trades.sql index 203df9a845d..7b69f5c3684 100644 --- a/dbt_subprojects/dex/models/trades/dex_trades.sql +++ b/dbt_subprojects/dex/models/trades/dex_trades.sql @@ -13,6 +13,7 @@ , "base" , "blast" , "bnb" + , "boba" , "celo" , "ethereum" , "fantom" @@ -26,6 +27,7 @@ , "ronin" , "scroll" , "sei" + , "sonic" , "zkevm" , "zksync" , "zora" diff --git a/dbt_subprojects/dex/models/trades/ethereum/_schema.yml b/dbt_subprojects/dex/models/trades/ethereum/_schema.yml index 5b33a0992c0..a88f3145e99 100644 --- a/dbt_subprojects/dex/models/trades/ethereum/_schema.yml +++ b/dbt_subprojects/dex/models/trades/ethereum/_schema.yml @@ -188,6 +188,7 @@ models: version: - 2 - mmpool + - pcsx - name: shibaswap_v1_ethereum_base_trades meta: diff --git a/dbt_subprojects/dex/models/trades/ethereum/platforms/pancakeswap_v2_ethereum_base_trades.sql b/dbt_subprojects/dex/models/trades/ethereum/platforms/pancakeswap_v2_ethereum_base_trades.sql index 7ab786f47ad..c06b00933e9 100644 --- a/dbt_subprojects/dex/models/trades/ethereum/platforms/pancakeswap_v2_ethereum_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/ethereum/platforms/pancakeswap_v2_ethereum_base_trades.sql @@ -25,6 +25,44 @@ dexs_macro AS ( }} ), +transfer as ( + select * from {{ source('tokens', 'transfers') }} + where blockchain = 'ethereum' + and block_date >= date '2024-09-20' + and tx_hash in (select evt_tx_hash from {{ source('pancakeswap_ethereum', 'ExclusiveDutchOrderReactor_evt_Fill') }}) + {% if is_incremental() %} + and {{ incremental_predicate('block_time') }} + {% endif %} +), + +dexs_pcsx AS ( + -- PancakeSwapX + SELECT + 'pcsx' AS version, + a.evt_block_number AS block_number, + a.evt_block_time AS block_time, + a.swapper AS taker, + a.filler AS maker, + receive.amount_raw AS token_bought_amount_raw, + send.amount_raw AS token_sold_amount_raw, + receive.contract_address AS token_bought_address, + send.contract_address AS token_sold_address, + a.contract_address AS project_contract_address, + a.evt_tx_hash AS tx_hash, + a.evt_index + + FROM {{ source('pancakeswap_ethereum', 'ExclusiveDutchOrderReactor_evt_Fill') }} a + + LEFT JOIN transfer AS send + ON a.evt_tx_hash = send.tx_hash AND a.swapper = send."from" + + LEFT JOIN transfer AS receive + on a.evt_tx_hash = receive.tx_hash AND a.swapper = receive."to" + {% if is_incremental() %} + WHERE {{ incremental_predicate('a.evt_block_time') }} + {% endif %} +), + dexs_mm AS ( -- PancakeSwap v2 MMPool SELECT @@ -129,3 +167,24 @@ SELECT dexs_ss.tx_hash, dexs_ss.evt_index FROM dexs_ss +UNION ALL +SELECT + 'ethereum' AS blockchain, + 'pancakeswap' AS project, + dexs_pcsx.version, + CAST(date_trunc('month', dexs_pcsx.block_time) AS date) AS block_month, + CAST(date_trunc('day', dexs_pcsx.block_time) AS date) AS block_date, + dexs_pcsx.block_time, + dexs_pcsx.block_number, + dexs_pcsx.token_bought_amount_raw, + dexs_pcsx.token_sold_amount_raw, + dexs_pcsx.token_bought_address, + dexs_pcsx.token_sold_address, + dexs_pcsx.taker, + dexs_pcsx.maker, + dexs_pcsx.project_contract_address, + dexs_pcsx.tx_hash, + dexs_pcsx.evt_index +FROM dexs_pcsx +WHERE token_sold_amount_raw > 0 +AND token_bought_amount_raw > 0 \ No newline at end of file diff --git a/dbt_subprojects/dex/models/trades/flare/_schema.yml b/dbt_subprojects/dex/models/trades/flare/_schema.yml new file mode 100644 index 00000000000..438345b34c8 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/_schema.yml @@ -0,0 +1,85 @@ +version: 2 + +models: + - name: dex_flare_base_trades + meta: + blockchain: flare + sector: dex + project: dex + contributors: hosuke + config: + tags: ['flare', 'dex', 'trades'] + description: > + Flare DEX trades + data_tests: + - check_dex_info_relationship + + - name: enosys_v2_flare_base_trades + meta: + blockchain: flare + sector: dex + project: enosys + contributors: hosuke + config: + tags: [ 'flare', 'dex', 'trades', 'enosys', 'v2' ] + description: "Enosys V2 Flare base trades" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + + - name: sparkdex_v2_flare_base_trades + meta: + blockchain: flare + sector: dex + project: sparkdex + contributors: hosuke + config: + tags: ['flare', 'dex', 'trades', 'sparkdex', 'v2'] + description: "SparkDex (UniswapV2 fork) base trades on Flare" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('sparkdex_flare_base_trades_seed') + filter: + version: 2 + + - name: sparkdex_v3_flare_base_trades + meta: + blockchain: flare + sector: dex + project: sparkdex + contributors: hosuke + config: + tags: [ 'flare', 'dex', 'trades', 'sparkdex', 'v3' ] + description: "SparkDex (UniswapV3 fork) base trades on Flare" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - evt_index + - check_dex_base_trades_seed: + seed_file: ref('sparkdex_flare_base_trades_seed') + filter: + version: 3 + + - name: blazeswap_flare_base_trades + meta: + blockchain: flare + sector: dex + project: blazeswap + contributors: hosuke + config: + tags: [ 'flare', 'dex', 'trades', 'blazeswap' ] + description: "Blazeswap Flare 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('blazeswap_flare_base_trades_seed') \ No newline at end of file diff --git a/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql new file mode 100644 index 00000000000..ba14cabcd7a --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/dex_flare_base_trades.sql @@ -0,0 +1,51 @@ +{{ config( + schema = 'dex_flare' + , alias = 'base_trades' + , materialized = 'view' + ) +}} + +{% set base_models = [ + ref('enosys_v2_flare_base_trades') + , ref('sparkdex_v2_flare_base_trades') + , ref('sparkdex_v3_flare_base_trades') + , ref('blazeswap_flare_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 = 'flare' + , columns = ['from', 'to', 'index'] + ) +}} diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql new file mode 100644 index 00000000000..d2743688085 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/platforms/blazeswap_flare_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'blazeswap_flare', + 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 = 'flare', + project = 'blazeswap', + version = '2', + Pair_evt_Swap = source('blazeswap_flare', 'BLAZE_LP_evt_Swap'), + Factory_evt_PairCreated = source('blazeswap_flare', 'BlazeSwapFactory_evt_PairCreated') + ) +}} diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v2_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v2_flare_base_trades.sql new file mode 100644 index 00000000000..680557edfbb --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/platforms/enosys_v2_flare_base_trades.sql @@ -0,0 +1,20 @@ +{{ config( + schema = 'enosys_v2_flare' + , 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 = 'flare' + , project = 'enosys' + , version = '2' + , Pair_evt_Swap = source('enosys_flare', 'EnosysPair_evt_Swap') + , Factory_evt_PairCreated = source('enosys_flare', 'EnosysDexFactory_evt_PairCreated') + ) +}} \ No newline at end of file diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql new file mode 100644 index 00000000000..852be76b246 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v2_flare_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'sparkdex_v2_flare', + 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 = 'flare', + project = 'sparkdex', + version = '2', + Pair_evt_Swap = source('sparkdex_flare', 'UniswapV2Pool_evt_Swap'), + Factory_evt_PairCreated = source('sparkdex_flare', 'UniswapV2Factory_evt_PairCreated') + ) +}} diff --git a/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v3_flare_base_trades.sql b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v3_flare_base_trades.sql new file mode 100644 index 00000000000..becc5cda95b --- /dev/null +++ b/dbt_subprojects/dex/models/trades/flare/platforms/sparkdex_v3_flare_base_trades.sql @@ -0,0 +1,21 @@ +{{ + config( + schema = 'sparkdex_v3_flare', + 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 = 'flare', + project = 'sparkdex', + version = '3', + Pair_evt_Swap = source('sparkdex_flare', 'UniswapV3Pool_evt_Swap'), + Factory_evt_PoolCreated = source('sparkdex_flare', 'UniswapV3Factory_evt_PoolCreated') + ) +}} diff --git a/dbt_subprojects/dex/models/trades/optimism/_schema.yml b/dbt_subprojects/dex/models/trades/optimism/_schema.yml index de83c8b4136..5257ac7bbeb 100644 --- a/dbt_subprojects/dex/models/trades/optimism/_schema.yml +++ b/dbt_subprojects/dex/models/trades/optimism/_schema.yml @@ -574,7 +574,7 @@ models: blockchain: optimism sector: dex project: saddle_finance - contributors: princi + contributors: princi, hosuke config: tags: [ 'optimism', 'dex', 'trades', 'saddle_finance'] description: "saddle finance optimism base trades" diff --git a/dbt_subprojects/dex/models/trades/optimism/dex_optimism_base_trades.sql b/dbt_subprojects/dex/models/trades/optimism/dex_optimism_base_trades.sql index 65342178024..b646f3d59b8 100644 --- a/dbt_subprojects/dex/models/trades/optimism/dex_optimism_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/optimism/dex_optimism_base_trades.sql @@ -35,8 +35,8 @@ , ref('elk_finance_optimism_base_trades') , ref('fraxswap_optimism_base_trades') , ref('swaap_v2_optimism_base_trades') - , ref('saddle_finance_optimism_base_trades') , ref('bridgers_optimism_base_trades') + , ref('saddle_finance_optimism_base_trades') ] %} WITH base_union AS ( diff --git a/dbt_subprojects/dex/models/trades/optimism/platforms/saddle_finance_optimism_base_trades.sql b/dbt_subprojects/dex/models/trades/optimism/platforms/saddle_finance_optimism_base_trades.sql index dda9f17a17e..78d562a80b6 100644 --- a/dbt_subprojects/dex/models/trades/optimism/platforms/saddle_finance_optimism_base_trades.sql +++ b/dbt_subprojects/dex/models/trades/optimism/platforms/saddle_finance_optimism_base_trades.sql @@ -8,6 +8,15 @@ unique_key = ['tx_hash', 'evt_index'] ) }} +-- contract 0x5847f8177221268d279cf377d0e01ab3fd993628 Id mapping: +-- 0 DAI https://optimistic.etherscan.io/token/0xda10009cbd5d07dd0cecc66161fc93d7c9000da1 +-- 1 USDC.e https://optimistic.etherscan.io/token/0x7f5c764cbc14f9669b88837ca1490cca17c31607 +-- 2 USDT https://optimistic.etherscan.io/token/0x94b008aa00579c1307b0ef2c499ad98a8ce58e58 + +-- contract 0xf6c2e0adc659007ba7c48446f5a4e4e94dfe08b5 Id mapping: +-- 0 USDC.e https://optimistic.etherscan.io/token/0x7f5c764cbc14f9669b88837ca1490cca17c31607 +-- 1 FRAX https://optimistic.etherscan.io/token/0x2e3d870790dc77a83dd1d18184acc7439a53f475 + WITH token_swaps AS ( SELECT evt_block_number AS block_number, @@ -16,8 +25,32 @@ WITH token_swaps AS ( evt_tx_to AS taker, tokensSold AS token_sold_amount_raw, tokensBought AS token_bought_amount_raw, - CAST(soldId AS varbinary) AS token_sold_address, - CAST(boughtId AS varbinary) AS token_bought_address, + CASE + WHEN contract_address = 0x5847f8177221268d279cf377d0e01ab3fd993628 THEN + CASE soldId + WHEN 0 THEN 0xda10009cbd5d07dd0cecc66161fc93d7c9000da1 + WHEN 1 THEN 0x7f5c764cbc14f9669b88837ca1490cca17c31607 + WHEN 2 THEN 0x94b008aa00579c1307b0ef2c499ad98a8ce58e58 + END + WHEN contract_address = 0xf6c2e0adc659007ba7c48446f5a4e4e94dfe08b5 THEN + CASE soldId + WHEN 0 THEN 0x7f5c764cbc14f9669b88837ca1490cca17c31607 + WHEN 1 THEN 0x2e3d870790dc77a83dd1d18184acc7439a53f475 + END + END AS token_sold_address, + CASE + WHEN contract_address = 0x5847f8177221268d279cf377d0e01ab3fd993628 THEN + CASE boughtId + WHEN 0 THEN 0xda10009cbd5d07dd0cecc66161fc93d7c9000da1 + WHEN 1 THEN 0x7f5c764cbc14f9669b88837ca1490cca17c31607 + WHEN 2 THEN 0x94b008aa00579c1307b0ef2c499ad98a8ce58e58 + END + WHEN contract_address = 0xf6c2e0adc659007ba7c48446f5a4e4e94dfe08b5 THEN + CASE boughtId + WHEN 0 THEN 0x7f5c764cbc14f9669b88837ca1490cca17c31607 + WHEN 1 THEN 0x2e3d870790dc77a83dd1d18184acc7439a53f475 + END + END AS token_bought_address, contract_address AS project_contract_address, evt_tx_hash AS tx_hash, evt_index AS evt_index diff --git a/dbt_subprojects/dex/models/trades/sonic/_schema.yml b/dbt_subprojects/dex/models/trades/sonic/_schema.yml new file mode 100644 index 00000000000..6b96924ec34 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/sonic/_schema.yml @@ -0,0 +1,23 @@ +version: 2 + +models: + - name: dex_sonic_base_trades + data_tests: + - check_dex_info_relationship + + - name: beets_sonic_base_trades + meta: + blockchain: sonic + sector: dex + project: beets + contributors: viniabussafi + config: + tags: ['sonic', 'dex', 'trades', 'beets'] + description: "beets 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('beets_sonic_base_trades_seed') \ No newline at end of file diff --git a/dbt_subprojects/dex/models/trades/sonic/dex_sonic_base_trades.sql b/dbt_subprojects/dex/models/trades/sonic/dex_sonic_base_trades.sql new file mode 100644 index 00000000000..bf2a270bfa8 --- /dev/null +++ b/dbt_subprojects/dex/models/trades/sonic/dex_sonic_base_trades.sql @@ -0,0 +1,48 @@ +{{ config( + schema = 'dex_sonic' + , alias = 'base_trades' + , materialized = 'view' + ) +}} + +{% set base_models = [ + ref('beets_sonic_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 = 'sonic' + , columns = ['from', 'to', 'index'] + ) +}} diff --git a/dbt_subprojects/dex/models/trades/sonic/platforms/beets_sonic_base_trades.sql b/dbt_subprojects/dex/models/trades/sonic/platforms/beets_sonic_base_trades.sql new file mode 100644 index 00000000000..75a321f1b4f --- /dev/null +++ b/dbt_subprojects/dex/models/trades/sonic/platforms/beets_sonic_base_trades.sql @@ -0,0 +1,41 @@ +{{ + config( + schema = 'beets_sonic', + 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')] + ) +}} + + +WITH v2_trades AS( + {{ + balancer_compatible_v2_trades( + blockchain = 'sonic', + project = 'beets', + version = '2', + project_decoded_as = 'beethoven_x_v2', + Vault_evt_Swap = 'Vault_evt_Swap', + pools_fees = 'pools_fees' + ) +}}), + +v3_trades AS( + {{ + balancer_compatible_v3_trades( + blockchain = 'sonic', + project = 'beets', + version = '3', + project_decoded_as = 'beethoven_x_v3', + Vault_evt_Swap = 'Vault_evt_Swap' + ) +}}) + +SELECT * FROM v2_trades + +UNION + +SELECT * FROM v3_trades \ No newline at end of file diff --git a/dbt_subprojects/dex/seeds/aggregator_trades/dex_aggregator_seed.csv b/dbt_subprojects/dex/seeds/aggregator_trades/dex_aggregator_seed.csv index 0af36d9f1c4..54e50862dd7 100644 --- a/dbt_subprojects/dex/seeds/aggregator_trades/dex_aggregator_seed.csv +++ b/dbt_subprojects/dex/seeds/aggregator_trades/dex_aggregator_seed.csv @@ -160,4 +160,12 @@ arbitrum,odos,1,2023-09-13,0xaef151abff4317b09660c749e1faca1b6400d9ab50ae751bc5f arbitrum,odos,1,2023-09-13,0x20fb5e16c99be306fb4058f207566332c96ed26a7f7575f0f136fda8d1c2285d,24,-1,0x307838326166343934343764386130376533626439356264306435366633353234313532336662616231,5.6455948955647e-05,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,0.1 arbitrum,odos,1,2023-09-13,0xeb9a5a3675dc2595390ef13b5392e924ad927e2fed616a8f8eacf355cb94643c,18,-1,0x307838326166343934343764386130376533626439356264306435366633353234313532336662616231,0.006570233329582102,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,49.9 arbitrum,odos,1,2023-09-13,0x5644436fcc4f702f8171473ecff69c39d3f13ef27fad26d8d01e4ba7680c397a,21,-1,0x307838326166343934343764386130376533626439356264306435366633353234313532336662616231,0.006570233329582102,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,50 -arbitrum,odos,1,2023-09-13,0x22c79845d2b5d155c71b53b7ed61165972a69a195406fae644f60f063cf007b0,23,-1,0x307838326166343934343764386130376533626439356264306435366633353234313532336662616231,5.17754278158e-05,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,0.1 \ No newline at end of file +arbitrum,odos,1,2023-09-13,0x22c79845d2b5d155c71b53b7ed61165972a69a195406fae644f60f063cf007b0,23,-1,0x307838326166343934343764386130376533626439356264306435366633353234313532336662616231,5.17754278158e-05,0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9,0.1 +base,bebop,jam,2025-01-09,0x81ac44bb72df7305662bda5632e42c3c12a067aae4e173b53a269298f5de0336,334,"0,0",0x833589fcd6edb6e08f4c7c32d4f71b54bda02913,33.457579,0x4200000000000000000000000000000000000006,0.01 +arbitrum,bebop,jam,2025-01-09,0x970589548387edcc3eed58071cf2d718fdb5aae8e6474db6b3ee8e9b48c0a24f,21,"0,0",0x6985884c4392d348587b19cb9eaaf157f13271cd,301.93504564845244,0xaf88d065e77c8cc2239327c5edb3a432268e5831,1439.743512 +bnb,bebop,jam,2025-01-09,0x2612ef5a82dd26817ba068e15776e549c5c5b81b53677b11297e808997ee0066,478,"0,0",0x55d398326f99059ff775485246999027b3197955,887.2914471310905,0x2170ed0880ac9a755fd29b2688956bd959f933f8,0.27422660244516145 +ethereum,bebop,jam,2025-01-09,0xff475060694e97634e46c31ec927172c3691e419266b952a36e9f945b8a74029,90,"0,0",0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,3.5726537819085715,0xae7ab96520de3a18e5e111b5eaab095312d7fe84,3.577 +optimism,bebop,jam,2025-01-09,0x840a18e97939b8f57882386cc2ea31203e11315f34f5177329120247eff92857,36,"0,0",0x0b2c639c533813f4aa9d7837caf62653d097ff85,55.386284,0x4200000000000000000000000000000000000006,0.01708965984257128 +polygon,bebop,jam,2025-01-09,0xb7e43804dab0b006c6aaebf5da025f304252ab646a2cfc3b835793e61061a008,968,"0,0",0x7ceb23fd6bc0add59e62ac25578270cff1b9f619,0.07549897094649265,0xc2132d05d31c914a87c6611c10748aeb04b58e8f,250 +scroll,bebop,jam,2025-01-09,0x6f0ceb5e9efcc841ebf8f1b2611550c6ff61bfe47dc73a160a70388d21a931ac,9,"0,0",0x06efdbff2a14a7c8e15944d1f4a48f9f95f663a4,254.993433,0xf55bec9cafdbe8730f096aa55dad6d22d44099df,255.338194 +zksync,bebop,jam,2025-01-09,0x8ec1c34a89a1bbaf0bb1adf1c8cc4c7c85e2fc723b63d042d4870283d456ccd1,25,"0,0",0x5aea5775959fbc2557cc8789bc1bf90a239d9a91,0.1363843857475935,0x5a7d6b2f92c77fad6ccabd7ee0624e64907eaf3e,2500 \ No newline at end of file diff --git a/dbt_subprojects/dex/seeds/trades/_schema.yml b/dbt_subprojects/dex/seeds/trades/_schema.yml index 8ace02b89cd..cd57b0fb1ae 100644 --- a/dbt_subprojects/dex/seeds/trades/_schema.yml +++ b/dbt_subprojects/dex/seeds/trades/_schema.yml @@ -4573,7 +4573,7 @@ seeds: token_sold_address: varbinary token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 - block_date: timestamp + block_date: timestamp - name: bridgers_optimism_base_trades_seed config: @@ -4605,6 +4605,21 @@ seeds: token_sold_amount_raw: uint256 block_date: timestamp + - name: sparkdex_flare_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: gravity_finance_polygon_base_trades_seed config: column_types: @@ -4634,3 +4649,83 @@ seeds: token_bought_amount_raw: uint256 token_sold_amount_raw: uint256 block_date: timestamp + + - name: beets_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 + + - name: blazeswap_flare_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: icecreamswap_boba_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 + taker: varbinary + maker: varbinary + project_contract_address: varbinary + block_month: timestamp + block_time: timestamp + + - name: oku_corn_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: camelot_corn_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 \ No newline at end of file diff --git a/dbt_subprojects/dex/seeds/trades/balancer_ethereum_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/balancer_ethereum_base_trades_seed.csv index 52089a72c77..d41bceb6d88 100644 --- a/dbt_subprojects/dex/seeds/trades/balancer_ethereum_base_trades_seed.csv +++ b/dbt_subprojects/dex/seeds/trades/balancer_ethereum_base_trades_seed.csv @@ -1,4 +1,4 @@ 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 ethereum,balancer,1,2020-08-02,0xac80f41cdfc018bfdc6d37f881fe3def377aa9fd3d0b794c3d7e7ee1e6501ce4,99,0x6b175474e89094c44da98b954eedeac495271d0f,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,10577678,25347466807281742558,65815288571622598 ethereum,balancer,2,2022-05-06,0xb6bba47d296682416f32fb4264cfe3fe2994284183081beafc8c36cc1e76b1f2,3,0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2,0xba100000625a3754423978a60c9317c58a424e3d,14725355,3755554997108104989,758723679950740258816 -ethereum,balancer,3,2024-12-11,0xa4909d720f14c0c4a89720150982a60768dc16bd30265cba6c660ab0cb0dbdb5,140,0xd4fa2d31b7968e448877f69a96de69f5de8cd23e,0x7bc3485026ac48b6cf9baf0a377477fff5703af8,21378232,452946,454359 \ No newline at end of file +ethereum,balancer,3,2024-12-11,0xa4909d720f14c0c4a89720150982a60768dc16bd30265cba6c660ab0cb0dbdb5,140,0xd4fa2d31b7968e448877f69a96de69f5de8cd23e,0x7bc3485026ac48b6cf9baf0a377477fff5703af8,21378232,452946,454359 diff --git a/dbt_subprojects/dex/seeds/trades/balancer_gnosis_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/balancer_gnosis_base_trades_seed.csv index c3aa2a57691..801fcb95d4f 100644 --- a/dbt_subprojects/dex/seeds/trades/balancer_gnosis_base_trades_seed.csv +++ b/dbt_subprojects/dex/seeds/trades/balancer_gnosis_base_trades_seed.csv @@ -1,3 +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 gnosis,balancer,2,2023-01-20,0x70a7380d73bd8dc96aa2a2ec338f6a660df54e797bab507b5ee04c27e6433844,20,0xe91d153e0b41518a2ce8dd3d7944fa863463a97d,0xddafbb505ad214d7b80b1f830fccc89b60fb7a83,26059328,2811201702694397942,2811563 -gnosis,balancer,3,2024-12-09,0xde406d9adbc7ec5c0157990cbcb77a6eccb053321786b91de53a4c5a848bcfab,53,0xaf204776c7245bf4147c2612bf6e5972ee483701,0x7c16f0185a26db0ae7a9377f23bc18ea7ce5d644,37444463,4106199510945472,18921089727982 \ No newline at end of file +gnosis,balancer,3,2024-12-09,0xde406d9adbc7ec5c0157990cbcb77a6eccb053321786b91de53a4c5a848bcfab,53,0xaf204776c7245bf4147c2612bf6e5972ee483701,0x7c16f0185a26db0ae7a9377f23bc18ea7ce5d644,37444463,4106199510945472,18921089727982 diff --git a/dbt_subprojects/dex/seeds/trades/beets_sonic_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/beets_sonic_base_trades_seed.csv new file mode 100644 index 00000000000..9e9bd5ce4bb --- /dev/null +++ b/dbt_subprojects/dex/seeds/trades/beets_sonic_base_trades_seed.csv @@ -0,0 +1,2 @@ +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 +sonic,beets,2,2025-01-07,0x373d087835d32dee82a306eb8ad67031f57e6f54b6fb0926fce72511b650822f,4,0x29219dd400f2bf60e5a23d13be72b486d4038894,0xd3dce716f3ef535c5ff8d041c1a41c3bd89b97ae,2850908,230927950,230996815 \ No newline at end of file diff --git a/dbt_subprojects/dex/seeds/trades/blazeswap_flare_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/blazeswap_flare_base_trades_seed.csv new file mode 100644 index 00000000000..f940476b700 --- /dev/null +++ b/dbt_subprojects/dex/seeds/trades/blazeswap_flare_base_trades_seed.csv @@ -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 +flare,blazeswap,2,2024-10-06,0x51407c99b67d71815b993420f8811900b5865cb673ba893ef07dcca5f85aa06d,30,0xe6505f92583103af7ed9974dec451a7af4e3a3be,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,30881152,1335216349117423088152,5497558138880000000000 +flare,blazeswap,2,2024-10-17,0x55de50c11e29636db85763b75c25a2b718dc18b4fe2c37539e5f324ac52e6e24,30,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,0xe6505f92583103af7ed9974dec451a7af4e3a3be,31449410,105931708336615473057,44371879946728776388 diff --git a/dbt_subprojects/dex/seeds/trades/camelot_corn_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/camelot_corn_base_trades_seed.csv new file mode 100644 index 00000000000..2dc24da645c --- /dev/null +++ b/dbt_subprojects/dex/seeds/trades/camelot_corn_base_trades_seed.csv @@ -0,0 +1,5 @@ +blockchain,project,version,tx_hash,evt_index,block_number,token_bought_address,token_sold_address,token_bought_amount_raw,token_sold_amount_raw,block_date +corn,camelot,3,0x679ee561e46e22c2f899a9b1d32c8a77027052807ccd3986b26ad40f02f894e1,5,140231,0xdf0b24095e15044538866576754f3c964e902ee6,0xda5ddd7270381a7c2717ad10d1c0ecb19e3cdfb2,186851764,2000000000000000,2025-01-13 +corn,camelot,3,0x576d6aba8db2c46f85936dfc856a0101c8b9e0fb0edbb0b9acd5c0ddaa46355f,5,140226,0xdf0b24095e15044538866576754f3c964e902ee6,0xda5ddd7270381a7c2717ad10d1c0ecb19e3cdfb2,186912093,2000000000000000,2025-01-13 +corn,camelot,yak,0xd8f80c1330f05a2fb3c1568ef86318099918d0198eead122d75f6a1c7d1ab629,8,140312,0xdf0b24095e15044538866576754f3c964e902ee6,0xda5ddd7270381a7c2717ad10d1c0ecb19e3cdfb2,185683424,2000000000000000,2025-01-13 +corn,camelot,yak,0x92cdffe4cf69618bac8597146bfa16d51045e86fdd7a5073c77530c17256cc82,8,140538,0xdf0b24095e15044538866576754f3c964e902ee6,0xda5ddd7270381a7c2717ad10d1c0ecb19e3cdfb2,184340418,2000000000000000,2025-01-13 diff --git a/dbt_subprojects/dex/seeds/trades/icecreamswap_boba_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/icecreamswap_boba_base_trades_seed.csv new file mode 100644 index 00000000000..4e29bf96c93 --- /dev/null +++ b/dbt_subprojects/dex/seeds/trades/icecreamswap_boba_base_trades_seed.csv @@ -0,0 +1,3 @@ +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 +boba,icecreamswap,1,2024-11-01 00:00,2024-11-24 00:00,2024-11-24 14:15,10726459,65183603501016643,300000000000000000,0x7d5a56742c082fcdfc240cd7d1775f00e059771f,0xa18bf3994c0cc6e3b63ac420308e5383f53120d7,0x85767bcbb2b5e95bddb3523406419d1aa7efdcf2,0x46d172bfdd9b03575229614bcf46da014d8ac8b1,0x46d172bfdd9b03575229614bcf46da014d8ac8b1,0x2a59b0f2abc8c29029c4dee209b0b82f2f1c89b825bca663a3d1c2b4deeb58b1,9 +boba,icecreamswap,1,2024-07-01 00:00,2024-07-19 00:00,2024-07-19 16:57,5201714,661356424536501999965,169150000000000000000,0xa18bf3994c0cc6e3b63ac420308e5383f53120d7,0x7d5a56742c082fcdfc240cd7d1775f00e059771f,0x0604e652a188931e245717d45feb26f583b92908,0x46d172bfdd9b03575229614bcf46da014d8ac8b1,0x46d172bfdd9b03575229614bcf46da014d8ac8b1,0x01f3b8af8421fa428fca4cf2dc85498614d94b637bc5887c29e50abc7897c2b3,3 diff --git a/dbt_subprojects/dex/seeds/trades/oku_corn_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/oku_corn_base_trades_seed.csv new file mode 100644 index 00000000000..db99fde9ba6 --- /dev/null +++ b/dbt_subprojects/dex/seeds/trades/oku_corn_base_trades_seed.csv @@ -0,0 +1,3 @@ +blockchain,project,version,tx_hash,evt_index,block_number,token_bought_address,token_sold_address,token_bought_amount_raw,token_sold_amount_raw,block_date +corn,oku,3,0x77673b46378569bf7639d7824abdf491c8b816db5f8b6505b70b38e34f0cbd68,2,140536,0xdf0b24095e15044538866576754f3c964e902ee6,0xda5ddd7270381a7c2717ad10d1c0ecb19e3cdfb2,184377140,2000000000000000,2025-01-13 +corn,oku,3,0x4ca5d3737d1de4a7eee5da47a99651d4b9049552b06a0a07ba086ca38262076a,2,140305,0xdf0b24095e15044538866576754f3c964e902ee6,0xda5ddd7270381a7c2717ad10d1c0ecb19e3cdfb2,185744203,2000000000000000,2025-01-13 diff --git a/dbt_subprojects/dex/seeds/trades/pancakeswap_ethereum_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/pancakeswap_ethereum_base_trades_seed.csv index ecdeabecc12..518176521fa 100644 --- a/dbt_subprojects/dex/seeds/trades/pancakeswap_ethereum_base_trades_seed.csv +++ b/dbt_subprojects/dex/seeds/trades/pancakeswap_ethereum_base_trades_seed.csv @@ -14,3 +14,6 @@ ethereum,pancakeswap,3,2023-04-01,0x942d7e8064aa1925e484ad9e38b25b0eea8620aa2b85 ethereum,pancakeswap,stableswap,2024-09-03 00:00:00.000 UTC,0x76706147bb031c1dff5386142d866ec083578420885fb24160124a66800ef418,299,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,0xbdf245957992bfbc62b07e344128a1eec7b7ee3f,20668595,9967437,10000000 ethereum,pancakeswap,stableswap,2024-09-04 00:00:00.000 UTC,0x6639947fd9c9d5e07425f2500f3f50b13bb7b4bd92316d5392866e759aa7e97c,74,0xbdf245957992bfbc62b07e344128a1eec7b7ee3f,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,20680551,1251896,1177998 ethereum,pancakeswap,stableswap,2024-09-08 00:00:00.000 UTC,0x7e07e90e2230148bd1a5c49ccaa94a36408dc3df2f39c923c6c49b154d6c7ba4,72,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,0xbdf245957992bfbc62b07e344128a1eec7b7ee3f,20704016,13399197,13511099 +ethereum,pancakeswap,pcsx,2024-12-12,0xa9f85566c718fa84dfe82dfc9638e8383271856e1c61f2ba11d3c4d23be6c8fc,226,0xdac17f958d2ee523a2206206994597c13d831ec7,0x2260fac5e5542a773aa44fbcfedf7c193bc2c599,21386209,20000000000,20072678 +ethereum,pancakeswap,pcsx,2024-12-12,0xdd63f84eca7f3b7cdfc174ae93b80d1fded3bc145be5a63479eb30c525e07f51,430,0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee,0x95ad61b0a150d79219dcf64e1e6cc01f0b64c4ce,21386418,1610345878716657319,220881632899203791230293346 +ethereum,pancakeswap,pcsx,2024-12-12,0x96a89245d9f67ae8f23bdb4c54879e805b727403bbef6214d08fdcc771aa3f51,447,0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48,0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9,21386687,553168032,1521057740000000000 diff --git a/dbt_subprojects/dex/seeds/trades/saddle_finance_optimism_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/saddle_finance_optimism_base_trades_seed.csv index a459ed8b479..e20c21d3ec3 100644 --- a/dbt_subprojects/dex/seeds/trades/saddle_finance_optimism_base_trades_seed.csv +++ b/dbt_subprojects/dex/seeds/trades/saddle_finance_optimism_base_trades_seed.csv @@ -1,2 +1,4 @@ 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,maker,taker,project_contract_address,tx_hash,evt_index -optimism,saddle_finance,1,2022-08-01 00:00,2022-08-05 00:00,2022-08-05 19:11,17943155,74907384,74857799085655995549,0x0000000000000000000000000000000000000000000000000000000000000000,0x0000000000000000000000000000000000000000000000000000000000000001,0xd131f1bcdd547e067af447dd3c36c99d6be9fdeb,0xf6c2e0adc659007ba7c48446f5a4e4e94dfe08b5,0xf6c2e0adc659007ba7c48446f5a4e4e94dfe08b5,0xbccdcd4ab61e5ad3384eb173156c3c0507d3bb3f2d2f5a406379e74aafbec38d,3 \ No newline at end of file +optimism,saddle_finance,1,2022-08-01 00:00,2022-08-05 00:00,2022-08-05 19:11,17943155,74907384,74857799085655995549,0x7f5c764cbc14f9669b88837ca1490cca17c31607,0x2e3d870790dc77a83dd1d18184acc7439a53f475,0xd131f1bcdd547e067af447dd3c36c99d6be9fdeb,0xf6c2e0adc659007ba7c48446f5a4e4e94dfe08b5,0xf6c2e0adc659007ba7c48446f5a4e4e94dfe08b5,0xbccdcd4ab61e5ad3384eb173156c3c0507d3bb3f2d2f5a406379e74aafbec38d,3 +optimism,saddle_finance,1,2022-07-01 00:00,2022-07-27 00:00,2022-07-27 19:05,16079111,92288022,92410669220437585672,0x7f5c764cbc14f9669b88837ca1490cca17c31607,0xda10009cbd5d07dd0cecc66161fc93d7c9000da1,0xfeb8bac57bc7c3dcce15b075e8d73b6d67dac9b9,0xa6baa075fb5cf4721b43fe068ee81b56f34fa06d,0x5847f8177221268d279cf377d0e01ab3fd993628,0x70c780f635e8cc884d5999ff812d98344bda173564155f0b62e3b88d74bfd477,3 +optimism,saddle_finance,1,2023-07-01 00:00,2023-07-06 00:00,2023-07-06 08:46,106517219,180000000,179931184169613570122,0x7f5c764cbc14f9669b88837ca1490cca17c31607,0x2e3d870790dc77a83dd1d18184acc7439a53f475,0x01901a4a1acfc3641ed8c2778820200de4b2ff63,0x5c4cf9768c857528b025a6de958f803c852fbaf1,0xf6c2e0adc659007ba7c48446f5a4e4e94dfe08b5,0x9552ae3a5519282594faf5170267d8966b16c3563ce38358c2fe6eebbf494429,5 \ No newline at end of file diff --git a/dbt_subprojects/dex/seeds/trades/sparkdex_flare_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/sparkdex_flare_base_trades_seed.csv new file mode 100644 index 00000000000..67298b2d4ad --- /dev/null +++ b/dbt_subprojects/dex/seeds/trades/sparkdex_flare_base_trades_seed.csv @@ -0,0 +1,5 @@ +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 +flare,sparkdex,2,2024-12-19,0x17b97c773299bb5432f7513ec1090b7182326dc6e8a8a772bbcc14639e2e5e74,16,0xfbda5f676cb37624f28265a144a48b0d6e87d3b6,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,34744392,164250,5873468685772181578 +flare,sparkdex,2,2024-12-19,0xe1ac5909a57022912a5853ccb70e2de4604eae3c6dd3483fc719338cf18a0625,23,0xfbda5f676cb37624f28265a144a48b0d6e87d3b6,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,34747482,658,24000000000000000 +flare,sparkdex,3,2024-12-04,0x2e172e22c714f28e9e8f29a89799ec5102397e29926a070a2bd11f92637106a3,10,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,0xfbda5f676cb37624f28265a144a48b0d6e87d3b6,34014169,4999999985390174801119,166057407 +flare,sparkdex,3,2024-10-29,0x2e29ac0d54b4bd75c4788a285a9806ea57ed801b4c931a877b2a17aeaa3dafff,10,0xfbda5f676cb37624f28265a144a48b0d6e87d3b6,0x1d80c49bbbcd1c0911346656b529df9e5c2f783d,32113089,4955860,353988522618423672831 \ No newline at end of file diff --git a/dbt_subprojects/dex/seeds/trades/stablebase_base_base_trades_seed.csv b/dbt_subprojects/dex/seeds/trades/stablebase_base_base_trades_seed.csv index 998c8e33f1b..e3cfc2f90b7 100644 --- a/dbt_subprojects/dex/seeds/trades/stablebase_base_base_trades_seed.csv +++ b/dbt_subprojects/dex/seeds/trades/stablebase_base_base_trades_seed.csv @@ -1,2 +1,2 @@ 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,maker,taker,project_contract_address,tx_hash,evt_index -base,stablebase,1,2023-08-01,2023-08-28,2023-08-28 19:18:00.000,3230470,129976172599579374396,135180385,0x0000000000000000000000000000000000000000000000000000000000000001,0x0000000000000000000000000000000000000000000000000000000000000000,0x19fbc29d72476365a62151ffdbf4764e54774a81,0x8c59cc9b958635710957e751a9b4e77cd771baf2,0x8c59cc9b958635710957e751a9b4e77cd771baf2,0xc2dec669877f4edfcb7debd2eb23288a0fba8cd57d6f3fb3e45e8b15a6458d43,31 +base,stablebase,1,2023-08-01,2023-08-28,2023-08-28 19:18:00.000,3230470,129976172599579374396,135180385,0x50c5725949a6f0c72e6c4a641f24049a917db0cb,0xd9aaec86b65d86f6a7b5b1b0c42ffa531710b6ca,0x19fbc29d72476365a62151ffdbf4764e54774a81,0x8c59cc9b958635710957e751a9b4e77cd771baf2,0x8c59cc9b958635710957e751a9b4e77cd771baf2,0xc2dec669877f4edfcb7debd2eb23288a0fba8cd57d6f3fb3e45e8b15a6458d43,31 diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_mapping.sql b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_mapping.sql index d939fcc5e9e..315c92bc772 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_mapping.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/erc4626_tokens/ethereum/balancer_v3_ethereum_erc4626_token_mapping.sql @@ -39,7 +39,8 @@ FROM (VALUES (0x0bfc9d54fc184518a81162f8fb99c2eaca081202, 'Static Aave Ethereum WETH', 'WaEthWETH', 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2, 'WETH', 18), (0x0fe906e030a44ef24ca8c7dc7b7c53a6c4f00ce9, 'Static Aave Ethereum Lido WETH', 'waEthLidoWETH', 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2, 'WETH', 18), (0x775f661b0bd1739349b9a2a3ef60be277c5d2d29, 'Static Aave Ethereum Lido wstETH', 'waEthLidowstETH', 0x7f39c581f595b53c5cb19bd0b3f8da6c935e2ca0, 'wstETH', 18), - (0x5F9D59db355b4A60501544637b00e94082cA575b, 'Static Aave Ethereum USDe', 'waEthUSDe', 0x4c9EDD5852cd905f086C759E8383e09bff1E68B3, 'USDe', 18) + (0x5F9D59db355b4A60501544637b00e94082cA575b, 'Static Aave Ethereum USDe', 'waEthUSDe', 0x4c9EDD5852cd905f086C759E8383e09bff1E68B3, 'USDe', 18), + (0xC71Ea051a5F82c67ADcF634c36FFE6334793D24C, 'Static Aave Ethereum Lido GHO', 'waEthLidoGHO', 0x40D16FC0246aD3160Ccc09B8D0D3A2cD28aE6C2f, 'GHO', 18) ) AS temp_table (erc4626_token, erc4626_token_name, erc4626_token_symbol, underlying_token, underlying_token_symbol, decimals) ), @@ -55,8 +56,23 @@ FROM {{ source('metamorpho_factory_ethereum', 'MetaMorphoFactory_evt_CreateMetaM JOIN {{ source('tokens', 'erc20') }} t ON t.blockchain = 'ethereum' AND a.asset = t.contract_address + +UNION + +SELECT + erc4626_token, + erc4626_token_name, + erc4626_token_symbol, + underlying_token, + underlying_token_symbol, + decimals +FROM (VALUES + (0x7204b7dbf9412567835633b6f00c3edc3a8d6330, 'CoinShift USDC', 'csUSDC', 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48, 'USDC', 18), + (0xbeefc011e94f43b8b7b455ebab290c7ab4e216f1, 'CoinShift USDL', 'csUSDL', 0xbdC7c08592Ee4aa51D06C27Ee23D5087D65aDbcD, 'wUSDL', 18) + ) AS temp_table (erc4626_token, erc4626_token_name, erc4626_token_symbol, underlying_token, underlying_token_symbol, decimals) ) + SELECT 'ethereum' AS blockchain, * diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/_schema.yml index aab385185a8..15ad890b7d2 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/_schema.yml @@ -59,6 +59,9 @@ models: - &treasury_share name: treasury_share description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd + - &treasury_fee_usd name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file + description: "USD value of fee directed to Balancer DAO's treasury" + - &lp_fee_collected_usd + name: lp_fee_collected_usd + description: "USD value of the fee returned to liquidity providers" \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/arbitrum/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/arbitrum/_schema.yml index 88e0f13e75e..8f928d668ee 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/arbitrum/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/arbitrum/_schema.yml @@ -56,6 +56,9 @@ models: - &treasury_share name: treasury_share description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd - name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file + - &treasury_fee_usd + name: treasury_fee_usd + description: "USD value of fee directed to Balancer DAO's treasury" + - &lp_fee_collected_usd + name: lp_fee_collected_usd + description: "USD value of the fee returned to liquidity providers" \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/avalanche_c/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/avalanche_c/_schema.yml index 4081df19bee..6f96a3bb2f1 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/avalanche_c/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/avalanche_c/_schema.yml @@ -58,4 +58,7 @@ models: description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - &treasury_revenue_usd name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file + description: "USD value of fee directed to Balancer DAO's treasury" + - &lp_fee_collected_usd + name: lp_fee_collected_usd + description: "USD value of the fee returned to liquidity providers" \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/balancer_protocol_fee.sql b/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/balancer_protocol_fee.sql index d0cf6d8445c..af563984e30 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/balancer_protocol_fee.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/balancer_protocol_fee.sql @@ -39,7 +39,8 @@ FROM ( token_amount, protocol_fee_collected_usd, treasury_share, - treasury_revenue_usd + treasury_fee_usd, + lp_fee_collected_usd FROM {{ protocol_fee }} {% if not loop.last %} UNION ALL diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/base/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/base/_schema.yml index 469d2d482d4..1beadbd4609 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/base/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/base/_schema.yml @@ -58,4 +58,7 @@ models: description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - &treasury_revenue_usd name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file + description: "USD value of fee directed to Balancer DAO's treasury" + - &lp_fee_collected_usd + name: lp_fee_collected_usd + description: "USD value of the fee returned to liquidity providers" \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/ethereum/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/ethereum/_schema.yml index edc8318cf02..53da112c560 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/ethereum/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/ethereum/_schema.yml @@ -59,9 +59,12 @@ models: - &treasury_share name: treasury_share description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd + - &treasury_fee_usd name: treasury_revenue_usd description: "USD value of fee directed to Balancer DAO's treasury" + - &lp_fee_collected_usd + name: lp_fee_collected_usd + description: "USD value of the fee returned to liquidity providers" - name: balancer_v3_ethereum_protocol_fee meta: @@ -94,4 +97,5 @@ models: - *token_amount - *protocol_fee_collected_usd - *treasury_share - - *treasury_revenue_usd \ No newline at end of file + - *treasury_fee_usd + - *lp_fee_collected_usd \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/gnosis/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/gnosis/_schema.yml index 51e384bdd3a..b37e3f34891 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/gnosis/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/gnosis/_schema.yml @@ -59,9 +59,12 @@ models: - &treasury_share name: treasury_share description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd + - &treasury_fee_usd name: treasury_revenue_usd description: "USD value of fee directed to Balancer DAO's treasury" + - &lp_fee_collected_usd + name: lp_fee_collected_usd + description: "USD value of the fee returned to liquidity providers" - name: balancer_v3_gnosis_protocol_fee meta: @@ -94,4 +97,5 @@ models: - *token_amount - *protocol_fee_collected_usd - *treasury_share - - *treasury_revenue_usd \ No newline at end of file + - *treasury_fee_usd + - *lp_fee_collected_usd \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/optimism/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/optimism/_schema.yml index e7e3bfbf87b..3c3b8226d20 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/optimism/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/optimism/_schema.yml @@ -56,6 +56,9 @@ models: - &treasury_share name: treasury_share description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd + - &treasury_fee_usd name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file + description: "USD value of fee directed to Balancer DAO's treasury" + - &lp_fee_collected_usd + name: lp_fee_collected_usd + description: "USD value of the fee returned to liquidity providers" \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/polygon/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/polygon/_schema.yml index 4e216ac455f..40434d2a6c2 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/polygon/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/polygon/_schema.yml @@ -56,6 +56,9 @@ models: - &treasury_share name: treasury_share description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd + - &treasury_fee_usd name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file + description: "USD value of fee directed to Balancer DAO's treasury" + - &lp_fee_collected_usd + name: lp_fee_collected_usd + description: "USD value of the fee returned to liquidity providers" \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/zkevm/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/zkevm/_schema.yml index 1e85c873787..aaab2938f03 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/zkevm/_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/protocol_fee/zkevm/_schema.yml @@ -56,6 +56,9 @@ models: - &treasury_share name: treasury_share description: "Share of total fee that is directed to Balancer DAO's treasury, as per BIPs 19, 161 and 371" - - &treasury_revenue_usd + - &treasury_fee_usd name: treasury_revenue_usd - description: "USD value of fee directed to Balancer DAO's treasury" \ No newline at end of file + description: "USD value of fee directed to Balancer DAO's treasury" + - &lp_fee_collected_usd + name: lp_fee_collected_usd + description: "USD value of the fee returned to liquidity providers" \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_project/balancer/support/balancer_token_whitelist.sql b/dbt_subprojects/hourly_spellbook/models/_project/balancer/support/balancer_token_whitelist.sql index a063cb927cd..5e1d5867ccd 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/balancer/support/balancer_token_whitelist.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/balancer/support/balancer_token_whitelist.sql @@ -44,6 +44,9 @@ WITH whitelist_token as ( (0x2791bca1f2de4661ed88a30c99a7a9449aa84174, 'USDC', 'polygon'), (0x8f3cf7ad23cd3cadbd9735aff958023239c6a063, 'DAI', 'polygon'), (0xc2132d05d31c914a87c6611c10748aeb04b58e8f, 'USDT', 'polygon'), + (0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38, 'wS', 'sonic'), + (0xe5da20f15420ad15de0fa650600afc998bbe3955, 'stS', 'sonic'), + (0x1e5fe95fb90ac0530f581c617272cd0864626795, 'BEETS', 'sonic'), (0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270, 'WMATIC', 'polygon'), (0x7ceb23fd6bc0add59e62ac25578270cff1b9f619, 'WETH', 'polygon'), (0x37eaa0ef3549a5bb7d431be78a3d99bd360d19e5, 'USDC', 'zkevm'), diff --git a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/arbitrum/cow_protocol_arbitrum_solvers.sql b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/arbitrum/cow_protocol_arbitrum_solvers.sql index f83aa055fab..5c78b11fa43 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/arbitrum/cow_protocol_arbitrum_solvers.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/arbitrum/cow_protocol_arbitrum_solvers.sql @@ -56,6 +56,7 @@ known_solver_metadata (address, environment, name) as ( (0x1FA2FF499b327f53cD9a82BcAFE36093563E32e4, 'prod', 'Apollo'), (0x0148538e6cA813D41eA5988008Cdc9B72d4e65A7, 'prod', 'Laita'), (0x9C75aae1Bd2f96D7B4E67e8C5344f3304382276E, 'prod', 'Enso'), + (0x5156808c3f9440191ef600587a73c87bb23c92b2, 'barn', 'Enso'), (0x034F6Aca83F1900b0157b0123F514A29456eeA59, 'barn', 'Laita'), (0x6bf97aFe2D2C790999cDEd2a8523009eB8a0823f, 'prod', 'Portus'), (0xBB765c920f86e2A2654c4B82deB5BC2E092fF93b, 'barn', 'Portus'), @@ -74,7 +75,11 @@ known_solver_metadata (address, environment, name) as ( (0x7B0211286d8Dfdb717f4A2E5Fa5131eD911097e1, 'barn', 'Barter'), (0xc8371B2898FBaEeAe658f9FaeE8ddeDA24e37012, 'barn', 'OpenOcean_Aggregator'), (0x2aeC288B42C99D2e8e984c5C324FB069f7705186, 'barn', 'Rizzolver'), - (0x26B5e3bF135D3Dd05A220508dD61f25BF1A47cBD, 'barn', 'Rizzolver') + (0x26B5e3bF135D3Dd05A220508dD61f25BF1A47cBD, 'barn', 'Rizzolver'), + (0x8C3f83f6A489cCbA2E3df304034F8C120cEb3527, 'barn', 'GlueX_Protocol'), + (0x49E1F55D4a695291533BB0A993aca5D58E90C613, 'prod', 'GlueX_Protocol'), + (0x3144a51a7699c629070d6aAEf68256c2d07a6334, 'barn', 'OKX'), + (0x7F636D152AB0Cfc68A899d4dF441F2322cd78C6B, 'prod', 'OKX') ) as _ ) -- Combining the metadata with current activation status for final table diff --git a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/base/cow_protocol_base_solvers.sql b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/base/cow_protocol_base_solvers.sql index a3eb28bc6f6..b5103731ed4 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/base/cow_protocol_base_solvers.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/base/cow_protocol_base_solvers.sql @@ -45,9 +45,19 @@ known_solver_metadata (address, environment, name) as ( (0x147d05987f3008A6C9Ec3E93A4ead430907ac3E1, 'barn', 'Gnosis_0x'), (0x9451D27C993f7a61096BFC33e0241644a7566F66, 'barn', 'Gnosis_BalancerSOR'), (0x0AC9287C83C2386A6a0bb27F847Ce59a0034183C, 'barn', 'Laita'), - (0x172FaCC5d970df43462b0f3aDe670d8cB86DC816, 'barn', 'ApeOut_1Inch'), + (0x172FaCC5d970df43462b0f3aDe670d8cB86DC816, 'barn', 'ApeOut_1inch'), (0xBB765c920f86e2A2654c4B82deB5BC2E092fF93b, 'barn', 'Portus'), - (0x1a72876ebE781E42aB2Ee4278B539688D8B80E2D, 'prod', 'ApeOut_1Inch'), + (0xDF580073E21fFd7968F317B5359B934Eb6d58804, 'barn', 'Barter'), + (0x9775be2Bb0B72d4eA98Bfd38024EF733dc048a30, 'barn', 'Apollo'), + (0xe0b25FA3EA727Dc34708D026ba122625B98A94FB, 'barn', 'GlueX_Protocol'), + (0x707Dfa95835542A6528fD077c351446f497276CF, 'barn', 'Rizzolver'), + (0x4eAD087d78C21Fd95D30411928A2Ade7456f56F4, 'barn', 'OKX'), + (0xd875cd50B179a046512C80edF6CB2C1Fc3F3072D, 'prod', 'OKX'), + (0x914db7338ACAe3f3866B79DcEfFcFBCC554F18ed, 'prod', 'Rizzolver'), + (0xc1b0bB599c578a846b51EE5dcE3d9FAD69528613, 'prod', 'GlueX_Protocol'), + (0x41f387db8470c99b7f376212075e2E289f085Ce9, 'prod', 'Apollo'), + (0x36Fd8A0C24B08F7bb4af8d6eaA6245C3884fC682, 'prod', 'Barter'), + (0x1a72876ebE781E42aB2Ee4278B539688D8B80E2D, 'prod', 'ApeOut_1inch'), (0x6bf97aFe2D2C790999cDEd2a8523009eB8a0823f, 'prod', 'Portus'), (0x69d7F96dFD091652f317D0734A5F2B492ACcbE07, 'prod', 'Baseline'), (0x4cb862E4821fea2dabBD1f0A69c17d52da2A58f6, 'prod', 'Seasolver'), diff --git a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/ethereum/cow_protocol_ethereum_solvers.sql b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/ethereum/cow_protocol_ethereum_solvers.sql index 5f9bc304b90..0f237e83b39 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/ethereum/cow_protocol_ethereum_solvers.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/ethereum/cow_protocol_ethereum_solvers.sql @@ -119,11 +119,13 @@ known_solver_metadata (address, environment, name) as ( (0x95480d3f27658e73b2785d30beb0c847d78294c7, 'prod', 'Fractal'), (0x00806DaA2Cfe49715eA05243FF259DeB195760fC, 'prod', 'Quasilabs'), (0x28B1bd44996105b5c14c4dE41093226Ff78A4eB1, 'prod', '0x'), - (0x04B89dBce06e7Aa2F4BBA78969ADD4576eB94788, 'prod', 'ApeOut_1Inch'), + (0x04B89dBce06e7Aa2F4BBA78969ADD4576eB94788, 'prod', 'ApeOut_1inch'), (0xbada5552a3e5e2fb57db982e29257821a2cf192d, 'prod', 'Project_Blanc'), (0x34717040928D7fd8154d4612f3228EFf14521023, 'prod', 'Laita'), + (0xdcE5B9574C9A18B4f1713C80BfC53623c007e7e1, 'prod', 'OKX'), + (0xD2E90778eE3F480d305FF535bE88f5AF9F2ac85c, 'barn', 'OKX'), (0xBab555BaBEe5d867983902bC8db8F707157245Be, 'barn', 'Project_Blanc'), - (0x854490ef1d402D4f6fce05aBefE1C676eB0DCD74, 'barn', 'ApeOut_1Inch'), + (0x854490ef1d402D4f6fce05aBefE1C676eB0DCD74, 'barn', 'ApeOut_1inch'), (0xBB765c920f86e2A2654c4B82deB5BC2E092fF93b, 'barn', 'Portus'), (0xcC73072B53697911Ff394ae01D3de59c9900b0b0, 'barn', '0x'), (0xd0bA1b1782fbdE45edAb392428f60e14827D08EC, 'barn', 'Laita'), diff --git a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/gnosis/cow_protocol_gnosis_solvers.sql b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/gnosis/cow_protocol_gnosis_solvers.sql index a68d5d4acd3..b6febff950d 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/gnosis/cow_protocol_gnosis_solvers.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/cow_protocol/gnosis/cow_protocol_gnosis_solvers.sql @@ -66,6 +66,8 @@ known_solver_metadata (address, environment, name) as ( (0xC4dd6355Fbc6Eb108FD1C100389789C5B1A9A980, 'barn', 'Barter'), (0x4398129426Cb1377E9E10395b8dfBDa153c7Fe7D, 'barn', 'Fractal'), (0xBB765c920f86e2A2654c4B82deB5BC2E092fF93b, 'barn', 'Portus'), + (0x01B278ab345Fc427B9Efd112928ACd6b7403c298, 'barn', 'GlueX_Protocol'), + (0x490F34C46cF271B288d1833571f5D47B7e068163, 'prod', 'GlueX_Protocol'), (0x6bf97aFe2D2C790999cDEd2a8523009eB8a0823f, 'prod', 'Portus'), (0x727EB77c6f84ef148403f641aA32d75b7f6902A7, 'prod', 'Fractal'), (0x0a360134553feED49FE5eb273074d80B6e45941F, 'prod', 'Barter'), diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/arbitrum/safe_arbitrum_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/arbitrum/safe_arbitrum_schema.yml index 269628b66e5..5a0a9ee77b9 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/arbitrum/safe_arbitrum_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/arbitrum/safe_arbitrum_schema.yml @@ -6,9 +6,6 @@ models: blockchain: arbitrum project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'singletons', 'arbitrum'] description: "Singletons addresses used with Safes" @@ -25,9 +22,6 @@ models: blockchain: arbitrum project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'arbitrum'] description: "Safe addresses" @@ -54,9 +48,6 @@ models: blockchain: arbitrum project: safe contributors: tschubotz, danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'arbitrum'] description: "Safe transactions" @@ -118,9 +109,6 @@ models: blockchain: arbitrum project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'transfers', 'arbitrum'] description: "ETH transfers into or out of Safes" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/avalanche_c/safe_avalanche_c_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/avalanche_c/safe_avalanche_c_schema.yml index 9cbdd4f86d7..4a57e698c89 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/avalanche_c/safe_avalanche_c_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/avalanche_c/safe_avalanche_c_schema.yml @@ -6,9 +6,6 @@ models: blockchain: avalanche_c project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'singletons', 'avalanche_c'] description: "Singletons addresses used with Safes" @@ -25,9 +22,6 @@ models: blockchain: avalanche_c project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'avalanche_c'] description: "Safe addresses" @@ -54,9 +48,6 @@ models: blockchain: avalanche_c project: safe contributors: tschubotz, danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'avalanche_c'] description: "Safe transactions" @@ -118,9 +109,6 @@ models: blockchain: avalanche_c project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'transfers', 'avalanche_c'] description: "AVAX transfers into or out of Safes" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/base/safe_base_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/base/safe_base_schema.yml index 4e73519cadc..43300f339d1 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/base/safe_base_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/base/safe_base_schema.yml @@ -6,9 +6,6 @@ models: blockchain: base project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'base'] description: "Safe addresses" @@ -37,9 +34,6 @@ models: blockchain: base project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'transfers', 'base'] description: "Eth transfers for safes" @@ -69,9 +63,6 @@ models: blockchain: base project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'singletons', 'base'] description: "Singletons addresses used with Safes" @@ -87,9 +78,6 @@ models: blockchain: base project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'base'] description: "Safe transactions" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/bnb/safe_bnb_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/bnb/safe_bnb_schema.yml index 3954c7430a6..6aa34ab9660 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/bnb/safe_bnb_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/bnb/safe_bnb_schema.yml @@ -6,9 +6,6 @@ models: blockchain: bnb project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'singletons', 'bnb'] description: "Singletons addresses used with Safes" @@ -25,9 +22,6 @@ models: blockchain: bnb project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'bnb'] description: "Safe addresses" @@ -54,9 +48,6 @@ models: blockchain: bnb project: safe contributors: tschubotz, danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'bnb'] description: "Safe transactions" @@ -118,9 +109,6 @@ models: blockchain: bnb project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'transfers', 'bnb'] description: "BNB transfers into or out of Safes" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/celo/safe_celo_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/celo/safe_celo_schema.yml index 3ced0eea607..8de48696fea 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/celo/safe_celo_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/celo/safe_celo_schema.yml @@ -6,9 +6,6 @@ models: blockchain: celo project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'singletons', 'celo'] description: "Singletons addresses used with Safes" @@ -25,9 +22,6 @@ models: blockchain: celo project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'celo'] description: "Safe addresses" @@ -54,9 +48,6 @@ models: blockchain: celo project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'celo'] description: "Safe transactions" @@ -118,9 +109,6 @@ models: blockchain: celo project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'transfers', 'celo'] description: "CELO transfers into or out of Safes" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/fantom/safe_fantom_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/fantom/safe_fantom_schema.yml index 25be69cea4e..a9c3f8db4c8 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/fantom/safe_fantom_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/fantom/safe_fantom_schema.yml @@ -6,9 +6,6 @@ models: blockchain: fantom project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'singletons', 'fantom'] description: "Singletons addresses used with Safes" @@ -25,9 +22,6 @@ models: blockchain: fantom project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'fantom'] description: "Safe addresses" @@ -54,9 +48,6 @@ models: blockchain: fantom project: safe contributors: tschubotz, danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'fantom'] description: "Safe transactions" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/gnosis/safe_gnosis_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/gnosis/safe_gnosis_schema.yml index 11d5459a77e..fb5eef674c7 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/gnosis/safe_gnosis_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/gnosis/safe_gnosis_schema.yml @@ -6,9 +6,6 @@ models: blockchain: gnosis project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'singletons', 'gnosis'] description: "Singletons addresses used with Safes" @@ -25,9 +22,6 @@ models: blockchain: gnosis project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'gnosis'] description: "Safe addresses" @@ -54,9 +48,6 @@ models: blockchain: gnosis project: safe contributors: tschubotz, danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'gnosis'] description: "Safe transactions" @@ -118,9 +109,6 @@ models: blockchain: gnosis project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'transfers', 'gnosis'] description: "xDAI transfers into or out of Safes" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/goerli/safe_goerli_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/goerli/safe_goerli_schema.yml index a5a4339fabe..d4214561c54 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/goerli/safe_goerli_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/goerli/safe_goerli_schema.yml @@ -6,9 +6,6 @@ models: blockchain: goerli project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'singletons', 'goerli'] description: "Singletons addresses used with Safes" @@ -25,9 +22,6 @@ models: blockchain: goerli project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'goerli'] description: "Safe addresses" @@ -54,9 +48,6 @@ models: blockchain: goerli project: safe contributors: tschubotz, danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'goerli'] description: "Safe transactions" @@ -118,9 +109,6 @@ models: blockchain: goerli project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'transfers', 'goerli'] description: "ETH transfers into or out of Safes" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/mantle/safe_mantle_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/mantle/safe_mantle_schema.yml index a91a8df6173..9ef9ff9e118 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/mantle/safe_mantle_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/mantle/safe_mantle_schema.yml @@ -6,9 +6,6 @@ models: blockchain: mantle project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'mantle'] description: "Safe addresses" @@ -42,9 +39,6 @@ models: blockchain: mantle project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'transfers', 'mantle'] description: "MNT transfers for safes" @@ -81,9 +75,6 @@ models: blockchain: mantle project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'singletons', 'mantle'] description: "Singletons addresses used with Safes" @@ -96,9 +87,6 @@ models: blockchain: mantle project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'mantle'] description: "Safe transactions" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/optimism/safe_optimism_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/optimism/safe_optimism_schema.yml index ab2bcca3a16..86f21687531 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/optimism/safe_optimism_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/optimism/safe_optimism_schema.yml @@ -6,9 +6,6 @@ models: blockchain: optimism project: safe contributors: frankmaseo - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'optimism'] description: "Safe addresses on Optimism" @@ -36,9 +33,6 @@ models: blockchain: optimism project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'singletons', 'optimism'] description: "Singletons addresses used with Safes" @@ -54,9 +48,6 @@ models: blockchain: optimism project: safe contributors: tschubotz, danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'optimism'] description: "Safe transactions" @@ -118,9 +109,6 @@ models: blockchain: optimism project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'transfers', 'optimism'] description: "ETH transfers into or out of Safes" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/polygon/safe_polygon_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/polygon/safe_polygon_schema.yml index 2d30451c537..b278434694b 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/polygon/safe_polygon_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/polygon/safe_polygon_schema.yml @@ -6,9 +6,6 @@ models: blockchain: polygon project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'singletons', 'polygon'] description: "Singletons addresses used with Safes" @@ -25,9 +22,6 @@ models: blockchain: polygon project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'polygon'] description: "Safe addresses" @@ -54,9 +48,6 @@ models: blockchain: polygon project: safe contributors: tschubotz - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'transfers', 'polygon'] description: "MATIC transfers into or out of Safes" @@ -93,9 +84,6 @@ models: blockchain: polygon project: safe contributors: tschubotz, danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'polygon'] description: "Safe transactions" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/ronin/safe_ronin_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/ronin/safe_ronin_schema.yml index 8e907415577..2044f49d81d 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/ronin/safe_ronin_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/ronin/safe_ronin_schema.yml @@ -6,9 +6,6 @@ models: blockchain: ronin project: safe contributors: petertherock - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'ronin'] description: "Safe addresses" @@ -42,9 +39,6 @@ models: blockchain: ronin project: safe contributors: petertherock - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'transfers', 'ronin'] description: "ETH transfers for safes" @@ -81,9 +75,6 @@ models: blockchain: ronin project: safe contributors: petertherock - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'singletons', 'ronin'] description: "Singletons addresses used with Safes" @@ -96,9 +87,6 @@ models: blockchain: ronin project: safe contributors: petertherock - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'ronin'] description: "Safe transactions" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/safe_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/safe_schema.yml index 84370178fec..4c758abd315 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/safe_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/safe_schema.yml @@ -35,9 +35,6 @@ models: blockchain: arbitrum, avalanche_c, base, blast, bnb, celo, ethereum, fantom, gnosis, goerli, linea, mantle, optimism, polygon, scroll, worldchain, zkevm, zksync project: safe contributors: kryptaki, danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['arbitrum', 'avalanche_c', 'base', 'blast', 'bnb', 'celo','ethereum', 'fantom', 'gnosis', 'goerli', 'linea', 'mantle', 'optimism', 'polygon', 'safe', 'scroll', 'worldchain', 'zkevm', 'zksync'] description: "Safe transactions" @@ -97,9 +94,6 @@ models: blockchain: arbitrum, avalanche_c, base, blast, bnb, celo, ethereum, gnosis, goerli, linea, mantle, optimism, polygon, scroll, worldchain, zkevm, zksync project: safe contributors: kryptaki, tschubotz, danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['arbitrum', 'avalanche_c', 'base', 'blast', 'bnb', 'celo','ethereum', 'gnosis', 'goerli', 'linea', 'mantle', 'optimism', 'polygon', 'safe', 'scroll', 'worldchain', 'zkevm', 'zksync'] description: "Native gas token transfers into or out of Safes" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/scroll/safe_scroll_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/scroll/safe_scroll_schema.yml index f33f34b7dc2..03393a99139 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/scroll/safe_scroll_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/scroll/safe_scroll_schema.yml @@ -6,9 +6,6 @@ models: blockchain: scroll project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'scroll'] description: "Safe addresses" @@ -42,9 +39,6 @@ models: blockchain: scroll project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'transfers', 'scroll'] description: "ETH transfers for safes" @@ -81,9 +75,6 @@ models: blockchain: scroll project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'singletons', 'scroll'] description: "Singletons addresses used with Safes" @@ -96,9 +87,6 @@ models: blockchain: scroll project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'scroll'] description: "Safe transactions" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/worldchain/safe_worldchain_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/worldchain/safe_worldchain_schema.yml index fa0f4fca473..a5be33ec938 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/worldchain/safe_worldchain_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/worldchain/safe_worldchain_schema.yml @@ -6,9 +6,6 @@ models: blockchain: worldchain project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'worldchain'] description: "Safe addresses" @@ -42,9 +39,6 @@ models: blockchain: worldchain project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'transfers', 'worldchain'] description: "ETH transfers for safes" @@ -81,9 +75,6 @@ models: blockchain: worldchain project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'singletons', 'worldchain'] description: "Singletons addresses used with Safes" @@ -96,9 +87,6 @@ models: blockchain: worldchain project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'worldchain'] description: "Safe transactions" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/zkevm/safe_zkevm_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/zkevm/safe_zkevm_schema.yml index e48894b19a8..94ce42e086a 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/zkevm/safe_zkevm_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/zkevm/safe_zkevm_schema.yml @@ -6,9 +6,6 @@ models: blockchain: zkevm project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'zkevm'] description: "Safe addresses" @@ -42,9 +39,6 @@ models: blockchain: zkevm project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'transfers', 'zkevm'] description: "MATIC transfers for safes" @@ -81,9 +75,6 @@ models: blockchain: zkevm project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'singletons', 'zkevm'] description: "Singletons addresses used with Safes" @@ -96,9 +87,6 @@ models: blockchain: zkevm project: safe contributors: danielpartida - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'zkevm'] description: "Safe transactions" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/zksync/safe_zksync_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/zksync/safe_zksync_schema.yml index f441fc2751d..21be2e0fed2 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/zksync/safe_zksync_schema.yml +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/zksync/safe_zksync_schema.yml @@ -6,9 +6,6 @@ models: blockchain: zksync project: safe contributors: ['danielpartida' , 'kryptaki'] - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'zksync'] description: "Safe addresses" @@ -42,9 +39,6 @@ models: blockchain: zksync project: safe contributors: ['danielpartida' , 'kryptaki'] - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'transfers', 'zksync'] description: "Eth transfers for safes" @@ -82,9 +76,6 @@ models: blockchain: zksync project: safe contributors: ['danielpartida' , 'kryptaki'] - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'singletons', 'zksync'] description: "Singletons addresses used with Safes" @@ -100,9 +91,6 @@ models: blockchain: zksync project: safe contributors: kryptaki - freshness: - warn_after: { count: 12, period: hour } - error_after: { count: 24, period: hour } config: tags: ['safe', 'zksync'] description: "Safe transactions" diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/blobs/ethereum/blobs_submitters.sql b/dbt_subprojects/hourly_spellbook/models/_sector/blobs/ethereum/blobs_submitters.sql index 4542d4d8391..a96b8d34093 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/blobs/ethereum/blobs_submitters.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/blobs/ethereum/blobs_submitters.sql @@ -33,6 +33,7 @@ SELECT address , (0x5ead389b57d533a94a0eacd570dc1cc59c25f2d4, 'Parallel', 'ParallelFi') , (0x40acdc94a00b33151b40763b3fed7c46ff639df4, 'Parallel', 'ParallelFi') , (0xcf2898225ed05be911d3709d9417e86e0b4cfc8f, 'Scroll', 'Scroll_ZKP') + , (0x054a47b9e2a22af6c0ce55020238c8fecd7d334b, 'Scroll', 'Scroll_ZKP') , (0xa6ea2f3299b63c53143c993d2d5e60a69cd6fe24, 'Lisk', 'LiskHQ') , (0x3d0bf26e60a689a7da5ea3ddad7371f27f7671a5, 'Optopia', 'Optopia_AI') , (0x5c53f2ff1030c7fbc0616fd5b8fc6be97aa27e00, 'Lumio', 'PontemNetwork') @@ -78,4 +79,8 @@ SELECT address , (0x2986bf308d0684ad77cd32ee1c60429e6573b5af, 'R0AR Chain', 'th3r0ar') , (0x2f60a5184c63ca94f82a27100643dbabe4f3f7fd, 'Unichain', 'unichain') , (0xf854cd5b26bfd73d51236c0122798907ed65b1f2, 'Swell', 'swellnetworkio') + , (0x500d7ea63cf2e501dadaa5feec1fc19fe2aa72ac, 'Ink', 'inkonchain') + , (0x68d5bbf3a01ecbb47ce38cf64a7d6c0ea618040f, 'Binary Network', 'thebinaryhldgs') + , (0xf263a0aa8afeaa7d516b596d49d7ba6c0feb102c, 'R0AR Chain', 'th3r0ar') + , (0x9391791f7cb74f8bfda65edc0749efd964311b55, 'HashKey', 'HashKeyHSK') ) AS x(address, entity, x_username) \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/cex/addresses/chains/bitcoin/cex_bitcoin_addresses.sql b/dbt_subprojects/hourly_spellbook/models/_sector/cex/addresses/chains/bitcoin/cex_bitcoin_addresses.sql index ecddc2099a3..20fd964b031 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/cex/addresses/chains/bitcoin/cex_bitcoin_addresses.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/cex/addresses/chains/bitcoin/cex_bitcoin_addresses.sql @@ -793,5 +793,7 @@ FROM (VALUES , ('bitcoin', '3CjxgnmNsu3kaFadzVea2FgECuHN7y2ENz', 'Bitcoin Suisse', 'Bitcoin Suisse 7', 'hildobby', date '2024-05-27') , ('bitcoin', 'bc1qu2dq8w8lv8v3l7lr2c5tvx3yltv22r3nhkx7w0', 'eXch.sc', 'eXch.sc 1', 'hildobby', date '2024-09-06') + + , ('bitcoin', 'bc1qlnkyrrupehgw5evu43erlgkhhagv0uj3yyhacvc65n3ud6qeas0sa958ps', 'Arkham', 'Arkham 1', 'hildobby', date '2024-12-13') ) AS x (blockchain, address, cex_name, distinct_name, added_by, added_date) diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/cex/addresses/chains/cex_evms_addresses.sql b/dbt_subprojects/hourly_spellbook/models/_sector/cex/addresses/chains/cex_evms_addresses.sql index 18acb039b82..cfa5616ec01 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/cex/addresses/chains/cex_evms_addresses.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/cex/addresses/chains/cex_evms_addresses.sql @@ -681,7 +681,7 @@ FROM (VALUES , (0xecd8b3877d8e7cd0739de18a5b545bc0b3538566, 'HTX', 'HTX Old Address 33', 'hildobby', date '2022-08-28') , (0xef54f559b5e3b55b783c7bc59850f83514b6149c, 'HTX', 'HTX Old Address 34', 'hildobby', date '2022-08-28') , (0x9d6d492bd500da5b33cf95a5d610a73360fcaaa0, 'HTX', 'HTX Mining Pool', 'hildobby', date '2022-08-28') - , (0xfd54078badd5653571726c3370afb127351a6f26, 'HTX', 'HTX Gas Supplier', 'hildobby', date '2023-08-31') + , (0xfd54078badd5653571726c3370afb127351a6f26, 'HTX', 'HTX Gas Supplier 1', 'hildobby', date '2023-08-31') , (0x18916e1a2933cb349145a280473a5de8eb6630cb, 'HTX', 'HTX Gas Supplier 2', 'hildobby', date '2023-08-31') , (0xdb0e89a9b003a28a4055ef772e345e8089987bfd, 'HTX', 'HTX Gas Supplier 3', 'hildobby', date '2023-08-31') , (0xf0458aaaf6d49192d3b4711960635d5fa2114e71, 'HTX', 'HTX Gas Supplier 4', 'hildobby', date '2023-08-31') @@ -751,7 +751,7 @@ FROM (VALUES , (0x187c0e0aa33282096b39a33457939f1dc3ea8e0f, 'CoinList', 'CoinList 4', 'hildobby', date '2024-02-20') -- Duelbits , (0x4e80744fa23cec76e1621ce0dfaceb4b1d532e12, 'Duelbits', 'Duelbits 1', 'hildobby', date '2023-11-15') - , (0x3e97ae61ceda35b857b05e6b579c54abd5568c36, 'Duelbits', 'Duelbits First Funder 1', 'hildobby', date '2024-10-06') + , (0x3e97ae61ceda35b857b05e6b579c54abd5568c36, 'Duelbits', 'Duelbits 2', 'hildobby', date '2024-10-06') -- Coincheck , (0x9c19b0497997fe9e75862688a295168070456951, 'Coincheck', 'Coincheck 1', 'hildobby', date '2023-11-19') , (0xd52814615dc129e1eea3520e7e7f8d44dbfc6c5b, 'Coincheck', 'Coincheck 2', 'hildobby', date '2023-11-19') @@ -767,7 +767,7 @@ FROM (VALUES , (0x85faa6c1f2450b9caea300838981c2e6e120c35c, 'Gate.io', 'Gate.io 7', 'hildobby', date '2024-04-20') , (0x925206b8a707096ed26ae47c84747fe0bb734f59, 'Gate.io', 'Gate.io 8', 'hildobby', date '2024-04-20') , (0xeb01f8cdae433e7b55023ff0b2da44c4c712dce2, 'Gate.io', 'Gate.io 9', 'hildobby', date '2024-04-20') - , (0x6596da8b65995d5feacff8c2936f0b7a2051b0d0, 'Gate.io', 'Gate.io Gas Supplier', 'web3_data', date '2023-02-07') + , (0x6596da8b65995d5feacff8c2936f0b7a2051b0d0, 'Gate.io', 'Gate.io Gas Supplier 1', 'web3_data', date '2023-02-07') , (0xd793281182a0e3e023116004778f45c29fc14f19, 'Gate.io', 'Gate.io Contract', 'web3_data', date '2023-02-07') -- Kraken , (0x2910543af39aba0cd09dbb2d50200b3e800a63d2, 'Kraken', 'Kraken 1', 'hildobby', date '2022-08-28') @@ -923,6 +923,9 @@ FROM (VALUES , (0xf6230e7e98d2bbebf96d14888020e9c3e8c27d69, 'Korbit', 'Korbit 10', 'hildobby', date '2024-05-04') , (0x223674cc4433a50caddf13c65f92151d75996e41, 'Korbit', 'Korbit 11', 'hildobby', date '2024-05-27') , (0x8e2040ab7a6af6bba67e6d9b280c6fea7f930c87, 'Korbit', 'Korbit 12', 'hildobby', date '2024-10-06') + , (0x3a70c2528265f0624e7ac8495b212a367b5b61b2, 'Korbit', 'Korbit 13', 'hildobby', date '2024-12-12') + , (0x5bd811987ee931ac85ed0eda8871282f9c5c88a4, 'Korbit', 'Korbit 14', 'hildobby', date '2024-12-12') + , (0x455ae9f6d25fd49ed7be9f3d8dd1cf58a79a5958, 'Korbit', 'Korbit 15', 'hildobby', date '2024-12-12') , (0xd17e26529e5fca53901f65f1a914317877cab08a, 'Korbit', 'Korbit Gas Supplier 1', 'hildobby', date '2024-10-06') , (0xd77f7f8868f20835fdfc8c7e851f6f23ce9f651d, 'Korbit', 'Korbit Gas Supplier 2', 'hildobby', date '2024-10-06') -- KuCoin @@ -1189,6 +1192,7 @@ FROM (VALUES , (0x787b8840100d9baadd7463f4a73b5ba73b00c6ca, 'Stake.com', 'Stake.com 11', 'hildobby', date '2024-04-04') , (0xbbc43c282b2f829176f4fc3802436d8fad3413f3, 'Stake.com', 'Stake.com 12', 'hildobby', date '2024-05-26') , (0x758be77a3ee14e7193730560daa07dd3fcbfd200, 'Stake.com', 'Stake.com 13', 'hildobby', date '2024-08-13') + , (0x6f419642ad147853a91e1cb50d4b909dde19cece, 'Stake.com', 'Stake.com 14', 'hildobby', date '2025-01-07') -- 1xBet , (0x777f415324d56e1d54fa832902d8797db7a4c57c, '1xBet', '1xBet 1', 'hildobby', date '2024-10-06') , (0xba3801847037ffe8de609ccfdd8e02c2f60adc43, '1xBet', '1xBet 2', 'hildobby', date '2024-10-06') @@ -1286,6 +1290,7 @@ FROM (VALUES , (0xee7c0bf91f9ac8117b490c8e028714acbcb41364, 'Bitstamp', 'Bitstamp 44', 'hildobby', date '2024-04-20') , (0xc3b7336d5a5158215599572012cedd4403a81629, 'Bitstamp', 'Bitstamp 45', 'hildobby', date '2024-05-04') , (0x3d9256ad37128e9f47b34a82e06e981719477c18, 'Bitstamp', 'Bitstamp 46', 'hildobby', date '2024-10-06') + , (0x1f69d824c3b4f906ac3fc8826e2391bcb9330e02, 'Bitstamp', 'Bitstamp 47', 'hildobby', date '2024-12-12') , (0xfca70e67b3f93f679992cd36323eeb5a5370c8e4, 'Bitstamp', 'Bitstamp Old Address 1', 'hildobby', date '2022-08-28') , (0x964771f6df31eea2d927fa71d7bd78e81bcdce05, 'Bitstamp', 'Bitstamp Contract 1', 'hildobby', date '2023-08-31') , (0x538d72ded42a76a30f730292da939e0577f22f57, 'Bitstamp', 'Bitstamp Deployer', 'hildobby', date '2023-08-31') @@ -1365,6 +1370,12 @@ FROM (VALUES , (0x76d0f5ddb248f03d7d38444e15cee5161fa66adf, 'HitBTC', 'HitBTC Gas Supplier 54', 'hildobby', date '2024-10-06') , (0x79be4dce73b64667ba06c05d011fabbc9fd240a8, 'HitBTC', 'HitBTC Gas Supplier 55', 'hildobby', date '2024-10-06') , (0x09eb27139bbfe4b97458cb85875e94a3a4d74a2e, 'HitBTC', 'HitBTC Gas Supplier 56', 'hildobby', date '2024-10-06') + , (0x78c1b2fc2484cd112cc980c3cb2f12c8e30b4c94, 'HitBTC', 'HitBTC Gas Supplier 57', 'hildobby', date '2025-01-07') + , (0x422026c9fe5dd65dc259ef1140735bdd952cc2eb, 'HitBTC', 'HitBTC Gas Supplier 58', 'hildobby', date '2025-01-07') + , (0xa8220ce798eb9a75883189fbdc9a8cf633ad1795, 'HitBTC', 'HitBTC Gas Supplier 59', 'hildobby', date '2025-01-07') + , (0x37d3e950dc5ceb6309cbc5bfa456caaedd179dd4, 'HitBTC', 'HitBTC Gas Supplier 60', 'hildobby', date '2025-01-07') + , (0x7b8067d5ca62a9ba370360f72c951e821669ba0a, 'HitBTC', 'HitBTC Gas Supplier 61', 'hildobby', date '2025-01-07') + -- BTSE , (0xbb4d1dc5c1abec4ea11166ec97e714862863ad1d, 'BTSE', 'BTSE 1', 'hildobby', date '2023-09-12') , (0x9036b1eb7630d9a45720fd80d05d46262f460529, 'BTSE', 'BTSE 2', 'hildobby', date '2023-09-12') @@ -1414,7 +1425,7 @@ FROM (VALUES , (0xdf21fa922215b1a56f5a6d6294e6e36c85a0acfb, 'Poloniex', 'Poloniex 6', 'hildobby', date '2023-11-17') , (0x8fca4ade3a517133ff23ca55cdaea29c78c990b8, 'Poloniex', 'Poloniex 7', 'hildobby', date '2024-04-04') , (0x007abbe8057433641acb791d966d33a12cf82d01, 'Poloniex', 'Poloniex 8', 'hildobby', date '2024-06-03') - , (0xb42b20ddbeabdc2a288be7ff847ff94fb48d2579, 'Poloniex', 'Poloniex Gas Supplier', 'hildobby', date '2023-09-09') + , (0xb42b20ddbeabdc2a288be7ff847ff94fb48d2579, 'Poloniex', 'Poloniex Gas Supplier 1', 'hildobby', date '2023-09-09') , (0xaa9fa73dfe17ecaa2c89b39f0bb2779613c5fc3b, 'Poloniex', 'Poloniex BAT', 'hildobby', date '2022-08-28') , (0x2fa2bc2ce6a4f92952921a4caa46b3727d24a1ec, 'Poloniex', 'Poloniex BNT', 'hildobby', date '2022-08-28') , (0x31a2feb9b5d3b5f4e76c71d6c92fc46ebb3cb1c1, 'Poloniex', 'Poloniex CVC', 'hildobby', date '2022-08-28') @@ -1440,6 +1451,7 @@ FROM (VALUES , (0xab928e30bede5919d4bd9ec244711495769d2d85, 'WhiteBIT', 'WhiteBIT 6', 'hildobby', date '2024-04-04') , (0x33eac50b7faf4b8842a621d0475335693f5d21fe, 'WhiteBIT', 'WhiteBIT 7', 'hildobby', date '2024-05-25') , (0x98cea98be2a37a8bb52451bd46259b2fbee1bdc0, 'WhiteBIT', 'WhiteBIT 8', 'hildobby', date '2024-08-13') + , (0xeefbd9626704dcd9c672c1031fc81e7f346ff3b8, 'WhiteBIT', 'WhiteBIT 9', 'hildobby', date '2025-01-07') -- Paxos , (0x286af5cf60ae834199949bbc815485f07cc9c644, 'Paxos', 'Paxos 1', 'hildobby', date '2023-11-15') , (0x0c23fc0ef06716d2f8ba19bc4bed56d045581f2d, 'Paxos', 'Paxos 2', 'hildobby', date '2023-11-15') @@ -1712,6 +1724,7 @@ FROM (VALUES , (0x5d089c8141e58773bc88fba973198b3ec95aa501, 'ShapeShift', 'ShapeShift Gas Supplier 22', 'hildobby', date '2024-10-06') , (0x5aa107c71a314cada39db8fe7f9b591f67521c14, 'ShapeShift', 'ShapeShift Gas Supplier 23', 'hildobby', date '2024-10-12') , (0x7b9bc474667db2ffe5b08d000f1acc285b2ae47d, 'ShapeShift', 'ShapeShift Gas Supplier 24', 'hildobby', date '2024-11-08') + , (0xcae39061f41686e1aaf9cf10145e5d4a4265635c, 'ShapeShift', 'ShapeShift Gas Supplier 25', 'hildobby', date '2025-01-07') -- Shakepay , (0x912fd21d7a69678227fe6d08c64222db41477ba0, 'Shakepay', 'Shakepay 1', 'hildobby', date '2023-11-17') , (0x000f422887ea7d370ff31173fd3b46c8f66a5b1c, 'Shakepay', 'Shakepay 2', 'hildobby', date '2023-11-17') @@ -1763,7 +1776,8 @@ FROM (VALUES , (0x079a892628ebf28d0ed8f00151cff225a093dc63, 'Bitvavo', 'Bitvavo Hot 1', 'hildobby', date '2023-11-17') , (0x95b564f3b3bae3f206aa418667ba000afafacc8a, 'Bitvavo', 'Bitvavo Hot 2', 'hildobby', date '2023-11-17') , (0xab782bc7d4a2b306825de5a7730034f8f63ee1bc, 'Bitvavo', 'Bitvavo Hot 3', 'hildobby', date '2024-03-13') - , (0x1a1c87d9a6f55d3bbb064bff1059ad37b6bdc097, 'Bitvavo', 'Bitvavo Gas Supplier', 'hildobby', date '2023-11-17') + , (0x1a1c87d9a6f55d3bbb064bff1059ad37b6bdc097, 'Bitvavo', 'Bitvavo Gas Supplier 1', 'hildobby', date '2023-11-17') + , (0x897321a0ee56b57ef56f284037ffe4b63287d52a, 'Bitvavo', 'Bitvavo Gas Supplier 2', 'hildobby', date '2024-01-13') -- QuadrigaCX , (0x027beefcbad782faf69fad12dee97ed894c68549, 'QuadrigaCX', 'QuadrigaCX 1', 'hildobby', date '2023-09-09') , (0xb6aac3b56ff818496b747ea57fcbe42a9aae6218, 'QuadrigaCX', 'QuadrigaCX 2', 'hildobby', date '2023-09-09') @@ -1912,6 +1926,7 @@ FROM (VALUES , (0x4df5f3610e2471095a130d7d934d551f3dde01ed, 'ATAIX', 'ATAIX 1', 'hildobby', date '2022-08-28') -- Beaxy , (0xadb72986ead16bdbc99208086bd431c1aa38938e, 'Beaxy', 'Beaxy 1', 'hildobby', date '2022-08-28') + , (0x6d932cb67760f6a5343998bebac85c0de7c9aa10, 'Beaxy', 'Beaxy Gas Supplier 1', 'hildobby', date '2025-01-07') -- Bgogo , (0x7a10ec7d68a048bdae36a70e93532d31423170fa, 'Bgogo', 'Bgogo 1', 'hildobby', date '2022-08-28') , (0xce1bf8e51f8b39e51c6184e059786d1c0eaf360f, 'Bgogo', 'Bgogo 2', 'hildobby', date '2022-08-28') @@ -1961,8 +1976,8 @@ FROM (VALUES , (0xea81ce54a0afa10a027f65503bd52fba83d745b8, 'Kuna', 'Kuna 1', 'hildobby', date '2022-08-28') , (0x77ab999d1e9f152156b4411e1f3e2a42dab8cd6d, 'Kuna', 'Kuna 2', 'hildobby', date '2022-08-28') , (0x9030a104a49141459f4b419bd6f56e4ba6fcd800, 'Kuna', 'Kuna 3', 'hildobby', date '2023-11-23') - , (0xfac0f29459896ed8550e002344734989d958de01, 'Kuna', 'Kuna First Funder 1', 'hildobby', date '2024-10-06') - , (0x04196627190ff624492427317d853deaa270f9d2, 'Kuna', 'Kuna First Funder 2', 'hildobby', date '2024-10-06') + , (0xfac0f29459896ed8550e002344734989d958de01, 'Kuna', 'Kuna Gas Supplier 1', 'hildobby', date '2024-10-06') + , (0x04196627190ff624492427317d853deaa270f9d2, 'Kuna', 'Kuna Gas Supplier 2', 'hildobby', date '2024-10-06') -- BW.com , (0xbcdfc35b86bedf72f0cda046a3c16829a2ef41d1, 'BW.com', 'BW.com Old Address 1', 'hildobby', date '2022-08-28') , (0x73957709695e73fd175582105c44743cf0fb6f2f, 'BW.com', 'BW.com 1', 'hildobby', date '2022-08-28') @@ -2190,6 +2205,8 @@ FROM (VALUES , (0x7009407b417759c34a35d63530d30a818661b857, 'CoinW', 'CoinW Gas Supplier 11', 'hildobby', date '2024-10-06') , (0xc4e08dd8dfc72cdbb61bc9cfa82f8738f3ab6d05, 'CoinW', 'CoinW Gas Supplier 12', 'hildobby', date '2024-10-06') , (0x9998d99daae38b87f0f43c40974720a0b3d3d95c, 'CoinW', 'CoinW Gas Supplier 13', 'hildobby', date '2024-10-12') + , (0x092738e25c5d132e235e8bd4451d180e86da6736, 'CoinW', 'CoinW Gas Supplier 14', 'hildobby', date '2025-01-07') + , (0xbef77b5f2b7434333b13f6441cb88866e07eca2d, 'CoinW', 'CoinW Gas Supplier 15', 'hildobby', date '2025-01-07') -- Cryptopia , (0x5baeac0a0417a05733884852aa068b706967e790, 'Cryptopia', 'Cryptopia 1', 'hildobby', date '2022-08-28') , (0x2984581ece53a4390d1f568673cf693139c97049, 'Cryptopia', 'Cryptopia 2', 'hildobby', date '2022-08-28') @@ -2525,6 +2542,7 @@ FROM (VALUES , (0xc97a4ed29f03fd549c4ae79086673523122d2bc5, 'ZB.com', 'ZB.com 5', 'hildobby', date '2024-05-04') , (0x38b78904a6b44f63eb81d98937fc6614870cfbb9, 'ZB.com', 'ZB.com 6', 'hildobby', date '2024-05-04') , (0xf0d9fcb4fefdbd3e7929374b4632f8ad511bd7e3, 'ZB.com', 'ZB.com 7', 'hildobby', date '2024-10-06') + , (0xcb45822dfa8a65b97bc854a1a61b674153a42967, 'ZB.com', 'ZB.com 8', 'hildobby', date '2024-12-12') , (0x734ac651dd95a339c633cded410228515f97faff, 'ZB.com', 'ZB.com Gas Supplier 1', 'hildobby', date '2023-11-23') , (0xdb7248d26ea60170a4fdc2ea44dc839c9e8c9ee4, 'ZB.com', 'ZB.com Gas Supplier 2', 'hildobby', date '2024-05-04') , (0x5e91e8ccae2dd2c6db87f677e161ed1e07d6ccc8, 'ZB.com', 'ZB.com Gas Supplier 3', 'hildobby', date '2024-10-06') @@ -2689,6 +2707,7 @@ FROM (VALUES , (0xe2933566f172d08f8c90144fed5ae28e9d54b1ec, 'Woo X', 'Woo X Team', 'hildobby', date '2024-01-04') , (0x15271e572267def474366bb683719cc59489efbe, 'Woo X', 'Woo X Treasury 1', 'hildobby', date '2024-01-04') , (0xd7d8bcae65537cb5079a4fb249b9fbb4526e4084, 'Woo X', 'Woo X Treasury 2', 'hildobby', date '2024-06-03') + , (0xfa2d1f15557170f6c4a4c5249e77f534184cdb79, 'Woo X', 'Woo X Treasury 3', 'hildobby', date '2024-12-12') , (0xe64eb20471491956338eedc0f98242bc3ad0c91b, 'Woo X', 'Woo X Deployer 1', 'hildobby', date '2024-06-03') -- FastEx , (0x85e1de87a7575c6581f7930f857a3813b66a14d8, 'FastEx', 'FastEx 1', 'hildobby', date '2023-11-23') @@ -2703,6 +2722,7 @@ FROM (VALUES , (0xfa66605b88e16c2fd011622dee6f35a976098edb, 'BTCEX', 'BTCEX 2', 'hildobby', date '2024-01-04') , (0x4f26b5961210f295542b0c5c13c4887e24f0910e, 'BTCEX', 'BTCEX 3', 'hildobby', date '2024-01-04') , (0xbbdaea89ced53bf9e31a4ceb926832fbb1bc0bb4, 'BTCEX', 'BTCEX Gas Supplier 1', 'hildobby', date '2024-10-06') + , (0xd020220ca4841229514d1bc02a8abce4c162c015, 'BTCEX', 'BTCEX Gas Supplier 2', 'hildobby', date '2025-01-07') -- GDAC , (0x5735fbac26bb21ca3c5228022cc382136038087c, 'GDAC', 'GDAC 1', 'hildobby', date '2024-01-04') , (0x9f4745df0d6713b08323e0d39ab4cef6891c11e1, 'GDAC', 'GDAC 2', 'hildobby', date '2024-01-04') @@ -2773,6 +2793,7 @@ FROM (VALUES -- OPNX , (0x610887f0ae329557d1ae067f6b7697ff07032116, 'OPNX', 'OPNX 1', 'hildobby', date '2024-01-04') , (0xe5241ac645cad844e94a2e7486283ed6398fb3aa, 'OPNX', 'OPNX 2', 'hildobby', date '2024-01-04') + , (0x05d618a67786e4d078c0fbc8e601ad9765787c5d, 'OPNX', 'OPNX Safe 1', 'hildobby', date '2024-12-12') , (0xcd5f17b1fe981ba260c40c67e740b7290b50ea50, 'OPNX', 'OPNX Contract 1', 'hildobby', date '2024-01-04') , (0x78a0a62fba6fb21a83fe8a3433d44c73a4017a6f, 'OPNX', 'OPNX OX Token', 'hildobby', date '2024-01-04') , (0x28901cf869d94c9d892fbd86c8e57b801e8fdd87, 'OPNX', 'OPNX veOX Token', 'hildobby', date '2024-01-04') @@ -3173,4 +3194,9 @@ FROM (VALUES , (0x8f3ab2c3b651382b07a76653d2be9eb4b87e1630, 'YOOBTC', 'YOOBTC 1', 'hildobby', date '2024-05-25') -- Mbcbit , (0x5e6ad578fe3a2da7bbd0255f04179e1e77317d1a, 'Mbcbit', 'Mbcbit 1', 'hildobby', date '2024-07-05') + -- Arkham Exchange + , (0x679fb19dec9d66c34450a8563ffdfd29c04e615a, 'Arkham', 'Arkham 1', 'hildobby', date '2024-12-13') + , (0x0323718324218dcbff7c9f89ba5a5954f61a6c74, 'Arkham', 'Arkham 2', 'hildobby', date '2024-12-13') + , (0x34407900475cef87ace1597670a9a42f31961d02, 'Arkham', 'Arkham 3', 'hildobby', date '2024-12-13') + , (0xdc2822d0685c0cceab07b35d6de4ac9280fb9cff, 'Arkham', 'Arkham 4', 'hildobby', date '2024-12-13') ) AS x (address, cex_name, distinct_name, added_by, added_date) \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/dune/_schema.yml b/dbt_subprojects/hourly_spellbook/models/_sector/dune/_schema.yml new file mode 100644 index 00000000000..6c6e4f12e11 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/dune/_schema.yml @@ -0,0 +1,24 @@ +version: 2 + +models: + - name: dune_blockchains + meta: + sector: dune + contributors: 0xRob + description: > + Core table listing blockchains on Dune with meta info + columns: + - name: name + description: "The namespaces of the blockchain as used on Dune" + - name: chain_id + description: "The chain ID (only for EVM)" + - name: display_name + description: "Nicely formatted name" + - name: protocol + description: "evm or non_evm" + - name: token_address + description: "The token address used on Dune to represent the native token" + - name: token_symbol + description: "The token symbol of the native token" + - name: token_decimals + description: "The token decimals of the native token" diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/dune/dune_blockchains.sql b/dbt_subprojects/hourly_spellbook/models/_sector/dune/dune_blockchains.sql new file mode 100644 index 00000000000..739b358e3c7 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_sector/dune/dune_blockchains.sql @@ -0,0 +1,15 @@ +{{ config( + schema='dune', + alias = 'blockchains', + materialized = 'view', + post_hook='{{ expose_spells(\'["dune"]\', + "sector", + "dune", + \'["0xRob"]\') }}') +}} + +-- because the graphql endpoint often returns http error 403 when querying through http_get(), +-- we store the results in a matview instead and expose that one here with a view on top. +-- matview: https://dune.com/queries/4467416 +select * from +{{ source("dune", "result_blockchains", database="dune") }} diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_linea_l1_data_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_linea_l1_data_fees.sql index 76201e6f05c..bce7f75e8c7 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_linea_l1_data_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_data_fees/chains/rollup_economics_linea_l1_data_fees.sql @@ -29,8 +29,9 @@ AND bytearray_substring(t.data, 1, 4) IN ( 0x7a776315 -- submitData (Aplha v2 Release at block. 19222438) , 0x2d3c12e5 -- submitBlobData , 0x42fbe842 -- submitBlobs + , 0x99467a35 -- submitBlobs (updated) ) AND t.block_time >= TIMESTAMP '2023-07-12' {% if is_incremental() %} AND {{incremental_predicate('t.block_time')}} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_linea_l1_verification_fees.sql b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_linea_l1_verification_fees.sql index d98fb88dfa1..ddf9d8329d5 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_linea_l1_verification_fees.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/rollup_economics/ethereum/l1_verification_fees/chains/rollup_economics_linea_l1_verification_fees.sql @@ -27,10 +27,11 @@ WHERE t.to IN ( ) AND bytearray_substring(t.data, 1, 4) IN ( 0x4165d6dd -- Finalize Blocks (proof verified immediately) + , 0x5603c65f -- Finalize Blocks (updated) , 0xd630280f -- finalizeCompressedBlocksWithProof (Aplha v2 Release at block. 19222438) , 0xabffac32 -- finalizeBlocksWithProof ) AND t.block_time >= TIMESTAMP '2023-07-12' {% if is_incremental() %} AND {{incremental_predicate('t.block_time')}} -{% endif %} \ No newline at end of file +{% endif %} diff --git a/dbt_subprojects/hourly_spellbook/models/_sector/staking/ethereum/staking_ethereum_flows.sql b/dbt_subprojects/hourly_spellbook/models/_sector/staking/ethereum/staking_ethereum_flows.sql index dd6b3a7f087..2ad0188d082 100644 --- a/dbt_subprojects/hourly_spellbook/models/_sector/staking/ethereum/staking_ethereum_flows.sql +++ b/dbt_subprojects/hourly_spellbook/models/_sector/staking/ethereum/staking_ethereum_flows.sql @@ -8,45 +8,18 @@ \'["hildobby", "0xBoxer"]\') }}') }} -WITH invalid_pubkeys AS ( - SELECT pubkey - FROM (VALUES - (0xb01dd8e44a8e02e36e0d66161103b9ff32315dbb9ae8c8ac8d097ba86a9e2b1eb3c7fd41e7cd1f77a987985639c26f52) - , (0xac424d8a3e6ce38eb22109125357324a1c44ecad7a330a3d3deff91e68f4b567ba38c065d2cf852ef050d21705e5dfcb) - , (0x918f080ca717afed4966901794ad8222ca618b523bbd3ce94be4a1240aa69d9be20f884950214a3cafa0404ce41213e1) - , (0xa8bcbf91bff7d3368ddbf5b35c46a4f5d82b16230c851a4b8eec82be45225d339414170e14a6cd17ad83ee3792dead85) - , (0x86f473a006c566f1648a82c74cdfbd4a3cb2ea04eb2e0d49ef381ab2562576888554ef3d39e56996f24c804abb489600) - , (0x8c69edd7a8e8da5330787952a1ad5075516e6fd4bda1586d62dd64701f7628d5229eb7f929017dea9ae6995f9c69ef5e) - , (0x80a29e569e8ced0be1fff42c845a59449aecf8a2503542e4e76763ccc0265e683e2d5d46618cc829349293ed08ff49ff) - , (0xb913a27913c8a74c05cc31c1a690ecad05a59e405bd7c5e8f6eab8e426e041a98b26cf40b04356b4d92ac20a56b7dcae) - , (0x86af099d9134b2994b835cced1fadfb4587dddfc4010470db9d8875cffd9e5a62a197db7d9c0266fb67c5175feb7ef51) - , (0x8107543db1d5c69be127b3eb84c0f7b8157b892482f7e98b85b83d9a6be75e7c24a645df6283d46b16285862530cad77) - , (0x8e05d99c557001d06f8240d46899b829a8cc77ac57b3d16359279cad707cfe5f223a3374987ab73a379ee358dd05d524) - , (0xaebf3fbab24f55df829e2bc939bb987cbdb3edea7d4cb8877e422f1185d03a22f3a0f6449a1d6d1b912ec09ed11f2bb3) - , (0xac3a0887866d5d45555904e2cb35e1b89b4c338c19001b0cc1184c9f95c5a731ccef70dc4c4fed7709c2106042a119c9) - , (0xa03840dd6af6555442e3fc0d62de8dde77970f45175ea9926327372b5c83542f67cdd06e14e1daa44a3ae23e4d8eef52) - , (0x828116d0d2e945f1483ec7c6c135a8e00814588879e9a12a67c42268c339388b6f796f6c858e673f6000f5d028b913da) - , (0x816827749a5194cf8389419e88d87f6786436daaa5546b92c68af015f0b7e17c66f4bb30b18872f3f051c2bc213ecaab) - , (0xa0ab932b24d80a7a96f0fb32ce2aa724625eb090c70cb9c977f0bc5909503629155335be021e58b245e11a77c847a11c) - , (0x8d135f9185f635be5e3d738c835a02d5efab05bc5fa38ce4cb6d02156446aa3cc1ce9cc38576ec519af815dc39d52c81) - , (0x8151e62f956cf1562007d9620fd4e91c029fb43959d1a7d1d2168c2943d65a3ef31764d1cc2d2540fb26ce86efad2ffd) - , (0x9714e943c81d802f3c858f284fff25779818a903c034a3de42da7a2b63ae6632c52b2be0982007e8090d0d334f8cf656) - --, (0x00) -- This is a dummy pubkey used to refresh the table - ) AS temp_table (pubkey) - ) - -, indexes AS ( - SELECT pubkey - , ROW_NUMBER() OVER (ORDER BY MIN(deposit_index)) - 1 AS validator_index +WITH indexes AS ( + SELECT d.pubkey + , i.index AS validator_index , MAX(entity) AS entity , MAX(entity_category) AS entity_category , MAX(entity_unique_name) AS entity_unique_name , MAX(sub_entity) AS sub_entity , MAX(sub_entity_category) AS sub_entity_category , MAX(sub_entity_unique_name) AS sub_entity_unique_name - FROM {{ ref('staking_ethereum_deposits')}} - WHERE pubkey NOT IN (SELECT pubkey FROM invalid_pubkeys) - GROUP BY 1 + FROM {{ ref('staking_ethereum_deposits')}} d + INNER JOIN {{source('beacon', 'validators')}} i ON d.pubkey=i.public_key + GROUP BY 1, 2 ) , deposits AS ( @@ -63,15 +36,15 @@ WITH invalid_pubkeys AS ( , d.tx_hash , d.tx_from , d.deposit_index - , i.validator_index - , pubkey + , i.index AS validator_index + , d.pubkey , d.signature , d.withdrawal_address , d.withdrawal_credentials , d.withdrawal_credentials_type , d.evt_index FROM {{ ref('staking_ethereum_deposits')}} d - INNER JOIN indexes i USING (pubkey) + INNER JOIN {{source('beacon', 'validators')}} i ON d.pubkey=i.public_key ) SELECT block_time @@ -125,4 +98,4 @@ SELECT w.block_time , NULL AS tx_hash , NULL AS evt_index FROM {{source('ethereum', 'withdrawals')}} w -INNER JOIN indexes i USING (validator_index) +INNER JOIN indexes i USING (validator_index) \ No newline at end of file diff --git a/dbt_subprojects/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_xcopy_collections.sql b/dbt_subprojects/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_xcopy_collections.sql index cb3eb9a7ef9..98f6fbaef49 100644 --- a/dbt_subprojects/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_xcopy_collections.sql +++ b/dbt_subprojects/nft/models/nft_metrics/ethereum/metadata/nft_ethereum_metadata_xcopy_collections.sql @@ -126,9 +126,12 @@ from (VALUES , ('E X P O S U R E', 'Edition', 'KnownOrigin', 25, 'Ethereum', 'erc721', 0xFBeef911Dc5821886e1dda71586d90eD28174B7d, 119326, 119350, '', 'https://opensea.io/collection/xcopy-knownorigin?search[stringTraits][0][name]=Tag&search[stringTraits][0][values][0]=exposure&search[sortAscending]=true&search[sortBy]=UNIT_PRICE','2020-01-20') , ('BLOOD BUBBLE', 'Edition', 'KnownOrigin', 25, 'Ethereum', 'erc721', 0xFBeef911Dc5821886e1dda71586d90eD28174B7d, 115026, 115050, '', 'https://opensea.io/collection/xcopy-knownorigin?search[collections][0]=xcopy-knownorigin&search[query]=blood%20bubble','2020-01-12') , ('BLOOD RUN', 'Unique', 'SuperRare', 1, 'Ethereum', 'erc721', 0xb932a70a57673d89f4acffbe830e8ed7f75fb9e0, 7009, 7009, '', 'https://superrare.com/artwork/eth/0xb932a70a57673d89f4acffbe830e8ed7f75fb9e0/7009','2020-01-11') - , ('THE RABBLE', 'Layer', 'Async Art', 44, 'Ethereum', 'erc721', 0xb6dAe651468E9593E4581705a09c10A76AC1e0c8, 432, 475, '', 'https://xcopy.art/works/the-rabble','2020-01-01') + , ('THE RABBLE 1/1', 'Unique', 'Async Art', 1, 'Ethereum', 'erc721', 0xb6dAe651468E9593E4581705a09c10A76AC1e0c8, 432, 432, '', 'https://xcopy.art/works/the-rabble','2020-01-01') + , ('BANKSTA 1/1', 'Unique', 'Async Art', 1, 'Ethereum', 'erc721', 0x6c424C25e9F1ffF9642cB5B7750b0Db7312c29ad, 28, 28, '', 'https://xcopy.art/works/banksta','2020-01-01') + , ('DOOM PARTY 1/1', 'Unique', 'Async Art', 1, 'Ethereum', 'erc721', 0xb6dAe651468E9593E4581705a09c10A76AC1e0c8, 199, 199, '', 'https://xcopy.art/works/doom-party','2020-01-01') + , ('THE RABBLE', 'Layer', 'Async Art', 43, 'Ethereum', 'erc721', 0xb6dAe651468E9593E4581705a09c10A76AC1e0c8, 433, 475, '', 'https://xcopy.art/works/the-rabble','2020-01-01') , ('BANKSTA', 'Layer', 'Async Art', 8, 'Ethereum', 'erc721', 0x6c424C25e9F1ffF9642cB5B7750b0Db7312c29ad, 29, 36, '', 'https://xcopy.art/works/banksta','2020-01-01') - , ('DOOM PARTY', 'Layer', 'Async Art', 12, 'Ethereum', 'erc721', 0xb6dAe651468E9593E4581705a09c10A76AC1e0c8, 199, 210, '', 'https://xcopy.art/works/doom-party','2020-01-01') + , ('DOOM PARTY', 'Layer', 'Async Art', 11, 'Ethereum', 'erc721', 0xb6dAe651468E9593E4581705a09c10A76AC1e0c8, 200, 210, '', 'https://xcopy.art/works/doom-party','2020-01-01') , ('RESIST', 'Edition', 'KnownOrigin', 25, 'Ethereum', 'erc721', 0xFBeef911Dc5821886e1dda71586d90eD28174B7d, 109251, 109275, '', 'https://opensea.io/collection/xcopy-knownorigin?search[collections][0]=xcopy-knownorigin&search[query]=resist','2019-12-31') , ('FOMO', 'Unique', 'SuperRare', 1, 'Ethereum', 'erc721', 0xb932a70a57673d89f4acffbe830e8ed7f75fb9e0, 6708, 6708, '', 'https://superrare.com/artwork/eth/0xb932a70a57673d89f4acffbe830e8ed7f75fb9e0/6708','2019-12-31') , ('THE DAMAGE', 'Edition', 'KnownOrigin', 25, 'Ethereum', 'erc721', 0xFBeef911Dc5821886e1dda71586d90eD28174B7d, 108701, 108725, '', 'https://opensea.io/collection/xcopy-knownorigin?search[collections][0]=xcopy-knownorigin&search[query]=the%20damage','2019-12-30') diff --git a/dbt_subprojects/tokens/dbt_project.yml b/dbt_subprojects/tokens/dbt_project.yml index 4ab163deb41..582d4218748 100644 --- a/dbt_subprojects/tokens/dbt_project.yml +++ b/dbt_subprojects/tokens/dbt_project.yml @@ -23,6 +23,12 @@ vars: DBT_ENV_INCREMENTAL_TIME_UNIT: "{{ env_var('DBT_ENV_INCREMENTAL_TIME_UNIT', 'day') }}" ETH_ERC20_ADDRESS: '0x0000000000000000000000000000000000000000' +# Configuring tests +# Full documentation: https://docs.getdbt.com/reference/test-configs +data_tests: + tokens: + +store_failures: true # store failures for all tests + # These configurations specify where dbt should look for different types of files. # You don't need to change these! model-paths: ["models", "../../sources"] diff --git a/dbt_subprojects/tokens/models/prices/_schema.yml b/dbt_subprojects/tokens/models/prices/_schema.yml index 0774a3dfa3f..6f20dac9447 100644 --- a/dbt_subprojects/tokens/models/prices/_schema.yml +++ b/dbt_subprojects/tokens/models/prices/_schema.yml @@ -144,7 +144,7 @@ models: - name: prices_tokens meta: - blockchain: arbitrum, avalanche_c, gnosis, polygon, optimism, ethereum, bnb, solana, fantom, celo, base, zksync, zora, linea, zkevm, blast, sei, nova, worldchain, kaia, ronin + blockchain: arbitrum, avalanche_c, gnosis, polygon, optimism, ethereum, bnb, solana, fantom, celo, base, zksync, zora, linea, zkevm, blast, sei, nova, worldchain, kaia, ronin, ink sector: prices contributors: aalan3, hildobby, pipistrella, viniabussafi, jeff-dude, hosuke config: @@ -171,7 +171,7 @@ models: - name: prices_native_tokens meta: - blockchain: arbitrum, avalanche_c, gnosis, polygon, optimism, ethereum, bnb, solana, fantom, celo, zksync, zora, sei, nova, worldchain, kaia, ronin + blockchain: arbitrum, avalanche_c, gnosis, polygon, optimism, ethereum, bnb, solana, fantom, celo, zksync, zora, sei, nova, worldchain, kaia, ronin, ink sector: prices contributors: aalan3, jeff-dude config: diff --git a/dbt_subprojects/tokens/models/prices/avalanche_c/prices_avalanche_c_tokens.sql b/dbt_subprojects/tokens/models/prices/avalanche_c/prices_avalanche_c_tokens.sql index 6fa223a52c3..357d9f5a51d 100644 --- a/dbt_subprojects/tokens/models/prices/avalanche_c/prices_avalanche_c_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/avalanche_c/prices_avalanche_c_tokens.sql @@ -105,6 +105,7 @@ FROM ('renbtc-renbtc', 'avalanche_c', 'renBTC', 0xdbf31df14b66535af65aac99c32e9ea844e14501, 8), ('arena-the-arena', 'avalanche_c', 'ARENA', 0xb8d7710f7d8349a506b75dd184f05777c82dad0c, 18), ('zro-layerzero', 'avalanche_c', 'ZRO', 0x6985884c4392d348587b19cb9eaaf157f13271cd, 18), - ('beam-beam-eth', 'avalanche_c', 'BEAM', 0x62d0a8458ed7719fdaf978fe5929c6d342b0bfce, 18) + ('beam-beam-eth', 'avalanche_c', 'BEAM', 0x62d0a8458ed7719fdaf978fe5929c6d342b0bfce, 18), + ('ggp-gogopool', 'avalanche_c', 'GGP', 0x69260B9483F9871ca57f81A90D91E2F96c2Cd11d, 18) ) as temp (token_id, blockchain, symbol, contract_address, decimals) diff --git a/dbt_subprojects/tokens/models/prices/corn/_schema.yml b/dbt_subprojects/tokens/models/prices/corn/_schema.yml new file mode 100644 index 00000000000..db32a0ff44c --- /dev/null +++ b/dbt_subprojects/tokens/models/prices/corn/_schema.yml @@ -0,0 +1,29 @@ +version: 2 + +models: + - name: prices_corn_tokens + meta: + blockchain: corn + sector: prices + contributors: hosuke + config: + tags: ['prices', 'tokens', 'usd', 'corn'] + description: "Price tokens on Corn EVM chain" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - contract_address + columns: + - name: token_id + description: "Id of the token at coinpaprika. This id is required to pull the price feed data. NOTE: Not all tokens are listed at coinpaprika - consider using price data from DEX sources in this case or submit a listing request at coinpaprika." + - name: blockchain + description: "Native blockchain of the token, if any" + data_tests: + - accepted_values: + values: [ "corn" ] + - name: contract_address + description: "Contract address of the token, if any" + - name: symbol + description: "Token symbol" + - name: decimals + description: "Number of decimals for the token contract" \ No newline at end of file diff --git a/dbt_subprojects/tokens/models/prices/corn/prices_corn_tokens.sql b/dbt_subprojects/tokens/models/prices/corn/prices_corn_tokens.sql new file mode 100644 index 00000000000..484e6758742 --- /dev/null +++ b/dbt_subprojects/tokens/models/prices/corn/prices_corn_tokens.sql @@ -0,0 +1,25 @@ +{% set blockchain = 'corn' %} + +{{ config( + schema = 'prices_' + blockchain, + alias = 'tokens', + materialized = 'table', + file_format = 'delta', + tags = ['static'] + ) +}} + +SELECT + token_id + , '{{ blockchain }}' as blockchain + , symbol + , contract_address + , decimals +FROM +( + VALUES + ('wbtc-wrapped-bitcoin', 'wBTCN', 0xda5ddd7270381a7c2717ad10d1c0ecb19e3cdfb2, 18) + , ('lbtc-lombard-staked-btc', 'LBTC', 0xecAc9C5F704e954931349Da37F60E39f515c11c1, 8) + , ('usdce-usd-coine', 'USDC.e', 0xDF0B24095e15044538866576754F3C964e902Ee6, 6) + , ('pumpbtc-pumpbtc', 'pumpBTC', 0xF469fBD2abcd6B9de8E169d128226C0Fc90a012e, 8) +) as temp (token_id, symbol, contract_address, decimals) diff --git a/dbt_subprojects/tokens/models/prices/ethereum/prices_ethereum_tokens.sql b/dbt_subprojects/tokens/models/prices/ethereum/prices_ethereum_tokens.sql index 61dafea3763..a324dbd2686 100644 --- a/dbt_subprojects/tokens/models/prices/ethereum/prices_ethereum_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/ethereum/prices_ethereum_tokens.sql @@ -1255,7 +1255,6 @@ FROM ('donk-donkey', 'ethereum', 'DONK', 0xe4f6d46c244bb7cf3e218cdfb5c35cf9a4d9c920, 18), ('evn-evolution-finance', 'ethereum', 'EVN', 0x9af15d7b8776fa296019979e70a5be53c714a7ec, 18), ('fair-fairgame', 'ethereum', 'FAIR', 0x9b20dabcec77f6289113e61893f7beefaeb1990a, 18), - ('gm-gm-token', 'ethereum', 'GM', 0xbc7250c8c3eca1dfc1728620af835fca489bfdf3, 9), ('gnft-gnft', 'ethereum', 'GNFT', 0xc502002aeb1b9309fccb016adf50507987fc6c2b, 18), ('happy-happyfans', 'ethereum', 'HAPPY', 0x3079f61704e9efa2bcf1db412f735d8d4cfa26f4, 18), ('hmt-human-protocol', 'ethereum', 'HMT', 0xd1ba9bac957322d6e8c07a160a3a8da11a0d2867, 18), @@ -1871,8 +1870,11 @@ FROM ('mstr-mstr2100', 'ethereum', 'MSTR', 0x42069026EAC8Eee0Fd9b5f7aDFa4f6E6D69a2B39, 9), ('usdl-lift-dollar', 'ethereum', 'USDL', 0xbdC7c08592Ee4aa51D06C27Ee23D5087D65aDbcD, 18), ('usr-resolv-usr', 'ethereum', 'USR', 0x66a1e37c9b0eaddca17d3662d6c05f4decf3e110, 18), - ('sovrn-sovrun','ethereum', 'SOVRN', 0x031B8d752d73d7Fe9678ACEf26e818280D0646b4, 18) -) as temp (token_id, blockchain, symbol, contract_address, decimals) + ('sovrn-sovrun','ethereum', 'SOVRN', 0x031B8d752d73d7Fe9678ACEf26e818280D0646b4, 18), + ('apw-spectra','ethereum', 'APW', 0x4104b135dbc9609fc1a9490e61369036497660c8, 18), + ('wagmi5-wagmi', 'ethereum', 'WAGMI', 0x92CC36D66e9d739D50673d1f27929a371FB83a67, 18), + ('deusd-elixir-deusd','ethereum', 'DEUSD', 0x15700b564ca08d9439c58ca5053166e8317aa138, 18) + ) as temp (token_id, blockchain, symbol, contract_address, decimals) where contract_address not in ( -- bad price feeds 0x841fb148863454a3b3570f515414759be9091465 -- SHIH @@ -1899,4 +1901,5 @@ where contract_address not in ( ,0xee06a81a695750e71a662b51066f2c74cf4478a0 -- DG, bad price feed ,0x9e24415d1e549ebc626a13a482bb117a2b43e9cf -- LOVELY, rugpull ,0xe9689028ede16c2fdfe3d11855d28f8e3fc452a3 -- BUBBLE, bad price feed + ,0xbc7250c8c3eca1dfc1728620af835fca489bfdf3 -- GM, bad price feed ) diff --git a/dbt_subprojects/tokens/models/prices/gnosis/prices_gnosis_tokens.sql b/dbt_subprojects/tokens/models/prices/gnosis/prices_gnosis_tokens.sql index 396bd2ca4bc..d3a7f540fef 100644 --- a/dbt_subprojects/tokens/models/prices/gnosis/prices_gnosis_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/gnosis/prices_gnosis_tokens.sql @@ -41,5 +41,7 @@ FROM ('giv-giv', 'gnosis', 'GIV', 0x4f4F9b8D5B4d0Dc10506e5551B0513B61fD59e75, 18), ('usdc-usd-coin', 'gnosis', 'USDC.e', 0x2a22f9c3b484c3629090feed35f17ff8f88f76f0, 6), ('ageur-ageur', 'gnosis', 'agEUR', 0x4b1e2c2762667331bc91648052f646d1b0d35984, 18), - ('brla-brla-digital-brla', 'gnosis', 'BRLA', 0xFECB3F7c54E2CAAE9dC6Ac9060A822D47E053760, 18) + ('brla-brla-digital-brla', 'gnosis', 'BRLA', 0xFECB3F7c54E2CAAE9dC6Ac9060A822D47E053760, 18), + ('gyd-gyro-dollar','gnosis','GYD',0xca5d8f8a8d49439357d3cf46ca2e720702f132b8, 18), + ('reth-rocket-pool-eth', 'gnosis', 'rETH', 0xc791240d1f2def5938e2031364ff4ed887133c3d, 18) ) as temp (token_id, blockchain, symbol, contract_address, decimals) diff --git a/dbt_subprojects/tokens/models/prices/ink/_schema.yml b/dbt_subprojects/tokens/models/prices/ink/_schema.yml new file mode 100644 index 00000000000..811bf9c0e2b --- /dev/null +++ b/dbt_subprojects/tokens/models/prices/ink/_schema.yml @@ -0,0 +1,29 @@ +version: 2 + +models: + - name: prices_ink_tokens + meta: + blockchain: ink + sector: prices + contributors: jeff-dude + config: + tags: ['prices', 'tokens', 'usd', 'ink'] + description: "Price tokens on ink EVM chain" + data_tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - contract_address + columns: + - name: token_id + description: "Id of the token at coinpaprika. This id is required to pull the price feed data. NOTE: Not all tokens are listed at coinpaprika - consider using price data from DEX sources in this case or submit a listing request at coinpaprika." + - name: blockchain + description: "Native blockchain of the token, if any" + data_tests: + - accepted_values: + values: [ "ink" ] + - name: contract_address + description: "Contract address of the token, if any" + - name: symbol + description: "Token symbol" + - name: decimals + description: "Number of decimals for the token contract" \ No newline at end of file diff --git a/dbt_subprojects/tokens/models/prices/ink/prices_ink_tokens.sql b/dbt_subprojects/tokens/models/prices/ink/prices_ink_tokens.sql new file mode 100644 index 00000000000..27d65a58b4a --- /dev/null +++ b/dbt_subprojects/tokens/models/prices/ink/prices_ink_tokens.sql @@ -0,0 +1,23 @@ +{% set blockchain = 'ink' %} + +{{ config( + schema = 'prices_' + blockchain, + alias = 'tokens', + materialized = 'table', + file_format = 'delta', + tags = ['static'] + ) +}} + +SELECT + token_id + , '{{ blockchain }}' as blockchain + , symbol + , contract_address + , decimals +FROM +( + VALUES + ('weth-weth', 'WETH', 0x4200000000000000000000000000000000000006, 18) + , ('usdc-usd-coin', 'USDC.e', 0xF1815bd50389c46847f0Bda824eC8da914045D14, 6) +) as temp (token_id, symbol, contract_address, decimals) \ No newline at end of file diff --git a/dbt_subprojects/tokens/models/prices/prices_tokens.sql b/dbt_subprojects/tokens/models/prices/prices_tokens.sql index 0f38cb25f82..877acf5f23e 100644 --- a/dbt_subprojects/tokens/models/prices/prices_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/prices_tokens.sql @@ -14,10 +14,12 @@ , "boba" , "cardano" , "celo" + , "corn" , "ethereum" , "fantom" , "flare" , "gnosis" + , "ink" , "kaia" , "linea" , "nova" @@ -27,6 +29,7 @@ , "scroll" , "sei" , "solana" + , "sonic" , "viction" , "worldchain" , "zksync" @@ -70,6 +73,9 @@ ref('prices_native_tokens') ,ref('prices_ronin_tokens') ,ref('prices_boba_tokens') ,ref('prices_viction_tokens') +,ref('prices_corn_tokens') +,ref('prices_sonic_tokens') +,ref('prices_ink_tokens') ] %} diff --git a/dbt_subprojects/tokens/models/prices/prices_trusted_tokens.sql b/dbt_subprojects/tokens/models/prices/prices_trusted_tokens.sql index cb20a76eda0..b9171d8de41 100644 --- a/dbt_subprojects/tokens/models/prices/prices_trusted_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/prices_trusted_tokens.sql @@ -61,6 +61,10 @@ WITH trusted_tokens AS ( , ('celo', 0xd629eb00deced2a080b7ec630ef6ac117e614f1b) , ('celo', 0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c) , ('celo', 0x48065fbbe25f71c9282ddf5e1cd6d6a887483d5e) + , ('corn', 0xda5ddd7270381a7c2717ad10d1c0ecb19e3cdfb2) -- WBTCN + , ('corn', 0xecac9c5f704e954931349da37f60e39f515c11c1) -- LBTC + , ('corn', 0xdf0b24095e15044538866576754f3c964e902ee6) -- USDC.e + , ('corn', 0xf469fbd2abcd6b9de8e169d128226c0fc90a012e) -- pumpBTC , ('ethereum', 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2) , ('ethereum', 0xdac17f958d2ee523a2206206994597c13d831ec7) , ('ethereum', 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48) @@ -85,6 +89,8 @@ WITH trusted_tokens AS ( , ('gnosis', 0x8e5bbbb09ed1ebde8674cda39a0c169401db4252) , ('gnosis', 0x44fa8e6f47987339850636f88629646662444217) , ('gnosis', 0xdd96b45877d0e8361a4ddb732da741e97f3191ff) + , ('ink', 0x4200000000000000000000000000000000000006) + , ('ink', 0xf1815bd50389c46847f0bda824ec8da914045d14) , ('kaia', 0x5c13e303a62fc5dedf5b52d66873f2e59fedadc2) , ('kaia', 0x608792deb376cce1c9fa4d0e6b7b44f507cffa6a) , ('kaia', 0x19aac5f612f524b754ca7e7c41cbfa2e981a4432) @@ -143,6 +149,12 @@ WITH trusted_tokens AS ( , ('solana', from_base58('mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So')) , ('solana', from_base58('Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB')) , ('solana', from_base58('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v')) + , ('sonic', 0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38) + , ('sonic', 0x29219dd400f2Bf60E5a23d13Be72B486D4038894) + , ('sonic', 0x50c42dEAcD8Fc9773493ED674b675bE577f2634b) + , ('sonic', 0xe715cba7b5ccb33790cebff1436809d36cb17e57) + , ('sonic', 0xd3DCe716f3eF535C5Ff8d041c1A41C3bd89b97aE) + , ('sonic', 0xe5da20f15420ad15de0fa650600afc998bbe3955) , ('worldchain', 0x2cFc85d8E48F8EAB294be644d9E25C3030863003) , ('worldchain', 0x79A02482A880bCE3F13e09Da970dC34db4CD24d1) , ('worldchain', 0x03C7054BCB39f7b2e5B2c7AcB37583e32D70Cfa3) @@ -198,4 +210,4 @@ UNION ALL SELECT * FROM - native_tokens \ No newline at end of file + native_tokens diff --git a/dbt_subprojects/tokens/models/prices/sonic/_schema.yml b/dbt_subprojects/tokens/models/prices/sonic/_schema.yml new file mode 100644 index 00000000000..de77489ffeb --- /dev/null +++ b/dbt_subprojects/tokens/models/prices/sonic/_schema.yml @@ -0,0 +1,24 @@ +version: 2 + +models: + - name: prices_sonic_tokens + meta: + blockchain: sonic + sector: tokens + contributors: hosuke + config: + tags: ['tokens', 'sonic', 'prices'] + description: "Token prices and metadata on Sonic" + columns: + - name: token_id + description: "Unique identifier for the token" + - name: blockchain + description: "Blockchain where the token is deployed" + - name: symbol + description: "Token symbol" + - name: contract_address + description: "Contract address of the token" + data_tests: + - unique + - name: decimals + description: "Number of decimal places for the token" \ No newline at end of file diff --git a/dbt_subprojects/tokens/models/prices/sonic/prices_sonic_tokens.sql b/dbt_subprojects/tokens/models/prices/sonic/prices_sonic_tokens.sql new file mode 100644 index 00000000000..6a15f52541d --- /dev/null +++ b/dbt_subprojects/tokens/models/prices/sonic/prices_sonic_tokens.sql @@ -0,0 +1,31 @@ +{% set blockchain = 'sonic' %} + +{{ config( + schema = 'prices_' + blockchain, + alias = 'tokens', + materialized = 'table', + file_format = 'delta', + tags = ['static'] + ) +}} + +SELECT + token_id + , '{{ blockchain }}' as blockchain + , symbol + , contract_address + , decimals +FROM +( + VALUES + ('ws-wrapped-sonic', 'wS', 0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38, 18) + , ('usdc-usd-coin', 'USDC.e', 0x29219dd400f2Bf60E5a23d13Be72B486D4038894, 6) + , ('weth-weth', 'WETH', 0x50c42dEAcD8Fc9773493ED674b675bE577f2634b, 18) + , ('euroc-euro-coin', 'EURC.e', 0xe715cba7b5ccb33790cebff1436809d36cb17e57, 6) + , ('beets-beethoven-x', 'BEETS', 0x2d0e0814e62d80056181f5cd932274405966e4f0, 18) + , ('goglz-goggles', 'GOGLZ', 0x9fDbC3f8Abc05Fa8f3Ad3C17D2F806c1230c4564, 18) + , ('fsonic-fantomsonicinu', 'FSONIC', 0x05e31a691405d06708A355C029599c12d5da8b28, 18) + , ('scusd-sonic-usd', 'scUSD', 0xd3DCe716f3eF535C5Ff8d041c1A41C3bd89b97aE, 6) + , ('sceth-sonic-eth', 'scETH', 0x3bce5cb273f0f148010bbea2470e7b5df84c7812, 18) + , ('sts-staked-sonic', 'stS', 0xe5da20f15420ad15de0fa650600afc998bbe3955, 18) +) as temp (token_id, symbol, contract_address, decimals) diff --git a/dbt_subprojects/tokens/models/prices/zksync/prices_zksync_tokens.sql b/dbt_subprojects/tokens/models/prices/zksync/prices_zksync_tokens.sql index 734c23a9279..4d3b378fa55 100644 --- a/dbt_subprojects/tokens/models/prices/zksync/prices_zksync_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/zksync/prices_zksync_tokens.sql @@ -58,7 +58,18 @@ FROM ('zkid-zksync-id', 'zksync', 'ZKID', 0x2141d7fe06A1d69c016fC638bA75b6Ef92Fa1435, 18), ('zk-zksync', 'zksync', 'ZK', 0x5A7d6b2F92C77FAD6CCaBd7EE0624E64907Eaf3E, 18), ('weeth-wrapped-eeth', 'zksync', 'weETH', 0xc1fa6e2e8667d9be0ca938a54c7e0285e9df924a, 18), - ('koi4-koi', 'zksync', 'KOI4', 0xa995ad25ce5eb76972ab356168f5e1d9257e4d05, 18), + ('koi4-koi', 'zksync', 'KOI', 0xa995ad25ce5eb76972ab356168f5e1d9257e4d05, 18), ('mvx-metavault-trade', 'zksync', 'MVX', 0xc8ac6191cdc9c7bf846ad6b52aaaa7a0757ee305, 18), - ('zf-zkswap-finance', 'zksync', 'ZF', 0x31c2c031fdc9d33e974f327ab0d9883eae06ca4a, 18) + ('zf-zkswap-finance', 'zksync', 'ZF', 0x31c2c031fdc9d33e974f327ab0d9883eae06ca4a, 18), + ('rseth-rseth', 'zksync', 'wrsETH', 0xd4169e045bcf9a86cc00101225d9ed61d2f51af2, 18), + ('usdc-usd-coin', 'zksync', 'USDC', 0x1d17cbcf0d6d143135ae902365d2e5e2a16538d4, 6), + ('usdm-mountain-protocol-usd', 'zksync', 'USDM', 0x7715c206a14ac93cb1a6c0316a6e5f8ad7c9dc31, 18), + ('usde-ethena-usde', 'zksync', 'USDe', 0x39Fe7a0DACcE31Bd90418e3e659fb0b5f0B3Db0d, 18), + ('susde-ethena-staked-usde', 'zksync', 'sUSDe', 0xAD17Da2f6Ac76746EF261E835C50b2651ce36DA8, 18), + ('ena-ethena', 'zksync', 'ENA', 0x686b311F82b407f0be842652a98e5619F64cC25F, 18), + ('m-btc-merlins-seal-btc', 'zksync', 'M-BTC', 0xe757355edba7ced7b8c0271bba4efda184ad75ab, 18), + ('bnb-binance-coin', 'zksync', 'BNB', 0x7400793aad94c8ca801aa036357d10f5fd0ce08f, 18), + ('xvs-venus', 'zksync', 'XVS', 0xd78abd81a3d57712a3af080dc4185b698fe9ac5a, 18), + ('usd-overnightfi-usd-arbitrum', 'zksync', 'USD+', 0x8e86e46278518efc1c5ced245cba2c7e3ef11557, 6), + ('vno-veno-finance', 'zksync', 'VNO', 0xe75a17b4f5c4f844688d5670b684515d7c785e63, 18) ) as temp (token_id, blockchain, symbol, contract_address, decimals) diff --git a/dbt_subprojects/tokens/models/tokens/_schema.yml b/dbt_subprojects/tokens/models/tokens/_schema.yml index 1969374b9ba..8886ef21ecb 100644 --- a/dbt_subprojects/tokens/models/tokens/_schema.yml +++ b/dbt_subprojects/tokens/models/tokens/_schema.yml @@ -3,11 +3,11 @@ version: 2 models: - name: tokens_erc20 meta: - blockchain: arbitrum, avalanche_c, bnb, ethereum, gnosis, mantle, optimism, fantom, polygon, base, blast, sepolia, sei, nova, worldchain, kaia, ronin, boba, flare, viction, sonic + blockchain: arbitrum, avalanche_c, bnb, ethereum, gnosis, mantle, optimism, fantom, polygon, base, blast, sepolia, sei, nova, worldchain, kaia, ronin, boba, flare, viction, sonic, ink sector: tokens contributors: hildobby, 0xManny, dot2dotseurat, soispoke, mtitus6, wuligy, angus_1, Henrystats, viniabussafi, jeff-dude, rantum, hosuke, irishlatte19 config: - tags: ['tokens','erc20', 'arbitrum', 'avalanche_c', 'bnb', 'ethereum', 'gnosis', 'mantle', 'optimism', 'fantom', 'base', 'blast', 'sei', 'nova', 'linea', 'worldchain', 'kaia', 'ronin', 'boba', 'flare', 'viction', 'sonic'] + tags: ['tokens','erc20', 'arbitrum', 'avalanche_c', 'bnb', 'ethereum', 'gnosis', 'mantle', 'optimism', 'fantom', 'base', 'blast', 'sei', 'nova', 'linea', 'worldchain', 'kaia', 'ronin', 'boba', 'flare', 'viction', 'sonic', 'ink'] description: > Crosschain ERC20 tokens diff --git a/dbt_subprojects/tokens/models/tokens/avalanche_c/tokens_avalanche_c_nft_curated.sql b/dbt_subprojects/tokens/models/tokens/avalanche_c/tokens_avalanche_c_nft_curated.sql index 46a751ad005..1fa443c8bea 100644 --- a/dbt_subprojects/tokens/models/tokens/avalanche_c/tokens_avalanche_c_nft_curated.sql +++ b/dbt_subprojects/tokens/models/tokens/avalanche_c/tokens_avalanche_c_nft_curated.sql @@ -9,6 +9,7 @@ SELECT contract_address, name, symbol FROM (VALUES + (0xaaaea1fb9f3de3f70e89f37b69ab11b47eb9ce6f, 'Voting Escrow Pharaoh', 'vePHAR'), (0x2b9328d83becd4f04de05f129ba56781fa191e67, 'Cattopya', 'CAT'), (0x34b4da1a0b06cfb09cb0efb46f02e667330e17db, 'Humping Unicorns', 'HUMP'), (0x47d42b18d54ee0b94b59c3e41dcac3260e995e48, 'Doggerinos Accessories', 'DOGACC'), diff --git a/dbt_subprojects/tokens/models/tokens/corn/schema.yml b/dbt_subprojects/tokens/models/tokens/corn/schema.yml new file mode 100644 index 00000000000..ae4fc75cb9d --- /dev/null +++ b/dbt_subprojects/tokens/models/tokens/corn/schema.yml @@ -0,0 +1,25 @@ +version: 2 + +models: + - name: tokens_corn_erc20 + meta: + blockchain: corn + sector: tokens + contributors: hosuke + config: + tags: ['tokens', 'corn', 'erc20'] + description: "Known CORN ERC20 tokens" + columns: + - name: contract_address + description: "Contract address of the ERC20 token" + data_tests: + - unique + - not_null + - name: symbol + description: "Symbol of the token" + data_tests: + - not_null + - name: decimals + description: "Number of decimals the token has" + data_tests: + - not_null diff --git a/dbt_subprojects/tokens/models/tokens/corn/tokens_corn_erc20.sql b/dbt_subprojects/tokens/models/tokens/corn/tokens_corn_erc20.sql new file mode 100644 index 00000000000..c9f598adb97 --- /dev/null +++ b/dbt_subprojects/tokens/models/tokens/corn/tokens_corn_erc20.sql @@ -0,0 +1,19 @@ +{{ + config( + schema = 'tokens_corn' + ,alias = 'erc20' + ,tags = ['static'] + ,materialized = 'table' + ) +}} + +SELECT + contract_address + , symbol + , decimals +FROM (VALUES + (0xda5ddd7270381a7c2717ad10d1c0ecb19e3cdfb2, 'wBTCN', 18) + , (0xecAc9C5F704e954931349Da37F60E39f515c11c1, 'LBTC', 8) + , (0xDF0B24095e15044538866576754F3C964e902Ee6, 'USDC.e', 6) + , (0xF469fBD2abcd6B9de8E169d128226C0Fc90a012e, 'pumpBTC', 8) +) as temp (contract_address, symbol, decimals) diff --git a/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql b/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql index 98fe7b101f0..a4be3f402d0 100644 --- a/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_erc20.sql @@ -4743,4 +4743,8 @@ FROM (VALUES , ( 0x2371e134e3455e0593363cbf89d3b6cf53740618, 'gtWETH', 18) , ( 0x5F9D59db355b4A60501544637b00e94082cA575b, 'waEthUSDe', 18) , ( 0x634Ed807647e07a7C038EF1956a58ADbc6695F88, 'shezUSD', 18) + , ( 0x7204b7dbf9412567835633b6f00c3edc3a8d6330, 'csUSDC', 18) + , ( 0xbeefc011e94f43b8b7b455ebab290c7ab4e216f1, 'csUSDL', 18) + , ( 0xc4441c2be5d8fa8126822b9929ca0b81ea0de38e, 'USUAL', 18) + , ( 0xC71Ea051a5F82c67ADcF634c36FFE6334793D24C, 'waEthLidoGHO', 18) ) AS temp_table (contract_address, symbol, decimals) diff --git a/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_rwa.sql b/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_rwa.sql index 8eefd5af2ed..a983fcca641 100644 --- a/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_rwa.sql +++ b/dbt_subprojects/tokens/models/tokens/ethereum/tokens_ethereum_rwa.sql @@ -30,7 +30,10 @@ FROM (VALUES ('ethereum', 0xe4A6f23Fb9e00Fca037Aa0EA0a6954dE0a6C53bF, 'Gold-backed', 'TXAU', 18, 'Aurus'), ('ethereum', 0x34ABce75D2f8f33940c721dCA0f562617787bfF3, 'Silver-backed', 'TXAG', 18, 'Aurus'), ('ethereum', 0x6d57B2E05F26C26b549231c866bdd39779e4a488, 'Gold-backed', 'VNXAU', 18, 'VNX'), - ('ethereum', 0x19b22DbADc298c359A1D1b59e35f352A2b40E33c, 'Platinum-backed', 'TXPT', 18, 'Aurus') + ('ethereum', 0x19b22DbADc298c359A1D1b59e35f352A2b40E33c, 'Platinum-backed', 'TXPT', 18, 'Aurus'), + ('ethereum', 0xC139190F447e929f090Edeb554D95AbB8b18aC1C, 'Treasury-backed', 'USDtb', 18, 'Ethena'), + ('ethereum', 0x35D8949372D46B7a3D5A56006AE77B215fc69bC0, 'Treasury-backed', 'USD0++', 18, 'Usual') + ) AS temp_table (blockchain, contract_address, backing, symbol, decimals, name) diff --git a/dbt_subprojects/tokens/models/tokens/gnosis/tokens_gnosis_erc20.sql b/dbt_subprojects/tokens/models/tokens/gnosis/tokens_gnosis_erc20.sql index 19ca6d3d2d7..effa93ed2bb 100644 --- a/dbt_subprojects/tokens/models/tokens/gnosis/tokens_gnosis_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/gnosis/tokens_gnosis_erc20.sql @@ -7825,4 +7825,5 @@ FROM (VALUES , ( 0x773cda0cade2a3d86e6d4e30699d40bb95174ff2, 'waGnowstETH', 18) , ( 0x57f664882f762fa37903fc864e2b633d384b411a, 'waGnoWETH', 18) , ( 0x51350d88c1bd32Cc6A79368c9Fb70373Fb71F375, 'waGNOUSDCe', 6) + , ( 0xa4d8bae4430cb084dcd9d82e938bce270b76bae5, 'CHT', 18) ) AS temp_table (contract_address, symbol, decimals) diff --git a/dbt_subprojects/tokens/models/tokens/ink/_schema.yml b/dbt_subprojects/tokens/models/tokens/ink/_schema.yml new file mode 100644 index 00000000000..291eb376ccd --- /dev/null +++ b/dbt_subprojects/tokens/models/tokens/ink/_schema.yml @@ -0,0 +1,21 @@ +version: 2 + +models: + - name: tokens_ink_erc20 + meta: + blockchain: ink + sector: tokens + project: erc20 + contributors: jeff-dude + config: + tags: ['table', 'erc20', 'ink'] + description: "ERC20 Token Addresses, Symbols and Decimals" + columns: + - name: contract_address + description: "ERC20 token contract address" + data_tests: + - unique + - name: symbol + description: "ERC20 token symbol" + - name: decimals + description: "Number of decimals, refers to how divisible an ERC20 token can be" diff --git a/dbt_subprojects/tokens/models/tokens/ink/tokens_ink_erc20.sql b/dbt_subprojects/tokens/models/tokens/ink/tokens_ink_erc20.sql new file mode 100644 index 00000000000..283fa19c6c4 --- /dev/null +++ b/dbt_subprojects/tokens/models/tokens/ink/tokens_ink_erc20.sql @@ -0,0 +1,20 @@ +{{ + config( + schema = 'tokens_ink' + ,alias = 'erc20' + ,tags = ['static'] + ,materialized = 'table' + ) +}} + +SELECT + contract_address + , symbol + , decimals +FROM (VALUES + (0x4200000000000000000000000000000000000006, 'WETH', 18) + , (0xf1815bd50389c46847f0bda824ec8da914045d14, 'USDC.e', 6) + , (0xca5f2ccbd9c40b32657df57c716de44237f80f05, 'KRAKEN', 18) + , (0x2e1ac42aef8dc9fb4c661d017273e93ba82d3d0e, 'IAGENT', 18) + , (0xbf0cafcbaaf0be8221ae8d630500984edc908861, 'SQUIDS', 18) +) AS temp_table (contract_address, symbol, decimals) \ No newline at end of file diff --git a/dbt_subprojects/tokens/models/tokens/sonic/tokens_sonic_erc20.sql b/dbt_subprojects/tokens/models/tokens/sonic/tokens_sonic_erc20.sql index 7b2fd6541a5..97f271392dc 100644 --- a/dbt_subprojects/tokens/models/tokens/sonic/tokens_sonic_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/sonic/tokens_sonic_erc20.sql @@ -12,8 +12,8 @@ SELECT , symbol , decimals FROM (VALUES - (0x309C92261178fA0CF748A855e90Ae73FDb79EBc7, 'WETH', 18) - , (0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38, 'WS', 18) + (0x50c42dEAcD8Fc9773493ED674b675bE577f2634b, 'WETH', 18) + , (0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38, 'wS', 18) , (0x29219dd400f2Bf60E5a23d13Be72B486D4038894, 'USDC.e', 6) , (0xe715cba7b5ccb33790cebff1436809d36cb17e57, 'EURC.e', 6) , (0xf2f9f482a395b4dd5b5b92173b7d62f3aff92884, 'DOG', 18) @@ -23,5 +23,23 @@ FROM (VALUES , (0x2030170901a9d87f6bd0ca9b8ad130119c7e1173, 'BABYSONIC', 9) , (0xe5da20f15420ad15de0fa650600afc998bbe3955, 'stS', 18) , (0xd4a5c68a1ed1fc2bb06cba2d90d6adeee7503671, 'HOOPS', 18) - + , (0x1e5fe95fb90ac0530f581c617272cd0864626795, 'BEETS', 18) + , (0xe17be928a08d66156ec242a68c4929b07cf14ccc, 'SCARTEL', 18) + , (0x309c92261178fa0cf748a855e90ae73fdb79ebc7, 'WETH', 18) + , (0x342781fd3d3f73bdb54b2dedd925f2ad81b48590, 'SPOOH', 18) + , (0xb5a10bd15af95381d830f71e85328f2d1d823de7, 'SPUB', 18) + , (0x71d634647a1aa323c1a0e6d9548ddaa6eb750e6e, 'SHOB', 18) + , (0x93cd403693da40d27188714a872943f717e3c543, 'SBEER', 18) + , (0x2d10a2e2d680564a942e98ee43e35553db990807, 'STEQILA', 18) + , (0x3854fd4712eb3a5aa51c949c29cace84f7ed2efc, 'Shilly', 18) + , (0x2d0e0814e62d80056181f5cd932274405966e4f0, 'BEETS', 18) + , (0xd3DCe716f3eF535C5Ff8d041c1A41C3bd89b97aE, 'scUSD', 6) + , (0x3bce5cb273f0f148010bbea2470e7b5df84c7812, 'scETH', 18) + , (0xddf26b42c1d903de8962d3f79a74a501420d5f19, 'EQUAL', 18) + , (0x313636D4f23859142b523a7965B76F6e3965Af64, 'SonicSwap', 18) + , (0x4eec869d847a6d13b0f6d1733c5dec0d1e741b4f, 'INDI', 18) + , (0x4D85bA8c3918359c78Ed09581E5bc7578ba932ba, 'stkscUSD', 6) + , (0x455d5f11Fea33A8fa9D3e285930b478B6bF85265, 'stkscETH', 18) + , (0x541FD749419CA806a8bc7da8ac23D346f2dF8B77, 'SolvBTC', 18) + , (0xCC0966D8418d412c599A6421b760a847eB169A8c, 'solvBTC.bbn', 18) ) as temp (contract_address, symbol, decimals) diff --git a/dbt_subprojects/tokens/models/tokens/tokens_erc20.sql b/dbt_subprojects/tokens/models/tokens/tokens_erc20.sql index e8854fb8cca..55f31bda1d7 100644 --- a/dbt_subprojects/tokens/models/tokens/tokens_erc20.sql +++ b/dbt_subprojects/tokens/models/tokens/tokens_erc20.sql @@ -12,11 +12,13 @@ ,"bnb" ,"boba" ,"celo" + ,"corn" ,"ethereum" ,"fantom" ,"fuse" ,"gnosis" ,"goerli" + ,"ink" ,"kaia" ,"linea" ,"mantle" @@ -77,6 +79,8 @@ ,'tokens_boba': {'blockchain': 'boba', 'model': ref('tokens_boba_erc20')} ,'tokens_viction': {'blockchain': 'viction', 'model': ref('tokens_viction_erc20')} ,'tokens_sonic': {'blockchain': 'sonic', 'model': ref('tokens_sonic_erc20')} + ,'tokens_corn': {'blockchain': 'corn', 'model': ref('tokens_corn_erc20')} + ,'tokens_ink': {'blockchain': 'ink', 'model': ref('tokens_ink_erc20')} } %} with automated_source as ( diff --git a/docs/general/faq_and_common_issues.md b/docs/general/faq_and_common_issues.md index 428e876d6d3..8e20a8e4083 100644 --- a/docs/general/faq_and_common_issues.md +++ b/docs/general/faq_and_common_issues.md @@ -3,7 +3,7 @@ - Why is my PR running more models than included in the CI test runs? - Steps within the CI test workflow depend on DBT manifest file to be up-to-date on the main branch - When other PRs are merged, main is updated, therefore a new manifest file needs uploaded to storage for CI to read - - The GH workflow to do this lives here: https://github.com/duneanalytics/spellbook/actions/workflows/commit_manifest.yml + - The GH workflow to do this lives [here](https://github.com/duneanalytics/spellbook/actions/workflows/commit_manifest.yml) - If the latest run failed and/or is in progress, then it’s possible manifest files are out of date and your PR will run more than it should - Wait for it to complete or Dune team to fix any failures - I’m modifying an existing spell within my PR that contains a seed test on it via the schema YML file. CI is failing on the seed test, as it can’t find the seed. How do I get around this? @@ -14,4 +14,4 @@ - In order to get around this, force a change on the associated seed file and bring into PR to rebuild, then CI will be able to find in the test section - I submitted a PR to add a new token to `prices.usd`, but it's still not showing up? Why is that? - new price additions can take a few days, as the backend process needs to acknowledge the new API ID value provided & backfill historical pricing data - - please check back in a few days to see the new data populated \ No newline at end of file + - please check back in a few days to see the new data populated diff --git a/sources/_base_sources/evm/corn_base_sources.yml b/sources/_base_sources/evm/corn_base_sources.yml new file mode 100644 index 00000000000..526d09da75f --- /dev/null +++ b/sources/_base_sources/evm/corn_base_sources.yml @@ -0,0 +1,429 @@ +version: 2 + +sources: + # Corn Tables + - name: corn + description: "raw tables for the chain" + + tables: + - name: transactions + meta: + docs_slug: /evm/corn/raw/transactions + short_description: The transactions table contains detailed information about transactions on the network. + description: '{{ doc("corn_transactions_doc") }}' + columns: + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: value + description: "Amount of BTCN sent from sender to recipient (if any), measured in wei (1 BTCN = 10^18 wei)" + - name: gas_limit + description: "Maximum number of gas units this transaction can consume" + - name: gas_price + description: "Price per unit of gas for this transaction, denominated in wei" + - name: gas_used + description: "Actual amount of gas units consumed by this transaction's execution" + - name: max_fee_per_gas + description: "Maximum total amount per gas unit the initiator is willing to pay" + - name: max_priority_fee_per_gas + description: "Maximum additional fee per gas unit the initiator is willing to pay as a tip to validators" + - name: priority_fee_per_gas + description: "Actual priority fee per gas paid to validators" + - name: nonce + description: "Sequential number representing the count of transactions sent from the sender's address" + - name: index + description: "Position of this transaction within its containing block" + - name: success + description: "Boolean flag indicating whether the transaction executed successfully (true) or failed (false)" + - name: from + description: "Address of the account that initiated and signed this transaction" + - name: to + description: "Address of the recipient account or contract for this transaction" + - name: block_hash + description: "Unique 256-bit identifier (hash) of the block containing this transaction" + - name: data + description: "Input data for the transaction, which may include function calls or contract interaction data" + - name: hash + description: "Unique 256-bit identifier (hash) of this specific transaction" + - name: type + description: "Type of transaction (e.g., legacy, EIP-1559) indicating its structure and fee mechanism" + - name: access_list + description: "List of addresses and storage keys the transaction plans to access, used for gas optimization in EIP-2930 transactions" + - name: chain_id + description: "Chain identifier for the network" + - name: block_date + description: "The UTC date of the block in which this transaction was included" + + - name: traces + meta: + docs_slug: /evm/corn/raw/traces + short_description: The traces table contains information about traces on the network. + description: '{{ doc("corn_traces_doc") }}' + columns: + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: value + description: "Amount of BTCN sent from sender to recipient (if any), measured in wei (1 BTCN = 10^18 wei)" + - name: gas + description: "Amount of gas allocated for this trace's execution (including gas used by child traces)" + - name: gas_used + description: "Actual amount of gas consumed by this trace's execution" + - name: block_hash + description: "Unique 256-bit identifier (hash) of the block containing this transaction" + - name: success + description: "Boolean flag indicating whether this specific trace was executed successfully (true) or reverted (false)" + - name: tx_index + description: "Position of the parent transaction within its containing block" + - name: tx_from + description: "Address that initiated the parent transaction" + - name: tx_to + description: "Recipient address of the parent transaction" + - name: sub_traces + description: "Number of child traces spawned by this trace during execution" + - name: error + description: "Error message or code if the trace execution failed" + - name: tx_success + description: "Boolean flag indicating whether the parent transaction of this trace was successful" + - name: tx_hash + description: "Unique 256-bit identifier (hash) of the parent transaction" + - name: from + description: "Address that sent this trace" + - name: to + description: "Address that received this trace" + - name: trace_address + description: "Array indicating the exact position of this trace within the trace tree" + - name: type + description: "Type of trace (e.g., call, create, suicide) indicating the nature of the operation" + - name: address + description: "If this trace is a contract creation, this is the address of the deployed contract" + - name: code + description: "If this trace is a contract creation, this is the deployed bytecode of contract" + - name: call_type + description: "Type of call made in this trace (e.g., call, delegatecall, staticcall)" + - name: input + description: "Call data provided to this trace, often containing function signatures and parameters" + - name: output + description: "Data returned by this trace after execution" + - name: refund_address + description: "Address designated to receive any gas refund from this trace" + - name: revert_reason + description: "Reason for reversion if the trace was reverted" + - name: block_date + description: "The UTC date of the block in which this transaction was included" + + - name: traces_decoded + meta: + docs_slug: /evm/corn/decoded/traces_decoded + short_description: The `corn.traces_decoded` table contains decoded traces, including additional information based on submitted smart contracts and their ABIs. + description: '{{ doc("corn_traces_decoded_doc") }}' + columns: + - name: block_date + description: "The UTC date of the block in which this transaction was included" + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: namespace + description: "Categorical grouping or project name associated with the contract" + - name: contract_name + description: "Human-readable name of the smart contract involved in this trace" + - name: to + description: "Address of the contract or account receiving this trace" + - name: trace_address + description: "Array indicating the exact position of this trace within the trace tree of the transaction" + - name: tx_hash + description: "Unique 256-bit identifier (hash) of the parent transaction" + - name: tx_from + description: "Address that initiated the parent transaction" + - name: tx_to + description: "Recipient address of the parent transaction" + - name: signature + description: "Function signature hash" + - name: function_name + description: "Name of the specific contract function called in this trace" + + - name: logs + meta: + docs_slug: /evm/corn/raw/logs + short_description: The `corn.logs` table contains information about event logs emitted by smart contracts on the corn blockchain. + description: '{{ doc("corn_logs_doc") }}' + columns: + - name: block_date + description: "The UTC date of the block in which this transaction was included" + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: block_hash + description: "Unique 256-bit identifier (hash) of the block containing this transaction" + - name: tx_index + description: "Position of the parent transaction within its containing block" + - name: tx_hash + description: "Unique 256-bit identifier (hash) of the parent transaction" + - name: contract_address + description: "Address of the smart contract that emitted this log" + - name: topic0 + description: "First 32-byte topic, typically containing the event signature hash" + - name: topic1 + description: "Second 32-byte topic, often containing indexed event parameters" + - name: topic2 + description: "Third 32-byte topic, often containing indexed event parameters" + - name: topic3 + description: "Fourth 32-byte topic, often containing indexed event parameters" + - name: data + description: "ABI-encoded data of the log, containing non-indexed event parameters" + - name: index + description: "Position of this log within the block" + - name: tx_from + description: "Address that initiated the transaction which created this log" + - name: tx_to + description: "Recipient address of the transaction which created this log" + + - name: logs_decoded + meta: + docs_slug: /evm/corn/decoded/logs_decoded + short_description: The `corn.logs_decoded` table contains a subset of all logs for which Dune has the ABI. + description: '{{ doc("corn_logs_decoded_doc") }}' + columns: + - name: block_date + description: "The UTC date of the block in which this transaction was included" + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: namespace + description: "Categorical grouping or project name associated with the contract" + - name: contract_name + description: "Human-readable name of the smart contract" + - name: contract_address + description: "Address of the smart contract that emitted this log" + - name: tx_hash + description: "Unique 256-bit identifier (hash) of the parent transaction" + - name: tx_from + description: "Address that initiated the transaction which created this log" + - name: tx_to + description: "Recipient address of the transaction which created this log" + - name: index + description: "Position of this log within the block" + - name: signature + description: "Event signature hash" + - name: event_name + description: "Human-readable name of the event" + + - name: contracts + meta: + docs_slug: /evm/corn/raw/contracts + short_description: The `corn.contracts` table tracks decoded contracts on corn, including associated metadata such as namespace, name, address, ABI. It is populated manually by the Dune Community via [contract decoding submissions](https://dune.com/contracts/new). + description: '{{ doc("corn_contracts_doc") }}' + columns: + - name: address + description: "Unique address of the contract on the blockchain" + - name: bytecode + description: "Compiled bytecode of the contract" + - name: name + description: "Human-readable name of the contract" + - name: namespace + description: "Project or protocol name associated with the contract" + - name: abi + description: "JSON representation of the contract's Application Binary Interface" + - name: created_at + description: "Timestamp when this contract entry was created in the table" + + - name: contracts_submitted + meta: + docs_slug: /evm/corn/decoded/contracts_submitted + short_description: The `corn.contracts_submitted` table contains information about contracts submitted for decoding. + description: '{{ doc("corn_contracts_submitted_doc") }}' + columns: + - name: address + description: "Address of the submitted contract" + - name: namespace + description: "Project or protocol name associated with the contract" + - name: name + description: "Name of the submitted contract" + - name: submitted_at + description: "Timestamp when the contract was submitted for decoding" + - name: submitted_by + description: "Address or identifier of the user who submitted the contract" + + - name: creation_traces + meta: + docs_slug: /evm/corn/raw/creation_traces + short_description: The `corn.creation_traces` table contains information about contract creation traces. + description: '{{ doc("corn_creation_traces_doc") }}' + columns: + - name: block_date + description: "The UTC date of the block in which this transaction was included" + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: tx_hash + description: "Unique 256-bit identifier (hash) of the parent transaction" + - name: address + description: "Address of the created contract" + - name: from + description: "Address that created the contract" + - name: code + description: "Contract bytecode" + - name: success + description: "Whether the contract creation was successful" + - name: block_month + description: "The month of the block date" + + - name: blocks + meta: + docs_slug: /evm/corn/raw/blocks + short_description: The `corn.blocks` table contains information about blocks on the corn blockchain. + description: '{{ doc("corn_blocks_doc") }}' + columns: + - name: block_date + description: "The UTC date of the block in which this transaction was included" + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: block_hash + description: "Unique 256-bit identifier (hash) of the block containing this transaction" + - name: parent_hash + description: "Hash of the parent block" + - name: nonce + description: "Block nonce value" + - name: difficulty + description: "Block mining difficulty" + - name: gas_limit + description: "Maximum gas allowed in this block" + - name: gas_used + description: "Total gas used by all transactions in this block" + - name: miner + description: "Address of the miner/validator who produced this block" + - name: size + description: "Size of the block in bytes" + - name: total_difficulty + description: "Total chain difficulty up to this block" + - name: base_fee_per_gas + description: "Base fee per gas in this block (EIP-1559)" + - name: state_root + description: "Root hash of the state trie after this block" + - name: transactions_root + description: "Root hash of the transactions trie of this block" + - name: receipts_root + description: "Root hash of the receipts trie of this block" + - name: blob_gas_used + description: "Total blob gas used in this block" + - name: excess_blob_gas + description: "Excess blob gas in this block" + - name: parent_beacon_block_root + description: "Root hash of the parent beacon block" + + - name: erc20_corn + description: "Transfer events for ERC20 tokens on Corn blockchain" + tables: + - name: evt_transfer + meta: + docs_slug: /evm/corn/raw/erc20_transfers + short_description: The evt_transfer table contains all ERC20 token transfer events on the Corn blockchain. + description: '{{ doc("erc20_corn_evt_transfer_doc") }}' + columns: + - name: contract_address + description: "The address of the ERC20 token contract" + - name: from + description: "The address sending the tokens" + - name: to + description: "The address receiving the tokens" + - name: value + description: "The amount of tokens transferred" + - name: evt_tx_hash + description: "The transaction hash of the transfer event" + - name: evt_index + description: "The index of this event within the transaction" + - name: evt_block_time + description: "The timestamp of the block containing this transfer" + - name: evt_block_number + description: "The block number containing this transfer" + + - name: erc721_corn + description: "Transfer events for ERC721 tokens on Corn blockchain" + tables: + - name: evt_transfer + meta: + docs_slug: /evm/corn/raw/erc721_transfers + short_description: The evt_transfer table contains all ERC721 token transfer events on the Corn blockchain. + description: '{{ doc("erc721_corn_evt_transfer_doc") }}' + columns: + - name: contract_address + description: "The address of the ERC721 token contract" + - name: from + description: "The address sending the NFT" + - name: to + description: "The address receiving the NFT" + - name: tokenId + description: "The unique identifier of the NFT being transferred" + - name: evt_tx_hash + description: "The transaction hash of the transfer event" + - name: evt_index + description: "The index of this event within the transaction" + - name: evt_block_time + description: "The timestamp of the block containing this transfer" + - name: evt_block_number + description: "The block number containing this transfer" + + - name: erc1155_corn + description: "Transfer events for ERC1155 tokens on Corn blockchain" + tables: + - name: evt_transfersingle + meta: + docs_slug: /evm/corn/raw/erc1155_transfers_single + short_description: The evt_transfersingle table contains single token transfer events from ERC1155 contracts on the Corn blockchain. + description: '{{ doc("erc1155_corn_evt_transfer_doc") }}' + columns: + - name: contract_address + description: "The address of the ERC1155 token contract" + - name: operator + description: "The address authorized to make the transfer" + - name: from + description: "The address sending the tokens" + - name: to + description: "The address receiving the tokens" + - name: id + description: "The identifier for the token being transferred" + - name: value + description: "The amount of tokens being transferred" + - name: evt_tx_hash + description: "The transaction hash of the transfer event" + - name: evt_index + description: "The index of this event within the transaction" + - name: evt_block_time + description: "The timestamp of the block containing this transfer" + - name: evt_block_number + description: "The block number containing this transfer" + + - name: evt_transferbatch + meta: + docs_slug: /evm/corn/raw/erc1155_transfers_batch + short_description: The evt_transferbatch table contains batch token transfer events from ERC1155 contracts on the Corn blockchain. + description: '{{ doc("erc1155_corn_evt_transfer_doc") }}' + columns: + - name: contract_address + description: "The address of the ERC1155 token contract" + - name: operator + description: "The address authorized to make the transfer" + - name: from + description: "The address sending the tokens" + - name: to + description: "The address receiving the tokens" + - name: ids + description: "The array of token identifiers being transferred" + - name: values + description: "The array of amounts being transferred for each token id" + - name: evt_tx_hash + description: "The transaction hash of the transfer event" + - name: evt_index + description: "The index of this event within the transaction" + - name: evt_block_time + description: "The timestamp of the block containing this transfer" + - name: evt_block_number + description: "The block number containing this transfer" diff --git a/sources/_base_sources/evm/corn_docs_block.md b/sources/_base_sources/evm/corn_docs_block.md new file mode 100644 index 00000000000..a78e8b71ad4 --- /dev/null +++ b/sources/_base_sources/evm/corn_docs_block.md @@ -0,0 +1,203 @@ +{% docs corn_transactions_doc %} + +The `corn.transactions` table contains detailed information about transactions on the Corn blockchain. It includes: + +- Block information: number, timestamp, hash +- Transaction details: hash, from_address, to_address, value +- Gas data: gas_price, gas_limit, gas_used, max_fee_per_gas, priority_fee_per_gas +- Status: success or failure +- Input data for contract interactions +- Nonce and chain_id +- Transaction type and access list + +This table is used for analyzing transaction patterns, gas usage, value transfers, and overall network activity on Corn. + +{% enddocs %} + +{% docs corn_traces_doc %} + +The `corn.traces` table contains records of execution steps for transactions on the Corn blockchain. Each trace represents an atomic operation that modifies the state of the Ethereum Virtual Machine (EVM). Key components include: + +- Transaction hash and block information +- From and to addresses +- Value transferred +- Gas metrics (gas, gas_used) +- Input and output data +- Call type (e.g., CALL, DELEGATECALL, CREATE) +- Error information and revert reasons +- Trace address for nested calls +- Sub-traces count + +This table is essential for: +- Analyzing internal transactions +- Debugging smart contract interactions +- Tracking value flows through complex transactions +- Understanding contract creation and deployment + +{% enddocs %} + +{% docs corn_traces_decoded_doc %} + +The `corn.traces_decoded` table contains a subset of decoded traces from the Corn blockchain dependent on submitted smart contracts and their ABIs. It includes: + +- Block information and transaction details +- Contract name and namespace +- Decoded function names and signatures +- Trace address for execution path tracking +- Transaction origin and destination + +This table is used for high level analysis of smart contract interactions. For fully decoded function calls and parameters, refer to protocol-specific decoded tables. + +{% enddocs %} + +{% docs corn_logs_doc %} + +The `corn.logs` table contains event logs emitted by smart contracts on the Corn blockchain. It includes: + +- Block information: number, timestamp, hash +- Transaction details: hash, index, from, to +- Contract address (emitting the event) +- Topic0 (event signature) +- Additional topics (indexed parameters) +- Data field (non-indexed parameters) +- Log index and transaction index + +This table is crucial for: +- Tracking on-chain events +- Monitoring contract activity +- Analyzing token transfers +- Following protocol-specific events + +{% enddocs %} + +{% docs corn_logs_decoded_doc %} + +The `corn.logs_decoded` table contains a subset of decoded logs from the Corn blockchain dependent on submitted smart contracts and their ABIs. It includes: + +- Block and transaction information +- Contract details (name, namespace, address) +- Decoded event names and signatures +- Transaction origin and destination +- Event parameters (when available) + +This table is used for high level analysis of smart contract events. For fully decoded events and parameters, refer to protocol-specific decoded tables. + +{% enddocs %} + +{% docs corn_blocks_doc %} + +The `corn.blocks` table contains information about Corn blocks. It provides essential data about each block in the Corn blockchain, including: + +- Block identifiers and timestamps +- Gas metrics and size +- Consensus information (difficulty, nonce) +- State roots and receipts +- Parent block information +- Blob gas information +- Parent beacon block root + +This table is used for analyzing block production, network capacity, and chain state. + +{% enddocs %} + +{% docs corn_contracts_doc %} + +The `corn.contracts` table contains information about verified smart contracts on the Corn blockchain. It includes: + +- Contract address +- Contract bytecode +- Contract name and namespace +- Contract ABI +- Creation timestamp + +This table is used for contract verification and analysis. + +{% enddocs %} + +{% docs corn_contracts_submitted_doc %} + +The `corn.contracts_submitted` table tracks contracts submitted for decoding on the Corn blockchain. It includes: + +- Contract address +- Contract name and namespace +- Submission details (timestamp, submitter) + +This table is used for managing contract submissions and decoding status. + +{% enddocs %} + +{% docs corn_creation_traces_doc %} + +The `corn.creation_traces` table contains information about contract creation events on the Corn blockchain. It includes: + +- Block and transaction information +- Creator address +- Created contract address +- Contract bytecode +- Creation success status +- Gas consumption + +This table is used for: +- Analyzing contract deployment patterns +- Tracking new contract deployments +- Understanding contract creation success rates + +{% enddocs %} + +{% docs erc20_corn_evt_transfer_doc %} + +The `erc20_corn.evt_transfer` table contains Transfer events from ERC20 token contracts on the Corn blockchain. Each record represents a token transfer and includes: + +- Token contract address +- Sender and recipient addresses +- Amount of tokens transferred +- Block and transaction information +- Event log details + +This table is essential for: +- Tracking token transfers and holder activity +- Analyzing token distribution patterns +- Monitoring token holder behavior +- Calculating token balances +- Understanding token velocity and liquidity + +{% enddocs %} + +{% docs erc721_corn_evt_transfer_doc %} + +The `erc721_corn.evt_transfer` table contains Transfer events from ERC721 (NFT) token contracts on the Corn blockchain. Each record represents an NFT transfer and includes: + +- NFT contract address +- Token ID +- Sender and recipient addresses +- Block and transaction information +- Event log details + +This table is used for: +- Tracking NFT ownership changes +- Analyzing NFT trading patterns +- Monitoring NFT collection activity +- Building NFT holder histories +- Understanding NFT market dynamics + +{% enddocs %} + +{% docs erc1155_corn_evt_transfer_doc %} + +The `erc1155_corn.evt_transfersingle` and `erc1155_corn.evt_transferbatch` tables contain Transfer events from ERC1155 token contracts on the Corn blockchain. These tables track both fungible and non-fungible token transfers within the same contract. They include: + +- Token contract address +- Token IDs +- Amounts transferred +- Sender, operator, and recipient addresses +- Block and transaction information +- Event log details + +These tables are essential for: +- Tracking multi-token transfers +- Analyzing gaming asset movements +- Monitoring hybrid token systems +- Understanding complex token ecosystems +- Building token holder analytics + +{% enddocs %} diff --git a/sources/_base_sources/evm/ink_base_sources.yml b/sources/_base_sources/evm/ink_base_sources.yml new file mode 100644 index 00000000000..0318a43f675 --- /dev/null +++ b/sources/_base_sources/evm/ink_base_sources.yml @@ -0,0 +1,513 @@ +version: 2 + +sources: + # Ink Tables + - name: ink + description: "Ink is a Layer 2 (L2) blockchain developed by Kraken to connect users to decentralized finance (DeFi). It's built on Optimism's Superchain, which is a network of L2 blockchains that share security, governance, and other resources." + + tables: + - name: transactions + meta: + docs_slug: /evm/ink/raw/transactions + short_description: The transactions table contains detailed information about transactions on the Ink network. + description: '{{ doc("ink_transactions_doc") }}' + + columns: + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: value + description: "Amount of native tokens transferred in this transaction" + - name: gas_limit + description: "Maximum amount of gas units that this transaction can consume" + - name: gas_price + description: "Price per unit of gas for this transaction" + - name: gas_used + description: "Actual amount of gas units consumed by this transaction's execution" + - name: max_fee_per_gas + description: "Maximum total fee per gas the sender is willing to pay (base fee + priority fee)" + - name: max_priority_fee_per_gas + description: "Maximum additional fee per gas the sender is willing to pay to validators" + - name: priority_fee_per_gas + description: "Actual priority fee per gas paid to validators" + - name: nonce + description: "Sequential number representing the count of transactions sent from the sender's address" + - name: index + description: "Position of this transaction within its containing block" + - name: success + description: "Boolean indicating whether the transaction executed successfully" + - name: from + description: "Address that initiated and signed this transaction" + - name: to + description: "Recipient address of this transaction" + - name: block_hash + description: "Hash of the block containing this transaction" + - name: data + description: "Input data of the transaction, containing function calls or contract interaction data" + - name: hash + description: "Unique hash identifier of this transaction" + - name: type + description: "Transaction type (e.g., legacy, EIP-1559, EIP-2930)" + - name: access_list + description: "List of addresses and storage keys the transaction plans to access (EIP-2930)" + - name: chain_id + description: "Identifier of the blockchain network" + - name: block_date + description: "The UTC date of the block containing this transaction" + - name: traces + meta: + docs_slug: /evm/ink/raw/traces + short_description: The traces table contains detailed execution traces of transactions. + description: '{{ doc("ink_traces_doc") }}' + columns: + - name: block_time + description: "The exact UTC timestamp when the block containing this trace was added to the chain" + - name: block_number + description: "The sequential number of the block containing this trace" + - name: value + description: "Amount of native tokens transferred in this trace" + - name: gas + description: "Amount of gas allocated for this trace's execution" + - name: gas_used + description: "Actual amount of gas consumed by this trace" + - name: block_hash + description: "Hash of the block containing this trace" + - name: success + description: "Boolean indicating whether this trace executed successfully" + - name: tx_index + description: "Index position of the parent transaction in the block" + - name: tx_from + description: "Address that initiated the parent transaction" + - name: tx_to + description: "Recipient address of the parent transaction" + - name: sub_traces + description: "Number of child traces spawned by this trace" + - name: error + description: "Error message if the trace execution failed" + - name: tx_success + description: "Boolean indicating whether the parent transaction was successful" + - name: tx_hash + description: "Hash of the parent transaction" + - name: from + description: "Address that initiated this trace" + - name: to + description: "Recipient address of this trace" + - name: trace_address + description: "Array indicating the position of this trace in the trace tree" + - name: type + description: "Type of trace (call, create, suicide, etc.)" + - name: address + description: "Address of the contract if this is a contract creation trace" + - name: code + description: "Contract bytecode if this is a contract creation trace" + - name: call_type + description: "Type of call (call, delegatecall, staticcall)" + - name: input + description: "Input data provided to this trace" + - name: output + description: "Output data returned by this trace" + - name: refund_address + description: "Address to receive any gas refund" + - name: revert_reason + description: "Reason for reversion if the trace was reverted" + - name: block_date + description: "The UTC date of the block containing this trace" + + - name: traces_decoded + meta: + docs_slug: /evm/ink/decoded/traces_decoded + short_description: The traces_decoded table contains decoded traces with additional information based on contract ABIs. + description: '{{ doc("ink_traces_decoded_doc") }}' + columns: + - name: block_date + description: "The UTC date of the block containing this trace" + - name: block_time + description: "The exact UTC timestamp when the block containing this trace was added to the chain" + - name: block_number + description: "The sequential number of the block containing this trace" + - name: namespace + description: "Categorical grouping or project name associated with the contract" + - name: contract_name + description: "Human-readable name of the smart contract involved in this trace" + - name: to + description: "Address of the contract receiving this trace" + - name: trace_address + description: "Array indicating the position of this trace in the trace tree" + - name: tx_hash + description: "Hash of the parent transaction" + - name: tx_from + description: "Address that initiated the parent transaction" + - name: tx_to + description: "Recipient address of the parent transaction" + - name: signature + description: "Function signature hash" + - name: function_name + description: "Human-readable name of the called function" + + - name: logs + meta: + docs_slug: /evm/ink/raw/logs + short_description: The logs table contains event logs emitted by smart contracts on the ink blockchain. + description: '{{ doc("ink_logs_doc") }}' + columns: + - name: block_date + description: "The UTC date of the block in which this transaction was included" + - name: block_time + description: "The exact UTC timestamp when the block containing this transaction was added to the chain" + - name: block_number + description: "The sequential number of the block containing this transaction" + - name: block_hash + description: "Unique 256-bit identifier (hash) of the block containing this transaction" + - name: tx_index + description: "Position of the parent transaction within its containing block" + - name: tx_hash + description: "Unique 256-bit identifier (hash) of the parent transaction" + - name: contract_address + description: "Address of the smart contract that emitted this log" + - name: topic0 + description: "First 32-byte topic, typically containing the event signature hash" + - name: topic1 + description: "Second 32-byte topic, often containing indexed event parameters" + - name: topic2 + description: "Third 32-byte topic, often containing indexed event parameters" + - name: topic3 + description: "Fourth 32-byte topic, often containing indexed event parameters" + - name: data + description: "ABI-encoded data of the log, containing non-indexed event parameters" + - name: index + description: "Position of this log within the block" + - name: tx_from + description: "Address that initiated the transaction which created this log" + - name: tx_to + description: "Recipient address of the transaction which created this log" + + - name: logs_decoded + meta: + docs_slug: /evm/ink/decoded/logs_decoded + short_description: The logs_decoded table contains decoded event logs with additional information based on contract ABIs. + description: '{{ doc("ink_logs_decoded_doc") }}' + columns: + - name: block_date + description: "The UTC date of the block containing this log" + - name: block_time + description: "The exact UTC timestamp when the block containing this log was added to the chain" + - name: block_number + description: "The sequential number of the block containing this log" + - name: namespace + description: "Categorical grouping or project name associated with the contract" + - name: contract_name + description: "Human-readable name of the smart contract that emitted this event" + - name: contract_address + description: "Address of the contract that emitted this event" + - name: tx_hash + description: "Hash of the transaction that generated this event" + - name: tx_from + description: "Address that initiated the transaction" + - name: tx_to + description: "Recipient address of the transaction" + - name: index + description: "Index position of the log in the block" + - name: signature + description: "Event signature hash" + - name: event_name + description: "Human-readable name of the emitted event" + + - name: contracts + meta: + docs_slug: /evm/ink/raw/contracts + short_description: The contracts table tracks decoded contracts on ink, including associated metadata such as namespace, name, address, ABI. It is populated manually by the Dune Community via [contract decoding submissions](https://dune.com/contracts/new). + description: '{{ doc("ink_contracts_doc") }}' + columns: + - name: address + description: "Unique address of the contract on the blockchain" + - name: bytecode + description: "Compiled bytecode of the contract" + - name: name + description: "Human-readable name of the contract" + - name: namespace + description: "Project or protocol name associated with the contract" + - name: abi + description: "JSON representation of the contract's Application Binary Interface" + - name: created_at + description: "Timestamp when this contract entry was created in the table" + + - name: contracts_submitted + meta: + docs_slug: /evm/ink/decoded/contracts_submitted + short_description: The contracts_submitted table contains information about contracts submitted for decoding. + description: '{{ doc("ink_contracts_submitted_doc") }}' + columns: + - name: address + description: "Address of the submitted contract" + - name: namespace + description: "Project or protocol name associated with the contract" + - name: name + description: "Name of the submitted contract" + - name: submitted_at + description: "Timestamp when the contract was submitted for decoding" + - name: submitted_by + description: "Address or identifier of the user who submitted the contract" + + - name: creation_traces + meta: + docs_slug: /evm/ink/raw/creation_traces + short_description: The creation_traces table contains information about contract creation traces on the network. + description: '{{ doc("ink_creation_traces_doc") }}' + columns: + - name: block_time + description: "The exact UTC timestamp when the block containing this contract creation was added to the chain" + - name: block_number + description: "The sequential number of the block containing this contract creation" + - name: tx_hash + description: "Unique 256-bit identifier (hash) of the transaction that created this contract" + - name: address + description: "The address of the newly created contract" + - name: from + description: "The address that initiated the contract creation" + - name: code + description: "The deployment bytecode of the contract" + - name: block_month + description: "The UTC month of the block in which this contract creation occurred" + + - name: blocks + meta: + docs_slug: /evm/ink/raw/blocks + short_description: The blocks table contains detailed information about blocks on the network. + description: '{{ doc("ink_blocks_doc") }}' + columns: + - name: time + description: "The exact UTC timestamp when this block was added to the chain" + - name: number + description: "The sequential block number" + - name: gas_limit + description: "Maximum amount of gas that could be used in this block" + - name: gas_used + description: "Actual amount of gas used in this block" + - name: difficulty + description: "Mining difficulty for this block" + - name: total_difficulty + description: "Total chain difficulty up to this block" + - name: size + description: "Size of the block in bytes" + - name: base_fee_per_gas + description: "Base fee per gas in this block (EIP-1559)" + - name: hash + description: "Unique 256-bit identifier (hash) of this block" + - name: parent_hash + description: "Hash of the parent block" + - name: miner + description: "Address of the miner/validator who produced this block" + - name: nonce + description: "Nonce value used in block mining" + - name: state_root + description: "Root hash of the state trie after this block" + - name: transactions_root + description: "Root hash of the transaction trie of this block" + - name: receipts_root + description: "Root hash of the receipts trie of this block" + - name: date + description: "The UTC date of this block" + - name: blob_gas_used + description: "Amount of blob gas used in this block (EIP-4844)" + - name: excess_blob_gas + description: "Excess blob gas in this block (EIP-4844)" + - name: parent_beacon_block_root + description: "Root hash of the parent beacon block" + + - name: erc20_ink + description: "Transfer events for ERC20 tokens on Ink blockchain" + tables: + - name: evt_transfer + meta: + docs_slug: /evm/ink/raw/erc20_transfers + short_description: The evt_transfer table contains all ERC20 token transfer events on the Ink blockchain. + description: '{{ doc("erc20_ink_evt_transfer_doc") }}' + columns: + - name: contract_address + description: "The address of the ERC20 token contract" + - name: from + description: "The address sending the tokens" + - name: to + description: "The address receiving the tokens" + - name: value + description: "The amount of tokens transferred" + - name: evt_tx_hash + description: "The transaction hash of the transfer event" + - name: evt_index + description: "The index of this event within the transaction" + - name: evt_block_time + description: "The timestamp of the block containing this transfer" + - name: evt_block_number + description: "The block number containing this transfer" + - name: evt_approval + meta: + docs_slug: /evm/ink/decoded/interfaces/erc20/evt_approval + short_description: The `ink.evt_approval` table contains approval events for ERC20 tokens on ink, allowing an address to spend tokens on behalf of the owner. + description: '{{ doc("erc20_ink_evt_approval_doc") }}' + columns: + - name: contract_address + description: "Address of the ERC20 token contract" + - name: evt_tx_hash + description: "The transaction hash of the approval event" + - name: evt_index + description: "The index of this event within the transaction" + - name: evt_block_time + description: "The timestamp of the block containing this approval" + - name: evt_block_number + description: "The block number containing this approval" + - name: owner + description: "address of the token owner granting approval" + - name: spender + description: "address being granted permission to spend tokens" + - name: value + description: "Amount of ERC20 tokens approved for spending, in the token's smallest unit" + + - name: erc721_ink + description: "Transfer events for ERC721 tokens on Ink blockchain" + tables: + - name: evt_transfer + meta: + docs_slug: /evm/ink/raw/erc721_transfers + short_description: The evt_transfer table contains all ERC721 token transfer events on the Ink blockchain. + description: '{{ doc("erc721_ink_evt_transfer_doc") }}' + columns: + - name: contract_address + description: "The address of the ERC721 token contract" + - name: from + description: "The address sending the NFT" + - name: to + description: "The address receiving the NFT" + - name: tokenId + description: "The unique identifier of the NFT being transferred" + - name: evt_tx_hash + description: "The transaction hash of the transfer event" + - name: evt_index + description: "The index of this event within the transaction" + - name: evt_block_time + description: "The timestamp of the block containing this transfer" + - name: evt_block_number + description: "The block number containing this transfer" + - name: evt_Approval + meta: + docs_slug: /evm/ink/decoded/interfaces/erc721/evt_Approval + short_description: "Approval events for ERC721 tokens on this network" + description: '{{ doc("erc721_ink_evt_Approval_doc") }}' + columns: + - name: contract_address + description: "Contract address of the ERC721 token contract" + - name: evt_tx_hash + description: "The transaction hash of the approval event" + - name: evt_index + description: "The index of this event within the transaction" + - name: evt_block_time + description: "The timestamp of the block containing this approval" + - name: evt_block_number + description: "The block number containing this approval" + - name: approved + description: "The address being granted or revoked permission to operate all tokens" + - name: owner + description: "The address of the token owner granting approval" + - name: tokenId + description: "Unique identifier of the ERC721 token (NFT) for which approval is granted or revoked" + - name: evt_ApprovalForAll + meta: + docs_slug: /evm/ink/decoded/interfaces/erc721/evt_ApprovalForAll + short_description: The `ink.evt_ApprovalForAll` table contains approval events for all tokens of an ERC721 contract on the ink blockchain. + description: '{{ doc("erc721_ink_evt_ApprovalForAll_doc") }}' + columns: + - name: contract_address + description: "Address of the ERC721 token contract" + - name: evt_tx_hash + description: "The transaction hash of the approval event" + - name: evt_index + description: "The index of this event within the transaction" + - name: evt_block_time + description: "The timestamp of the block containing this approval" + - name: evt_block_number + description: "The block number containing this approval" + - name: approved + description: "The address being granted or revoked permission to operate all tokens" + - name: owner + description: "The address of the token owner granting approval" + - name: operator + description: "The address being granted or revoked permission to operate all tokens" + + - name: erc1155_ink + description: "Transfer events for ERC1155 tokens on Ink blockchain" + tables: + - name: evt_transfersingle + meta: + docs_slug: /evm/ink/raw/erc1155_transfers_single + short_description: The evt_transfersingle table contains single token transfer events from ERC1155 contracts on the Ink blockchain. + description: '{{ doc("erc1155_ink_evt_transfersingle_doc") }}' + columns: + - name: contract_address + description: "The address of the ERC1155 token contract" + - name: operator + description: "The address authorized to make the transfer" + - name: from + description: "The address sending the tokens" + - name: to + description: "The address receiving the tokens" + - name: id + description: "The identifier for the token being transferred" + - name: value + description: "The amount of tokens being transferred" + - name: evt_tx_hash + description: "The transaction hash of the transfer event" + - name: evt_index + description: "The index of this event within the transaction" + - name: evt_block_time + description: "The timestamp of the block containing this transfer" + - name: evt_block_number + description: "The block number containing this transfer" + + - name: evt_transferbatch + meta: + docs_slug: /evm/ink/raw/erc1155_transfers_batch + short_description: The evt_transferbatch table contains batch token transfer events from ERC1155 contracts on the Ink blockchain. + description: '{{ doc("erc1155_ink_evt_transferbatch_doc") }}' + columns: + - name: contract_address + description: "The address of the ERC1155 token contract" + - name: operator + description: "The address authorized to make the transfer" + - name: from + description: "The address sending the tokens" + - name: to + description: "The address receiving the tokens" + - name: ids + description: "The array of token identifiers being transferred" + - name: values + description: "The array of amounts being transferred for each token id" + - name: evt_tx_hash + description: "The transaction hash of the transfer event" + - name: evt_index + description: "The index of this event within the transaction" + - name: evt_block_time + description: "The timestamp of the block containing this transfer" + - name: evt_block_number + description: "The block number containing this transfer" + - name: evt_ApprovalForAll + meta: + docs_slug: /evm/ink/decoded/interfaces/erc1155/evt_ApprovalForAll + short_description: This table contains approval events for all tokens of an ERC1155 contract on this network. + description: '{{ doc("erc1155_ink_evt_ApprovalForAll_doc") }}' + columns: + - name: contract_address + description: "ink address of the ERC1155 token contract" + - name: evt_tx_hash + description: "The transaction hash of the approval event" + - name: evt_index + description: "The index of this event within the transaction" + - name: evt_block_time + description: "The timestamp of the block containing this approval" + - name: evt_block_number + description: "The block number containing this approval" + - name: approved + description: "Boolean indicating whether approval is granted (true) or revoked (false)" + - name: owner + description: "ink address of the token owner granting or revoking approval" + - name: operator + description: "ink address being granted or revoked permission to operate all tokens" diff --git a/sources/_base_sources/evm/ink_docs_block.md b/sources/_base_sources/evm/ink_docs_block.md new file mode 100644 index 00000000000..e216368a37d --- /dev/null +++ b/sources/_base_sources/evm/ink_docs_block.md @@ -0,0 +1,283 @@ +{% docs ink_transactions_doc %} + +The `ink.transactions` table contains detailed information about transactions on the Ink blockchain. It includes: + +- Block information: block_time, block_number, block_hash, block_date +- Transaction details: hash, from, to, value +- Gas metrics: gas_price, gas_limit, gas_used +- EIP-1559 fee parameters: max_fee_per_gas, max_priority_fee_per_gas, priority_fee_per_gas +- Transaction metadata: nonce, index, success +- Smart contract interaction: data +- Transaction type and access list +- Chain identification: chain_id + +This table is used for analyzing transaction patterns, gas usage, value transfers, and network activity on Ink. + +{% enddocs %} + +{% docs ink_traces_doc %} + +The `ink.traces` table contains records of execution steps for transactions on the Ink blockchain. Each trace represents an atomic operation that modifies the blockchain state. Key components include: + +- Block information: block_time, block_number, block_hash, block_date +- Transaction context: tx_hash, tx_index, tx_from, tx_to +- Value transfer details +- Gas metrics: gas, gas_used +- Input and output data +- Call type (CALL, DELEGATECALL, CREATE) +- Error information and revert reasons +- Trace address for nested calls +- Contract creation data: address, code + +This table is essential for: +- Analyzing internal transactions +- Debugging smart contract interactions +- Tracking value flows through complex transactions +- Understanding contract creation and deployment + +{% enddocs %} + +{% docs ink_traces_decoded_doc %} + +The `ink.traces_decoded` table contains decoded traces from verified smart contracts on the Ink blockchain. It includes: + +- Block information: block_date, block_time, block_number +- Contract context: namespace, contract_name +- Transaction details: tx_hash, tx_from, tx_to +- Execution path: trace_address +- Function identification: signature, function_name + +This table is used for analyzing smart contract interactions with decoded function calls. + +{% enddocs %} + +{% docs ink_logs_doc %} + +The `ink.logs` table contains event logs emitted by smart contracts on the Ink blockchain. It includes: + +- Block information: block_time, block_number, block_hash, block_date +- Transaction details: tx_hash, tx_index, tx_from, tx_to +- Contract address +- Event topics: topic0 (event signature), topic1, topic2, topic3 +- Event data +- Log position: index + +This table is crucial for: +- Tracking on-chain events +- Monitoring contract activity +- Analyzing token transfers +- Following protocol-specific events + +{% enddocs %} + +{% docs ink_logs_decoded_doc %} + +The `ink.logs_decoded` table contains decoded logs from verified smart contracts on the Ink blockchain. It includes: + +- Block information: block_date, block_time, block_number +- Contract details: namespace, contract_name, contract_address +- Transaction context: tx_hash, tx_from, tx_to +- Event identification: signature, event_name +- Log position: index + +This table is used for analyzing smart contract events with decoded event data. + +{% enddocs %} + +{% docs ink_blocks_doc %} + +The `ink.blocks` table contains information about blocks on the Ink blockchain. It includes: + +- Block identifiers: number, hash, time, date +- Gas metrics: gas_limit, gas_used +- Block characteristics: size, base_fee_per_gas +- Block roots: state_root, transactions_root, receipts_root +- Consensus data: difficulty, total_difficulty, nonce +- Block producer: miner +- Parent block: parent_hash +- Data availability: blob_gas_used, excess_blob_gas +- Beacon chain: parent_beacon_block_root + +This table is fundamental for analyzing: +- Block production and timing +- Network capacity and usage +- Chain structure and growth +- Network performance metrics + +{% enddocs %} + +{% docs ink_contracts_doc %} + +The `ink.contracts` table tracks verified smart contracts on the Ink blockchain, including: + +- Contract address +- Contract bytecode +- Contract name and namespace +- Complete ABI +- Creation timestamp +- Verification status + +This table is used for: +- Contract verification and analysis +- Protocol research and monitoring +- Development and debugging +- Smart contract security analysis + +{% enddocs %} + +{% docs ink_contracts_submitted_doc %} + +The `ink.contracts_submitted` table tracks contracts submitted for verification on the Ink blockchain. It includes: + +- Contract address +- Submission metadata (timestamp, submitter) +- Contract name and namespace +- Verification status + +This table helps track the progress of contract verification and community contributions. + +{% enddocs %} + +{% docs ink_creation_traces_doc %} + +The `ink.creation_traces` table contains data about contract creation events on the Ink blockchain. It includes: + +- Block information: block_time, block_number, block_month +- Transaction details: tx_hash +- Contract details: address, from, code + +This table is used for: +- Analyzing contract deployment patterns +- Tracking smart contract origins +- Monitoring protocol deployments +- Understanding contract creation + +{% enddocs %} + +{% docs erc20_ink_evt_transfer_doc %} + +The `erc20_ink.evt_transfer` table contains Transfer events from ERC20 token contracts on the Ink blockchain. Each record represents a token transfer and includes: + +- Token contract address +- Sender and recipient addresses +- Amount of tokens transferred +- Block and transaction information +- Event log details + +This table is essential for: +- Tracking token transfers +- Analyzing token distribution patterns +- Monitoring token holder behavior +- Calculating token balances +- Understanding token velocity + +{% enddocs %} + +{% docs erc20_ink_evt_approval_doc %} + +The `erc20_ink.evt_approval` table contains Approval events for ERC20 tokens on the ink blockchain. It includes: + +- Block number and timestamp +- Transaction hash +- Contract address +- Owner and spender addresses +- Approved amount + +This table is used for analyzing ERC20 token approvals and spending permissions on the ink network. + +{% enddocs %} + +{% docs erc721_ink_evt_transfer_doc %} + +The `erc721_ink.evt_transfer` table contains Transfer events from ERC721 (NFT) token contracts on the Ink blockchain. Each record represents an NFT transfer and includes: + +- NFT contract address +- Token ID +- Sender and recipient addresses +- Block and transaction information +- Event log details + +This table is used for: +- Tracking NFT ownership changes +- Analyzing NFT trading patterns +- Monitoring NFT collection activity +- Building NFT holder histories +- Understanding NFT market dynamics + +{% enddocs %} + +{% docs erc1155_ink_evt_transfersingle_doc %} + +The `erc1155_ink.evt_transfersingle` table contains TransferSingle events for ERC1155 tokens on the ink blockchain. It includes: + +- Block number and timestamp +- Transaction hash +- Contract address +- Operator, from, and to addresses +- Token ID +- Amount transferred + +This table is used for tracking individual ERC1155 token transfers on the ink network. + +Please be aware that this table is the raw ERC1155 event data, and does not include any additional metadata, context or is in any way filtered or curated. Use `nft.transfers` for a more complete and curated view of NFT transfers. + +{% enddocs %} + +{% docs erc1155_ink_evt_transferbatch_doc %} + +The `erc1155_ink.evt_transferbatch` table contains TransferBatch events for ERC1155 tokens on the ink blockchain. It includes: + +- Block number and timestamp +- Transaction hash +- Contract address +- Operator, from, and to addresses +- Array of token IDs +- Array of amounts transferred + +This table is used for tracking batch transfers of multiple ERC1155 tokens on the ink network. + +Please be aware that this table is the raw ERC1155 event data, and does not include any additional metadata, context or is in any way filtered or curated. Use nft.transfers for a more complete and curated view of NFT transfers. + +{% enddocs %} + +{% docs erc1155_ink_evt_ApprovalForAll_doc %} + +The `erc1155_ink.evt_ApprovalForAll` table contains ApprovalForAll events for ERC1155 tokens on the ink blockchain. It includes: + +- Block number and timestamp +- Transaction hash +- Contract address +- Account and operator addresses +- Approved status (boolean) + +This table is used for analyzing blanket approvals for ERC1155 token collections on the ink network. + +{% enddocs %} + +{% docs erc721_ink_evt_Approval_doc %} + +The `erc721_ink.evt_Approval` table contains Approval events for ERC721 tokens on the ink blockchain. It includes: + +- Block number and timestamp +- Transaction hash +- Contract address +- Owner and approved addresses +- Token ID + +This table is used for analyzing approvals for individual ERC721 tokens (NFTs) on the ink network. + +{% enddocs %} + +{% docs erc721_ink_evt_ApprovalForAll_doc %} + +The `erc721_ink.evt_ApprovalForAll` table contains ApprovalForAll events for ERC721 tokens on the ink blockchain. It includes: + +- Block number and timestamp +- Transaction hash +- Contract address +- Owner and operator addresses +- Approved status (boolean) + +This table is used for analyzing blanket approvals for ERC721 token collections on the ink network. + +{% enddocs %} \ No newline at end of file diff --git a/sources/_base_sources/evm/kaia_docs_block.md b/sources/_base_sources/evm/kaia_docs_block.md index 56dd35d7550..ee2ca6cdf7e 100644 --- a/sources/_base_sources/evm/kaia_docs_block.md +++ b/sources/_base_sources/evm/kaia_docs_block.md @@ -85,7 +85,7 @@ The `kaia.contracts` table tracks all contracts that have been submitted to Dune {% docs kaia_creation_traces_doc %} -The `kaiam.creation_traces` table contains data about contract creation events on the kaia blockchain. It includes: +The `kaia.creation_traces` table contains data about contract creation events on the kaia blockchain. It includes: - Block number and timestamp - Transaction hash diff --git a/sources/_base_sources/evm/nova_base_sources.yml b/sources/_base_sources/evm/nova_base_sources.yml index f4e998b670c..26a33df163d 100644 --- a/sources/_base_sources/evm/nova_base_sources.yml +++ b/sources/_base_sources/evm/nova_base_sources.yml @@ -84,7 +84,7 @@ sources: - name: error description: "Error log" - name: tx_success - description: "Whether the transaction was completed sucessfully" + description: "Whether the transaction was completed successfully" - &tx_hash name: tx_hash description: "Primary key of the transaction" @@ -321,7 +321,7 @@ sources: description: "Is approved" - &operator name: operator - description: "Opperator" + description: "Operator" - name: erc721_nova description: "Transfers events for ERC721 tokens on Nova." @@ -374,7 +374,6 @@ sources: - *evt_tx_to - *evt_tx_index - *evt_index - - *evt_index - *evt_block_time - *evt_block_number - *evt_block_date diff --git a/sources/_base_sources/evm/optimism_base_sources.yml b/sources/_base_sources/evm/optimism_base_sources.yml index 62e3a112db7..dafc6ed724b 100644 --- a/sources/_base_sources/evm/optimism_base_sources.yml +++ b/sources/_base_sources/evm/optimism_base_sources.yml @@ -131,7 +131,7 @@ sources: - name: traces_decoded meta: docs_slug: /evm/optimism/decoded/traces_decoded - short_description: The `optimism.traces_decoded` table contains decoded traces, including additional information optimismd on submitted smart contracts and their ABIs. + short_description: The `optimism.traces_decoded` table contains decoded traces, including additional information optimised on submitted smart contracts and their ABIs. description: '{{ doc("optimism_traces_decoded_doc") }}' columns: - *block_date diff --git a/sources/_base_sources/evm/polygon_base_sources.yml b/sources/_base_sources/evm/polygon_base_sources.yml index aea25200b50..ed0b7736b4c 100644 --- a/sources/_base_sources/evm/polygon_base_sources.yml +++ b/sources/_base_sources/evm/polygon_base_sources.yml @@ -262,7 +262,7 @@ sources: - name: polygon description: "Boolean indicating if this is a manual individual submission of a contract." - name: factory - description: "Boolean indicating if this submission was submitted to Dune with the 'factory' flag enabled. If yes, our decoder will search for contract's deployed by the same factory and decode them into the same namespace as the initial contract." + description: "Boolean indicating if this submission was submitted to Dune with the 'factory' flag enabled. If yes, our decoder will search for contracts deployed by the same factory and decode them into the same namespace as the initial contract." - name: detection_source description: "Method used to detect and decode this contract: 'factory', 'polygon', or 'dynamic'. " - name: created_at diff --git a/sources/_base_sources/evm/ronin_docs_block.md b/sources/_base_sources/evm/ronin_docs_block.md index fa52cd0ea90..0ec8279ef00 100644 --- a/sources/_base_sources/evm/ronin_docs_block.md +++ b/sources/_base_sources/evm/ronin_docs_block.md @@ -85,7 +85,7 @@ The `ronin.contracts` table tracks all contracts that have been submitted to Dun {% docs ronin_creation_traces_doc %} -The `roninm.creation_traces` table contains data about contract creation events on the ronin blockchain. It includes: +The `ronin.creation_traces` table contains data about contract creation events on the ronin blockchain. It includes: - Block number and timestamp - Transaction hash @@ -218,4 +218,4 @@ The `erc721_ronin.evt_ApprovalForAll` table contains ApprovalForAll events for E This table is used for analyzing blanket approvals for ERC721 token collections on the ronin network. -{% enddocs %} \ No newline at end of file +{% enddocs %} diff --git a/sources/_base_sources/evm/sonic_base_sources.yml b/sources/_base_sources/evm/sonic_base_sources.yml new file mode 100644 index 00000000000..12bed27cb57 --- /dev/null +++ b/sources/_base_sources/evm/sonic_base_sources.yml @@ -0,0 +1,605 @@ +version: 2 + +sources: + - name: sonic + description: "Raw tables for the Sonic blockchain" + tables: + - name: transactions + meta: + docs_slug: "/evm/sonic/raw/transactions" + short_description: "The `sonic.transactions` table contains all transactions on the Sonic blockchain." + description: '{{ doc("sonic_transactions_doc") }}' + columns: + - name: block_time + description: "The exact UTC timestamp when this transaction was included" + data_type: timestamp + - name: block_number + description: "The sequential number of the block containing this transaction" + data_type: bigint + - name: value + description: "Amount of native tokens transferred in this transaction" + data_type: uint256 + - name: gas_limit + description: "Maximum amount of gas that can be used by this transaction" + data_type: bigint + - name: gas_price + description: "Price per unit of gas specified by the sender" + data_type: uint256 + - name: gas_used + description: "Amount of gas used by this transaction" + data_type: bigint + - name: max_fee_per_gas + description: "Maximum total fee per unit of gas (EIP-1559)" + data_type: bigint + - name: max_priority_fee_per_gas + description: "Maximum priority fee per unit of gas (EIP-1559)" + data_type: bigint + - name: priority_fee_per_gas + description: "Actual priority fee per unit of gas (EIP-1559)" + data_type: bigint + - name: nonce + description: "Number of transactions sent by the sender prior to this one" + data_type: bigint + - name: index + description: "Index of this transaction within the block" + data_type: bigint + - name: success + description: "Whether the transaction was successful" + data_type: boolean + - name: from + description: "Address that sent the transaction" + data_type: varbinary + - name: to + description: "Address that received the transaction" + data_type: varbinary + - name: block_hash + description: "Hash of the block containing this transaction" + data_type: varbinary + - name: data + description: "Data payload of the transaction" + data_type: varbinary + - name: hash + description: "Unique identifier (hash) of this transaction" + data_type: varbinary + - name: type + description: "Transaction type (0 = legacy, 1 = access list, 2 = EIP-1559)" + data_type: varchar + - name: access_list + description: "List of addresses and storage keys that the transaction plans to access" + data_type: array(row(address varbinary,storageKeys array(varbinary))) + - name: chain_id + description: "Chain ID of the network where this transaction was executed" + data_type: bigint + - name: block_date + description: "UTC date of the block containing this transaction" + data_type: date + + - name: traces + meta: + docs_slug: "/evm/sonic/raw/traces" + short_description: "The `sonic.traces` table contains all transaction traces on the Sonic blockchain." + description: '{{ doc("sonic_traces_doc") }}' + columns: + - name: block_time + description: "The exact UTC timestamp when this trace was created" + data_type: timestamp + - name: block_number + description: "The sequential number of the block containing this trace" + data_type: bigint + - name: value + description: "Amount of native tokens transferred in this trace" + data_type: uint256 + - name: gas + description: "Gas limit for this trace" + data_type: bigint + - name: gas_used + description: "Amount of gas used by this trace" + data_type: bigint + - name: block_hash + description: "Hash of the block containing this trace" + data_type: varbinary + - name: success + description: "Whether this trace was successful" + data_type: boolean + - name: tx_index + description: "Index of the transaction within the block" + data_type: integer + - name: tx_from + description: "Address that sent the transaction" + data_type: varbinary + - name: tx_to + description: "Address that received the transaction" + data_type: varbinary + - name: sub_traces + description: "Number of sub-traces" + data_type: bigint + - name: error + description: "Error message if the trace failed" + data_type: varchar + - name: tx_success + description: "Whether the parent transaction was successful" + data_type: boolean + - name: tx_hash + description: "Hash of the transaction" + data_type: varbinary + - name: from + description: "Address initiating this trace" + data_type: varbinary + - name: to + description: "Address receiving this trace" + data_type: varbinary + - name: trace_address + description: "Array indicating the position in the call trace tree" + data_type: array(bigint) + - name: type + description: "Type of the trace (call, create, suicide, reward)" + data_type: varchar + - name: address + description: "Address of the contract if this is a create trace" + data_type: varbinary + - name: code + description: "Contract code for create traces" + data_type: varbinary + - name: call_type + description: "Type of call (call, delegatecall, staticcall)" + data_type: varchar + - name: input + description: "Input data for the trace" + data_type: varbinary + - name: output + description: "Output data from the trace" + data_type: varbinary + - name: refund_address + description: "Address receiving refund for self-destruct" + data_type: varbinary + - name: revert_reason + description: "Reason for revert if the trace failed" + data_type: varchar + - name: block_date + description: "UTC date of the block containing this trace" + data_type: date + + - name: traces_decoded + meta: + docs_slug: "/evm/sonic/raw/traces_decoded" + short_description: "The `sonic.traces_decoded` table contains decoded traces from known contracts on the Sonic blockchain." + description: '{{ doc("sonic_traces_decoded_doc") }}' + columns: + - name: block_date + description: "UTC date of the block containing this trace" + data_type: date + - name: block_time + description: "The exact UTC timestamp when this trace was created" + data_type: timestamp + - name: block_number + description: "The sequential number of the block containing this trace" + data_type: bigint + - name: namespace + description: "Project namespace for the contract" + data_type: varchar + - name: contract_name + description: "Name of the contract" + data_type: varchar + - name: to + description: "Address receiving this trace" + data_type: varbinary + - name: trace_address + description: "Array indicating the position in the call trace tree" + data_type: array(bigint) + - name: tx_hash + description: "Hash of the transaction" + data_type: varbinary + - name: tx_from + description: "Address that sent the transaction" + data_type: varbinary + - name: tx_to + description: "Address that received the transaction" + data_type: varbinary + - name: signature + description: "Function signature hash" + data_type: varbinary + - name: function_name + description: "Name of the called function" + data_type: varchar + + - name: creation_traces + meta: + docs_slug: "/evm/sonic/raw/creation_traces" + short_description: "The `sonic.creation_traces` table contains information about contract creation events." + description: '{{ doc("sonic_creation_traces_doc") }}' + columns: + - name: block_time + description: "The exact UTC timestamp when the block containing this creation was added to the chain" + data_type: timestamp + - name: block_number + description: "The sequential number of the block containing this creation" + data_type: bigint + - name: tx_hash + description: "Unique 256-bit identifier (hash) of the transaction" + data_type: varbinary + - name: address + description: "Address of the deployed contract" + data_type: varbinary + - name: from + description: "Address of the account that created the contract" + data_type: varbinary + - name: code + description: "Bytecode of the deployed contract" + data_type: varbinary + - name: block_month + description: "The month of the block date" + data_type: date + + - name: logs + meta: + docs_slug: "/evm/sonic/raw/logs" + short_description: "The `sonic.logs` table contains all event logs emitted by contracts on the Sonic blockchain." + description: '{{ doc("sonic_logs_doc") }}' + columns: + - name: block_time + description: "The exact UTC timestamp when this log was emitted" + data_type: timestamp + - name: block_number + description: "The sequential number of the block containing this log" + data_type: bigint + - name: block_hash + description: "Hash of the block containing this log" + data_type: varbinary + - name: contract_address + description: "Address of the contract that emitted this log" + data_type: varbinary + - name: topic0 + description: "First topic of the log (typically the event signature)" + data_type: varbinary + - name: topic1 + description: "Second topic of the log" + data_type: varbinary + - name: topic2 + description: "Third topic of the log" + data_type: varbinary + - name: topic3 + description: "Fourth topic of the log" + data_type: varbinary + - name: data + description: "Additional data included in the log" + data_type: varbinary + - name: tx_hash + description: "Hash of the transaction that generated this log" + data_type: varbinary + - name: index + description: "Index of this log within the transaction" + data_type: integer + - name: tx_index + description: "Index of the transaction within the block" + data_type: integer + - name: block_date + description: "UTC date of the block containing this log" + data_type: date + - name: tx_from + description: "Address that sent the transaction" + data_type: varbinary + - name: tx_to + description: "Address that received the transaction" + data_type: varbinary + + - name: logs_decoded + meta: + docs_slug: "/evm/sonic/raw/logs_decoded" + short_description: "The `sonic.logs_decoded` table contains decoded event logs from known contracts on the Sonic blockchain." + description: '{{ doc("sonic_logs_decoded_doc") }}' + columns: + - name: block_date + description: "UTC date of the block containing this log" + data_type: date + - name: block_time + description: "The exact UTC timestamp when this log was emitted" + data_type: timestamp + - name: block_number + description: "The sequential number of the block containing this log" + data_type: bigint + - name: namespace + description: "Project namespace for the contract" + data_type: varchar + - name: contract_name + description: "Name of the contract that emitted this event" + data_type: varchar + - name: contract_address + description: "Address of the contract that emitted this event" + data_type: varbinary + - name: tx_hash + description: "Hash of the transaction that generated this event" + data_type: varbinary + - name: tx_from + description: "Address that sent the transaction" + data_type: varbinary + - name: tx_to + description: "Address that received the transaction" + data_type: varbinary + - name: index + description: "Index of this event within the transaction" + data_type: integer + - name: signature + description: "Event signature hash" + data_type: varbinary + - name: event_name + description: "Name of the emitted event" + data_type: varchar + + - name: blocks + meta: + docs_slug: "/evm/sonic/raw/blocks" + short_description: "The `sonic.blocks` table contains information about blocks on the Sonic blockchain." + description: '{{ doc("sonic_blocks_doc") }}' + columns: + - name: time + description: "The exact UTC timestamp when this block was added to the chain" + data_type: timestamp + - name: number + description: "The sequential number of this block in the chain" + data_type: bigint + - name: gas_limit + description: "Maximum amount of gas that could be used by all transactions in this block" + data_type: decimal(38,0) + - name: gas_used + description: "Actual amount of gas used by all transactions in this block" + data_type: decimal(38,0) + - name: difficulty + description: "Numerical value indicating the computational effort required to mine this block" + data_type: bigint + - name: total_difficulty + description: "Sum of block difficulties up to this block" + data_type: decimal(38,0) + - name: size + description: "Size of this block in bytes" + data_type: bigint + - name: base_fee_per_gas + description: "Base fee per gas in the block (post-EIP-1559)" + data_type: bigint + - name: hash + description: "Unique 256-bit identifier (hash) of this block" + data_type: varbinary + - name: parent_hash + description: "Hash of the previous block in the chain" + data_type: varbinary + - name: miner + description: "Address of the validator that produced this block" + data_type: varbinary + - name: nonce + description: "Value used to demonstrate proof of work for this block" + data_type: varbinary + - name: state_root + description: "Root hash of the state trie" + data_type: varbinary + - name: transactions_root + description: "Root hash of the transactions trie" + data_type: varbinary + - name: receipts_root + description: "Root hash of the receipts trie" + data_type: varbinary + - name: date + description: "The UTC date when this block was added to the chain" + data_type: date + - name: blob_gas_used + description: "Amount of blob gas used in this block" + data_type: bigint + - name: excess_blob_gas + description: "Excess blob gas in this block" + data_type: bigint + - name: parent_beacon_block_root + description: "Root hash of the parent beacon block" + data_type: varbinary + + - name: erc20_sonic + description: "Transfer events for ERC20 tokens on Sonic blockchain" + tables: + - name: evt_transfer + meta: + docs_slug: "/evm/sonic/decoded/interfaces/erc20/evt_transfer" + short_description: "This table contains individual transfer events for ERC20 tokens on the Sonic blockchain. Each row represents a single token transfer event." + description: '{{ doc("erc20_sonic_evt_transfer_doc") }}' + columns: + - name: contract_address + description: "Address of the ERC20 token contract that emitted this event" + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" + - name: from + description: "Address that sent the transaction" + data_type: varbinary + - name: to + description: "Address that received the transaction" + data_type: varbinary + - name: value + description: "Amount of ERC20 tokens transferred, in the token's Sonic unit" + + - name: evt_approval + meta: + docs_slug: "/evm/sonic/decoded/interfaces/erc20/evt_approval" + short_description: "The `sonic.evt_approval` table contains approval events for ERC20 tokens on Sonic, allowing an address to spend tokens on behalf of the owner." + description: '{{ doc("erc20_sonic_evt_approval_doc") }}' + columns: + - name: contract_address + description: "Address of the ERC20 token contract" + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" + - name: owner + description: "Address of the token owner granting approval" + data_type: varbinary + - name: spender + description: "Address being granted permission to spend tokens" + data_type: varbinary + - name: value + description: "Amount of ERC20 tokens approved for spending, in the token's smallest unit" + + - name: erc1155_sonic + description: "Events related to ERC1155 tokens on Sonic blockchain" + tables: + - name: evt_transfersingle + meta: + docs_slug: "/evm/sonic/decoded/interfaces/erc1155/evt_transfersingle" + short_description: "This table contains single transfer events for ERC1155 tokens on the network." + description: '{{ doc("erc1155_sonic_evt_transfersingle_doc") }}' + columns: + - name: contract_address + description: "Address of the ERC1155 token contract" + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" + - name: operator + description: "The address that is authorized to execute the transfer on behalf of the owner" + data_type: varbinary + - name: from + description: "Address that sent the transaction" + data_type: varbinary + - name: to + description: "Address that received the transaction" + data_type: varbinary + - name: id + description: "Unique identifier of the ERC1155 token being transferred" + - name: value + description: "Quantity of the ERC1155 token transferred" + + - name: evt_transferbatch + meta: + docs_slug: "/evm/sonic/decoded/interfaces/erc1155/evt_transferbatch" + short_description: "This table contains all batch transfer events for ERC1155 tokens on the network." + description: '{{ doc("erc1155_ethereum_evt_transferbatch_doc") }}' + columns: + - name: contract_address + description: "Contract address of the ERC1155 token contract" + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" + - name: operator + description: "Contract address authorized to execute the batch transfer on behalf of the owner" + data_type: varbinary + - name: from + description: "Address that sent the transaction" + data_type: varbinary + - name: to + description: "Address that received the transaction" + data_type: varbinary + - name: ids + description: "Array of unique identifiers of the ERC1155 tokens being transferred" + - name: values + description: "Array of quantities for each ERC1155 token transferred, corresponding to the ids array" + + - name: evt_ApprovalForAll + meta: + docs_slug: "/evm/sonic/decoded/interfaces/erc1155/evt_ApprovalForAll" + short_description: "This table contains approval events for all tokens of an ERC1155 contract on this network." + description: '{{ doc("erc1155_ethereum_evt_ApprovalForAll_doc") }}' + columns: + - name: contract_address + description: "Sonic address of the ERC1155 token contract" + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" + - name: approved + description: "Boolean indicating whether approval is granted (true) or revoked (false)" + - name: owner + description: "Sonic address of the token owner granting or revoking approval" + data_type: varbinary + - name: operator + description: "Sonic address being granted or revoked permission to operate all tokens" + data_type: varbinary + + - name: erc721_sonic + description: '{{ doc("erc721_sonic_evt_transfer_doc") }}' + tables: + - name: evt_transfer + description: "Transfer events for ERC721 tokens on this network" + columns: + - name: contract_address + description: "Contract address of the ERC721 token contract" + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" + - name: from + description: "Address that sent the transaction" + data_type: varbinary + - name: to + description: "Address that received the transaction" + data_type: varbinary + - name: tokenId + description: "Unique identifier of the ERC721 token (NFT) being transferred" + + - name: evt_Approval + meta: + docs_slug: "/evm/sonic/decoded/interfaces/erc721/evt_Approval" + short_description: "Approval events for ERC721 tokens on this network" + description: '{{ doc("erc721_ethereum_evt_Approval_doc") }}' + columns: + - name: contract_address + description: "Contract address of the ERC721 token contract" + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" + - name: approved + description: "Boolean indicating whether approval is granted (true) or revoked (false)" + - name: owner + description: "Address of the token owner granting or revoking approval" + data_type: varbinary + - name: tokenId + description: "Unique identifier of the ERC721 token (NFT) for which approval is granted or revoked" + + - name: evt_ApprovalForAll + meta: + docs_slug: "/evm/sonic/decoded/interfaces/erc721/evt_ApprovalForAll" + short_description: "The `sonic.evt_ApprovalForAll` table contains approval events for all tokens of an ERC721 contract on the Sonic blockchain." + description: '{{ doc("erc721_ethereum_evt_ApprovalForAll_doc") }}' + columns: + - name: contract_address + description: "Address of the ERC721 token contract" + - name: evt_tx_hash + description: "Hash of the transaction containing this event" + - name: evt_index + description: "Index position of this event within the transaction" + - name: evt_block_time + description: "Timestamp of the block containing this event" + - name: evt_block_number + description: "The block number containing this event" + - name: approved + description: "Boolean indicating whether approval is granted (true) or revoked (false)" + - name: owner + description: "Address of the token owner granting or revoking approval" + data_type: varbinary + - name: operator + description: "The address being granted or revoked permission to operate all tokens" + data_type: varbinary diff --git a/sources/_base_sources/evm/sonic_docs_block.md b/sources/_base_sources/evm/sonic_docs_block.md new file mode 100644 index 00000000000..0cddb0102b1 --- /dev/null +++ b/sources/_base_sources/evm/sonic_docs_block.md @@ -0,0 +1,254 @@ +{% docs sonic_transactions_doc %} + +The `sonic.transactions` table contains detailed information about transactions on the Sonic blockchain. It includes: + +- Block information: number, timestamp, hash +- Transaction details: hash, from_address, to_address, value +- Gas data: gas_price, gas_limit, gas_used, max_fee_per_gas, priority_fee_per_gas +- Status: success or failure +- Input data for contract interactions +- Nonce and chain_id +- Transaction type and access list + +This table is used for analyzing transaction patterns, gas usage, value transfers, and overall network activity on Sonic. + +{% enddocs %} + +{% docs sonic_traces_doc %} + +The `sonic.traces` table contains records of execution steps for transactions on the Sonic blockchain. Each trace represents an atomic operation that modifies the state of the Ethereum Virtual Machine (EVM). Key components include: + +- Transaction hash and block information +- From and to addresses +- Value transferred +- Gas metrics (gas, gas_used) +- Input and output data +- Call type (e.g., CALL, DELEGATECALL, CREATE) +- Error information and revert reasons +- Trace address for nested calls + +This table is essential for: +- Analyzing internal transactions +- Debugging smart contract interactions +- Tracking value flows through complex transactions +- Understanding contract creation and deployment +- Monitoring protocol operations +- Analyzing cross-chain operations + +{% enddocs %} + +{% docs sonic_traces_decoded_doc %} + +The `sonic.traces_decoded` table contains a subset of decoded traces from the Sonic blockchain dependent on submitted smart contracts and their ABIs. It includes: + +- Block information and transaction details +- Contract name and namespace +- Decoded function names and signatures +- Trace address for execution path tracking +- Transaction origin and destination +- Function parameters (when available) + +This table is used for high level analysis of smart contract interactions and protocol operations. For fully decoded function calls and parameters, refer to protocol-specific decoded tables. + +{% enddocs %} + +{% docs sonic_logs_doc %} + +The `sonic.logs` table contains event logs emitted by smart contracts on the Sonic blockchain. It includes: + +- Block information: number, timestamp, hash +- Transaction details: hash, index, from, to +- Contract address (emitting the event) +- Topic0 (event signature) +- Additional topics (indexed parameters) +- Data field (non-indexed parameters) +- Log index and transaction index + +This table is crucial for: +- Tracking on-chain events +- Monitoring contract activity +- Analyzing token transfers +- Following protocol-specific events +- Tracking cross-chain operations +- Monitoring protocol state changes + +{% enddocs %} + +{% docs sonic_logs_decoded_doc %} + +The `sonic.logs_decoded` table contains a subset of decoded logs from the Sonic blockchain dependent on submitted smart contracts and their ABIs. It includes: + +- Block and transaction information +- Contract details (name, namespace, address) +- Decoded event names and signatures +- Transaction origin and destination +- Event parameters (when available) + +This table is used for high level analysis of smart contract events, particularly useful for monitoring protocol activities. For fully decoded events and parameters, refer to protocol-specific decoded tables. + +{% enddocs %} + +{% docs sonic_blocks_doc %} + +The `sonic.blocks` table contains information about Sonic blocks. It provides essential data about each block in the Sonic blockchain, including: + +- Block identifiers and timestamps +- Gas metrics and size +- Consensus information (difficulty, nonce) +- State roots and receipts +- Parent block information +- Base fee per gas +- Blob gas metrics +- Parent beacon block root + +This table is fundamental for: +- Analyzing block production and timing +- Monitoring network performance +- Tracking gas usage patterns +- Understanding network upgrades +- Analyzing consensus metrics +- Studying blockchain structure + +{% enddocs %} + +{% docs sonic_creation_traces_doc %} + +The `sonic.creation_traces` table contains information about contract deployments on the Sonic blockchain. It includes: + +- Block information and timestamps +- Transaction details +- Contract addresses +- Creator addresses +- Contract bytecode + +This table is essential for: +- Tracking smart contract deployments +- Analyzing contract creation patterns +- Monitoring new protocol deployments +- Auditing contract creation history +- Understanding contract deployment costs + +{% enddocs %} + +{% docs erc20_sonic_evt_transfer_doc %} + +The `erc20_sonic.evt_transfer` table contains ERC20 token transfer events on the Sonic blockchain. Each record represents a token transfer and includes: + +- Block information and timestamps +- Transaction details +- Token contract address +- Sender and receiver addresses +- Transfer amount +- Event index and transaction index + +This table is essential for: +- Tracking token transfers and flows +- Analyzing token holder behavior +- Monitoring token activity +- Understanding token economics +- Tracking cross-chain token movements + +{% enddocs %} + +{% docs erc721_sonic_evt_transfer_doc %} + +The `erc721_sonic.evt_transfer` table contains ERC721 (NFT) transfer events on the Sonic blockchain. Each record represents an NFT transfer and includes: + +- Block information and timestamps +- Transaction details +- NFT contract address +- Sender and receiver addresses +- Token ID +- Event index and transaction index + +This table is crucial for: +- Tracking NFT ownership changes +- Analyzing NFT trading patterns +- Monitoring NFT market activity +- Understanding NFT collections +- Tracking cross-chain NFT movements + +{% enddocs %} + +{% docs erc1155_sonic_evt_transfer_doc %} + +The `erc1155_sonic.evt_transfer` table contains ERC1155 multi-token transfer events on the Sonic blockchain. Each record represents a token transfer and includes: + +- Block information and timestamps +- Transaction details +- Token contract address +- Sender and receiver addresses +- Token ID and amount +- Event index and transaction index + +This table is used for: +- Tracking multi-token transfers +- Analyzing token usage patterns +- Monitoring protocol activity +- Understanding multi-token operations +- Tracking DeFi integrations + +{% enddocs %} + +{% docs erc20_sonic_evt_approval_doc %} + +The `erc20_sonic.evt_approval` table contains approval events for ERC20 tokens on the Sonic blockchain. Each record represents a token approval and includes: + +- Block information and timestamps +- Transaction details +- Token contract address +- Owner address +- Spender address +- Approved amount +- Event index and transaction index + +This table is essential for: +- Tracking token approvals +- Monitoring DeFi allowances +- Analyzing smart contract permissions +- Understanding protocol integrations +- Tracking liquidity provisions + +{% enddocs %} + +{% docs erc1155_sonic_evt_transfersingle_doc %} + +The `erc1155_sonic.evt_transfersingle` table contains single transfer events for ERC1155 tokens on the Sonic blockchain. Each record represents a single token transfer and includes: + +- Block information and timestamps +- Transaction details +- Token contract address +- Operator address +- Sender and receiver addresses +- Token ID and amount +- Event index and transaction index + +This table is used for: +- Tracking individual token transfers +- Analyzing token usage patterns +- Monitoring protocol activity +- Understanding multi-token operations +- Tracking DeFi integrations + +{% enddocs %} + +{% docs erc1155_sonic_evt_transferbatch_doc %} + +The `erc1155_sonic.evt_transferbatch` table contains batch transfer events for ERC1155 tokens on the Sonic blockchain. Each record represents a batch token transfer and includes: + +- Block information and timestamps +- Transaction details +- Token contract address +- Operator address +- Sender and receiver addresses +- Array of token IDs and amounts +- Event index and transaction index + +This table is crucial for: +- Tracking bulk token transfers +- Analyzing batch operations +- Monitoring large-scale movements +- Understanding protocol migrations +- Tracking multi-token operations + +{% enddocs %} diff --git a/sources/_datasets/dune/sources.yml b/sources/_datasets/dune/sources.yml new file mode 100644 index 00000000000..adc99858345 --- /dev/null +++ b/sources/_datasets/dune/sources.yml @@ -0,0 +1,6 @@ +version: 2 + +sources: + - name: dune + tables: + - name: result_blockchains diff --git a/sources/_sector/dex/trades/boba/_sources.yml b/sources/_sector/dex/trades/boba/_sources.yml new file mode 100644 index 00000000000..6d8638002d9 --- /dev/null +++ b/sources/_sector/dex/trades/boba/_sources.yml @@ -0,0 +1,7 @@ +version: 2 + +sources: + - name: icecreamswap_boba + tables: + - name: IceCreamSwapV2Pair_evt_Swap + - name: IceCreamSwapV2Factory_evt_PairCreated diff --git a/sources/_sector/dex/trades/corn/_sources.yml b/sources/_sector/dex/trades/corn/_sources.yml new file mode 100644 index 00000000000..7c955c93e8c --- /dev/null +++ b/sources/_sector/dex/trades/corn/_sources.yml @@ -0,0 +1,14 @@ +version: 2 + +sources: + - name: oku_corn + tables: + - name: v3CoreFactoryAddress_evt_PoolCreated + - name: OkuV3Pair_evt_Swap + - name: camelot_corn + tables: + - name: AlgebraFactory_evt_Pool + - name: AlgebraPool_evt_Swap + - name: CamelotFactory_evt_PairCreated + - name: CamelotPair_evt_Swap + - name: CamelotYakRouter_evt_YakSwap diff --git a/sources/_sector/dex/trades/ethereum/_sources.yml b/sources/_sector/dex/trades/ethereum/_sources.yml index 5c63d9043bc..4a582b28ca8 100644 --- a/sources/_sector/dex/trades/ethereum/_sources.yml +++ b/sources/_sector/dex/trades/ethereum/_sources.yml @@ -132,3 +132,6 @@ sources: - name: fluid_ethereum tables: - name: FluidDexT1_evt_Swap + - name: pancakeswap_ethereum + tables: + - name: ExclusiveDutchOrderReactor_evt_Fill diff --git a/sources/_sector/dex/trades/flare/_sources.yml b/sources/_sector/dex/trades/flare/_sources.yml new file mode 100644 index 00000000000..5052c204fd3 --- /dev/null +++ b/sources/_sector/dex/trades/flare/_sources.yml @@ -0,0 +1,21 @@ +version: 2 + +sources: + - name: blazeswap_flare + tables: + - name: BlazeSwapFactory_evt_PairCreated + - name: BLAZE_LP_evt_Swap + + - name: sparkdex_flare + tables: + - name: UniswapV3Factory_evt_PoolCreated + - name: UniswapV2Factory_evt_PairCreated + - name: UniswapV3Pool_evt_Swap + - name: UniswapV2Pool_evt_Swap + + - name: enosys_flare + tables: + - name: EnosysPair_evt_Swap + - name: EnosysDexFactory_evt_PairCreated + - name: EnosysDexV3Pool_evt_Swap + - name: EnosysDexV3Factory_evt_PoolCreated diff --git a/sources/_sector/dex/trades/optimism/_sources.yml b/sources/_sector/dex/trades/optimism/_sources.yml index 4d723797c87..c54e6a688bd 100644 --- a/sources/_sector/dex/trades/optimism/_sources.yml +++ b/sources/_sector/dex/trades/optimism/_sources.yml @@ -2,6 +2,8 @@ version: 2 sources: - name: uniswap_v3_optimism + tables: + - name: pools - name: sushi_optimism tables: - name: ConstantProductPool_evt_Swap diff --git a/sources/_sector/dex/trades/ronin/_sources.yml b/sources/_sector/dex/trades/ronin/_sources.yml index 4e40c27221e..50a87f2523c 100644 --- a/sources/_sector/dex/trades/ronin/_sources.yml +++ b/sources/_sector/dex/trades/ronin/_sources.yml @@ -5,7 +5,5 @@ sources: tables: - name: KatanaPair_evt_Swap - name: KatanaFactory_evt_PairCreated - - name: katana_dex_ronin - tables: - name: KatanaV3Pool_evt_Swap - name: KatanaV3Factory_evt_PoolCreated diff --git a/sources/_subprojects_outputs/daily_spellbook/_sources.yml b/sources/_subprojects_outputs/daily_spellbook/_sources.yml index e086d2254ef..be8ca799747 100644 --- a/sources/_subprojects_outputs/daily_spellbook/_sources.yml +++ b/sources/_subprojects_outputs/daily_spellbook/_sources.yml @@ -41,4 +41,8 @@ sources: - name: ethereum tables: - name: blobs_submissions - \ No newline at end of file + + - name: beets + tables: + - name: pools_metrics_daily + - name: trades \ No newline at end of file diff --git a/sources/_subprojects_outputs/dex/_sources.yml b/sources/_subprojects_outputs/dex/_sources.yml index 1d1d25769a6..bb73d57800e 100644 --- a/sources/_subprojects_outputs/dex/_sources.yml +++ b/sources/_subprojects_outputs/dex/_sources.yml @@ -88,4 +88,4 @@ sources: - name: trades - name: beethoven_x tables: - - name: trades + - name: trades \ No newline at end of file diff --git a/sources/_subprojects_outputs/hourly_spellbook/_sources.yml b/sources/_subprojects_outputs/hourly_spellbook/_sources.yml index ecf970cd3af..a5a273cd1b3 100644 --- a/sources/_subprojects_outputs/hourly_spellbook/_sources.yml +++ b/sources/_subprojects_outputs/hourly_spellbook/_sources.yml @@ -82,4 +82,4 @@ sources: - name: evms tables: - - name: transaction_metrics + - name: transaction_metrics \ No newline at end of file diff --git a/sources/_subprojects_outputs/spellbook/_sources.yml b/sources/_subprojects_outputs/spellbook/_sources.yml index 9aa040b2036..b3eaf34dbd0 100644 --- a/sources/_subprojects_outputs/spellbook/_sources.yml +++ b/sources/_subprojects_outputs/spellbook/_sources.yml @@ -119,6 +119,7 @@ sources: - name: balancer_v3 tables: - name: erc4626_token_prices + - name: erc4626_token_mapping - name: addresses_ethereum tables: diff --git a/sources/aave/base/aave_base_sources.yml b/sources/aave/base/aave_base_sources.yml new file mode 100644 index 00000000000..e3348a3f85f --- /dev/null +++ b/sources/aave/base/aave_base_sources.yml @@ -0,0 +1,61 @@ +version: 2 + +sources: + - name: aave_v3_base + description: "Decoded contracts for aave v3 on Base" + + tables: + - name: L2Pool_evt_ReserveDataUpdated + description: "Provides the liquidity index, stable and variable borrow rates for aave v3 reserves." + columns: + - name: contract_address + description: "Aave token contract address" + type: varbinary + + - name: evt_tx_hash + description: "Transaction hash of the event" + type: varbinary + + - name: evt_tx_from + description: "Address that initiated the transaction" + type: varbinary + + - name: evt_tx_to + description: "Address that received the transaction" + type: varbinary + + - name: evt_index + description: "Event index" + type: bigint + + - name: evt_block_time + description: "Timestamp for block event time in UTC" + type: timestamp + + - name: evt_block_number + description: "Event block number" + type: bigint + + - name: reserve + description: "Aave reserve contract address" + type: varbinary + + - name: liquidityRate + description: "Liquidity rate value of the reserve" + type: uint256 + + - name: stableBorrowRate + description: "Stable borrow rate value of the reserve" + type: uint256 + + - name: variableBorrowRate + description: "Variable borrow rate value of the reserve" + type: uint256 + + - name: liquidityIndex + description: "Liquidity index value of the reserve" + type: uint256 + + - name: variableBorrowIndex + description: "Variable borrow index value of the reserve" + type: uint256 \ No newline at end of file diff --git a/sources/bebop/arbitrum/bebop_arbitrum_sources.yml b/sources/bebop/arbitrum/bebop_arbitrum_sources.yml index e3645be2065..2eb72ef2dff 100644 --- a/sources/bebop/arbitrum/bebop_arbitrum_sources.yml +++ b/sources/bebop/arbitrum/bebop_arbitrum_sources.yml @@ -18,6 +18,11 @@ sources: - name: JamSettlement_call_settle - name: JamSettlement_call_settleWithPermitsSignatures - name: JamSettlement_evt_Settlement + - name: jam_v2_arbitrum + description: "BebopJAM_V2 decoded tables related to Bebop" + tables: + - name: JamSettlement_call_settle + - name: JamSettlement_evt_BebopJamOrderFilled - name: bebop_pmms_arbitrum description: "Bebop decoded tables related to Bebop" tables: diff --git a/sources/bebop/base/bebop_base_sources.yml b/sources/bebop/base/bebop_base_sources.yml index a27ed49983c..78eefcf1f96 100644 --- a/sources/bebop/base/bebop_base_sources.yml +++ b/sources/bebop/base/bebop_base_sources.yml @@ -7,6 +7,11 @@ sources: - name: JamSettlement_call_settle - name: JamSettlement_call_settleWithPermitsSignatures - name: JamSettlement_evt_Settlement + - name: jam_v2_base + description: "BebopJAM_V2 decoded tables related to Bebop" + tables: + - name: JamSettlement_call_settle + - name: JamSettlement_evt_BebopJamOrderFilled - name: bebop_pmms_base description: "Bebop decoded tables related to Bebop" tables: diff --git a/sources/bebop/bnb/bebop_bnb_sources.yml b/sources/bebop/bnb/bebop_bnb_sources.yml index f7aa50b540b..d500337ff06 100644 --- a/sources/bebop/bnb/bebop_bnb_sources.yml +++ b/sources/bebop/bnb/bebop_bnb_sources.yml @@ -7,3 +7,8 @@ sources: - name: JamSettlement_call_settle - name: JamSettlement_call_settleWithPermitsSignatures - name: JamSettlement_evt_Settlement + - name: jam_v2_bnb + description: "BebopJAM_V2 decoded tables related to Bebop" + tables: + - name: JamSettlement_call_settle + - name: JamSettlement_evt_BebopJamOrderFilled diff --git a/sources/bebop/ethereum/bebop_ethereum_sources.yml b/sources/bebop/ethereum/bebop_ethereum_sources.yml index aa93a4250c2..7a461adef9d 100644 --- a/sources/bebop/ethereum/bebop_ethereum_sources.yml +++ b/sources/bebop/ethereum/bebop_ethereum_sources.yml @@ -18,6 +18,11 @@ sources: - name: JamSettlement_call_settle - name: JamSettlement_call_settleWithPermitsSignatures - name: JamSettlement_evt_Settlement + - name: jam_v2_ethereum + description: "BebopJAM_V2 decoded tables related to Bebop" + tables: + - name: JamSettlement_call_settle + - name: JamSettlement_evt_BebopJamOrderFilled - name: bebop_pmms_ethereum description: "Bebop decoded tables related to Bebop" tables: diff --git a/sources/bebop/optimism/bebop_optimism_sources.yml b/sources/bebop/optimism/bebop_optimism_sources.yml index 250640ba63a..48598dc6f34 100644 --- a/sources/bebop/optimism/bebop_optimism_sources.yml +++ b/sources/bebop/optimism/bebop_optimism_sources.yml @@ -13,3 +13,8 @@ sources: - name: JamSettlement_call_settle - name: JamSettlement_call_settleWithPermitsSignatures - name: JamSettlement_evt_Settlement + - name: jam_v2_optimism + description: "BebopJAM_V2 decoded tables related to Bebop" + tables: + - name: JamSettlement_call_settle + - name: JamSettlement_evt_BebopJamOrderFilled diff --git a/sources/bebop/polygon/bebop_polygon_sources.yml b/sources/bebop/polygon/bebop_polygon_sources.yml index 9053b4db81b..6ab03d3135b 100644 --- a/sources/bebop/polygon/bebop_polygon_sources.yml +++ b/sources/bebop/polygon/bebop_polygon_sources.yml @@ -18,6 +18,11 @@ sources: - name: JamSettlement_call_settle - name: JamSettlement_call_settleWithPermitsSignatures - name: JamSettlement_evt_Settlement + - name: jam_v2_polygon + description: "BebopJAM_V2 decoded tables related to Bebop" + tables: + - name: JamSettlement_call_settle + - name: JamSettlement_evt_BebopJamOrderFilled - name: bebop_pmms_polygon description: "Bebop decoded tables related to Bebop" tables: diff --git a/sources/bebop/scroll/bebop_scroll_sources.yml b/sources/bebop/scroll/bebop_scroll_sources.yml index 06f95a5ea55..591a7c257f8 100644 --- a/sources/bebop/scroll/bebop_scroll_sources.yml +++ b/sources/bebop/scroll/bebop_scroll_sources.yml @@ -7,3 +7,8 @@ sources: - name: JamSettlement_call_settle - name: JamSettlement_call_settleWithPermitsSignatures - name: JamSettlement_evt_Settlement + - name: jam_v2_scroll + description: "BebopJAM_V2 decoded tables related to Bebop" + tables: + - name: JamSettlement_call_settle + - name: JamSettlement_evt_BebopJamOrderFilled diff --git a/sources/bebop/zksync/bebop_zksync_sources.yml b/sources/bebop/zksync/bebop_zksync_sources.yml index 030892c64e6..65f6178551d 100644 --- a/sources/bebop/zksync/bebop_zksync_sources.yml +++ b/sources/bebop/zksync/bebop_zksync_sources.yml @@ -7,3 +7,8 @@ sources: - name: JamSettlement_call_settle - name: JamSettlement_call_settleWithPermitsSignatures - name: JamSettlement_evt_Settlement + - name: jam_v2_zksync + description: "BebopJAM_V2 decoded tables related to Bebop" + tables: + - name: JamSettlement_call_settle + - name: JamSettlement_evt_BebopJamOrderFilled diff --git a/sources/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_sources.yml b/sources/labels/addresses/__single_category_labels__/balancer/labels_balancer_sources.yml similarity index 96% rename from sources/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_sources.yml rename to sources/labels/addresses/__single_category_labels__/balancer/labels_balancer_sources.yml index 7e04cd0686b..da9ecdbe2e7 100644 --- a/sources/labels/addresses/__single_category_labels__/balancer_v2/labels_balancer_v2_sources.yml +++ b/sources/labels/addresses/__single_category_labels__/balancer/labels_balancer_sources.yml @@ -889,6 +889,34 @@ sources: - name: addr - name: gauge_type - name: weight + + - name: GnosisRootGauge_call_initialize + - name: ArbitrumRootGauge_call_initialize + - name: AvalancheRootGauge_call_initialize + - name: BaseRootGauge_call_initialize + - name: OptimismRootGauge_call_initialize + - name: PolygonRootGauge_call_initialize + - name: PolygonZkEVMRootGauge_call_initialize + - name: LiquidityGauge_call_initialize + - name: LiquidityGaugeV5_call_initialize + - name: CappedArbitrumRootGauge_call_initialize + - name: CappedOptimismRootGauge_call_initialize + - name: CappedPolygonRootGauge_call_initialize + - name: CappedLiquidityGaugeV5_call_initialize + - name: GnosisRootGauge_call_killGauge + - name: ArbitrumRootGauge_call_killGauge + - name: AvalancheRootGauge_call_killGauge + - name: BaseRootGauge_call_killGauge + - name: OptimismRootGauge_call_killGauge + - name: PolygonRootGauge_call_killGauge + - name: PolygonZkEVMRootGauge_call_killGauge + - name: LiquidityGauge_call_killGauge + - name: LiquidityGaugeV5_call_killGauge + - name: CappedArbitrumRootGauge_call_killGauge + - name: CappedOptimismRootGauge_call_killGauge + - name: CappedPolygonRootGauge_call_killGauge + - name: CappedLiquidityGaugeV5_call_killGauge + - name: AuthorizerAdaptorEntrypoint_evt_ActionPerformed - name: balancer_polygon description: > @@ -1937,6 +1965,33 @@ sources: - *tokens - name: gyroscope_avalanche_c + tables: + - name: GyroECLPPoolFactory_call_create + description: > + Decoded table of registered pools on the Gyroscope ECLP contract. + columns: + - *call_block_number + - *call_block_time + - *call_success + - *call_trace_address + - *call_tx_hash + - name: capManager + - name: capParams + - name: contract_address + description: "Address of the ECLP Pool contract" + - name: derivedECLPParams + - name: eclpParams + - name: name + - *output_0 + - *owner + - name: pauseManager + - name: pauseParams + - *swapFeePercentage + - *rateProviders + - *symbol + - *tokens + + - name: gyroscope_sonic tables: - name: GyroECLPPoolFactory_call_create description: > diff --git a/sources/oneinch/zksync/oneinch_zksync_sources.yml b/sources/oneinch/zksync/oneinch_zksync_sources.yml index e4a0d604b9e..7b2238abd17 100644 --- a/sources/oneinch/zksync/oneinch_zksync_sources.yml +++ b/sources/oneinch/zksync/oneinch_zksync_sources.yml @@ -39,5 +39,7 @@ sources: - name: AggregationRouterV6_call_fillOrderArgs - name: AggregationRouterV6_call_fillContractOrder - name: AggregationRouterV6_call_fillContractOrderArgs + - name: EscrowFactoryV1_call_createDstEscrow + - name: EscrowFactoryV1_evt_SrcEscrowCreated - name: lop - name: ar \ No newline at end of file