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

Add service fee log #423

Merged
merged 3 commits into from
Nov 11, 2024
Merged
Changes from 1 commit
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
17 changes: 16 additions & 1 deletion src/fetch/payouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,15 @@ def reward_scaling(self) -> Fraction:
The reward is multiplied by this factor"""
return 1 - SERVICE_FEE_FACTOR * self.service_fee

def total_service_fee(self) -> Fraction:
"""Scaling factor for service fee
fhenneke marked this conversation as resolved.
Show resolved Hide resolved
The reward is multiplied by this factor"""
return (
SERVICE_FEE_FACTOR
* self.service_fee
* (self.primary_reward_cow + self.quote_reward_cow)
harisang marked this conversation as resolved.
Show resolved Hide resolved
)

def is_overdraft(self) -> bool:
"""
True if the solver's complete combined data results in a net negative
Expand Down Expand Up @@ -534,13 +543,19 @@ def construct_payouts(
performance_reward = complete_payout_df["primary_reward_cow"].sum()
quote_reward = complete_payout_df["quote_reward_cow"].sum()

service_fee = sum(
RewardAndPenaltyDatum.from_series(payment).total_service_fee()
for _, payment in complete_payout_df.iterrows()
)

dune.log_saver.print(
"Payment breakdown (ignoring service fees):\n"
f"Performance Reward: {performance_reward / 10 ** 18:.4f}\n"
f"Quote Reward: {quote_reward / 10 ** 18:.4f}\n"
f"Protocol Fees: {final_protocol_fee_wei / 10 ** 18:.4f}\n"
f"Partner Fees Tax: {partner_fee_tax_wei / 10 ** 18:.4f}\n"
f"Partner Fees: {total_partner_fee_wei_taxed / 10 ** 18:.4f}\n",
f"Partner Fees: {total_partner_fee_wei_taxed / 10 ** 18:.4f}\n"
f"COW DAO Service Fees: {service_fee / 10 ** 18:.4f}\n",
category=Category.TOTALS,
)
payouts = prepare_transfers(
Expand Down
Loading