Skip to content

Commit

Permalink
Add service fee log (#423)
Browse files Browse the repository at this point in the history
This PR adds a log for the service fee charged to solvers in the COW DAO
bonding pool.

This log is useful since it determines the budget for ongoing bounties.

This PR does not change the behavior of the code and no additional test
was added.

---------

Co-authored-by: Haris Angelidakis <[email protected]>
  • Loading branch information
fhenneke and harisang authored Nov 11, 2024
1 parent 59cb592 commit 4aac141
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/fetch/payouts.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ 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:
"""Total service fee charged from rewards"""
return (
SERVICE_FEE_FACTOR
* self.service_fee
* (self.primary_reward_cow + self.quote_reward_cow)
)

def is_overdraft(self) -> bool:
"""
True if the solver's complete combined data results in a net negative
Expand Down Expand Up @@ -529,13 +537,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

0 comments on commit 4aac141

Please sign in to comment.