Sbhn_NPfun-purple
    Updated 2025-02-16
    WITH price as (
    select hour::date as datee,
    avg(price) as usdprice
    from crosschain.price.ez_prices_hourly
    where symbol = 'OLAS'
    group by 1)

    select
    from_address as "Staker",
    concat('0x',substr(data,27,40)) as "Multisig",
    concat('0x', right(data,40)) as "StakingInstance",
    ethereum.public.udf_hex_to_int(substr(topics[2],3,len(topics[2]))) as "Social ID",
    ethereum.public.udf_hex_to_int(substr(topics[3],3,len(topics[3]))) as "Service ID",
    sum(amount) as "Staked $OLAS",
    sum(amount*usdprice) as "Staked USD",
    from base.core.fact_event_logs
    join base.core.ez_token_transfers b using(tx_hash)
    left join price on block_timestamp::date = datee
    where topics[0] = '0x2c50df9a1dea57a91edc18dc7b7d135675e66bca942cb9ab6009bc7647f09c64'
    and to_address = '0xaea9ef993d8a1a164397642648df43f053d43d85'
    group by 1,2,3,4,5



    -- select
    -- topics
    -- from base.core.fact_event_logs
    -- join base.core.ez_token_transfers b using(tx_hash)
    -- where topics[0] = '0x2c50df9a1dea57a91edc18dc7b7d135675e66bca942cb9ab6009bc7647f09c64'
    -- and to_address = '0xaea9ef993d8a1a164397642648df43f053d43d85'
    -- and tx_hash = '0xdc219ef6ec9040da865574428b32034fa189a485d7c5c5681048fd6289c79c40'


    QueryRunArchived: QueryRun has been archived