Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridges: fixing transfers #682

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 78 additions & 78 deletions macros/rolling_active_addresses.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions models/projects/synapse/raw/ez_synapse_bridge_transfers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions seeds/chain_ids.csv
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ id,chain
534352,scroll
34443,mode
1135,lisk
480,worldchain
Loading