MeirFrax Convex Staking
    Updated 2023-11-21
    -- 0xE7211E87D60177575846936F2123b5FA6f0ce8Ab staking contract for frax


    with dates as (
    select
    date_day
    from ethereum.core.dim_dates
    where date_day between '{{start_date}}' and current_date()
    ),

    deposits as (

    SELECT
    block_timestamp,
    (TO_NUMBER(DECODED_LOG:amount::string) / POW(10,18)) as staked_amount,
    DECODED_LOG:source_address::string as user,
    tx_hash
    FROM ethereum.core.ez_decoded_event_logs
    WHERE CONTRACT_ADDRESS = lower('{{frax_staking_contraxt}}')
    AND EVENT_NAME = 'StakeLocked'
    ),

    withdraws as (
    SELECT
    block_timestamp,
    (TO_NUMBER(DECODED_LOG:liquidity::string) / POW(10,18)) as withdrawn_amount,
    DECODED_LOG:destination_address::string as user,
    tx_hash
    FROM ethereum.core.ez_decoded_event_logs
    WHERE CONTRACT_ADDRESS = lower('{{frax_staking_contraxt}}')
    AND EVENT_NAME = 'WithdrawLocked'
    ),

    frax_actions as (
    SELECT
    block_timestamp,
    Run a query to Download Data