Query editor
with constants as (select * from query_5207063), transactions as (select * from dune.bob_dinkytown.result_infinifi_transactions where mode in ('revenue', 'yield')), swaps as (select tx_hashfrom transactionswheremode = 'revenue' andcontract_address in (select ca from constants where name='iUSD') andtx_hash in (select tx_hashfrom transactionswhere contract_address in (select ca from constants where name='USDC'))), revenue as (select block_time as date, amount as revenuefrom transactionswhere mode = 'revenue' and tx_hash not in (select tx_hash from swaps)), revenue_agg as (selectdate_trunc('month',date) as month,date_format(date, '%M, %Y') as date,sum(revenue) as revenuefrom revenuegroup by 1,2), yield as (select block_time as date, amount as yieldfrom transactionswhere mode = 'yield'), yield_agg as (selectdate_trunc('month',date) as month,date_format(date, '%M, %Y') as date,sum(yield) as yieldfrom yieldgroup by 1,2), revenue_and_yield as (select y.month, y.date, yield, revenuefrom yield_agg yfull outer join revenue_agg r on y.date = r.date and y.month = r.month)select * from revenue_and_yield order by month asc