adriaparcerisasdau aptos contracts
    Updated 2024-12-13
    WITH
    daus as (
    SELECT
    distinct sender as users,
    trunc(block_timestamp,'week') as weeks,
    count(distinct trunc(block_timestamp,'day')) as active_days
    from aptos.core.fact_transactions
    group by 1,2
    having active_days>=4
    ),
    active_users as (
    SELECT
    trunc(x.block_timestamp,'week') as date,
    payload_function,
    count(distinct sender) as n_user,
    count(distinct x.tx_hash) as txs
    from aptos.core.fact_transactions x
    --join aptos.core.fact_events y on x.tx_hash=y.tx_hash
    where sender in (select users from daus)
    group by 1,2
    ),
    final as (
    select
    date,
    case when payload_function ilike '%vote%' then 'Vote'
    when payload_function ilike '%transfer%' then 'Transfer'
    when payload_function ilike '%swap%' then 'Swap'
    when payload_function ilike '%reward%' or payload_function ilike '%claim%' then 'Claim'
    when payload_function ilike '%eragon%' then 'Eragon-Checkin'
    when payload_function ilike '%Milestone%' or payload_function ilike '%increment%' then 'Increment'
    when payload_function ilike '%Mint%' then 'Mint'
    when payload_function ilike '%Liquidity%' or payload_function ilike '%Deposit%' or payload_function ilike '%Withdraw%' then 'Liquidity'
    when payload_function ilike '%Mint%' then 'Mint'
    when payload_function ilike '%stake%' then 'Staking'
    when payload_function ilike '%token%' or payload_function ilike '%price%' then 'Token'
    when payload_function ilike '%Tapos%' then 'Tapos Game'
    QueryRunArchived: QueryRun has been archived