maybeyonasnear_defi_degens
    Updated 2022-10-31
    with activity_data as (
    select
    tx_signer,
    count(
    case tx_receiver
    when 'v2.ref-finance.near' then t.tx_hash
    when 'boostfarm.ref-labs.near' then t.tx_hash
    when 'v2.ref-farming.near' then t.tx_hash
    else null end
    ) as ref_finance,
    count( distinct
    case method_name
    when 'ft_transfer' then tx_receiver
    when 'ft_transfer_call' then tx_receiver
    else null end
    ) as tokens,
    count(
    case method_name
    when 'ft_transfer' then t.tx_hash
    when 'ft_transfer_call' then t.tx_hash
    else null end
    ) as token_activity,
    count( distinct
    case split(tx_receiver,'.')[1]::string
    when 'poolv1' then tx_receiver
    when 'pool' then tx_receiver
    else null end
    ) as validators,
    count(
    case split(tx_receiver,'.')[1]::string
    when 'poolv1' then t.tx_hash
    Run a query to Download Data