Crate governance

Crate governance 

Source
Expand description

§Governance Crate

A comprehensive governance system for decentralized decision-making in the Neural Trader platform.

§Features

  • Proposal Management: Create, submit, and manage proposals with various types
  • Weighted Voting: Vote on proposals with weighted voting power based on stake/reputation
  • Execution System: Automatic execution with time-locks and veto mechanisms
  • Member Management: Register members with roles and voting power
  • Treasury Integration: Budget allocation and fund management through governance

§Example

use governance::{GovernanceSystem, types::*};
use rust_decimal::Decimal;

// Create governance system
let governance = GovernanceSystem::new(GovernanceConfig::default());

// Register members
governance.register_member("alice".to_string(), Role::Member, Decimal::from(100))?;
governance.register_member("bob".to_string(), Role::Member, Decimal::from(150))?;

// Create a proposal
let proposal_id = governance.create_proposal(
    "Increase Risk Limit".to_string(),
    "Proposal to increase daily risk limit".to_string(),
    ProposalType::RiskLimitAdjustment {
        limit_type: "daily_var".to_string(),
        old_limit: Decimal::from(10000),
        new_limit: Decimal::from(15000),
    },
    "alice".to_string(),
)?;

// Cast votes
governance.vote(&proposal_id, "alice", VoteType::For, None)?;
governance.vote(&proposal_id, "bob", VoteType::For, None)?;

Modules§

error
execution
member
proposal
treasury
types
voting

Structs§

GovernanceSystem
Main governance system