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

Commit 9ec9f43

Browse files
authored
Merge pull request #293 from BalancerMaxis/stakedao-and-actions-perms
add action perms, fetch stakedao supported chains
2 parents 9008557 + b5b762a commit 9ec9f43

7 files changed

Lines changed: 41 additions & 75 deletions

File tree

.github/workflows/comment_payload_report.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ on:
99
end_date:
1010
required: true
1111
type: string
12-
pull_request_target:
13-
types: [opened, synchronize]
14-
paths:
15-
- "fee_allocator/payloads/*.json"
1612

1713
jobs:
1814
comment-report:

.github/workflows/trigger_fee_collection.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ on:
1313
paths:
1414
- "fee_allocator/fees_collected/*.json"
1515

16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
issues: write
20+
1621
jobs:
1722
process_fees:
1823
runs-on: ubuntu-latest

fee_allocator/accounting/chains.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,10 +414,10 @@ def _fetch_and_process_pool_fee_data(self) -> list[PoolFeeData]:
414414
end_snaps = None
415415
if self.chains.protocol_version == "v2":
416416
start_snaps = self.subgraph.get_balancer_pool_snapshots(
417-
block=self.block_range[0], pools_per_req=1000, limit=5000
417+
block=self.block_range[0], pools_per_req=1000, limit=5000, use_full_subgraph=True
418418
)
419419
end_snaps = self.subgraph.get_balancer_pool_snapshots(
420-
block=self.block_range[1], pools_per_req=1000, limit=5000
420+
block=self.block_range[1], pools_per_req=1000, limit=5000, use_full_subgraph=True
421421
)
422422

423423
pools = self.subgraph.fetch_all_pools_info()

fee_allocator/bribe_platforms/stakedao.py

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
from typing import Dict, Optional, Tuple, Any
1+
from typing import Dict, Optional, Set, Tuple, Any
22
import pandas as pd
3+
import requests
34
from web3 import Web3
45
from .base import BribePlatform
56
from bal_tools.safe_tx_builder import SafeContract
67
from bal_tools import Web3Rpc
78
from pathlib import Path
9+
from fee_allocator.constants import VOTEMARKET_CONFIG_URL
810
from fee_allocator.logger import logger
911
from bal_addresses import AddrBook
1012
from eth_abi import encode
@@ -13,8 +15,8 @@
1315

1416

1517
class StakeDAOPlatform(BribePlatform):
16-
SUPPORTED_L2_CHAINS = ["arbitrum", "optimism", "base", "polygon"]
1718
AURA_VEBAL_LOCKER = Web3.to_checksum_address("0xaF52695E1bB01A16D33D7194C28C42b10e0Dbec2")
19+
DEFAULT_DESTINATION_CHAIN = "arbitrum"
1820
BASE_GAS_LIMIT = 50000
1921
GAS_BUFFER_MULTIPLIER = 1.25
2022
ABI_DIR = Path(__file__).parent.parent / "abi"
@@ -37,9 +39,19 @@ def __init__(self, book: Dict[str, str], run_config: Any):
3739
self.usdc_address = book["tokens/USDC"]
3840
self._gauge_to_chain_cache = {}
3941
self._build_gauge_to_chain_map()
42+
self.supported_chains = self._fetch_supported_chains()
4043

4144
self.w3 = Web3Rpc("mainnet", os.environ.get("DRPC_KEY"))
4245

46+
@staticmethod
47+
def _fetch_supported_chains() -> Set[str]:
48+
response = requests.get(VOTEMARKET_CONFIG_URL)
49+
response.raise_for_status()
50+
data = response.json()
51+
chain_id_to_name = {v: k for k, v in AddrBook.chain_ids_by_name.items()}
52+
chain_ids = {entry["chainId"] for entry in data["data"] if entry["protocol"] == "balancer"}
53+
return {chain_id_to_name[cid] for cid in chain_ids}
54+
4355
def _build_gauge_to_chain_map(self):
4456
for chain in self.run_config.all_chains:
4557
for pool in chain.core_pools:
@@ -189,18 +201,12 @@ def process_bribes(self, bribes_df: pd.DataFrame, builder: Any, usdc: Any) -> No
189201

190202
mantissa = round(row["amount"] * 1e6)
191203

192-
if chain_name == "mainnet":
193-
destination_chain_name = "arbitrum"
194-
destination_chain_id = AddrBook.chain_ids_by_name["arbitrum"]
195-
elif chain_name == "gnosis":
196-
# Gnosis gauges redirect bribes to Arbitrum (similar to mainnet)
197-
destination_chain_name = "arbitrum"
198-
destination_chain_id = AddrBook.chain_ids_by_name["arbitrum"]
199-
elif chain_name in self.SUPPORTED_L2_CHAINS:
204+
if chain_name in self.supported_chains:
200205
destination_chain_name = chain_name
201206
destination_chain_id = chain_id
202207
else:
203-
raise ValueError(f"Chain {chain_name} not supported by StakeDAO v2. Supported chains: mainnet, {', '.join(self.SUPPORTED_L2_CHAINS)}")
208+
destination_chain_name = self.DEFAULT_DESTINATION_CHAIN
209+
destination_chain_id = AddrBook.chain_ids_by_name[self.DEFAULT_DESTINATION_CHAIN]
204210

205211
destination_book = AddrBook(destination_chain_name)
206212
vote_market_v2_address = destination_book.flatbook["stake_dao/votemarket_v2"]

fee_allocator/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
PARTNER_CONFIG_URL = "https://raw.githubusercontent.com/BalancerMaxis/multisig-ops/main/config/partner_fee_share.json"
44
EZKL_POOLS_URL = "https://raw.githubusercontent.com/BalancerMaxis/bal_addresses/main/outputs/ezkl_pools.json"
55
POOL_OVERRIDES_URL = "https://raw.githubusercontent.com/BalancerMaxis/multisig-ops/main/config/pool_incentives_overrides.json"
6+
VOTEMARKET_CONFIG_URL = "https://raw.githubusercontent.com/stake-dao/contracts-monorepo/main/packages/votemarket/data/votemarkets.json"

fee_allocator/summaries/v2_recon.json

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@
3535
},
3636
{
3737
"feesCollected": 207130.84,
38-
"incentivesDistributed": 1979911.77,
39-
"feesNotDistributed": -1772780.93,
38+
"incentivesDistributed": 207130.84,
39+
"feesNotDistributed": 0.0,
4040
"auraIncentives": 34157.8,
4141
"balIncentives": 18703.18,
42-
"feesToDao": 337233.89,
43-
"feesToVebal": 1589816.9,
42+
"feesToDao": 36247.9,
43+
"feesToVebal": 118021.96,
4444
"auravebalShare": 0.65,
45-
"auraIncentivesPct": 0.0173,
46-
"balIncentivesPct": 0.0094,
47-
"feesToDaoPct": 0.1703,
48-
"feesToVebalPct": 0.803,
45+
"auraIncentivesPct": 0.1649,
46+
"balIncentivesPct": 0.0903,
47+
"feesToDaoPct": 0.175,
48+
"feesToVebalPct": 0.5698,
4949
"createdAt": 1748012323,
5050
"periodStart": 1746662400,
5151
"periodEnd": 1747872000
@@ -452,27 +452,6 @@
452452
"periodEnd": 1769644800,
453453
"bribeThreshold": 490
454454
},
455-
{
456-
"feesCollected": 31650.06,
457-
"totalDistributed": 31650.06,
458-
"feesNotDistributed": -0.0,
459-
"coreFees": 989.49,
460-
"noncoreFees": 30660.57,
461-
"totalIncentives": 410.32,
462-
"feesToDao": 5412.22,
463-
"feesToVebal": 24841.46,
464-
"feesToPartners": 827.93,
465-
"feesToBeets": 158.14,
466-
"incentivesPct": 0.013,
467-
"feesToDaoPct": 0.171,
468-
"feesToVebalPct": 0.7849,
469-
"feesToPartnersPct": 0.0262,
470-
"feesToBeetsPct": 0.005,
471-
"createdAt": 1770982245,
472-
"periodStart": 1769644800,
473-
"periodEnd": 1770854400,
474-
"bribeThreshold": 390
475-
},
476455
{
477456
"feesCollected": 31650.06,
478457
"totalDistributed": 31650.06,

fee_allocator/summaries/v3_recon.json

Lines changed: 8 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,17 @@
3535
},
3636
{
3737
"feesCollected": 74626.13,
38-
"incentivesDistributed": 480510.51,
39-
"feesNotDistributed": -405884.38,
38+
"incentivesDistributed": 74626.13,
39+
"feesNotDistributed": 0.0,
4040
"auraIncentives": 8021.13,
4141
"balIncentives": 4175.51,
42-
"feesToDao": 81954.93,
43-
"feesToVebal": 386358.95,
42+
"feesToDao": 13059.57,
43+
"feesToVebal": 49369.92,
4444
"auravebalShare": 0.66,
45-
"auraIncentivesPct": 0.0167,
46-
"balIncentivesPct": 0.0087,
47-
"feesToDaoPct": 0.1706,
48-
"feesToVebalPct": 0.8041,
45+
"auraIncentivesPct": 0.1075,
46+
"balIncentivesPct": 0.056,
47+
"feesToDaoPct": 0.175,
48+
"feesToVebalPct": 0.6616,
4949
"createdAt": 1748012455,
5050
"periodStart": 1746662400,
5151
"periodEnd": 1747872000
@@ -452,27 +452,6 @@
452452
"periodEnd": 1769644800,
453453
"bribeThreshold": 490
454454
},
455-
{
456-
"feesCollected": 42204.24,
457-
"totalDistributed": 42204.24,
458-
"feesNotDistributed": -0.0,
459-
"coreFees": 27049.07,
460-
"noncoreFees": 15155.17,
461-
"totalIncentives": 18486.29,
462-
"feesToDao": 7430.29,
463-
"feesToVebal": 15069.78,
464-
"feesToPartners": 1217.88,
465-
"feesToBeets": 0.0,
466-
"incentivesPct": 0.438,
467-
"feesToDaoPct": 0.1761,
468-
"feesToVebalPct": 0.3571,
469-
"feesToPartnersPct": 0.0289,
470-
"feesToBeetsPct": 0.0,
471-
"createdAt": 1770982291,
472-
"periodStart": 1769644800,
473-
"periodEnd": 1770854400,
474-
"bribeThreshold": 390
475-
},
476455
{
477456
"feesCollected": 42204.24,
478457
"totalDistributed": 42204.24,

0 commit comments

Comments
 (0)