marquw gov - voting power over time
    Updated 2025-03-28
    with

    delegateVotesChanged_txs as (

    select

    block_timestamp
    , tx_hash
    , concat('0x', right(topics[1], 40)) as delegate
    , utils.udf_hex_to_int(substr(data, 67, 64)) ::int / pow(10, 18) as new_votes
    , utils.udf_hex_to_int(substr(data, 3, 64)) ::int / pow(10, 18) as previous_votes
    , new_votes - previous_votes as change_votes
    , 'Ethereum' as chain

    from ethereum.core.fact_event_logs
    where tx_status = 'SUCCESS'
    and contract_address = '0xb0ffa8000886e57f86dd5264b9582b2ad87b2b91'
    and topics[0] = '0xdec2bacdd2f05b59de34da9b523dff8be42e5e38e818c82fdb0bae774387a724' -- DelegateVotesChanged
    and block_timestamp >= '2024-04-17'
    -- qualify row_number() over (partition by delegate order by block_timestamp desc) = 1

    union all

    select

    block_timestamp
    , tx_hash
    , concat('0x', right(topics[1], 40)) as delegate
    , utils.udf_hex_to_int(substr(data, 67, 64)) ::int / pow(10, 18) as new_votes
    , utils.udf_hex_to_int(substr(data, 3, 64)) ::int / pow(10, 18) as previous_votes
    , new_votes - previous_votes as change_votes
    , 'Arbitrum' as chain

    from arbitrum.core.fact_event_logs
    where tx_status = 'SUCCESS'
    and contract_address = '0xb0ffa8000886e57f86dd5264b9582b2ad87b2b91'
    Last run: about 1 month ago
    DATE
    Chain
    W Tokens
    Active Stake
    1
    2024-06-06 00:00:00.000Optimism779049.20933805853.320970839
    2
    2024-06-07 00:00:00.000Optimism1116148.3440011922001.66497184
    3
    2024-06-08 00:00:00.000Optimism1264572.0464913186573.71146284
    4
    2024-06-09 00:00:00.000Optimism1109503.2385764296076.95003884
    5
    2024-06-10 00:00:00.000Optimism1597843.724027265893920.6740661
    6
    2024-06-11 00:00:00.000Optimism-89395.4739445295804525.20012157
    7
    2024-06-12 00:00:00.000Optimism310891.7403006616115416.94042223
    8
    2024-06-13 00:00:00.000Optimism176910.2931959976292327.23361823
    9
    2024-06-14 00:00:00.000Optimism83956.6407688576376283.87438709
    10
    2024-06-15 00:00:00.000Optimism54085.3504655396430369.22485263
    11
    2024-06-16 00:00:00.000Optimism97355.0376832116527724.26253584
    12
    2024-06-17 00:00:00.000Optimism-110130.9527324396417593.3098034
    13
    2024-06-18 00:00:00.000Optimism128403.9991090416545997.30891244
    14
    2024-06-19 00:00:00.000Optimism194334.0157086516740331.32462109
    15
    2024-06-20 00:00:00.000Optimism63144.9996519786803476.32427307
    16
    2024-06-21 00:00:00.000Optimism52754.9720354286856231.2963085
    17
    2024-06-22 00:00:00.000Optimism35580.2130793696891811.50938786
    18
    2024-06-23 00:00:00.000Optimism28694.0854744296920505.59486229
    19
    2024-06-24 00:00:00.000Optimism196.2286859276920701.82354822
    20
    2024-06-25 00:00:00.000Optimism21632.7898353566942334.61338358
    ...
    1184
    82KB
    213s