niloDaily Swap Volume of stETH to ETH
    Updated 2022-06-15
    with swap_in as (
    select
    block_timestamp,
    tx_id,
    from_address as user,
    case when token_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' then 'WETH' else 'stETH' end as token_in,
    amount_out as swap_in
    from ethereum.dex_swaps
    where direction = 'OUT'
    and pool_address = '0xdc24316b9ae028f1497c275eb9192a3ea0f67022' --- Lido: Curve Liquidity Farming Pool Contract
    ),
    swap_out as (
    select
    block_timestamp,
    tx_id,
    from_address as user,
    case when token_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' then 'WETH' else 'stETH' end as token_out,
    amount_in as swap_out
    from ethereum.dex_swaps
    where direction = 'IN'
    and pool_address = '0xdc24316b9ae028f1497c275eb9192a3ea0f67022'
    ),
    swaps as (
    select
    a.block_timestamp,
    a.tx_id,
    a.user,
    token_in,
    token_out,
    swap_in,
    swap_out,
    swap_out-swap_in as gain,
    gain*100/(swap_in) as gain_percentage
    from swap_in a join swap_out b on a.tx_id = b.tx_id and token_in != token_out
    where gain is not null
    and abs(gain_percentage) <= 10