mondov2023-06-11 10:42 PM
    SELECT date_trunc('day', t.block_timestamp) as date,
    coalesce (project_name, TRY_PARSE_JSON(a.args):receiver_id) as cex,
    sum(TRY_PARSE_JSON(a.args):amount) as amount,
    count (distinct t.tx_hash) as TX_Count,
    count (distinct t.tx_Signer) as Users_count
    FROM near.core.fact_transactions t
    join near.core.fact_actions_events_function_call a on t.tx_hash = a.tx_hash
    join near.core.dim_address_labels l on TRY_PARSE_JSON(a.args):receiver_id = l.address
    WHERE (lower(t.tx_receiver) LIKE 'dac17f958d2ee523a2206206994597c13d831ec7.factory.bridge.near'
    OR lower(t.tx_receiver) LIKE 'dac17f958d2ee523a2206206994597c13d831ec7.factory.bridge.near')
    AND t.block_timestamp >= current_date - {{past_days}} AND label_type = 'cex'
    GROUP BY date, cex
    ORDER BY date;
    Run a query to Download Data