Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GLIP-1: Governance Contract (EXAMPLE) #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

emarai
Copy link
Collaborator

@emarai emarai commented Nov 11, 2024

Add Governance Contract Implementation

Overview

This PR introduces a flexible on-chain governance system that allows token holders to participate in decentralized decision-making. The governance contract enables proposal creation, voting, and execution with configurable parameters and multiple voting mechanisms. This governance contract uses the Asset Contract as its voting token.

Key Features

  • Token-based Governance: Voting power tied to governance token holdings
  • Flexible Voting Systems:
    • Simple voting (yes/no/abstain)
    • Ranked choice voting
    • Weighted voting
  • Configurable Parameters:
    • Proposal thresholds
    • Quorum requirements
    • Voting periods
    • Execution delays
  • Security Features:
    • Optional veto powers
    • Authorized executors
    • Delegation system

Technical Changes

  • Added GovernanceContract struct with validation logic
  • Extended ContractType enum to include governance
  • Added governance-specific call types (CreateProposal, Vote, etc.)
  • Implemented proposal actions for system modifications
  • Added validation for governance parameters and pubkeys

Testing

  • Add unit tests for governance contract validation
  • Add integration tests for proposal creation and voting
  • Test different voting mechanisms
  • Test parameter validation
  • Test veto functionality

Documentation

  • Add inline documentation for governance functions
  • Update README with governance features
  • Add examples for creating and interacting with governance contracts

Future Improvements

  1. Add support for quadratic voting
  2. Implement timelock functionality for sensitive actions
  3. Add governance analytics and reporting
  4. Consider implementing delegate voting power tracking

Breaking Changes

None. This is an additive change that maintains compatibility with existing contracts.

Security Considerations

  • Validated all pubkeys and ratios
  • Implemented checks for voting thresholds
  • Added safeguards against invalid configurations
  • Ensured proper validation of execution permissions

Related Issues

Closes #XXX (Add issue number if applicable)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant