mariyabLUNA/LUNA withdraw (Terraswap vs provideliquidity in astroport)
    Updated 2022-02-06
    with withdraw_from_terra_swap as (
    select date_trunc('day',block_timestamp) as date ,sum(msg_value:execute_msg:send:amount/1e6) as amount from terra.msgs
    where msg_value:contract = 'terra1nuy34nwnsh53ygpc4xprlj263cztw7vc99leh2'
    and msg_value:execute_msg:send:amount is not NULL
    and block_timestamp >= '2021-12-27'
    and tx_status = 'SUCCEEDED'
    group by 1
    ),
    provider_to_astro as (
    select
    date_trunc('day',block_timestamp) as date,
    sum(event_attributes:"0_amount"/1e6) as amount
    from terra.msg_events
    where event_attributes:"0_contract_address" = 'terra1j66jatn3k50hjtg2xemnjm8s7y8dws9xqa5y8w'
    AND event_attributes:"0_action" = 'provide_liquidity'
    and block_timestamp >= '2021-12-27'
    group by 1
    )
    select withdraw_from_terra_swap.date , withdraw_from_terra_swap.amount as terra_swap_withdraw_amount ,
    provider_to_astro.amount as astroport_provide_liquidity_amount
    from withdraw_from_terra_swap INNER join provider_to_astro
    on withdraw_from_terra_swap.date = provider_to_astro.date
    GROUP by 1,2,3
    Run a query to Download Data