pecio222TMStaking users princess
    Updated 2024-12-17
    -- forked from TMStaking users boner @ https://flipsidecrypto.xyz/studio/queries/d46d8b10-6328-45bf-ada1-3147bfe4a4e0

    with all_staking_updates as (
    select
    tx_hash,
    ORIGIN_FROM_ADDRESS,
    DATE_TRUNC('HOUR', block_timestamp) AS DAY,
    concat('0x', SUBSTR(topics [2], 27, 40)) as token,
    ethereum.public.udf_hex_to_int('s2c', concat('0x', SUBSTR(data, 3, 64))) as staking_amount,
    ethereum.public.udf_hex_to_int('s2c', concat('0x', SUBSTR(data, 67, 64))) as vesting_amount,
    from
    avalanche.core.fact_event_logs
    where
    topics [0] = '0x885f8a20123cf81bbcf1b6db2ea5f37ab88bf3d3a94bf8754c611a60dee15bf1'
    and contract_address = lower('0xF2C15BD1BF3d7863A4b6d72F89758c18489794Aa')
    ),
    token_staking as (
    select
    ORIGIN_FROM_ADDRESS
    from
    all_staking_updates
    where
    token = lower('0xB310Ed3A7F4Ae79E59dCa99784b312c2D19fFC7C')
    ),
    all_swaps as (
    select
    tx_hash,
    DATE_TRUNC('HOUR', block_timestamp) AS DAY,
    ethereum.public.udf_hex_to_int('s2c', concat('0x', SUBSTR(data, 3, 64))) as baseAmount,
    ethereum.public.udf_hex_to_int('s2c', concat('0x', SUBSTR(data, 67, 64))) as quoteAmount,
    origin_from_address,
    contract_address
    from
    avalanche.core.fact_event_logs
    where
    contract_address = lower('0x5f02a83b937a04ed0615f1e6ebec7cddcd11abed')
    QueryRunArchived: QueryRun has been archived