diff --git a/queries/orderbook/quote_rewards.sql b/queries/orderbook/quote_rewards.sql index cae67269..723a1d43 100644 --- a/queries/orderbook/quote_rewards.sql +++ b/queries/orderbook/quote_rewards.sql @@ -3,7 +3,10 @@ with winning_quotes as (SELECT concat('0x', encode(oq.solver, 'hex')) as solver, FROM trades t INNER JOIN orders o ON order_uid = uid JOIN order_quotes oq ON t.order_uid = oq.order_uid - WHERE block_number >= {{start_block}} AND block_number <= {{end_block}} + WHERE ((o.kind = 'sell' AND o.buy_amount <= oq.buy_amount) + OR (o.kind='buy' AND o.sell_amount >= oq.sell_amount)) + AND o.partially_fillable='f' + AND block_number >= {{start_block}} AND block_number <= {{end_block}} AND oq.solver != '\x0000000000000000000000000000000000000000') SELECT solver, count(*) AS num_quotes