adriaparcerisas Have staking rewards impacted the amount of $RUNE bonded or in LPs? 2
    Updated 2024-07-02
    WITH
    rune_in_pools as (
    select
    trunc(block_timestamp,'month') as date,
    --distinct from_address as users,
    sum(rune_amount_usd) as rune_deposited
    from thorchain.defi.fact_liquidity_actions
    where lp_action = 'add_liquidity'
    group by 1
    ),
    rune_out_pools as (
    select
    trunc(block_timestamp,'month') as date,
    --distinct from_address as users,
    sum(rune_amount_usd) as rune_removed
    from thorchain.defi.fact_liquidity_actions
    where lp_action = 'remove_liquidity'
    group by 1
    ),
    final_pools as (
    SELECT
    --x.users,
    x.date,
    rune_deposited-rune_removed as daily_lp_rune,
    sum(daily_lp_rune) over (order by x.date) as current_rune_lp
    from rune_in_pools x
    left join rune_out_pools y on x.date=y.date
    --where x.users in (select users_adding from users)
    --having current_lp_rune >0

    ),
    srewards as (
    SELECT
    trunc(block_timestamp,'month') as date,
    sum(liq_fee_rune_usd+liq_fee_asset_usd) as revenues,
    revenues*0.75 as thor_stakers_revenues
    QueryRunArchived: QueryRun has been archived