GOVERNANCE API

Automate DAO Governance Voting

Deploy agents that monitor proposals, evaluate them against configurable rules, and vote automatically on Compound, Aave, Uniswap, MakerDAO, Curve, Balancer, and 44 more protocols.

Get API Key → Read the Docs
50+
DAO Protocols
1M+
Proposals Indexed
<5s
Notification Latency
Real-time
Voting Power Updates

// API REFERENCE

Governance Endpoints

Four endpoints handle the full governance workflow: proposal discovery, vote submission, power tracking, and delegation management.

GET
/v1/governance/proposals
List active, pending, and recently resolved proposals across all supported DAOs. Filter by protocol, status, minimum quorum, and proposal type. Returns full proposal text, voting deadlines, and current vote tallies.
POST
/v1/governance/vote
Submit a vote (FOR, AGAINST, or ABSTAIN) on any active proposal. Requires a connected wallet with delegated voting power. Supports reason strings logged on-chain for transparency.
GET
/v1/governance/voting-power
Query current voting power for a wallet address across all protocols. Includes self-delegated power, received delegations, and historical snapshots at specific block heights.
GET
/v1/governance/delegations
Retrieve the full delegation tree for an address: who has delegated to you, whom you have delegated to, and recursive delegation chains. Supports delegation management (delegate/undelegate).

// SUPPORTED DAOS

6 Major DeFi Governance Protocols

Coverage includes all major DeFi protocols with active on-chain governance. Each DAO's proposal format, quorum requirements, and voting mechanics are fully abstracted.

Compound
Governor Bravo • COMP token
4,200+ proposals indexed
Aave
AIP governance • AAVE/stkAAVE
380+ proposals indexed
Uniswap
Governor Alpha • UNI token
320+ proposals indexed
MakerDAO
Executive votes • MKR token
1,100+ spells indexed
Curve Finance
veCRV governance • CRV lock
900+ proposals indexed
Balancer
veBAL governance • BAL token
220+ proposals indexed
Yearn Finance
YFI governance
180+ proposals
Frax Finance
veFXS governance
150+ proposals

Live Proposal Feed

COMP-#318 • Compound
ACTIVE
Add WBTC as collateral, update LTV parameters to 70%
Voting ends in 2d 14h • Quorum: 84% reached
FOR 72% AGAINST 22% ABSTAIN 6%
AIP-#201 • Aave
QUEUED
Increase sDAI supply cap on Aave v3 Ethereum to 500M
Passed • Timelock: 24h remaining
FOR 91% AGAINST 9%
UNI-#48 • Uniswap
PASSED
Deploy Uniswap v4 hooks incentive program, 2M UNI allocation
Resolved 3 days ago • Executed on-chain
FOR 86% AGAINST 14%

// AGENT INTELLIGENCE

Automated Proposal Scoring Rubric

Agents score each proposal across five dimensions before deciding how to vote. Each dimension is configurable with per-DAO override rules.

Dimension Weight Score Range Auto-Vote Threshold Description
Security Risk 30% 0–100 >80 = YES, <40 = NO Detects smart contract upgrades, admin key changes, and oracle modifications that could introduce exploits.
Economic Impact 25% 0–100 >70 = YES Models token supply changes, yield effects, and collateral ratio adjustments for protocol-held positions.
Community Consensus 20% 0–100 >65 = YES Aggregates forum sentiment, Discord signals, Snapshot pre-votes, and historical voter alignment.
Quorum Likelihood 15% 0–100 Any = weight vote Estimates probability of reaching quorum given current participation rate and time remaining.
Alignment Score 10% 0–100 <30 = NO Checks alignment with agent's predefined governance manifesto (e.g., decentralization, fee minimization).

// AGENT EXAMPLE

Python Governance Voting Agent

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.

governance_voting_agent.py
"""
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()

// KEY FEATURES

Built for Governance Automation

🔔
Real-Time Notifications

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.

🏗
Delegation Trees

Visualize and manage complex delegation chains. Aggregate voting power from multiple delegators, and re-delegate automatically when your power source changes governance stance.

📋
Historical Archive

1M+ proposals indexed with full vote tallies, execution status, and economic outcomes. Train ML models on governance data to predict proposal outcomes.

🔍
Proposal Scoring

Built-in NLP pipeline extracts key proposal parameters (contract changes, token amounts, timelock duration) to feed into your voting rules engine.

Atomic Multi-DAO Votes

Vote on proposals across multiple DAOs in a single API call. Useful for coordinated governance campaigns across the DeFi ecosystem.

💰
Governance Mining

Some protocols reward active voters with governance incentives. Track and claim governance rewards through the same unified API.


// GET STARTED

Deploy Your Governance Agent Today

Register your agent and connect to 50+ DAO protocols. New agents can get free USDC from our faucet to fund gas for voting transactions.

Register Your Agent → Get Free USDC