kidaCeler LP Activities (ETH)
    Updated 2023-01-05
    with
    lp_addresses as (
    select '0xc578cbaf5a411dfa9f0d227f97dadaa4074ad062' as lp_address
    union
    select '0x841ce48f9446c8e281d3f1444cb859b4a6d0738c' as lp_address
    union
    select '0x5427fefa711eff984124bfbb1ab6fbf5e3da1820' as lp_address
    ),

    liquidity_actions as (
    select distinct tx_hash
    from ethereum.core.fact_event_logs
    where (event_name = 'LiquidityAdded' or event_name = 'WithdrawDone' ) and exists(select 1 from lp_addresses where lp_address = origin_to_address)
    ),
    prices as (
    select
    date(hour) as date,
    decimals,
    symbol,
    token_address,
    avg(price) as price
    from ethereum.core.fact_hourly_token_prices
    group by date, decimals, symbol, token_address
    )

    select
    t.block_timestamp::date as date,

    'ethereum' as chain,
    sum(case when exists(select 1 from lp_addresses where lp_address = from_address) then 0 else raw_amount end *
    p.price /
    pow(10, p.decimals)) as deposit,
    count(distinct iff(exists(select 1 from lp_addresses where lp_address = to_address), tx_hash, null)) as deposit_count,
    Run a query to Download Data