diff --git a/src/fetch/payouts.py b/src/fetch/payouts.py index 644fd3b1..883302fe 100644 --- a/src/fetch/payouts.py +++ b/src/fetch/payouts.py @@ -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 @@ -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(