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

Commit 4d1291b

Browse files
Merge pull request #236 from BalancerMaxis/ezkl-fee-split
ezkl fee split logic
2 parents 05afbca + fc1c8a4 commit 4d1291b

5 files changed

Lines changed: 41 additions & 7 deletions

File tree

fee_allocator/accounting/chains.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
FEE_CONSTANTS_URL,
3232
ALLIANCE_CONFIG_URL,
3333
PARTNER_CONFIG_URL,
34+
EZKL_POOLS_URL,
3435
POOL_OVERRIDES_URL
3536
)
3637
from fee_allocator.accounting.decorators import round, require_pool_fee_data
@@ -69,6 +70,7 @@ def __init__(
6970
self.fee_config = GlobalFeeConfig(**requests.get(FEE_CONSTANTS_URL).json())
7071
self.alliance_config = AllianceConfig(**requests.get(ALLIANCE_CONFIG_URL).json())
7172
self.partner_config = PartnerConfig(**requests.get(PARTNER_CONFIG_URL).json())
73+
self.ezkl_pools = requests.get(EZKL_POOLS_URL).json()
7274

7375
pool_overrides_raw = requests.get(POOL_OVERRIDES_URL).json()
7476

@@ -288,8 +290,13 @@ def _fetch_partner_pools(self) -> Dict[str, Partner]:
288290

289291
if partner.pool_types:
290292
for pool_type in partner.pool_types:
291-
pool_ids = self.subgraph.fetch_pools_by_type(pool_type)
292-
logger.info(f"Found {len(pool_ids)} {pool_type} pools for {partner.name} on {self.name}")
293+
if pool_type == "EZKL":
294+
chain_ezkl_data = self.chains.ezkl_pools.get(self.name, {})
295+
pool_ids = chain_ezkl_data.get(self.chains.protocol_version, [])
296+
logger.info(f"Found {len(pool_ids)} EZKL {self.chains.protocol_version} pools for {partner.name} on {self.name}")
297+
else:
298+
pool_ids = self.subgraph.fetch_pools_by_type(pool_type)
299+
logger.info(f"Found {len(pool_ids)} {pool_type} pools for {partner.name} on {self.name}")
293300

294301
for pool_id in pool_ids:
295302
# Skip if already added from explicit list
@@ -319,7 +326,6 @@ def _get_pool_category(self, has_gauge: bool, is_core: bool) -> Optional[str]:
319326
elif not is_core and not has_gauge:
320327
return "non_core_without_gauge"
321328
elif is_core and not has_gauge:
322-
logger.error("Invalid state: Core pool must have gauge")
323329
return None
324330
return None
325331

fee_allocator/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
FEE_CONSTANTS_URL = "https://raw.githubusercontent.com/BalancerMaxis/multisig-ops/main/config/protocol_fees_constants.json"
22
ALLIANCE_CONFIG_URL = "https://raw.githubusercontent.com/BalancerMaxis/multisig-ops/main/config/alliance_fee_share.json"
33
PARTNER_CONFIG_URL = "https://raw.githubusercontent.com/BalancerMaxis/multisig-ops/main/config/partner_fee_share.json"
4+
EZKL_POOLS_URL = "https://raw.githubusercontent.com/BalancerMaxis/bal_addresses/main/outputs/ezkl_pools.json"
45
POOL_OVERRIDES_URL = "https://raw.githubusercontent.com/BalancerMaxis/multisig-ops/main/config/pool_incentives_overrides.json"
56
SNAPSHOT_URL = "https://hub.snapshot.org/graphql?"
67
HH_API_URL = "https://api.hiddenhand.finance/proposal"
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"avalanche": 370149388,
3+
"base": 4726164967,
4+
"arbitrum": 24475711886,
5+
"polygon": 12284347826,
6+
"optimism": 2014172038,
7+
"gnosis": 19296737423,
8+
"mainnet": 190640914196
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"avalanche": 17037904970,
3+
"base": 127943496102,
4+
"gnosis": 4869862296,
5+
"arbitrum": 8701144463,
6+
"optimism": 528740192,
7+
"plasma": 74462862951,
8+
"mainnet": 33661436626
9+
}

tests/conftest.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,20 @@ def chain(run_config, web3):
4444

4545
@pytest.fixture
4646
def allocator(fee_period):
47-
input_fees = {"mainnet": Decimal("10000000.0"), "optimism": Decimal("10000.0")}
47+
input_fees = {
48+
"mainnet": Decimal("1000000"),
49+
"arbitrum": Decimal("1000000"),
50+
"polygon": Decimal("1000000"),
51+
"optimism": Decimal("1000000"),
52+
"base": Decimal("1000000"),
53+
"gnosis": Decimal("1000000"),
54+
"avalanche": Decimal("1000000"),
55+
"plasma": Decimal("1000000"),
56+
}
4857

4958
return FeeAllocator(
50-
input_fees,
51-
fee_period,
52-
cache_dir=Path("tests/cache"),
59+
input_fees,
60+
fee_period,
61+
cache_dir=Path("tests/cache"),
5362
use_cache=True
5463
)

0 commit comments

Comments
 (0)