Update git remote URL from git.threefold.info to git.ourworld.tf

This commit is contained in:
2025-08-04 10:44:17 +02:00
parent 0cf66642a2
commit aa7e79d26c
85 changed files with 1865 additions and 392 deletions

View File

@@ -1,62 +1,47 @@
module governance
import base
import freeflowuniverse.herolib.data.ourtime
// ProposalStatus enum is used from governance_enums.v in the same module
import freeflowuniverse.herolib.hero.models.core
// Proposal represents a governance proposal that can be voted upon.
// It now incorporates the voting mechanism from biz/vote.v.
pub struct Proposal {
base.Base // Provides Proposal's own ID, created_at, updated_at
pub mut:
// Fields from original Proposal struct
creator_id string // User ID of the proposal creator
title string // Title of the proposal
description string // Detailed description of the proposal
status ProposalStatus // Status of the proposal lifecycle (draft, active, approved etc.)
// Fields from biz/vote.v's Vote struct (representing the voting event aspects of the proposal)
vote_start_date ourtime.OurTime // When voting on this proposal starts
vote_end_date ourtime.OurTime // When voting on this proposal ends
vote_status VoteEventStatus // Status of the voting event (open, closed, cancelled)
options []VoteOption // The choices users can vote for
ballots []Ballot // The cast votes by users
private_group []u32 // Optional: list of user IDs who are eligible to vote
}
// ProposalStatus defines the lifecycle status of a governance proposal itself
// ProposalStatus tracks the state of a governance proposal
pub enum ProposalStatus {
draft // Proposal is being prepared
active // Proposal is active (might be pre-voting, during voting, or post-voting but not yet finalized)
approved // Proposal has been formally approved
rejected // Proposal has been formally rejected
cancelled// Proposal was cancelled
draft
pending_review
active
voting
passed
rejected
implemented
cancelled
}
// -- Structures from biz/vote.v, adapted for integration --
// VoteEventStatus represents the status of the voting process for a proposal
// Renamed from VoteStatus in biz/vote.v to avoid confusion with ProposalStatus
pub enum VoteEventStatus {
open // Voting is currently open
closed // Voting has finished
cancelled // The voting event was cancelled
// ProposalType categorizes proposals
pub enum ProposalType {
constitutional
policy
budget
election
merger
dissolution
other
}
// VoteOption represents a specific choice that can be voted on within a proposal's voting event
pub struct VoteOption {
// Proposal represents a governance proposal
pub struct Proposal {
core.Base
pub mut:
id u8 // Simple identifier for this option within this proposal's vote (e.g., 1, 2, 3)
text string // The descriptive text of the option (e.g., "Option A: Approve budget")
count int // How many votes this option has received
min_valid int // Optional: minimum votes needed for this option to be considered valid
}
// Ballot represents an individual vote cast by a user for a specific proposal
pub struct Ballot {
base.Base // Provides Ballot's own ID, created_at, updated_at
pub mut:
user_id u32 // The ID of the user who cast this ballot
vote_option_id u8 // The 'id' of the VoteOption chosen by the user
shares_count int // Number of shares/tokens/voting power used for this ballot
company_id u32 // Reference to company @[index]
title string // Proposal title @[index]
description string // Detailed description
proposal_type ProposalType // Category of proposal
status ProposalStatus // Current state
proposer_id u32 // User who created @[index]
target_committee_id u32 // Target committee @[index]
voting_start u64 // Start timestamp
voting_end u64 // End timestamp
quorum_required f64 // Percentage required
approval_threshold f64 // Percentage for approval
votes_for u32 // Votes in favor
votes_against u32 // Votes against
votes_abstain u32 // Abstention votes
implementation_notes string // Post-implementation notes
}