MoDeFiGTC staking - stake over time
    Updated 34 minutes ago
    with
    prices as (
    select hour, token_address, price, decimals, symbol
    from arbitrum.price.ez_prices_hourly
    where token_address in ('0x912ce59144191c1204e64559fe8253a0e49e6548','0x4f604735c1cf31399c6e711d5962b2b3e0225ad3','0xaf88d065e77c8cc2239327c5edb3a432268e5831')
    union all
    select hour, '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee', price, 18, 'ETH'
    from arbitrum.price.ez_prices_hourly
    where token_address='0x82af49447d8a07e3bd95bd0d56f35241523fbab1'
    union all
    select hour, '0x7f9a7db853ca816b9a138aee3380ef34c437dee0', price, 18, symbol
    from ethereum.price.ez_prices_hourly
    where token_address='0xde30da39c46104798bb5aa3fe8b9e0e1f348163f'
    ),

    gtc_staking_lock as (
    select
    BLOCK_TIMESTAMP,
    '0x'||SUBSTR(TOPIC_1, 27, 40) as user,
    utils.udf_hex_to_int(SUBSTR(data, 3, 64)) AS chainId,
    utils.udf_hex_to_int(SUBSTR(data, 67, 64)) AS poolId,
    utils.udf_hex_to_int(SUBSTR(data, 131, 64))::decimal/1e18 AS amount,
    '0x'||SUBSTR(TOPIC_2, 27, 40) as project,
    TX_HASH
    from ethereum.core.fact_event_logs
    where CONTRACT_ADDRESS='0x73d7439ca441da0bed1020a1f1c88bd572f3d57c'
    and TX_SUCCEEDED=true
    and ORIGIN_FUNCTION_SIGNATURE='0x1a23008c'
    and BLOCK_TIMESTAMP::date>='2025-04-02')

    select date_trunc(day, BLOCK_TIMESTAMP) as "Date",
    count(distinct user) as "Stakers",
    count(distinct project) as "Projects",
    sum(amount) as "Amount",
    sum("Amount") over (order by "Date") as "Total Amount"
    from gtc_staking_lock
    Last run: 34 minutes agoAuto-refreshes every 1 hour
    Date
    Stakers
    Projects
    Amount
    Total Amount
    1
    2025-04-16 00:00:00.000364214610.783342685.733604
    2
    2025-04-12 00:00:00.00022172299.94321268.59919
    3
    2025-04-06 00:00:00.00080487539.772245105059.892859
    4
    2025-04-13 00:00:00.00023953638.57152324907.17071
    5
    2025-04-07 00:00:00.0001155465499.11818170559.011039
    6
    2025-04-02 00:00:00.000515426813.7319126813.73191
    7
    2025-04-09 00:00:00.000415718096.897476287257.25601
    8
    2025-04-14 00:00:00.00034671369.147894326276.318604
    9
    2025-04-11 00:00:00.000212718096.7234318968.65919
    10
    2025-04-03 00:00:00.0005014542063.07677868876.808688
    11
    2025-04-10 00:00:00.000276713614.67978300871.93579
    12
    2025-04-04 00:00:00.000573823320.24992197.057688
    13
    2025-04-05 00:00:00.00068315323.06292697520.120614
    14
    2025-04-08 00:00:00.00011823498601.347495269160.358534
    15
    2025-04-15 00:00:00.00038301798.632328074.950604
    15
    885B
    26s