Skip to content

Commit

Permalink
Filtered out un verified stablecoin transfers and accounts (#460)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunny77D authored Sep 4, 2024
1 parent 288852f commit a96dd8f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions models/projects/ton/raw/ez_ton_stablecoin_transfers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ select
fact_ton_stablecoin_contracts.contract_address
from
{{ ref('fact_ton_stablecoin_transfers') }} as transfers
where dest_verified and source_verified and account_verified
left join
pc_dbt_db.prod.fact_ton_stablecoin_contracts
on lower(transfers.symbol)
Expand Down
6 changes: 6 additions & 0 deletions models/staging/ton/fact_ton_stablecoin_transfers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ with raw_data as (
, source_json:"decimals"::int as decimal
, source_json:"symbol"::string as symbol
, source_json:"trace_id"::string as trace_id
, source_json:"dest_verified"::boolean as dest_verified
, source_json:"source_verified"::boolean as source_verified
, source_json:"account_verified"::boolean as account_verified
from
{{ source("PROD_LANDING", "raw_ton_stablecoin_transfers") }}
{% if is_incremental() %}
Expand All @@ -38,6 +41,9 @@ select
, max_by(trace_id, extraction_date) as trace_id
, max_by(decimal, extraction_date) as decimal
, case when (max_by(symbol, extraction_date) = 'USD₮' or max_by(url, extraction_date) = 'https://tether.to/usdt-ton.json') then 'USDT' else max_by(symbol, extraction_date) end as symbol
, max_by(dest_verified, extraction_date) as dest_verified
, max_by(source_verified, extraction_date) as source_verified
, max_by(account_verified, extraction_date) as account_verified
from raw_data
where
from_address is not null and
Expand Down

0 comments on commit a96dd8f

Please sign in to comment.