Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
changes copied from solver-rewards related to layout
Browse files Browse the repository at this point in the history
  • Loading branch information
fhenneke committed Mar 7, 2024
1 parent ebcdfdf commit f8719fa
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/sql/orderbook/batch_rewards.sql
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,13 @@ order_protocol_fee AS (
-- impossible anyways. This query will return a division by
-- zero error in that case.
LEAST(
fp.max_volume_factor * os.sell_amount * os.buy_amount / (os.sell_amount - os.observed_fee), -- at most charge a fraction of volume
fp.max_volume_factor * os.sell_amount * os.buy_amount / (os.sell_amount - os.observed_fee),
-- at most charge a fraction of volume
fp.surplus_factor / (1 - fp.surplus_factor) * surplus -- charge a fraction of surplus
)
WHEN os.kind = 'buy' THEN LEAST(
fp.max_volume_factor / (1 + fp.max_volume_factor) * os.sell_amount, -- at most charge a fraction of volume
fp.max_volume_factor / (1 + fp.max_volume_factor) * os.sell_amount,
-- at most charge a fraction of volume
fp.surplus_factor / (1 - fp.surplus_factor) * surplus -- charge a fraction of surplus
)
END
Expand Down Expand Up @@ -186,11 +188,9 @@ reward_data AS (
0
) as network_fee_correction
FROM
settlement_scores ss
-- If there are reported scores,
settlement_scores ss -- If there are reported scores,
-- there will always be a record of auction participants
JOIN auction_participation ap ON ss.auction_id = ap.auction_id
-- outer joins made in order to capture non-existent settlements.
JOIN auction_participation ap ON ss.auction_id = ap.auction_id -- outer joins made in order to capture non-existent settlements.
LEFT OUTER JOIN observed_settlements os ON os.auction_id = ss.auction_id
LEFT OUTER JOIN batch_protocol_fees bpf ON bpf.tx_hash = os.tx_hash
),
Expand Down

0 comments on commit f8719fa

Please sign in to comment.