Skip to content

Commit

Permalink
fix solver rewards function
Browse files Browse the repository at this point in the history
  • Loading branch information
harisang committed Jan 21, 2025
1 parent d84fa8b commit 4298ad8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/fetch/payouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from src.models.token import Token
from src.models.transfer import Transfer
from src.pg_client import MultiInstanceDBFetcher
from src.fetch.orderbook import OrderbookFetcher
from src.utils.print_store import Category

log = set_log(__name__)
Expand Down Expand Up @@ -503,13 +504,18 @@ def construct_payouts(
) -> list[Transfer]:
"""Workflow of solver reward payout logic post-CIP27"""
# pylint: disable-msg=too-many-locals

analytics_data_fetcher = OrderbookFetcher()
prod_prices_corrections_str, barn_prices_corrections_str = (
analytics_data_fetcher.fetch_auction_prices_corrections(config)
)
quote_rewards_df = orderbook.get_quote_rewards(dune.start_block, dune.end_block)
batch_rewards_df = orderbook.get_solver_rewards(
dune.start_block,
dune.end_block,
config.reward_config.batch_reward_cap_upper,
config.reward_config.batch_reward_cap_lower,
prod_prices_corrections_str,
barn_prices_corrections_str,
)
partner_fees_df = batch_rewards_df[["partner_list", "partner_fee_eth"]]
batch_rewards_df = batch_rewards_df.drop(
Expand Down
4 changes: 4 additions & 0 deletions src/pg_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ def get_solver_rewards(
end_block: str,
reward_cap_upper: int,
reward_cap_lower: int,
prod_prices_corrections_str: str,
barn_prices_corrections_str: str,
) -> DataFrame:
"""
Returns aggregated solver rewards for accounting period defined by block range
Expand All @@ -59,6 +61,7 @@ def get_solver_rewards(
.replace("{{EPSILON_LOWER}}", str(reward_cap_lower))
.replace("{{EPSILON_UPPER}}", str(reward_cap_upper))
.replace("{{results}}", "solver_rewards_script_table")
.replace("{{auction_prices_corrections}}", prod_prices_corrections_str)
)
batch_reward_query_barn = (
open_query("orderbook/barn_batch_rewards.sql")
Expand All @@ -67,6 +70,7 @@ def get_solver_rewards(
.replace("{{EPSILON_LOWER}}", str(reward_cap_lower))
.replace("{{EPSILON_UPPER}}", str(reward_cap_upper))
.replace("{{results}}", "solver_rewards_script_table")
.replace("{{auction_prices_corrections}}", barn_prices_corrections_str)
)
results = []

Expand Down

0 comments on commit 4298ad8

Please sign in to comment.