From b7d63a9e7a91e63577119a5bd38391d3f8ada5f7 Mon Sep 17 00:00:00 2001 From: Sebastian Melendez Date: Sun, 15 Dec 2024 23:13:24 -0500 Subject: [PATCH] fixing transfers --- macros/rolling_active_addresses.sql | 156 +++++++++--------- .../across/raw/ez_across_bridge_transfers.sql | 1 - .../raw/ez_synapse_bridge_transfers.sql | 4 +- seeds/chain_ids.csv | 1 + 4 files changed, 81 insertions(+), 81 deletions(-) diff --git a/macros/rolling_active_addresses.sql b/macros/rolling_active_addresses.sql index f26e625d..516b45dd 100644 --- a/macros/rolling_active_addresses.sql +++ b/macros/rolling_active_addresses.sql @@ -235,86 +235,86 @@ ), {% elif chain == 'aptos' %} single_signed_transactions as ( - select block_timestamp::date as date, parse_json(signature):public_key as signer - from aptos_flipside.core.fact_transactions - where - tx_type = 'user_transaction' - and success = 'true' - and parse_json(signature):public_key is not null - {% if is_incremental() %} - and block_timestamp::date > (select dateadd('day', -30, max(date)) from {{ this }}) - {% endif %} - ), - primary_multi_signed_transactions as ( - select - block_timestamp::date as date, - parse_json(signature):sender:public_key as signer - from aptos_flipside.core.fact_transactions - where - tx_type = 'user_transaction' - and success = 'true' - and parse_json(signature):sender is not null - {% if is_incremental() %} - and block_timestamp::date > (select dateadd('day', -30, max(date)) from {{ this }}) - {% endif %} - ), - raw_secondary_multi_signed_transactions as ( - select - block_timestamp, - parse_json(signature):secondary_signers as secondary_signers - from aptos_flipside.core.fact_transactions - where - tx_type = 'user_transaction' - and success = 'true' - and parse_json(signature):secondary_signers is not null + select block_timestamp::date as date, parse_json(signature):public_key as signer + from aptos_flipside.core.fact_transactions + where + tx_type = 'user_transaction' + and success = 'true' + and parse_json(signature):public_key is not null + {% if is_incremental() %} + and block_timestamp::date > (select dateadd('day', -30, max(date)) from {{ this }}) + {% endif %} + ), + primary_multi_signed_transactions as ( + select + block_timestamp::date as date, + parse_json(signature):sender:public_key as signer + from aptos_flipside.core.fact_transactions + where + tx_type = 'user_transaction' + and success = 'true' + and parse_json(signature):sender is not null + {% if is_incremental() %} + and block_timestamp::date > (select dateadd('day', -30, max(date)) from {{ this }}) + {% endif %} + ), + raw_secondary_multi_signed_transactions as ( + select + block_timestamp, + parse_json(signature):secondary_signers as secondary_signers + from aptos_flipside.core.fact_transactions + where + tx_type = 'user_transaction' + and success = 'true' + and parse_json(signature):secondary_signers is not null + {% if is_incremental() %} + and block_timestamp::date > (select dateadd('day', -30, max(date)) from {{ this }}) + {% endif %} + ), + secondary_multi_signed_transactions as ( + select block_timestamp::date as date, value:"public_key" as signer + from + raw_secondary_multi_signed_transactions, + lateral flatten(input => secondary_signers) + where value:"public_key" is not null + ), + raw_bitmap_multi_sig_transactions as ( + select block_timestamp::date as date, value:"public_keys" as public_keys + from + raw_secondary_multi_signed_transactions, + lateral flatten(input => secondary_signers) + ), + bitmap_multi_sig_transactions as ( + select date, value as signer + from raw_bitmap_multi_sig_transactions, lateral flatten(input => public_keys) + ), + combined_signers as ( + select date, signer + from single_signed_transactions + union all + select date, signer + from primary_multi_signed_transactions + union all + select date, signer + from secondary_multi_signed_transactions + union all + select date, signer + from bitmap_multi_sig_transactions + ), + distinct_dates as ( + select distinct + date as raw_date + from combined_signers {% if is_incremental() %} - and block_timestamp::date > (select dateadd('day', -30, max(date)) from {{ this }}) + where raw_date > (select dateadd('day', -1, max(date)) from {{ this }}) {% endif %} - ), - secondary_multi_signed_transactions as ( - select block_timestamp::date as date, value:"public_key" as signer - from - raw_secondary_multi_signed_transactions, - lateral flatten(input => secondary_signers) - where value:"public_key" is not null - ), - raw_bitmap_multi_sig_transactions as ( - select block_timestamp::date as date, value:"public_keys" as public_keys - from - raw_secondary_multi_signed_transactions, - lateral flatten(input => secondary_signers) - ), - bitmap_multi_sig_transactions as ( - select date, value as signer - from raw_bitmap_multi_sig_transactions, lateral flatten(input => public_keys) - ), - combined_signers as ( - select date, signer - from single_signed_transactions - union all - select date, signer - from primary_multi_signed_transactions - union all - select date, signer - from secondary_multi_signed_transactions - union all - select date, signer - from bitmap_multi_sig_transactions - ), - distinct_dates as ( - select distinct - date as raw_date - from combined_signers - {% if is_incremental() %} - where raw_date > (select dateadd('day', -1, max(date)) from {{ this }}) - {% endif %} - ), - distinct_dates_for_rolling_active_address as ( - select distinct - date as raw_date - , signer as from_address - from combined_signers - ), + ), + distinct_dates_for_rolling_active_address as ( + select distinct + date as raw_date + , signer as from_address + from combined_signers + ), {% elif chain == 'zora' %} distinct_dates as ( select diff --git a/models/projects/across/raw/ez_across_bridge_transfers.sql b/models/projects/across/raw/ez_across_bridge_transfers.sql index 186d2854..c705eae0 100644 --- a/models/projects/across/raw/ez_across_bridge_transfers.sql +++ b/models/projects/across/raw/ez_across_bridge_transfers.sql @@ -27,4 +27,3 @@ select from {{ref('fact_across_transfers')}} t1 left join {{ref('chain_ids')}} t2 on t1.destination_chain_id = t2.id left join {{ref('chain_ids')}} t3 on t1.origin_chain_id = t3.id -limit 10 diff --git a/models/projects/synapse/raw/ez_synapse_bridge_transfers.sql b/models/projects/synapse/raw/ez_synapse_bridge_transfers.sql index 1cb6499b..b33fc77e 100644 --- a/models/projects/synapse/raw/ez_synapse_bridge_transfers.sql +++ b/models/projects/synapse/raw/ez_synapse_bridge_transfers.sql @@ -13,11 +13,11 @@ select s.chain as origin_chain , origin_tx_hash , origin_block_timestamp - , depositor as source_address + , depositor as origin_address , origin_token_address , origin_token_symbol , origin_token_amount - , d.chain as destiantion_chain + , d.chain as destination_chain , destination_tx_hash , destination_block_timestamp , recipient as destination_address diff --git a/seeds/chain_ids.csv b/seeds/chain_ids.csv index daa440cd..69e53474 100644 --- a/seeds/chain_ids.csv +++ b/seeds/chain_ids.csv @@ -24,3 +24,4 @@ id,chain 534352,scroll 34443,mode 1135,lisk +480,worldchain