Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove market order references #409

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions queries/orderbook/quote_rewards.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ with winning_quotes as (
JOIN order_quotes oq ON t.order_uid = oq.order_uid
WHERE
(
o.class = 'market'
OR (
(
o.kind = 'sell'
AND (
oq.sell_amount - oq.gas_amount * oq.gas_price / oq.sell_token_price
Expand Down
6 changes: 2 additions & 4 deletions tests/queries/batch_rewards_test_db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ CREATE TABLE IF NOT EXISTS auction_prices

-- orders table
CREATE TYPE OrderKind AS ENUM ('buy', 'sell');
CREATE TYPE OrderClass AS ENUM ('market', 'limit');
CREATE TYPE OrderClass AS ENUM ('limit');

CREATE TABLE orders (
uid bytea PRIMARY KEY,
Expand Down Expand Up @@ -223,9 +223,7 @@ VALUES (51, '\x01', 500000000000000000000000000),
(60, '\x02', 500000000000000);

INSERT INTO orders (uid, sell_token, buy_token, sell_amount, buy_amount, fee_amount, kind, partially_fillable, full_fee_amount, class, app_data)
VALUES ('\x01'::bytea, '\x01'::bytea, '\x02'::bytea, 95000000, 94000000000000000000, 5000000, 'sell', 'f', 5000000, 'market', '\x0000000000000000000000000000000000000000000000000000000000000000'::bytea), -- sell market order
('\x02'::bytea, '\x01'::bytea, '\x02'::bytea, 101000000, 100000000000000000000, 5000000, 'buy', 'f', 5000000, 'market', '\x0000000000000000000000000000000000000000000000000000000000000000'::bytea), -- buy market order
('\x03'::bytea, '\x01'::bytea, '\x02'::bytea, 100000000, 100000000000000000000, 0, 'sell', 't', 0, 'limit', '\x0000000000000000000000000000000000000000000000000000000000000000'::bytea), -- partially fillable sell limit order
VALUES ('\x03'::bytea, '\x01'::bytea, '\x02'::bytea, 100000000, 100000000000000000000, 0, 'sell', 't', 0, 'limit', '\x0000000000000000000000000000000000000000000000000000000000000000'::bytea), -- partially fillable sell limit order
('\x04'::bytea, '\x01'::bytea, '\x02'::bytea, 100000000, 100000000000000000000, 0, 'buy', 't', 0, 'limit', '\x0000000000000000000000000000000000000000000000000000000000000000'::bytea), -- partially fillable buy limit order
('\x05'::bytea, '\x01'::bytea, '\x02'::bytea, 100000000, 94000000000000000000, 0, 'sell', 'f', 0, 'limit', '\xd3418777a6ec517d7310b05a2a22f3737524ae0302d1f88230f4e066a1768b74'::bytea), -- in market sell limit order with volume-based partner fee of 45bps. An example of a real order with same appdata can be found here: https://explorer.cow.fi/orders/0x398510f3b0b35c0712d3caef470f036a4fead3d21b5a37280698484a197a5da45543dc0694384bd9a7c585027d436c4daacc95c7661c7213?tab=overview
('\x06'::bytea, '\x01'::bytea, '\x02'::bytea, 106000000, 100000000000000000000, 0, 'buy', 'f', 0, 'limit', '\x0000000000000000000000000000000000000000000000000000000000000000'::bytea), -- in market buy limit order
Expand Down
14 changes: 4 additions & 10 deletions tests/queries/quote_rewards_test_db.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ DROP TABLE IF EXISTS trades;

-- orders table
CREATE TYPE OrderKind AS ENUM ('buy', 'sell');
CREATE TYPE OrderClass AS ENUM ('market', 'limit');
CREATE TYPE OrderClass AS ENUM ('limit');

CREATE TABLE IF NOT EXISTS orders
(
Expand Down Expand Up @@ -50,25 +50,19 @@ TRUNCATE trades;


INSERT INTO orders (uid, sell_amount, buy_amount, fee_amount, kind, partially_fillable, class)
VALUES ('\x01'::bytea, 95000000, 94000000000000000000, 5000000, 'sell', 'f', 'market'), -- normal sell market order
('\x02'::bytea, 101000000, 100000000000000000000, 5000000, 'buy', 'f', 'market'), -- normal buy market order
('\x03'::bytea, 100000000, 100000000000000000000, 0, 'sell', 't', 'limit'), -- partially fillable sell limit order
VALUES ('\x03'::bytea, 100000000, 100000000000000000000, 0, 'sell', 't', 'limit'), -- partially fillable sell limit order
('\x04'::bytea, 100000000, 100000000000000000000, 0, 'buy', 't', 'limit'), -- partially fillable buy limit order
('\x05'::bytea, 100000000, 94000000000000000000, 0, 'sell', 'f', 'limit'), -- in market sell limit order
('\x06'::bytea, 106000000, 100000000000000000000, 0, 'buy', 'f', 'limit'); -- in market buy limit order

INSERT INTO order_quotes (order_uid, gas_amount, gas_price, sell_token_price, sell_amount, buy_amount, solver)
VALUES ('\x01'::bytea, 100000, 25000000000, 500000000., 95000000, 95000000000000000000, '\x01'::bytea),
('\x02'::bytea, 100000, 25000000000, 500000000., 100000000, 100000000000000000000, '\x02'::bytea),
('\x03'::bytea, 100000, 25000000000, 500000000., 100000000, 100000000000000000000, '\x03'::bytea),
VALUES ('\x03'::bytea, 100000, 25000000000, 500000000., 100000000, 100000000000000000000, '\x03'::bytea),
('\x04'::bytea, 100000, 25000000000, 500000000., 100000000, 100000000000000000000, '\x03'::bytea),
('\x05'::bytea, 100000, 25000000000, 500000000., 100000000, 100000000000000000000, '\x03'::bytea),
('\x06'::bytea, 100000, 25000000000, 500000000., 100000000, 100000000000000000000, '\x03'::bytea);

INSERT INTO trades (block_number, log_index, order_uid, sell_amount, buy_amount)
VALUES (1, 0, '\x01'::bytea, 100000000, 95000000000000000000),
(2, 0, '\x02'::bytea, 106000000, 100000000000000000000),
(3, 0, '\x03'::bytea, 100000000, 101000000000000000000),
VALUES (3, 0, '\x03'::bytea, 100000000, 101000000000000000000),
(4, 0, '\x04'::bytea, 99000000, 100000000000000000000),
(5, 0, '\x05'::bytea, 100000000, 95000000000000000000),
(6, 0, '\x06'::bytea, 105000000, 100000000000000000000);
Loading