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

Commit

Permalink
Merge pull request #80 from cowprotocol/cip_36
Browse files Browse the repository at this point in the history
Implement CIP-36
  • Loading branch information
fhenneke authored Feb 9, 2024
2 parents c2f6af7 + 10adb21 commit 58afd1e
Show file tree
Hide file tree
Showing 3 changed files with 191 additions and 126 deletions.
7 changes: 6 additions & 1 deletion src/fetch/orderbook.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,12 @@ def get_batch_rewards(cls, block_range: BlockRange) -> DataFrame:
open_query("orderbook/batch_rewards.sql")
.replace("{{start_block}}", str(block_range.block_from))
.replace("{{end_block}}", str(block_range.block_to))
.replace("{{EPSILON}}", "10000000000000000") # ETH cap for payment (in WEI)
.replace(
"{{EPSILON_LOWER}}", "10000000000000000"
) # lower ETH cap for payment (in WEI)
.replace(
"{{EPSILON_UPPER}}", "12000000000000000"
) # upper ETH cap for payment (in WEI)
)
data_types = {
# According to this: https://stackoverflow.com/a/11548224
Expand Down
6 changes: 3 additions & 3 deletions src/sql/orderbook/batch_rewards.sql
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ reward_per_auction as (
-- Capped Reward = CLAMP_[-E, E + exec_cost](uncapped_reward_eth)
LEAST(
GREATEST(
- {{EPSILON}},
- {{EPSILON_LOWER}},
surplus + protocol_fee + fee - network_fee_correction - reference_score
),
{{EPSILON}} + execution_cost
{{EPSILON_UPPER}} + execution_cost
) as capped_payment,
winning_score,
reference_score,
Expand All @@ -238,4 +238,4 @@ SELECT
reference_score :: text as reference_score,
participating_solvers
FROM
reward_per_auction
reward_per_auction
Loading

0 comments on commit 58afd1e

Please sign in to comment.