MoDeFiGTC staking - stake over time by return or new
    Updated 2 hours ago
    with 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,
    rank() over (partition by user order by BLOCK_TIMESTAMP asc) as rank
    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",
    case when rank=1 then 'New Staking' else 'Returning Staking' end as "Type",
    count(distinct user) as "Stakers",
    count(distinct project) as "Projects",
    sum(amount) as "Amount",
    sum("Amount") over (partition by "Type" order by "Date" asc) as "Total Amount"
    from gtc_staking_lock
    group by 1,2


    Last run: about 2 hours agoAuto-refreshes every 1 hour
    Date
    Type
    Stakers
    Projects
    Amount
    Total Amount
    1
    2025-04-12 00:00:00.000New Staking20152192.94197018.09773
    2
    2025-04-02 00:00:00.000New Staking514914044.7319114044.73191
    3
    2025-04-09 00:00:00.000New Staking35488987.847476173690.35455
    4
    2025-04-16 00:00:00.000New Staking34337629.283208940.952044
    5
    2025-04-11 00:00:00.000New Staking192516473.1234194825.15773
    6
    2025-04-13 00:00:00.000New Staking20731576.77152198594.86925
    7
    2025-04-05 00:00:00.000New Staking65292299.85292643715.190614
    8
    2025-04-08 00:00:00.000Returning Staking327619627.0405104457.85146
    9
    2025-04-03 00:00:00.000New Staking4614315315.63677829360.368688
    10
    2025-04-10 00:00:00.000New Staking23594661.67978178352.03433
    11
    2025-04-14 00:00:00.000New Staking32651316.617794199911.487044
    12
    2025-04-07 00:00:00.000Returning Staking253026610.28784830.81096
    13
    2025-04-13 00:00:00.000Returning Staking9332061.8126312.30146
    14
    2025-04-04 00:00:00.000Returning Staking162211265.2850781.72
    15
    2025-04-02 00:00:00.000Returning Staking11161276912769
    16
    2025-04-16 00:00:00.000Returning Staking6196981.5133744.78156
    17
    2025-04-10 00:00:00.000Returning Staking8148953122519.90146
    18
    2025-04-14 00:00:00.000Returning Staking61152.5301126364.83156
    19
    2025-04-15 00:00:00.000New Staking33271400.182201311.669044
    20
    2025-04-15 00:00:00.000Returning Staking68398.45126763.28156
    30
    2KB
    29s