MoDeFinear aidols - top tokens mc over time
    Updated 2025-03-05
    with tokens_list as (
    select * from $query('f6dfb764-1ad5-4744-b69a-40d8ce173cf0')),

    aidols_tokens_transfers as (
    select BLOCK_TIMESTAMP, contract_address, symbol, from_address, to_address, amount, tx_hash
    from (
    select a.BLOCK_TIMESTAMP, RECEIVER_ID as contract_address, b.symbol, try_parse_json(CLEAN_LOG) as log,
    log:data[0]:old_owner_id::string as from_address,
    log:data[0]:new_owner_id as to_address,
    log:data[0]:amount/pow(10, b.decimals) as amount, a.tx_hash
    from near.core.fact_logs a
    join tokens_list b
    on token_address=RECEIVER_ID
    where a.BLOCK_TIMESTAMP::date>='2025-01-14'
    and EVENT_STANDARD='nep141'
    and RECEIPT_SUCCEEDED=true
    and log:event='ft_transfer'
    union all
    select a.BLOCK_TIMESTAMP, RECEIVER_ID as contract_address, b.symbol, try_parse_json(CLEAN_LOG) as log,
    'system'::string as from_address,
    log:data[0]:owner_id as to_address,
    log:data[0]:amount/pow(10, b.decimals) as amount, a.tx_hash
    from near.core.fact_logs a
    join tokens_list b
    on token_address=RECEIVER_ID
    where a.BLOCK_TIMESTAMP::date>='2025-01-14'
    and EVENT_STANDARD='nep141'
    and log:event='ft_mint'
    and RECEIPT_SUCCEEDED=true)
    ),
    -------
    ref_swaps as (
    select a.BLOCK_TIMESTAMP, trader,
    token_in_contract,
    QueryRunArchived: QueryRun has been archived