Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.

Commit fa0c939

Browse files
committed
handle negative transfer scenario, add back aura bal split data to recon
1 parent db4846e commit fa0c939

2 files changed

Lines changed: 46 additions & 5 deletions

File tree

fee_allocator/accounting/core_pools.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,11 @@ def _get_partner_info(self):
135135

136136
def _get_voting_pool_override(self):
137137
pool_override = self.chain.chains.pool_overrides.get(self.pool_id)
138-
return pool_override.voting_pool_override if pool_override else None
138+
if pool_override and pool_override.voting_pool_override:
139+
return pool_override.voting_pool_override
140+
if self.is_alliance_core_pool:
141+
return "aura"
142+
return None
139143

140144
def _get_market_override(self):
141145
pool_override = self.chain.chains.pool_overrides.get(self.pool_id)

fee_allocator/fee_allocator.py

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,9 +195,27 @@ def generate_incentives_csv(
195195
self, output_path: Path = Path("fee_allocator/allocations/incentives")
196196
) -> Path:
197197
logger.info("generating incentives csv")
198+
199+
aura_vebal_share = self.run_config.mainnet.subgraph.calculate_aura_vebal_share(
200+
self.run_config.mainnet.web3, self.run_config.mainnet.block_range[1]
201+
)
202+
logger.info(f"Aura veBAL share: {aura_vebal_share:.4f}")
203+
198204
output = []
199205
for chain in self.run_config.all_chains:
200206
for core_pool in chain.core_pools:
207+
total_incentives = core_pool.total_to_incentives_usd
208+
209+
if core_pool.voting_pool_override == "aura":
210+
pool_aura_share = Decimal(1)
211+
elif core_pool.voting_pool_override == "bal":
212+
pool_aura_share = Decimal(0)
213+
else:
214+
pool_aura_share = aura_vebal_share
215+
216+
aura_incentives = round(total_incentives * pool_aura_share, 4)
217+
bal_incentives = round(total_incentives - total_incentives * pool_aura_share, 4)
218+
201219
output.append(
202220
{
203221
"pool_id": core_pool.pool_id,
@@ -208,7 +226,9 @@ def generate_incentives_csv(
208226
"fees_to_vebal": round(core_pool.to_vebal_usd, 4),
209227
"fees_to_dao": round(core_pool.to_dao_usd, 4),
210228
"fees_to_beets": round(core_pool.to_beets_usd, 4),
211-
"total_incentives": round(core_pool.total_to_incentives_usd, 4),
229+
"total_incentives": round(total_incentives, 4),
230+
"aura_incentives": aura_incentives,
231+
"bal_incentives": bal_incentives,
212232
"redirected_incentives": round(
213233
core_pool.redirected_incentives_usd, 4
214234
),
@@ -219,7 +239,7 @@ def generate_incentives_csv(
219239
)
220240

221241
df = pd.DataFrame(output)
222-
242+
223243
sorted_df = df.sort_values(by=["chain", "earned_fees"], ascending=False)
224244
output_path = (
225245
PROJECT_ROOT / output_path / f"{self.run_config.protocol_version}_incentives_{self.start_date}_{self.end_date}.csv"
@@ -384,8 +404,10 @@ def generate_bribe_payload(
384404
platform = StakeDAOPlatform(self.book, self.run_config)
385405
platform.process_bribes(bribe_df, builder, usdc)
386406

387-
usdc.transfer(payment_df["target"], dao_fee_usdc)
388-
usdc.transfer(beets_df["target"], beets_fee_usdc)
407+
if dao_fee_usdc > 0:
408+
usdc.transfer(payment_df["target"], dao_fee_usdc)
409+
if beets_fee_usdc > 0:
410+
usdc.transfer(beets_df["target"], beets_fee_usdc)
389411

390412
alliance_fee_usdc_spent = 0
391413
if alliance_csv:
@@ -447,12 +469,17 @@ def recon(self) -> None:
447469
"""
448470
total_fees = self.run_config.total_fees_collected_usd
449471
total_incentives = Decimal(0)
472+
total_aura_incentives = Decimal(0)
450473
total_dao = Decimal(0)
451474
total_vebal = Decimal(0)
452475
total_partner = Decimal(0)
453476
total_distributed = Decimal(0)
454477
total_beets = Decimal(0)
455478

479+
aura_vebal_share = self.run_config.mainnet.subgraph.calculate_aura_vebal_share(
480+
self.run_config.mainnet.web3, self.run_config.mainnet.block_range[1]
481+
)
482+
456483
for chain in self.run_config.all_chains:
457484
for pool in chain.core_pools:
458485
assert pool.total_to_incentives_usd >= 0, f"Negative incentives: {pool.total_to_incentives_usd}"
@@ -467,6 +494,11 @@ def recon(self) -> None:
467494
total_partner += pool.to_partner_usd
468495
total_beets += pool.to_beets_usd
469496

497+
if pool.voting_pool_override == "aura":
498+
total_aura_incentives += pool.total_to_incentives_usd
499+
elif pool.voting_pool_override != "bal":
500+
total_aura_incentives += pool.total_to_incentives_usd * aura_vebal_share
501+
470502
total_dao += chain.noncore_to_dao_usd + chain.alliance_noncore_to_dao_usd + chain.partner_noncore_to_dao_usd
471503
total_vebal += chain.noncore_to_vebal_usd + chain.alliance_noncore_to_vebal_usd + chain.partner_noncore_to_vebal_usd
472504
total_beets += chain.noncore_to_beets_usd + chain.alliance_noncore_to_beets_usd + chain.partner_noncore_to_beets_usd
@@ -511,6 +543,11 @@ def recon(self) -> None:
511543
"feesToVebalPct": float(round(total_vebal / total_distributed, 4)) if total_distributed > 0 else 0,
512544
"feesToPartnersPct": float(round(total_partner / total_distributed, 4)) if total_distributed > 0 else 0,
513545
"feesToBeetsPct": float(round(total_beets / total_distributed, 4)) if total_distributed > 0 else 0,
546+
"auraIncentives": float(round(total_aura_incentives, 2)),
547+
"balIncentives": float(round(total_incentives - total_aura_incentives, 2)),
548+
"auravebalShare": float(round(total_aura_incentives / total_incentives, 2)) if total_incentives > 0 else 0,
549+
"auraIncentivesPct": float(round(total_aura_incentives / total_distributed, 4)) if total_distributed > 0 else 0,
550+
"balIncentivesPct": float(round((total_incentives - total_aura_incentives) / total_distributed, 4)) if total_distributed > 0 else 0,
514551
"createdAt": int(datetime.datetime.now().timestamp()),
515552
"periodStart": self.date_range[0],
516553
"periodEnd": self.date_range[1],

0 commit comments

Comments
 (0)