kiacryptoremove amount from each SushiSwap pool
    Updated 2022-10-02
    with remove_lp as (
    select
    case when e.block_timestamp::date = '2022-09-15' then 'The merge' when e.block_number >= 15537393 then 'After the merge' else 'Before the merge' end as type,
    e.contract_address as pool_address,
    sum(t.amount_usd) as remove_liquidity_usd
    from ethereum.core.fact_event_logs e join ethereum.core.ez_token_transfers t on e.tx_hash = t.tx_hash
    where
    e.origin_to_address = '0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f' and
    e.block_timestamp::date between '2022-09-01' and '2022-10-01' and
    event_name = 'Transfer' and
    event_inputs:from::string = '0x0000000000000000000000000000000000000000' and
    e.origin_function_signature in (
    '0x5b0d5984', -- removeLiquidityETHWithPermitSupportingFeeOnTransferTokens
    '0xbaa2abde', -- removeLiquidity
    '0x2195995c', -- removeLiquidityWithPermit
    '0xded9382a', -- removeLiquidityETHWithPermit
    '0x02751cec' -- removeLiquidityETH
    ) and
    t.amount_usd > 0
    group by 1, 2

    union all

    select
    case when e.block_timestamp::date = '2022-09-15' then 'The merge' when e.block_number >= 15537393 then 'After the merge' else 'Before the merge' end as type,
    e.contract_address as pool_address,
    sum(t.amount_usd) as remove_liquidity_usd
    from ethereum.core.fact_event_logs e join ethereum.core.ez_eth_transfers t on e.tx_hash = t.tx_hash
    where
    e.origin_to_address = '0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f' and
    e.block_timestamp::date between '2022-09-01' and '2022-10-01' and
    event_name = 'Transfer' and
    event_inputs:from::string = '0x0000000000000000000000000000000000000000' and
    e.origin_function_signature in (
    '0x5b0d5984', -- removeLiquidityETHWithPermitSupportingFeeOnTransferTokens
    '0xbaa2abde', -- removeLiquidity
    Run a query to Download Data