Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 10 additions & 0 deletions fee_allocator/accounting/chains.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def __init__(
self.cache_dir.mkdir(exist_ok=True)

self._chains: Union[dict[str, CorePoolChain], None] = None
self.aura_vebal_share: Union[Decimal, None] = None
self.protocol_version = protocol_version


Expand Down Expand Up @@ -116,6 +117,15 @@ def set_core_pool_chains_data(self):

self._chains = _chains

def set_aura_vebal_share(self):
if not self.mainnet:
raise ValueError(
"mainnet must be initialized to calculate aura vebal share"
)
self.aura_vebal_share = self.mainnet.subgraph.calculate_aura_vebal_share(
self.mainnet.web3, self.mainnet.block_range[1]
)

def set_initial_pool_allocation(self) -> None:
"""
sets the intial fee allocation for all pools for all chains
Expand Down
15 changes: 10 additions & 5 deletions fee_allocator/fee_allocator.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def allocate(self, redistribute=True):
Non-core pools: 82.5% veBAL, 17.5% DAO
"""
self.run_config.set_core_pool_chains_data()
self.run_config.set_aura_vebal_share()
self.run_config.set_initial_pool_allocation()
if redistribute:
self.redistribute_fees()
Expand All @@ -79,11 +80,13 @@ def redistribute_fees(self):
Redistributes fees among pools based on minimum incentive amounts.

Pools with total incentives below the minimum threshold get their incentives
redistributed to eligible pools above the threshold.

redistributed to eligible pools above the threshold. The threshold is scaled
by Aura's veBAL share to ensure the effective Aura incentive meets the minimum.
"""
min_amount = self.run_config.fee_config.min_aura_incentive
logger.info(f"Redistribution threshold: ${min_amount}")
min_aura = Decimal(self.run_config.fee_config.min_aura_incentive)
aura_share = self.run_config.aura_vebal_share
min_amount = min_aura / aura_share
logger.info(f"Redistribution threshold: ${min_amount:.0f} (${min_aura:.0f} min Aura / {aura_share:.2%} veBAL share)")

for chain in self.run_config.all_chains:
pools_to_redistribute = [p for p in chain.core_pools if p.total_to_incentives_usd < min_amount]
Expand Down Expand Up @@ -514,7 +517,9 @@ def recon(self) -> None:
"createdAt": int(datetime.datetime.now().timestamp()),
"periodStart": self.date_range[0],
"periodEnd": self.date_range[1],
"bribeThreshold": self.run_config.fee_config.min_aura_incentive
"minAuraIncentive": self.run_config.fee_config.min_aura_incentive,
"auraVebalShare": float(round(self.run_config.aura_vebal_share, 4)),
"bribeThreshold": int(self.run_config.fee_config.min_aura_incentive / self.run_config.aura_vebal_share)
}

recon_file = Path(PROJECT_ROOT) / "fee_allocator/summaries" / f"{self.run_config.protocol_version}_recon.json"
Expand Down
Loading