Skip to content

Add Delegation & Proxy Functions to Governance Contract #507

@ONEONUORA

Description

@ONEONUORA

Component: Contracts (Governance) | Effort: 4-5 days | Priority: MEDIUM

Current State

No vote delegation or proxy voting support.

Missing Functions

Delegation functions:

  • delegate_votes() - Delegate voting power to another address
  • undelegate_votes() - Remove delegation
  • get_delegate() - Get who user delegated to
  • get_voting_power() - Get total voting power (own + delegated)
  • get_delegators() - Get list of addresses who delegated to user

Why This Matters

  • Participation: Users can delegate if they can't vote
  • Efficiency: Experts can vote on behalf of others
  • Governance: Increases voter participation
  • Standard: Most governance systems support delegation

Tasks

  • Add delegation storage (delegator -> delegate mapping)
  • Implement delegate_votes() function
    • Store delegation
    • Emit VotesDelegated event
  • Add undelegate_votes() function
  • Implement get_voting_power() calculation
    • Own tokens + delegated tokens
  • Add get_delegate() view function
  • Implement get_delegators() view
  • Update vote() to use voting power
  • Add delegation history tracking
  • Add tests for delegation scenarios
  • Document delegation system

Acceptance Criteria

  • Users can delegate voting power
  • Voting power calculated correctly
  • Delegates can vote with delegated power
  • Delegation can be revoked
  • Tests cover delegation scenarios
  • Documentation explains delegation

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions