Documentation

DAO Governance

On-chain voting on proposals with quorum requirements. Members create proposals, vote for or against, and finalize outcomes after the voting period ends.

Use Cases

  • DAO decision-making with transparent vote tallies
  • Community governance for protocol parameters
  • Grant funding decisions with on-chain accountability

Init Parameters

ParameterTypeDescription
nameStringDAO name
voting_periodu64Duration of each proposal's voting window (seconds)
quorumu64Minimum total votes required for a proposal to be valid

Execute Methods

MethodParametersDescription
initializename, voting_period, quorumSet up the DAO. Only callable once.
proposetitle: String, description: StringCreate a new proposal. Returns proposal ID.
voteproposal_id: u64, support: boolVote for (true) or against (false) a proposal. One vote per address.
finalizeproposal_id: u64End voting on a proposal. Sets status to Passed, Rejected, or Expired.

Query Methods

MethodParametersReturnsDescription
get_config--GovConfigDAO configuration
get_proposalproposal_id: u64GovProposalFull proposal details
get_proposal_count--u64Total number of proposals
get_voteproposal_id: u64, voter: Addressu8Vote status: 0=not voted, 1=for, 2=against

Key Types

ProposalStatus

pub enum ProposalStatus {
    Active,    // Voting is open
    Passed,    // Quorum met, more for-votes than against
    Rejected,  // Quorum met, more against-votes than for
    Expired,   // Voting period ended without quorum
}

GovConfig

pub struct GovConfig {
    pub creator: Address,
    pub name: String,
    pub voting_period: u64,
    pub quorum: u64,
    pub created_at: u64,
}

GovProposal

pub struct GovProposal {
    pub id: u64,
    pub proposer: Address,
    pub title: String,
    pub description: String,
    pub for_votes: u64,
    pub against_votes: u64,
    pub start_time: u64,
    pub end_time: u64,
    pub status: ProposalStatus,
}

CLI Usage

# Deploy
norn wallet deploy-loom --name my-dao
 
# Upload bytecode
norn wallet upload-bytecode --loom-id <LOOM_ID> \
  --bytecode governance.wasm
 
# Execute (borsh-encoded input)
norn wallet execute-loom --loom-id <LOOM_ID> --input <HEX>
 
# Query config
norn wallet query-loom --loom-id <LOOM_ID>