mucrypto2023-06-04 07:07 PM
    with added as (select
    date_trunc('month', block_timestamp) as month,
    tx_hash,
    decoded_log,
    decoded_log:token_amounts[0]/1e6 as usdt_amount_adj, --https://etherscan.io/token/0xdac17f958d2ee523a2206206994597c13d831ec7
    decoded_log:token_amounts[1]/1e8 as wbtc_amount_adj, --https://etherscan.io/token/0x2260fac5e5542a773aa44fbcfedf7c193bc2c599
    decoded_log:token_amounts[2]/1e18 as weth_amount_adj, --https://etherscan.io/token/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
    '0' as crv3crypto_adj,
    decoded_log:fee / pow(10,18)::string as fee_adj,
    decoded_log:provider::string as receiver
    from ethereum.core.ez_decoded_event_logs
    where contract_address = '0xd51a44d3fae010294c616388b506acda1bfaae46' --Curve's tricrypto2 pool; https://curve.fi/#/ethereum/pools/tricrypto2/deposit
    and event_name = 'AddLiquidity'),

    added_vol as (select
    month,
    sum(usdt_amount_adj as added_usdt_vol)
    from added
    group by 1)

    with rl as (
    select
    date_trunc('month', block_timestamp) as month,
    tx_hash,
    decoded_log,
    decoded_log:token_amounts[0]/1e6 as usdt_amount_adj,
    decoded_log:token_amounts[1]/1e8 as wbtc_amount_adj,
    decoded_log:token_amounts[2]/1e18 as weth_amount_adj,
    '0' as crv3crypto_adj,
    '0' as fee_adj,
    decoded_log:provider::string as receiver
    from ethereum.core.ez_decoded_event_logs
    where contract_address = '0xd51a44d3fae010294c616388b506acda1bfaae46'
    and event_name = 'RemoveLiquidity'
    )

    Run a query to Download Data