KeyrockAPT Staking 2
    Updated 2024-03-13
    -- forked from cristinatinto / VibrantX staking by platform @ https://flipsidecrypto.xyz/cristinatinto/q/EE-PLQCfScP7/vibrantx-staking-by-platform
    -- lending USDC 0x95f3c11ee99654cbf62db9598f477f8c421105d3c61aee3622b8a3e716f88ba7
    -- staking amnis 0x7a827d70d06f6a90d20fbdabfe2be6c1c066ef2e35568ec06c76deba24f4ec9a
    -- staking thala 0xd7156c7a23ffc6b7443ba2c394b931ca49db58884cbef20dad5e490e8d437d97
    --select * from aptos.core.fact_transactions
    --where payload_function='0x17f1e926a81639e9557f4e4934df93452945ec30bc962e11351db59eb0d78c33::amnis::stake'
    --tx_hash='0x7a827d70d06f6a90d20fbdabfe2be6c1c066ef2e35568ec06c76deba24f4ec9a'
    with prices as (
    SELECT
    HOUR,
    avg(PRICE) as price
    FROM
    aptos.price.ez_hourly_token_prices
    WHERE
    SYMBOL IN ('APT')
    AND hour >= '2024-01-01'
    GROUP by
    1
    )
    select
    trunc(block_timestamp, 'day') as day,
    case
    when payload_function = '0x17f1e926a81639e9557f4e4934df93452945ec30bc962e11351db59eb0d78c33::thala_lsd::stake' then 'Thala'
    else 'Amnis'
    end as provider,
    count(distinct tx_hash) as deposits,
    sum(deposits) over (
    partition by provider
    order by
    day
    ) as total_deposits,
    sum(payload:arguments [0] / pow(10, 8)) as apt_amount,
    sum(apt_amount) over (
    partition by provider
    order by
    day
    Auto-refreshes every 24 hours
    QueryRunArchived: QueryRun has been archived