Query editor
-- This query used incompatible data types from Dune SQL alpha and may need to be updated.-- More details can be found on https://dune.com/docs/query/dunesql-changes/SELECT * FROM cow_protocol_ethereum.solversLIMIT 1000-- WITH solver_info as (-- SELECT-- name,-- max(block_time) last_solution,-- count(*) as batches_solved,-- sum(dex_swaps) as dex_swaps,-- sum(num_trades) as num_trades,-- sum(gas_used) as gas_used,-- sum(batch_value) as total_batch_value,-- avg(batch_value) as average_batch_volume,-- avg(num_trades) as average_batch_size-- FROM cow_protocol_ethereum.batches b-- JOIN cow_protocol_ethereum.solvers-- ON solver_address = address-- WHERE environment not in ('test', 'service')-- and block_date > now() - interval '{{LastNDays}}' day-- and active = True-- GROUP BY name-- ),-- info_results as (-- SELECT-- name as solver_name,-- -- concat(environment, '-', name) as solver_name,-- last_solution,-- batches_solved,-- num_trades,-- dex_swaps,-- total_batch_value,-- 1.0 * gas_used / num_trades as average_gas_per_trade,-- 1.0 * dex_swaps / num_trades as average_dex_swaps_per_trade,-- average_batch_size,-- average_batch_volume-- FROM solver_info-- -- JOIN cow_protocol_ethereum.solvers-- -- ON solver_address = address-- -- WHERE active = True-- -- AND environment not in ('test', 'service')-- ORDER BY num_trades DESC-- )-- -- --- Next for Surplus Computation-- -- batches_with_nested_uids_and_trades AS (-- -- SELECT call_tx_hash,-- -- array_agg(-- -- "orderUid"-- -- ORDER BY evt_index ASC-- -- ) as uids,-- -- (-- -- select jsonb_agg(t->'sellAmount')-- -- from jsonb_array_elements(trades) as x(t)-- -- ) as sell_amount_limits,-- -- (-- -- select jsonb_agg(t->'buyAmount')-- -- from jsonb_array_elements(trades) as x(t)