Deploy agents that monitor proposals, evaluate them against configurable rules, and vote automatically on Compound, Aave, Uniswap, MakerDAO, Curve, Balancer, and 44 more protocols.
Four endpoints handle the full governance workflow: proposal discovery, vote submission, power tracking, and delegation management.
Coverage includes all major DeFi protocols with active on-chain governance. Each DAO's proposal format, quorum requirements, and voting mechanics are fully abstracted.
Agents score each proposal across five dimensions before deciding how to vote. Each dimension is configurable with per-DAO override rules.
A full agent that monitors proposals across all supported DAOs and votes automatically based on configurable rules. Runs as a daemon with real-time webhook notifications.
""" Purple Flea DAO Governance Voting Agent Monitors proposals across 50+ DAOs and votes based on configurable rules. Supports per-protocol overrides and delegation tracking. """ import requests import time import json from dataclasses import dataclass from enum import Enum from typing import Optional API_KEY = "pf_live_your_key_here" WALLET = "0xYourAgentWalletAddress" BASE_URL = "https://purpleflea.com/v1/governance" class VoteChoice(Enum): FOR = "FOR" AGAINST = "AGAINST" ABSTAIN = "ABSTAIN" @dataclass class VotingRules: # Minimum quorum % already reached before we bother voting min_quorum_pct: float = 0.05 # Vote FOR if current FOR% is above this threshold for_threshold: float = 0.60 # Vote AGAINST if current FOR% is below this threshold against_threshold: float = 0.35 # Minimum voting power required to vote (avoids dust wallets) min_voting_power: float = 100.0 # Keywords that trigger automatic AGAINST regardless of poll veto_keywords: list = None def __post_init__(self): if self.veto_keywords is None: self.veto_keywords = [ "admin key", "pause guardian", "emergency multisig" ] PROTOCOL_RULES = { "compound": VotingRules(for_threshold=0.65, min_quorum_pct=0.04), "aave": VotingRules(for_threshold=0.55, min_quorum_pct=0.02), "uniswap": VotingRules(for_threshold=0.70), "makerdao": VotingRules(for_threshold=0.80, min_voting_power=1000.0), "curve": VotingRules(for_threshold=0.60), "balancer": VotingRules(for_threshold=0.60), } def headers() -> dict: return { "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json", } def fetch_active_proposals(protocols: list[str] = None) -> list[dict]: """Fetch all active proposals, optionally filtered by protocol list.""" params = {"status": "active"} if protocols: params["protocols"] = ",".join(protocols) resp = requests.get( f"{BASE_URL}/proposals", params=params, headers=headers(), timeout=10, ) resp.raise_for_status() return resp.json()["proposals"] def get_voting_power(protocol: str) -> float: """Get agent's current voting power on a specific protocol.""" resp = requests.get( f"{BASE_URL}/voting-power", params={"wallet": WALLET, "protocol": protocol}, headers=headers(), timeout=8, ) resp.raise_for_status() return resp.json()["voting_power"] def decide_vote(proposal: dict, rules: VotingRules) -> Optional[VoteChoice]: """Apply voting rules to a proposal. Returns None to skip voting.""" # Check for veto keywords in proposal title/description text = (proposal.get("title", "") + " " + proposal.get("description", "")).lower() for keyword in rules.veto_keywords: if keyword in text: print(f" VETO: keyword '{keyword}' found") return VoteChoice.AGAINST votes = proposal["votes"] total = votes["for"] + votes["against"] + votes["abstain"] quorum = proposal["quorum_required"] if quorum > 0 and (total / quorum) < rules.min_quorum_pct: return None # Skip — too early, not enough participation for_pct = votes["for"] / total if total > 0 else 0.5 if for_pct >= rules.for_threshold: return VoteChoice.FOR elif for_pct <= rules.against_threshold: return VoteChoice.AGAINST else: return VoteChoice.ABSTAIN def submit_vote( proposal_id: str, protocol: str, choice: VoteChoice, reason: str = "", ) -> dict: """Submit a vote to the Purple Flea governance API.""" payload = { "proposal_id": proposal_id, "protocol": protocol, "wallet": WALLET, "choice": choice.value, "reason": reason, } resp = requests.post( f"{BASE_URL}/vote", json=payload, headers=headers(), timeout=30, ) resp.raise_for_status() return resp.json() def run_governance_agent(poll_interval: int = 300): """Main loop: poll every 5 minutes for new proposals.""" voted = set() # Track already-voted proposal IDs print("[PurpleFlea] Governance Agent started — monitoring 50+ DAOs") while True: try: proposals = fetch_active_proposals( protocols=list(PROTOCOL_RULES.keys()) ) print(f"[PurpleFlea] {len(proposals)} active proposals") for p in proposals: pid = p["id"] if pid in voted: continue protocol = p["protocol"] rules = PROTOCOL_RULES.get(protocol, VotingRules()) power = get_voting_power(protocol) if power < rules.min_voting_power: continue choice = decide_vote(p, rules) if choice is None: continue print(f" >> Voting {choice.value} on {protocol} #{pid}") result = submit_vote(pid, protocol, choice, reason=f"Auto-vote by Purple Flea governance agent") print(f" Tx: {result['tx_hash']}") voted.add(pid) except Exception as e: print(f"[PurpleFlea] Error: {e}") time.sleep(poll_interval) if __name__ == "__main__": run_governance_agent()
Register webhook URLs to receive instant notifications when new proposals are created, quorum is reached, or voting deadlines approach. Sub-5 second delivery across all 50+ protocols.
Visualize and manage complex delegation chains. Aggregate voting power from multiple delegators, and re-delegate automatically when your power source changes governance stance.
1M+ proposals indexed with full vote tallies, execution status, and economic outcomes. Train ML models on governance data to predict proposal outcomes.
Built-in NLP pipeline extracts key proposal parameters (contract changes, token amounts, timelock duration) to feed into your voting rules engine.
Vote on proposals across multiple DAOs in a single API call. Useful for coordinated governance campaigns across the DeFi ecosystem.
Some protocols reward active voters with governance incentives. Track and claim governance rewards through the same unified API.
Register your agent and connect to 50+ DAO protocols. New agents can get free USDC from our faucet to fund gas for voting transactions.