CryptoIcicle15. Bribes
    Updated 2022-02-25
    -- What addresses have the most delegated vlCVX? Is Votium the largest player in the space?
    -- If so, is that just for retail? Or are their protocols that leverage Votium, as well?

    with
    relock_withdraw_txns as (
    select
    event_inputs:"_relocked" as relocked,
    event_inputs:"_amount"/1e18 as cvx_amount,
    *
    from ethereum.events_emitted
    where
    block_timestamp::date <= CURRENT_DATE - 90
    and tx_to_address = '0xd18140b4b819b895a3dba5442f959fa44994af50' -- Vote Locked Convex Token (vlCVX)
    and event_inputs:"_relocked" is not null
    ),
    relock_withdraw_addresses as (
    select
    block_timestamp::date as date,
    tx_from_address as address,
    sum(IFF(relocked = TRUE, cvx_amount, cvx_amount * -1)) as vlCVX_amount
    from relock_withdraw_txns
    group by tx_from_address,date
    ),
    lock_addresses as (
    select
    block_timestamp::date as date,
    from_address as address,
    sum(amount) as vlCVX_amount
    from ethereum.udm_events
    where to_address = '0xd18140b4b819b895a3dba5442f959fa44994af50'
    and origin_function_name = 'lock'
    and contract_address = '0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b'
    group by from_address,date
    ),
    combined_balances as (
    select
    Run a query to Download Data