Pendlelp_pendle_daily_rewards
    Updated 2025-01-24
    with lp_addresses as (
    select address from $query('234128e1-a051-40f2-b1fa-6e5066ccfef6')
    )
    select market_address, user,
    date_trunc('day', block_timestamp) as dt,
    sum(pendle_amount/1E18) as pendle_amount
    from
    (
    select tx_hash, block_timestamp,
    contract_address as market_address,
    decoded_log['user'] as user,
    cast(decoded_log['rewardsOut'][array_size(decoded_log['rewardsOut']) - 1] as bigint) as pendle_amount,
    from ethereum.core.ez_decoded_event_logs
    where contract_address in (
    select * from lp_addresses
    )
    and event_name = 'RedeemRewards'

    union all

    select tx_hash, block_timestamp,
    contract_address as market_address,
    decoded_log['user'] as user,
    cast(decoded_log['rewardsOut'][array_size(decoded_log['rewardsOut']) - 1] as bigint) as pendle_amount,
    from arbitrum.core.ez_decoded_event_logs
    where contract_address in (
    select * from lp_addresses
    )
    and event_name = 'RedeemRewards'

    union all

    select tx_hash, block_timestamp,
    contract_address as market_address,
    decoded_log['user'] as user,
    cast(decoded_log['rewardsOut'][array_size(decoded_log['rewardsOut']) - 1] as bigint) as pendle_amount,
    QueryRunArchived: QueryRun has been archived