mondov2023-06-11 09:54 PM
    Updated 2023-06-11
    SELECT
    coalesce (project_name, TRY_PARSE_JSON(a.args):receiver_id) as project,
    count (distinct t.tx_hash) as TX_Count,
    count (distinct t.tx_Signer) as Users_count,
    tx_count/users_count as average_tx_per_user
    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 = 'defi' AND tx_status = 'Success'
    GROUP BY project
    ORDER BY users_count DESC;
    Run a query to Download Data