Query editor
with ausdc as (select evt_block_time, evt_tx_hash, cast(value as double) as quantityfrom erc20_arbitrum.evt_Transferwhere contract_address = 0x724dc807b04555b71ed48a6896b6F41593b8C637and "from" = 0x91beb5c41df001175b588c9510327d53f278972aUNION ALLselect evt_block_time, evt_tx_hash, -cast(value as double) as quantityfrom erc20_arbitrum.evt_Transferwhere contract_address = 0x724dc807b04555b71ed48a6896b6F41593b8C637and "to" = 0x91beb5c41df001175b588c9510327d53f278972a),fusdc as (select evt_block_time, evt_tx_hash, cast(value as double) as quantityfrom erc20_arbitrum.evt_Transferwhere contract_address = 0x4CFA50B7Ce747e2D61724fcAc57f24B748FF2b2Aand "from" = 0x0000000000000000000000000000000000000000UNION ALLselect evt_block_time, evt_tx_hash, -cast(value as double) as quantityfrom erc20_arbitrum.evt_Transferwhere contract_address = 0x4CFA50B7Ce747e2D61724fcAc57f24B748FF2b2Aand "to" = 0x0000000000000000000000000000000000000000),transfers as (select token, -sum(quantity / POW(10, decimals)) as total_transferredfrom(select quantity, 'aUSDC' as token, 6 as decimals from ausdcunion allselect quantity, 'fUSDC' as token, 6 as decimals from fusdc)group by token)select round(sum(total_transferred * coalesce(price, 1)), 2) as tvlfrom transfersleft join prices.usdon (symbol = tokenand blockchain = 'arbitrum')