Query editor
SELECT * FROM (-- noqa: TMP-- This query is generated by code in https://github.com/cowprotocol/data-jobs-- This query provides data related to rewards/payouts on a per batch auction level-- for all auctions that had at least one winner.-- Parameters:-- : the chain for which we want to retrieve batch data-- The output has the following columns:-- environment: varchar-- auction_id: bigint-- block_number: bigint-- block_deadline: bigint-- tx_hash: varbinary-- solver: varbinary-- execution_cost: decimal(38, 0)-- surplus: decimal(38, 0)-- protocol_fee: decimal(38, 0)-- protocol_volume_fee: decimal(38, 0)-- network_fee: decimal(38, 0)-- uncapped_payment_native_token: decimal(38, 0)-- capped_payment: decimal(38, 0)-- consistency_budget_contribution: decimal(38, 0)-- winning_score: decimal(38, 0)-- reference_score: decimal(38, 0)-- DISCLAIMER: All entries with auction_id = -1000 are invalidwithpast_batch_data_ethereum as (selects.environment,cast(null as bigint) as auction_id,cast(d.block_number as bigint) as block_number,cast(d.block_deadline as bigint) as block_deadline,cast(from_hex(d.tx_hash) as varbinary) as tx_hash,cast(from_hex(d.solver) as varbinary) as solver,cast(d.data.execution_cost as decimal(38, 0)) as execution_cost, --noqa: RF01cast(d.data.surplus as decimal(38, 0)) as surplus, --noqa: RF01cast(d.data.protocol_fee as decimal(38, 0)) as protocol_fee, --noqa: RF01cast(d.data.fee as decimal(38, 0)) as network_fee, --noqa: RF01cast(d.data.uncapped_payment_eth as decimal(38, 0)) as uncapped_payment_native_token, --noqa: RF01cast(d.data.capped_payment as decimal(38, 0)) as capped_payment, --noqa: RF01cast(d.data.winning_score as decimal(38, 0)) as winning_score, --noqa: RF01cast(d.data.reference_score as decimal(38, 0)) as reference_score --noqa: RF01from cowswap.raw_batch_rewards as dinner join cow_protocol_ethereum.solvers as son d.solver = cast(s.address as varchar)where d.block_deadline < 20866925 -- cut-off for using the raw_batch_rewards table, more recent data is covered by unions belowunion allselectenvironment,cast(auction_id as bigint) as auction_id,cast(block_number as bigint) as block_number,cast(block_deadline as bigint) as block_deadline,cast(tx_hash as varbinary) as tx_hash,cast(solver as varbinary) as solver,cast(execution_cost as decimal(38, 0)) as execution_cost,