From b0ad64f2b1d1cac8391c8b76c33ea6d179229377 Mon Sep 17 00:00:00 2001 From: jalbrekt85 Date: Tue, 17 Feb 2026 15:48:57 -0600 Subject: [PATCH] add action perms, fetch stakedao supported chains --- .github/workflows/comment_payload_report.yaml | 4 --- .github/workflows/trigger_fee_collection.yaml | 5 ++++ fee_allocator/bribe_platforms/stakedao.py | 28 +++++++++++-------- fee_allocator/constants.py | 1 + 4 files changed, 23 insertions(+), 15 deletions(-) diff --git a/.github/workflows/comment_payload_report.yaml b/.github/workflows/comment_payload_report.yaml index 702da5ae..eff0d8df 100644 --- a/.github/workflows/comment_payload_report.yaml +++ b/.github/workflows/comment_payload_report.yaml @@ -9,10 +9,6 @@ on: end_date: required: true type: string - pull_request_target: - types: [opened, synchronize] - paths: - - "fee_allocator/payloads/*.json" jobs: comment-report: diff --git a/.github/workflows/trigger_fee_collection.yaml b/.github/workflows/trigger_fee_collection.yaml index cefb24d5..e4ac52bd 100644 --- a/.github/workflows/trigger_fee_collection.yaml +++ b/.github/workflows/trigger_fee_collection.yaml @@ -13,6 +13,11 @@ on: paths: - "fee_allocator/fees_collected/*.json" +permissions: + contents: write + pull-requests: write + issues: write + jobs: process_fees: runs-on: ubuntu-latest diff --git a/fee_allocator/bribe_platforms/stakedao.py b/fee_allocator/bribe_platforms/stakedao.py index cef9ba0d..de77130a 100644 --- a/fee_allocator/bribe_platforms/stakedao.py +++ b/fee_allocator/bribe_platforms/stakedao.py @@ -1,10 +1,12 @@ -from typing import Dict, Optional, Tuple, Any +from typing import Dict, Optional, Set, Tuple, Any import pandas as pd +import requests from web3 import Web3 from .base import BribePlatform from bal_tools.safe_tx_builder import SafeContract from bal_tools import Web3Rpc from pathlib import Path +from fee_allocator.constants import VOTEMARKET_CONFIG_URL from fee_allocator.logger import logger from bal_addresses import AddrBook from eth_abi import encode @@ -13,8 +15,8 @@ class StakeDAOPlatform(BribePlatform): - SUPPORTED_L2_CHAINS = ["arbitrum", "optimism", "base", "polygon"] AURA_VEBAL_LOCKER = Web3.to_checksum_address("0xaF52695E1bB01A16D33D7194C28C42b10e0Dbec2") + DEFAULT_DESTINATION_CHAIN = "arbitrum" BASE_GAS_LIMIT = 50000 GAS_BUFFER_MULTIPLIER = 1.25 ABI_DIR = Path(__file__).parent.parent / "abi" @@ -37,9 +39,19 @@ def __init__(self, book: Dict[str, str], run_config: Any): self.usdc_address = book["tokens/USDC"] self._gauge_to_chain_cache = {} self._build_gauge_to_chain_map() + self.supported_chains = self._fetch_supported_chains() self.w3 = Web3Rpc("mainnet", os.environ.get("DRPC_KEY")) + @staticmethod + def _fetch_supported_chains() -> Set[str]: + response = requests.get(VOTEMARKET_CONFIG_URL) + response.raise_for_status() + data = response.json() + chain_id_to_name = {v: k for k, v in AddrBook.chain_ids_by_name.items()} + chain_ids = {entry["chainId"] for entry in data["data"] if entry["protocol"] == "balancer"} + return {chain_id_to_name[cid] for cid in chain_ids} + def _build_gauge_to_chain_map(self): for chain in self.run_config.all_chains: for pool in chain.core_pools: @@ -189,18 +201,12 @@ def process_bribes(self, bribes_df: pd.DataFrame, builder: Any, usdc: Any) -> No mantissa = round(row["amount"] * 1e6) - if chain_name == "mainnet": - destination_chain_name = "arbitrum" - destination_chain_id = AddrBook.chain_ids_by_name["arbitrum"] - elif chain_name == "gnosis": - # Gnosis gauges redirect bribes to Arbitrum (similar to mainnet) - destination_chain_name = "arbitrum" - destination_chain_id = AddrBook.chain_ids_by_name["arbitrum"] - elif chain_name in self.SUPPORTED_L2_CHAINS: + if chain_name in self.supported_chains: destination_chain_name = chain_name destination_chain_id = chain_id else: - raise ValueError(f"Chain {chain_name} not supported by StakeDAO v2. Supported chains: mainnet, {', '.join(self.SUPPORTED_L2_CHAINS)}") + destination_chain_name = self.DEFAULT_DESTINATION_CHAIN + destination_chain_id = AddrBook.chain_ids_by_name[self.DEFAULT_DESTINATION_CHAIN] destination_book = AddrBook(destination_chain_name) vote_market_v2_address = destination_book.flatbook["stake_dao/votemarket_v2"] diff --git a/fee_allocator/constants.py b/fee_allocator/constants.py index 1058ca26..911d3339 100644 --- a/fee_allocator/constants.py +++ b/fee_allocator/constants.py @@ -3,3 +3,4 @@ PARTNER_CONFIG_URL = "https://raw.githubusercontent.com/BalancerMaxis/multisig-ops/main/config/partner_fee_share.json" EZKL_POOLS_URL = "https://raw.githubusercontent.com/BalancerMaxis/bal_addresses/main/outputs/ezkl_pools.json" POOL_OVERRIDES_URL = "https://raw.githubusercontent.com/BalancerMaxis/multisig-ops/main/config/pool_incentives_overrides.json" +VOTEMARKET_CONFIG_URL = "https://raw.githubusercontent.com/stake-dao/contracts-monorepo/main/packages/votemarket/data/votemarkets.json"