Query editor
withstatic as (selecttimestamp '2023-10-01 00:00' as ts_from, 'day' as timeframe), settlements as (select blockchain, settlement_addressfrom dune."1inch".result_dict_fusion_settlements), settling as (select blockchain, tx_hash, "from" as resolver_executorfrom evms.traceswhereblock_time > (select ts_from from static)and tx_successand successand call_type = 'call'and substr(input, 1, 4) = 0x0965d04b -- settleOrdersand (blockchain, "to") in (select blockchain, settlement_address from settlements)), fills as (selectblockchain, block_time, tx_hash, resolver_executor, date_trunc('minute', block_time) as minute, date_trunc((select timeframe from static), block_time) as time, substr(call_input, 337, 20) as receiver -- maker, substr(call_input, 273, 20) as src_token_address -- src token address, bytearray_to_uint256(substr(call_output, 32*0 + 1, 32)) as src_amount -- the actual src amount from the output (when partial filling), substr(call_input, 305, 20) as dst_token_address -- dst token address, bytearray_to_uint256(substr(call_input, 453, 32)) as dst_min_return -- dst min return, bytearray_to_uint256(substr(call_output, 32*1 + 1, 32)) as dst_result_amount -- dst result amount, substr(call_output, 32*2 + 1, 32) as order_hashfrom settlingjoin oneinch.calls using(blockchain, tx_hash)whereblock_time > (select ts_from from static)and call_selector in (0xe5d7bde6) -- fillOrderToand (blockchain, call_from) in (select blockchain, settlement_address from settlements)and tx_successand call_success), prices_src as (selectblockchain, contract_address as src_token_address, minute, symbol as src_symbol, decimals as src_decimals, price as src_pricefrom prices.usdwhere minute > (select ts_from from static)