diff --git a/dbt_subprojects/daily_spellbook/models/_sector/airdrops/airdrop_claims.sql b/dbt_subprojects/daily_spellbook/models/_sector/airdrops/airdrop_claims.sql index 906271faa65..4beeea8705d 100644 --- a/dbt_subprojects/daily_spellbook/models/_sector/airdrops/airdrop_claims.sql +++ b/dbt_subprojects/daily_spellbook/models/_sector/airdrops/airdrop_claims.sql @@ -5,10 +5,10 @@ file_format = 'delta', incremental_strategy = 'merge', unique_key = ['blockchain', 'tx_hash', 'evt_index', 'recipient'], - post_hook='{{ expose_spells(\'["ethereum", "optimism", "arbitrum", "avalanche_c", "bnb", "gnosis"]\', + post_hook='{{ expose_spells(\'["ethereum", "optimism", "arbitrum", "avalanche_c", "bnb", "gnosis", "zksync"]\', "sector", "airdrop", - \'["hildobby"]\') }}' + \'["hildobby", "lgingerich"]\') }}' ) }} @@ -20,6 +20,7 @@ , ref('airdrop_avalanche_c_claims') , ref('airdrop_bnb_claims') , ref('airdrop_gnosis_claims') + , ref('airdrop_zksync_claims') ] %} @@ -43,11 +44,10 @@ FROM ( , evt_index FROM {{ airdrop_claims_model }} {% if is_incremental() %} - WHERE block_time >= date_trunc('day', now() - interval '7' Day) + WHERE {{incremental_predicate('block_time')}} {% endif %} {% if not loop.last %} UNION ALL {% endif %} {% endfor %} ) - diff --git a/dbt_subprojects/daily_spellbook/models/_sector/airdrops/airdrop_info.sql b/dbt_subprojects/daily_spellbook/models/_sector/airdrops/airdrop_info.sql index 542f7519d06..c0699660574 100644 --- a/dbt_subprojects/daily_spellbook/models/_sector/airdrops/airdrop_info.sql +++ b/dbt_subprojects/daily_spellbook/models/_sector/airdrops/airdrop_info.sql @@ -2,10 +2,10 @@ tags = [ 'static'], schema='airdrop', alias = 'info', - post_hook='{{ expose_spells(\'["ethereum", "bnb", "avalanche_c", "gnosis", "optimism", "arbitrum"]\', + post_hook='{{ expose_spells(\'["ethereum", "bnb", "avalanche_c", "gnosis", "optimism", "arbitrum", "lgingerich"]\', "sector", - "dex", - \'["hildobby"]\') }}') + "airdrop", + \'["hildobby", "lgingerich"]\') }}') }} SELECT project, name, eligible_addresses, airdropped_total, circulating_supply_on_drop, max_supply, token_issued_by_protocol, x_username, CAST(airdrop_start AS TIMESTAMP) AS airdrop_start, CAST(airdrop_end AS TIMESTAMP) AS airdrop_end @@ -60,5 +60,5 @@ FROM (VALUES , ('jupiter', 'Jupiter', 957935, 2700000000, NULL, NULL, TRUE, 'JupiterExchange', '2024-01-01 00:00', NULL) , ('aptos', 'Aptos', 124828, 450000000, NULL, NULL, TRUE, 'Aptos', '2022-10-01 00:00', NULL) , ('jito', 'Jito', 13133, 439000000, NULL, NULL, TRUE, 'jito_sol', '2023-12-01 00:00', NULL) - - ) AS temp_table (project, name, eligible_addresses, circulating_supply_on_drop, max_supply, airdropped_total, token_issued_by_protocol, x_username, airdrop_start, airdrop_end) \ No newline at end of file + , ('zksync', 'ZKsync Era', 693268, 3675000000, 3675000000, 21000000000, TRUE, 'zksync', '2024-06-17 06:45', NULL) +) AS temp_table (project, name, eligible_addresses, circulating_supply_on_drop, max_supply, airdropped_total, token_issued_by_protocol, x_username, airdrop_start, airdrop_end) \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/airdrops/airdrop_schema.yml b/dbt_subprojects/daily_spellbook/models/_sector/airdrops/airdrop_schema.yml index d68bcb512c1..d4ba25acc0a 100644 --- a/dbt_subprojects/daily_spellbook/models/_sector/airdrops/airdrop_schema.yml +++ b/dbt_subprojects/daily_spellbook/models/_sector/airdrops/airdrop_schema.yml @@ -3,12 +3,12 @@ version: 2 models: - name: airdrop_claims meta: - blockchain: ethereum, optimism, arbitrum, avalanche_c, bnb, gnosis + blockchain: ethereum, optimism, arbitrum, avalanche_c, bnb, gnosis, zksync sector: airdrop project: addresses - contributors: hildobby + contributors: hildobby, lgingerich config: - tags: ['table', 'airdrop', 'ethereum', 'optimism', 'arbitrum', 'avalanche_c', 'bnb', 'gnosis', 'claim'] + tags: ['table', 'airdrop', 'ethereum', 'optimism', 'arbitrum', 'avalanche_c', 'bnb', 'gnosis', 'zksync', 'claim'] description: "List of claim transactions for all airdrops" tests: - dbt_utils.unique_combination_of_columns: @@ -67,11 +67,11 @@ models: - name: airdrop_info meta: - blockchain: ethereum, bnb, avalanche_c, gnosis, optimism, arbitrum - sector: dex - contributors: hildobby + blockchain: ethereum, bnb, avalanche_c, gnosis, optimism, arbitrum, zksync + sector: airdrop + contributors: hildobby, lgingerich config: - tags: ['airdrop', 'ethereum', 'bnb', 'avalanche_c', 'gnosis', 'optimism', 'arbitrum', 'info'] + tags: ['airdrop', 'ethereum', 'bnb', 'avalanche_c', 'gnosis', 'optimism', 'arbitrum', 'zksync', 'info'] description: > Airdrop info tests: diff --git a/dbt_subprojects/daily_spellbook/models/_sector/airdrops/zksync/_schema.yml b/dbt_subprojects/daily_spellbook/models/_sector/airdrops/zksync/_schema.yml new file mode 100644 index 00000000000..60a1c89c662 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_sector/airdrops/zksync/_schema.yml @@ -0,0 +1,54 @@ +version: 2 + +models: + - name: airdrop_zksync_claims + meta: + blockchain: zksync + sector: airdrop + contributors: lgingerich + config: + tags: ['airdrop', 'zksync', 'claim'] + description: "List of airdrop claim transactions on ZKsync Era" + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &block_time + name: block_time + description: "Block time of transaction" + - &block_number + name: block_number + description: "Block number of transaction" + - &project + name: project + description: "Project name" + - &airdrop_number + name: airdrop_number + description: "Airdrop identifier number" + - &recipient + name: recipient + description: "Airdrop recipient" + - &contract_address + name: contract_address + description: "Contract addressed used" + - &tx_hash + name: tx_hash + description: "Transaction hash" + - &amount_raw + name: amount_raw + description: "Raw amount of tokens" + - &amount_original + name: amount_original + description: "Original amount of tokens" + - &amount_usd + name: amount_usd + description: "USD value of tokens" + - &token_address + name: token_address + description: "Token address" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &evt_index + name: evt_index + description: "Event index" \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/airdrops/zksync/airdrop_zksync_claims.sql b/dbt_subprojects/daily_spellbook/models/_sector/airdrops/zksync/airdrop_zksync_claims.sql new file mode 100644 index 00000000000..d08ad49b306 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_sector/airdrops/zksync/airdrop_zksync_claims.sql @@ -0,0 +1,36 @@ +{{ config( + schema = 'airdrop_zksync', + alias = 'claims' + ) +}} + + +{% set airdrop_claims_models = [ + ref('zksync_zksync_airdrop_claims') +] %} + + +SELECT * +FROM ( + {% for airdrop_claims_model in airdrop_claims_models %} + SELECT + blockchain + , block_time + , block_number + , project + , airdrop_number + , recipient + , contract_address + , tx_hash + , amount_raw + , amount_original + , amount_usd + , token_address + , token_symbol + , evt_index + FROM {{ airdrop_claims_model }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} +) diff --git a/dbt_subprojects/daily_spellbook/models/_sector/airdrops/zksync/projects/_schema.yml b/dbt_subprojects/daily_spellbook/models/_sector/airdrops/zksync/projects/_schema.yml new file mode 100644 index 00000000000..60b317ea69b --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_sector/airdrops/zksync/projects/_schema.yml @@ -0,0 +1,64 @@ +version: 2 + +models: + - name: zksync_zksync_airdrop_claims + meta: + blockchain: zksync + sector: airdrop + project: zksync + contributors: lgingerich + config: + tags: ['table', 'airdrop', 'zksync', 'claim'] + description: "List of claim transactions for the $ZK airdrop" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - tx_hash + - recipient + - evt_index + columns: + - &blockchain + name: blockchain + description: "Blockchain" + - &block_time + name: block_time + description: "Block time of transaction" + - &block_number + name: block_number + description: "Block number of transaction" + - &project + name: project + description: "Project name" + - &airdrop_number + name: airdrop_number + description: "Airdrop identifier number" + - &recipient + name: recipient + description: "Airdrop recipient" + - &contract_address + name: contract_address + description: "Contract addressed used" + - &tx_hash + name: tx_hash + description: "Transaction hash" + - &amount_raw + name: amount_raw + description: "Raw amount of tokens" + - &amount_original + name: amount_original + description: "Original amount of tokens" + - &amount_usd + name: amount_usd + description: "USD value of tokens" + - &token_address + name: token_address + description: "Token address" + - &token_symbol + name: token_symbol + description: "Token symbol" + - &evt_index + name: evt_index + description: "Event index" + - &block_month + name: block_month + description: "Block month" \ No newline at end of file diff --git a/dbt_subprojects/daily_spellbook/models/_sector/airdrops/zksync/projects/zksync_zksync_airdrop_claims.sql b/dbt_subprojects/daily_spellbook/models/_sector/airdrops/zksync/projects/zksync_zksync_airdrop_claims.sql new file mode 100644 index 00000000000..469f4d0ec47 --- /dev/null +++ b/dbt_subprojects/daily_spellbook/models/_sector/airdrops/zksync/projects/zksync_zksync_airdrop_claims.sql @@ -0,0 +1,49 @@ +{{ + config( + + schema = 'zksync_zksync', + alias = 'airdrop_claims', + materialized = 'incremental', + file_format = 'delta', + incremental_strategy = 'merge', + unique_key = ['recipient', 'tx_hash', 'evt_index'] + ) +}} + +{% set token_address = '0x5A7d6b2F92C77FAD6CCaBd7EE0624E64907Eaf3E' %} -- ZK token + +WITH early_price AS ( + SELECT + MIN(minute) AS minute + , MIN_BY(price, minute) AS price + FROM {{ source('prices', 'usd') }} + WHERE blockchain = 'zksync' + AND contract_address = {{token_address}} +) + +SELECT + 'zksync' AS blockchain + , t.evt_block_time AS block_time + , t.evt_block_number AS block_number + , 'zksync' AS project + , 1 AS airdrop_number + , t.account AS recipient + , t.contract_address + , t.evt_tx_hash AS tx_hash + , t.amount as amount_raw + , ROUND(CAST(t.amount/POWER(10, 18) AS double), 0) AS amount_original + , CASE + WHEN t.evt_block_time >= (SELECT minute FROM early_price) THEN CAST(pu.price*t.amount/POWER(10, 18) AS double) + ELSE CAST((SELECT price FROM early_price)*t.amount/POWER(10, 18) AS double) + END AS amount_usd + , {{token_address}} AS token_address + , 'ZK' AS token_symbol + , t.evt_index +FROM {{ source('zksync_era_zksync', 'ZkMerkleDistributor_evt_Claimed') }} t +LEFT JOIN {{ source('prices','usd_forward_fill') }} pu ON pu.blockchain = 'zksync' + AND pu.contract_address = {{token_address}} + AND pu.minute = date_trunc('minute', t.evt_block_time) +{% if is_incremental() %} + AND {{incremental_predicate('pu.minute')}} +WHERE {{incremental_predicate('t.evt_block_time')}} +{% endif %} diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_blocks.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_blocks.sql index ec629459e74..4cdfd74f526 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_blocks.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_blocks.sql @@ -28,6 +28,8 @@ , ('zkevm', source('zkevm', 'blocks')) , ('blast', source('blast', 'blocks')) , ('mantle', source('mantle', 'blocks')) + , ('mode', source('mode', 'blocks')) + , ('sei', source('sei', 'blocks')) ] %} SELECT * diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_contracts.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_contracts.sql index 23edf7ee816..43d1107668f 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_contracts.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_contracts.sql @@ -28,6 +28,7 @@ , ('zkevm', source('zkevm', 'contracts')) , ('blast', source('blast', 'contracts')) , ('mantle', source('mantle', 'contracts')) + , ('sei', source('sei', 'contracts')) ] %} SELECT * diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_creation_traces.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_creation_traces.sql index 0da729fca27..f0b0a8083f2 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_creation_traces.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_creation_traces.sql @@ -28,6 +28,7 @@ , ('zkevm', source('zkevm', 'creation_traces')) , ('blast', source('blast', 'creation_traces')) , ('mantle', source('mantle', 'creation_traces')) + , ('sei', source('sei', 'creation_traces')) ] %} SELECT * diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_erc1155_approvalsforall.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_erc1155_approvalsforall.sql index 9302d24a914..7d4c43bb510 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_erc1155_approvalsforall.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_erc1155_approvalsforall.sql @@ -28,6 +28,7 @@ , ('zkevm', source('erc1155_zkevm', 'evt_ApprovalForAll')) , ('blast', source('erc1155_blast', 'evt_ApprovalForAll')) , ('mantle', source('erc1155_mantle', 'evt_ApprovalForAll')) + , ('sei', source('erc1155_sei', 'evt_ApprovalForAll')) ] %} SELECT * diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_erc1155_transfersbatch.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_erc1155_transfersbatch.sql index c0c5c03484c..369d0c3e0a6 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_erc1155_transfersbatch.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_erc1155_transfersbatch.sql @@ -28,6 +28,7 @@ , ('zkevm', source('erc1155_zkevm', 'evt_transferbatch')) , ('blast', source('erc1155_blast', 'evt_transferbatch')) , ('mantle', source('erc1155_mantle', 'evt_transferbatch')) + , ('sei', source('erc1155_sei', 'evt_transferbatch')) ] %} SELECT * diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_erc1155_transferssingle.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_erc1155_transferssingle.sql index 594fbe02ecf..399ac930c5b 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_erc1155_transferssingle.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_erc1155_transferssingle.sql @@ -28,6 +28,7 @@ , ('zkevm', source('erc1155_zkevm', 'evt_transfersingle')) , ('blast', source('erc1155_blast', 'evt_transfersingle')) , ('mantle', source('erc1155_mantle', 'evt_transfersingle')) + , ('sei', source('erc1155_sei', 'evt_transfersingle')) ] %} SELECT * diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_erc20_approvals.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_erc20_approvals.sql index 447987c332d..117858e7fa7 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_erc20_approvals.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_erc20_approvals.sql @@ -28,6 +28,7 @@ , ('zkevm', source('erc20_zkevm', 'evt_approval')) , ('blast', source('erc20_blast', 'evt_approval')) , ('mantle', source('erc20_mantle', 'evt_approval')) + , ('sei', source('erc20_sei', 'evt_Approval')) ] %} SELECT * diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_erc20_transfers.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_erc20_transfers.sql index eb1e01a8ea7..7ca345d0b9b 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_erc20_transfers.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_erc20_transfers.sql @@ -28,6 +28,7 @@ , ('zkevm', source('erc20_zkevm', 'evt_transfer')) , ('blast', source('erc20_blast', 'evt_transfer')) , ('mantle', source('erc20_mantle', 'evt_transfer')) + , ('sei', source('erc20_sei', 'evt_transfer')) ] %} SELECT * diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_erc721_approvals.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_erc721_approvals.sql index 838c41a9357..e10c20eb273 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_erc721_approvals.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_erc721_approvals.sql @@ -28,6 +28,7 @@ , ('zkevm', source('erc721_zkevm', 'evt_Approval')) , ('blast', source('erc721_blast', 'evt_Approval')) , ('mantle', source('erc721_mantle', 'evt_Approval')) + , ('sei', source('erc721_sei', 'evt_Approval')) ] %} SELECT * diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_erc721_approvalsforall.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_erc721_approvalsforall.sql index 08e9578ebef..5fe7060c142 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_erc721_approvalsforall.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_erc721_approvalsforall.sql @@ -28,6 +28,7 @@ , ('zkevm', source('erc721_zkevm', 'evt_ApprovalForAll')) , ('blast', source('erc721_blast', 'evt_ApprovalForAll')) , ('mantle', source('erc721_mantle', 'evt_ApprovalForAll')) + , ('sei', source('erc721_sei', 'evt_ApprovalForAll')) ] %} SELECT * diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_erc721_transfers.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_erc721_transfers.sql index 961e412ff36..c7c7e0f68cf 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_erc721_transfers.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_erc721_transfers.sql @@ -28,6 +28,7 @@ , ('zkevm', source('erc721_zkevm', 'evt_transfer')) , ('blast', source('erc721_blast', 'evt_transfer')) , ('mantle', source('erc721_mantle', 'evt_transfer')) + , ('sei', source('erc721_sei', 'evt_transfer')) ] %} SELECT * diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_logs.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_logs.sql index 9743ae87c10..36a66355e7f 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_logs.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_logs.sql @@ -28,6 +28,8 @@ , ('zkevm', source('zkevm', 'logs')) , ('blast', source('blast', 'logs')) , ('mantle', source('mantle', 'logs')) + , ('mode', source('mode', 'logs')) + , ('sei', source('sei', 'logs')) ] %} SELECT * diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_logs_decoded.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_logs_decoded.sql index 6e8f9c50135..e4f4dc5fe3d 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_logs_decoded.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_logs_decoded.sql @@ -28,6 +28,7 @@ , ('zkevm', source('zkevm', 'logs_decoded')) , ('blast', source('blast', 'logs_decoded')) , ('mantle', source('mantle', 'logs_decoded')) + , ('sei', source('sei', 'logs_decoded')) ] %} SELECT * diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_schema.yml b/dbt_subprojects/daily_spellbook/models/evms/evms_schema.yml index dc2a20ed015..68b56b52d23 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_schema.yml +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_schema.yml @@ -3,9 +3,9 @@ version: 2 models: - name: evms_transactions meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, mode, sei sector: evms - contributors: hildobby + contributors: [hildobby, synthquest] config: tags: ['evms', 'transactions'] description: "An EVM transaction refers to an action initiated by an externally-owned account (i.e., an account managed by a human, not a contract)." @@ -76,9 +76,9 @@ models: - name: evms_traces meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, mode, sei sector: evms - contributors: hildobby + contributors: [hildobby, synthquest] config: tags: ['evms', 'traces'] description: "An EVM trace is a small atomic action that modify the internal state of the Ethereum Virtual Machine. The three main trace types are call, create, and suicide." @@ -127,9 +127,9 @@ models: - name: evms_traces_decoded meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, sei sector: evms - contributors: hildobby + contributors: [hildobby, synthquest] config: tags: ['evms', 'traces', 'decoded'] description: "An EVM trace is a small atomic action that modify the internal state of the Ethereum Virtual Machine. The three main trace types are call, create, and suicide. Decoded traces include additional information based on submitted smart contracts and their ABI" @@ -153,9 +153,9 @@ models: - name: evms_logs meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, mode, sei sector: evms - contributors: hildobby + contributors: [hildobby, synthquest] config: tags: ['evms', 'logs'] description: "An EVM log can be used to describe an event within a smart contract, like a token transfer or a change of ownership." @@ -183,9 +183,9 @@ models: - name: evms_logs_decoded meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, sei sector: evms - contributors: hildobby + contributors: [hildobby, synthquest] config: tags: ['evms', 'logs', 'decoded'] description: "An EVM log can be used to describe an event within a smart contract, like a token transfer or a change of ownership. Those logs are decoded based on submitted smart contracts to make them human readable." @@ -209,9 +209,9 @@ models: - name: evms_blocks meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, mode, sei sector: evms - contributors: hildobby + contributors: [hildobby, synthquest] config: tags: ['evms', 'blocks'] description: "Blocks are batches of transactions with a hash of the previous block in the chain. This links blocks together (in a chain) because hashes are cryptographically derived from the block data." @@ -232,9 +232,9 @@ models: - name: evms_contracts meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, sei sector: evms - contributors: hildobby + contributors: [hildobby, synthquest] config: tags: ['evms', 'contracts'] description: "A view keeping track of what contracts are decoded across EVM chains on Dune; contains information associated with the decoded contract such as namespace, name, address, ABI." @@ -268,9 +268,9 @@ models: - name: evms_creation_traces meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, sei sector: evms - contributors: hildobby + contributors: [hildobby, synthquest] config: tags: ['evms', 'traces', 'creation', 'contracts'] description: "EVM chains creation traces" @@ -288,9 +288,9 @@ models: - name: evms_erc20_transfers meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, sei sector: evms - contributors: hildobby + contributors: [hildobby, synthquest] config: tags: ['evms', 'erc20', 'transfers'] description: "Transfers events for ERC20 tokens on EVM chains." @@ -317,9 +317,9 @@ models: - name: evms_erc20_approvals meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, sei sector: evms - contributors: hildobby + contributors: [hildobby, synthquest] config: tags: ['evms', 'erc20', 'approvals'] description: "Approval events for ERC20 tokens on EVM chains." @@ -340,9 +340,9 @@ models: - name: evms_erc1155_transferssingle meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, sei sector: evms - contributors: hildobby + contributors: [hildobby, synthquest] config: tags: ['evms', 'erc1155', 'transfers', 'single'] description: "Single transfers events for ERC1155 tokens on EVM chains." @@ -365,9 +365,9 @@ models: - name: evms_erc1155_transfersbatch meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, sei sector: evms - contributors: hildobby + contributors: [hildobby, synthquest] config: tags: ['evms', 'erc1155', 'transfers', 'batch'] description: "Batch transfers events for ERC1155 tokens on EVM chains." @@ -390,9 +390,9 @@ models: - name: evms_erc1155_approvalsforall meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, sei sector: evms - contributors: hildobby + contributors: [hildobby, synthquest] config: tags: ['evms', 'erc1155', 'approvals'] description: "Approval for all events for ERC1155 tokens on EVM chains." @@ -415,9 +415,9 @@ models: - name: evms_erc721_transfers meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, sei sector: evms - contributors: hildobby + contributors: [hildobby, synthquest] config: tags: ['evms', 'erc721', 'transfers'] description: "Transfers events for ERC721 tokens on EVM chains." @@ -436,9 +436,9 @@ models: - name: evms_erc721_approvals meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, sei sector: evms - contributors: hildobby + contributors: [hildobby, synthquest] config: tags: ['evms', 'erc721', 'approvals'] description: "Approval events for ERC721 tokens on EVM chains." @@ -459,9 +459,9 @@ models: - name: evms_erc721_approvalsforall meta: - blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, sei sector: evms - contributors: hildobby + contributors: [hildobby, synthquest] config: tags: ['evms', 'erc721', 'approvals'] description: "Approval for all events for ERC721 tokens on EVM chains." @@ -479,7 +479,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 + blockchain: ethereum, polygon, bnb, avalanche_c, gnosis, fantom, optimism, arbitrum, celo, base, goerli, zksync, zora, scroll, linea, zkevm, blast, mantle, mode, sei sector: evms contributors: hildobby config: diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_traces.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_traces.sql index 91c49202c6c..1fc7f8872d3 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_traces.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_traces.sql @@ -28,6 +28,8 @@ , ('zkevm', source('zkevm', 'traces')) , ('blast', source('blast', 'traces')) , ('mantle', source('mantle', 'traces')) + , ('mode', source('mode', 'traces')) + , ('sei', source('sei', 'traces')) ] %} SELECT * diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_traces_decoded.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_traces_decoded.sql index 0ee1294cab7..ae98d94278b 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_traces_decoded.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_traces_decoded.sql @@ -28,6 +28,7 @@ , ('zkevm', source('zkevm', 'traces_decoded')) , ('blast', source('blast', 'traces_decoded')) , ('mantle', source('mantle', 'traces_decoded')) + , ('sei', source('sei', 'traces_decoded')) ] %} SELECT * diff --git a/dbt_subprojects/daily_spellbook/models/evms/evms_transactions.sql b/dbt_subprojects/daily_spellbook/models/evms/evms_transactions.sql index 81051e19604..bde8861a96c 100644 --- a/dbt_subprojects/daily_spellbook/models/evms/evms_transactions.sql +++ b/dbt_subprojects/daily_spellbook/models/evms/evms_transactions.sql @@ -5,7 +5,7 @@ post_hook='{{ expose_spells(\'["ethereum", "polygon", "bnb", "avalanche_c", "gnosis", "fantom", "optimism", "arbitrum", "celo", "base", "goerli", "zksync", "zora", "scroll", "linea", "zkevm", "blast", "mantle"]\', "sector", "evms", - \'["hildobby"]\') }}' + \'["hildobby", "synthquest"]\') }}' ) }} @@ -29,6 +29,11 @@ , ('zkevm', source('zkevm', 'transactions')) , ('blast', source('blast', 'transactions')) , ('mantle', source('mantle', 'transactions')) + , ('sei', source('sei', 'transactions')) +] %} + +{% set unstructured_transactions_models = [ + ('mode', source('mode', 'transactions')) ] %} SELECT * @@ -92,4 +97,44 @@ FROM ( {% endif %} {% endfor %} + UNION ALL + + {% for unstructured_transactions_models in unstructured_transactions_models %} + {% if unstructured_transactions_models[0] == 'mode' %} + SELECT + '{{ unstructured_transactions_models[0] }}' AS blockchain + , CAST(NULL AS array(row(address varbinary, storagekeys array(varbinary)))) AS access_list + , block_hash + , data + , "from" + , hash + , to + , block_number + , block_time + , gas_limit + , CAST(gas_price AS double) AS gas_price + , gas_used + , index + , max_fee_per_gas + , max_priority_fee_per_gas + , nonce + , priority_fee_per_gas + , success + , "type" + , CAST(value AS double) AS value + , l1_tx_origin + , l1_fee_scalar + , l1_block_number + , l1_fee + , l1_gas_price + , l1_gas_used + , l1_timestamp + , CAST(NULL AS DECIMAL(38,0)) AS effective_gas_price + {% endif %} + FROM {{ unstructured_transactions_models[1] }} + {% if not loop.last %} + UNION ALL + {% endif %} + {% endfor %} + ); diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_eth_transfers.sql b/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_eth_transfers.sql new file mode 100644 index 00000000000..198d83b0a05 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_eth_transfers.sql @@ -0,0 +1,83 @@ +{{ + config( + materialized='incremental', + schema = 'safe_linea', + alias= 'eth_transfers', + partition_by = ['block_month'], + unique_key = ['block_date', 'address', 'tx_hash', 'trace_address'], + on_schema_change='fail', + file_format ='delta', + incremental_strategy='merge', + post_hook = '{{ expose_spells( + blockchains = \'["linea"]\', + spell_type = "project", + spell_name = "safe", + contributors = \'["danielpartida"]\') }}' + ) +}} + +{% set project_start_date = '2023-07-11' %} + +select + t.*, + p.price * t.amount_raw / 1e18 AS amount_usd + +from ( + + select + 'linea' as blockchain, + 'ETH' as symbol, + s.address, + try_cast(date_trunc('day', et.block_time) as date) as block_date, + CAST(date_trunc('month', et.block_time) as DATE) as block_month, + et.block_time, + -CAST(et.value AS INT256) as amount_raw, + et.tx_hash, + array_join(et.trace_address, ',') as trace_address + from {{ source('linea', 'traces') }} et + join {{ ref('safe_linea_safes') }} s on et."from" = s.address + and et."from" != et.to -- exclude calls to self to guarantee unique key property + and et.success = true + and (lower(et.call_type) not in ('delegatecall', 'callcode', 'staticcall') or et.call_type is null) + and et.value > UINT256 '0' -- et.value is uint256 type + {% if not is_incremental() %} + where et.block_time > timestamp '{{project_start_date}}' -- for initial query optimisation + {% else %} + -- to prevent potential counterfactual safe deployment issues we take a bigger interval + where et.block_time > date_trunc('day', now() - interval '10' day) + {% endif %} + + union all + + select + 'linea' as blockchain, + 'ETH' as symbol, + s.address, + try_cast(date_trunc('day', et.block_time) as date) as block_date, + CAST(date_trunc('month', et.block_time) as DATE) as block_month, + et.block_time, + CAST(et.value AS INT256) as amount_raw, + et.tx_hash, + array_join(et.trace_address, ',') as trace_address + from {{ source('linea', 'traces') }} et + join {{ ref('safe_linea_safes') }} s on et.to = s.address + and et."from" != et.to -- exclude calls to self to guarantee unique key property + and et.success = true + and (lower(et.call_type) not in ('delegatecall', 'callcode', 'staticcall') or et.call_type is null) + and et.value > UINT256 '0' -- et.value is uint256 type + {% if not is_incremental() %} + where et.block_time > timestamp '{{project_start_date}}' -- for initial query optimisation + {% endif %} + {% if is_incremental() %} + -- to prevent potential counterfactual safe deployment issues we take a bigger interval + where et.block_time > date_trunc('day', now() - interval '10' day) + {% endif %} +) t + +left join {{ source('prices', 'usd') }} p on p.blockchain is null + and p.symbol = t.symbol + and p.minute = date_trunc('minute', t.block_time) + {% if is_incremental() %} + -- to prevent potential counterfactual safe deployment issues we take a bigger interval + and p.minute > date_trunc('day', now() - interval '10' day) + {% endif %} \ No newline at end of file diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_safes.sql b/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_safes.sql new file mode 100644 index 00000000000..ff805dcb211 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_safes.sql @@ -0,0 +1,48 @@ +{{ + config( + materialized='incremental', + schema = 'safe_linea', + alias= 'safes', + partition_by = ['block_month'], + unique_key = ['block_date', 'address'], + on_schema_change='fail', + file_format ='delta', + incremental_strategy='merge', + post_hook = '{{ expose_spells( + blockchains = \'["linea"]\', + spell_type = "project", + spell_name = "safe", + contributors = \'["danielpartida"]\') }}' + ) +}} + +{% set project_start_date = '2024-02-24' %} + +select + 'linea' as blockchain, + et."from" as address, + case + when et.to = 0xd9db270c1b5e3bd161e8c8503c55ceabee709552 then '1.3.0' + when et.to = 0x3e5c63644e683549055b9be8653de26e0b4cd36e then '1.3.0L2' + when et.to = 0x41675C099F32341bf84BFc5382aF534df5C7461a then '1.4.1' + when et.to = 0x29fcB43b46531BcA003ddC8FCB67FFE91900C762 then '1.4.1L2' + else 'unknown' + end as creation_version, + try_cast(date_trunc('day', et.block_time) as date) as block_date, + CAST(date_trunc('month', et.block_time) as DATE) as block_month, + et.block_time as creation_time, + et.tx_hash +from {{ source('linea', 'traces') }} et +join {{ ref('safe_linea_singletons') }} s + on et.to = s.address +where et.success = true + and et.call_type = 'delegatecall' -- delegatecall to singleton is Safe (proxy) address + and bytearray_substring(et.input, 1, 4) in ( + 0xb63e800d -- setup method v1.3.0, v1.3.0L2, v1.4.1, v.1.4.1L2 + ) + and et.gas_used > 10000 -- to ensure the setup call was successful. excludes e.g. setup calls with missing params that fallback + {% if not is_incremental() %} + and et.block_time > TIMESTAMP '{{project_start_date}}' -- for initial query optimisation + {% else %} + and {{ incremental_predicate('et.block_time') }} + {% endif %} diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_schema.yml b/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_schema.yml new file mode 100644 index 00000000000..ba3782bfdd4 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_schema.yml @@ -0,0 +1,149 @@ +version: 2 + +models: + - name: safe_linea_safes + meta: + blockchain: linea + project: safe + contributors: danielpartida + config: + tags: ['safe', 'linea'] + description: "Safe addresses" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - address + columns: + - &blockchain + name: blockchain + description: "The blockchain on which the Safe is deployed" + - &address + name: address + description: "Safe contract address" + - &creation_version + name: creation_version + description: "Version of initially created safe" + - &block_date + name: block_date + - &block_month + name: block_month + - &creation_time + name: creation_time + description: "Date/time of safe creation" + - &tx_hash + name: tx_hash + + - name: safe_linea_eth_transfers + meta: + blockchain: linea + project: safe + contributors: danielpartida + config: + tags: ['safe', 'transfers', 'linea'] + description: "Eth transfers for safes" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - address + - tx_hash + - trace_address + columns: + - *blockchain + - &symbol + name: symbol + description: "Symbol of native gas token: ETH" + - *address + - *block_date + - *block_month + - &block_time + name: block_time + description: "Date of Eth transfer" + - &amount_raw + name: amount_raw + description: "Raw amount of transferred ETH" + - *tx_hash + - &trace_address + name: trace_address + - &amount_usd + name: amount_usd + description: "USD amount of transferred ETH" + + - name: safe_linea_singletons + meta: + blockchain: linea + project: safe + contributors: danielpartida + config: + tags: ['safe', 'singletons', 'linea'] + description: "Singletons addresses used with Safes" + columns: + - name: address + description: "Safe contract address" + tests: + - unique + - not_null + + - name: safe_linea_transactions + meta: + blockchain: linea + project: safe + contributors: danielpartida + config: + tags: ['safe', 'linea'] + description: "Safe transactions" + tests: + - dbt_utils.unique_combination_of_columns: + combination_of_columns: + - block_date + - tx_hash + - trace_address + columns: + - *blockchain + - *block_date + - *block_month + - *block_time + - &block_number + name: block_number + description: "Number of block" + - *tx_hash + - name: address + description: "Safe contract address" + - &to + name: to + description: "Destination address" + - &value + name: value + description: "Value of transaction" + - &gas + name: gas + description: "Gas limit set for transaction" + - &execution_gas_used + name: execution_gas_used + description: "Execution gas used during transaction, for more details see https://dune.com/docs/data-tables/raw/evm/traces/?h=traces#gas-used-in-traces" + - &total_gas_used + name: total_gas_used + description: "Total gas used during transaction" + - &tx_index + name: tx_index + description: "Transaction index" + - &sub_traces + name: sub_traces + description: "Number of sub traces" + - *trace_address + - &success + name: success + description: "Success state of transaction" + - &error + name: error + description: "Error of transaction if any" + - &code + name: code + description: "Code" + - &input + name: input + description: "Input data" + - &output + name: output + description: "Output data" diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_singletons.sql b/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_singletons.sql new file mode 100644 index 00000000000..799270755a3 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_singletons.sql @@ -0,0 +1,22 @@ +{{ + config( + materialized='table', + schema = 'safe_linea', + alias= 'singletons', + post_hook = '{{ expose_spells( + blockchains = \'["linea"]\', + spell_type = "project", + spell_name = "safe", + contributors = \'["danielpartida"]\') }}' + ) +}} + + +-- Fetch all known singleton/mastercopy addresses used via factories. +select distinct singleton as address +from {{ source('gnosis_safe_linea', 'SafeProxyFactoryv_1_3_0_evt_ProxyCreation') }} + +union + +select distinct singleton as address +from {{ source('gnosis_safe_linea', 'SafeProxyFactoryv_1_4_1_evt_ProxyCreation') }} diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_transactions.sql b/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_transactions.sql new file mode 100644 index 00000000000..4426629ee39 --- /dev/null +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/linea/safe_linea_transactions.sql @@ -0,0 +1,68 @@ +{{ + config( + materialized='incremental', +schema = 'safe_linea', + alias= 'transactions', + partition_by = ['block_month'], + unique_key = ['block_date', 'tx_hash', 'trace_address'], + file_format ='delta', + incremental_strategy='merge', + post_hook = '{{ expose_spells( + blockchains = \'["linea"]\', + spell_type = "project", + spell_name = "safe", + contributors = \'["danielpartida"]\') }}' + ) +}} + +{% set project_start_date = '2023-07-11' %} + +select + 'linea' as blockchain, + try_cast(date_trunc('day', tr.block_time) as date) as block_date, + CAST(date_trunc('month', tr.block_time) as DATE) as block_month, + tr.block_time, + tr.block_number, + tr.tx_hash, + s.address, + tr.to, + tr.value, + tr.gas, + tr.gas_used as execution_gas_used, + et.gas_used as total_gas_used, + tr.tx_index, + tr.sub_traces, + tr.trace_address, + tr.success, + tr.error, + tr.code, + tr.input, + tr.output, + case + when bytearray_substring(tr.input, 1, 4) = 0x6a761202 then 'execTransaction' + when bytearray_substring(tr.input, 1, 4) = 0x468721a7 then 'execTransactionFromModule' + when bytearray_substring(tr.input, 1, 4) = 0x5229073f then 'execTransactionFromModuleReturnData' + else 'unknown' + end as method +from {{ source('linea', 'traces') }} tr +join {{ ref('safe_linea_safes') }} s + on s.address = tr."from" +join {{ ref('safe_linea_singletons') }} ss + on tr.to = ss.address +join {{ source('linea', 'transactions') }} et + on tr.tx_hash = et.hash + {% if is_incremental() %} + and {{ incremental_predicate('et.block_time') }} + {% endif %} + and tr.block_number = et.block_number +where bytearray_substring(tr.input, 1, 4) in ( + 0x6a761202, -- execTransaction + 0x468721a7, -- execTransactionFromModule + 0x5229073f -- execTransactionFromModuleReturnData + ) + and tr.call_type = 'delegatecall' + {% if not is_incremental() %} + and tr.block_time > TIMESTAMP '{{project_start_date}}' -- for initial query optimisation + {% else %} + and {{ incremental_predicate('tr.block_time') }} + {% endif %} diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/safe_native_transfers_all.sql b/dbt_subprojects/hourly_spellbook/models/_project/safe/safe_native_transfers_all.sql index a4dd6a3f1fd..8649285c293 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/safe_native_transfers_all.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/safe_native_transfers_all.sql @@ -1,7 +1,7 @@ {{ config( schema = 'safe', alias = 'native_transfers_all', - post_hook='{{ expose_spells(\'["arbitrum","avalanche_c","base","bnb","celo","ethereum","gnosis","goerli","optimism","polygon","zkevm","zksync"]\', + post_hook='{{ expose_spells(\'["arbitrum","avalanche_c","base","bnb","celo","ethereum","gnosis","goerli","linea","optimism","polygon","zkevm","zksync"]\', "project", "safe", \'["kryptaki", "danielpartida"]\') }}' @@ -17,6 +17,7 @@ ,ref('safe_ethereum_eth_transfers') ,ref('safe_gnosis_xdai_transfers') ,ref('safe_goerli_eth_transfers') +,ref('safe_linea_eth_transfers') ,ref('safe_optimism_eth_transfers') ,ref('safe_polygon_matic_transfers') ,ref('safe_zkevm_matic_transfers') diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/safe_safes_all.sql b/dbt_subprojects/hourly_spellbook/models/_project/safe/safe_safes_all.sql index 6bd372417a6..c27ef8a062f 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/safe_safes_all.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/safe_safes_all.sql @@ -1,7 +1,7 @@ {{ config( schema = 'safe', alias = 'safes_all', - post_hook='{{ expose_spells(\'["arbitrum","avalanche_c","base","bnb","celo","ethereum","fantom","gnosis","goerli","optimism","polygon","zkevm","zksync"]\', + post_hook='{{ expose_spells(\'["arbitrum","avalanche_c","base","bnb","celo","ethereum","fantom","gnosis","goerli","linea","optimism","polygon","zkevm","zksync"]\', "project", "safe", \'["tschubotz", "danielpartida", "kryptaki"]\') }}' @@ -18,6 +18,7 @@ ,ref('safe_fantom_safes') ,ref('safe_gnosis_safes') ,ref('safe_goerli_safes') +,ref('safe_linea_safes') ,ref('safe_optimism_safes') ,ref('safe_polygon_safes') ,ref('safe_zkevm_safes') diff --git a/dbt_subprojects/hourly_spellbook/models/_project/safe/safe_transactions_all.sql b/dbt_subprojects/hourly_spellbook/models/_project/safe/safe_transactions_all.sql index be19fb40a9c..b8eb899323d 100644 --- a/dbt_subprojects/hourly_spellbook/models/_project/safe/safe_transactions_all.sql +++ b/dbt_subprojects/hourly_spellbook/models/_project/safe/safe_transactions_all.sql @@ -1,7 +1,7 @@ {{ config( schema = 'safe', alias = 'transactions_all', - post_hook='{{ expose_spells(\'["arbitrum","avalanche_c","base","bnb","celo","ethereum","fantom","gnosis","goerli","optimism","polygon","zkevm","zksync"]\', + post_hook='{{ expose_spells(\'["arbitrum","avalanche_c","base","bnb","celo","ethereum","fantom","gnosis","goerli","linea","optimism","polygon","zkevm","zksync"]\', "project", "safe", \'["kryptaki", "danielpartida"]\') }}' @@ -18,6 +18,7 @@ ,ref('safe_fantom_transactions') ,ref('safe_gnosis_transactions') ,ref('safe_goerli_transactions') +,ref('safe_linea_transactions') ,ref('safe_optimism_transactions') ,ref('safe_polygon_transactions') ,ref('safe_zkevm_transactions') diff --git a/dbt_subprojects/solana/models/_sector/nft/old/magiceden_solana_events.sql b/dbt_subprojects/solana/models/_sector/nft/old/magiceden_solana_events.sql index 201e0874a80..b0369151206 100644 --- a/dbt_subprojects/solana/models/_sector/nft/old/magiceden_solana_events.sql +++ b/dbt_subprojects/solana/models/_sector/nft/old/magiceden_solana_events.sql @@ -157,3 +157,4 @@ LEFT JOIN {{ source('prices', 'usd') }} AS p {% if is_incremental() %} AND {{ incremental_predicate('p.minute') }} {% endif %} +where block_time <= timestamp '2022-11-30 22:43' -- new model takes over diff --git a/dbt_subprojects/solana/models/solana_utils/solana_utils_epochs.sql b/dbt_subprojects/solana/models/solana_utils/solana_utils_epochs.sql index 746b78efa84..7e9ac9ba45a 100644 --- a/dbt_subprojects/solana/models/solana_utils/solana_utils_epochs.sql +++ b/dbt_subprojects/solana/models/solana_utils/solana_utils_epochs.sql @@ -2,11 +2,9 @@ config( schema = 'solana_utils', alias = 'epochs', - materialized='incremental', + materialized='table', file_format = 'delta', - incremental_strategy = 'merge', unique_key = ['block_slot'], - incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')], post_hook='{{ expose_spells(\'["solana"]\', "sector", "solana_utils", @@ -25,9 +23,6 @@ with order by slot desc) as last_block_epoch , slot % 432000 as epoch_progress --blocks into epoch. might not always start at 0 because of skipped block slots. remember "height" shows actual non-skipped blocks but epoch follows total blocks. FROM {{ source('solana','blocks') }} - {% if is_incremental() %} - WHERE {{incremental_predicate('time')}} - {% endif %} ) SELECT diff --git a/dbt_subprojects/tokens/models/prices/base/prices_base_tokens.sql b/dbt_subprojects/tokens/models/prices/base/prices_base_tokens.sql index bfebc7628e9..0c9a117d4c8 100644 --- a/dbt_subprojects/tokens/models/prices/base/prices_base_tokens.sql +++ b/dbt_subprojects/tokens/models/prices/base/prices_base_tokens.sql @@ -140,5 +140,7 @@ FROM ('timi-this-is-my-iguana','base','TIMI',0x9beec80e62aa257ced8b0edd8692f79ee8783777, 18), ('french-french-on-base','base','FRENCH',0x013b6451e2b2131052d3473593bd786df5143faf, 18), ('mrsmiggles-mrs-miggles','base','MRSMIGGLES',0x31b28012f61fc3600e1c076bafc9fd997fb2da90, 18), - ('king-king-of-memes','base','KING',0x420b0fa3de2efcf2b2fd04152eb1df36a09717cd, 18) + ('king-king-of-memes','base','KING',0x420b0fa3de2efcf2b2fd04152eb1df36a09717cd, 18), + ('trump-maga','base','TRUMP',0x2e1d332893dc16124194e598a29866d2d5e8786b, 18), + ('donuts-the-simpsons','base','DONUTS',0xcc0733b7ba63b446624002441c4816d7fec8f4e0, 18) ) as temp (token_id, blockchain, symbol, contract_address, decimals) diff --git a/sources/safe/linea/safe_linea_sources.yml b/sources/safe/linea/safe_linea_sources.yml new file mode 100644 index 00000000000..886b18edb41 --- /dev/null +++ b/sources/safe/linea/safe_linea_sources.yml @@ -0,0 +1,45 @@ +version: 2 + +sources: + - name: gnosis_safe_linea + freshness: + warn_after: { count: 12, period: hour } + tables: + - name: SafeProxyFactoryv_1_3_0_evt_ProxyCreation + loaded_at_field: evt_block_time + description: "Safe v1.3.0 factory ProxyCreation events" + columns: + - &contract_address + name: contract_address + description: "Contract address" + - &evt_block_number + name: evt_block_number + description: "Event block number" + - &evt_block_time + name: evt_block_time + description: "Event block time" + - &evt_index + name: evt_index + description: "Event index" + - &evt_tx_hash + name: evt_tx_hash + description: "Event tx hash" + - &proxy + name: proxy + description: "Address of created Safe proxy" + - &singleton + name: singleton + description: "Singleton" + - name: SafeProxyFactoryv_1_4_1_evt_ProxyCreation + loaded_at_field: evt_block_time + description: "Safe v1.4.1 factory ProxyCreation events" + columns: + - *contract_address + - *evt_block_number + - *evt_block_time + - *evt_index + - *evt_tx_hash + - name: proxy + description: "Address of created Safe proxy" + - name: singleton + description: "Singleton" \ No newline at end of file diff --git a/sources/zksync/zksync_zksync_sources.yml b/sources/zksync/zksync_zksync_sources.yml new file mode 100644 index 00000000000..92302045702 --- /dev/null +++ b/sources/zksync/zksync_zksync_sources.yml @@ -0,0 +1,9 @@ +version: 2 + +sources: + - name: zksync_era_zksync + description: > + ZKsync contracts on ZKsync Era + tables: + - name: ZkMerkleDistributor_evt_Claimed + loaded_at_field: evt_block_time