From 20afdbed8f42414efd5a1234ec665ed098a304b4 Mon Sep 17 00:00:00 2001 From: Felix Henneke Date: Wed, 10 Jan 2024 12:29:26 +0100 Subject: [PATCH] restrict orders which receive quote rewards - only orders where the amounts are below quoted amounts are eligible - only orders which are not partially fillable are eligible --- queries/orderbook/quote_rewards.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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