Skip to content Search Apps Documentation Source Content File Folder Download Copy Actions State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

Community realm. Read the code first. Community realm, deployed by its author. Read the code before you interact or send coins.

v0 source pure

Package udao defines minimal interfaces for Decentralized Autonomous Organizations (DAOs). It intentionally does not ...

Readme View source

gno.land/p/nym-moultest123/udao

Minimal DAO interfaces, written from the outside. udao deliberately does not expose members or votes: those are implementation details that differ per DAO and that non-members cannot act on anyway. What it exposes is the part an outside observer needs: which proposals exist and where they stand.

1type DAO interface {
2	Propose(prop Proposal) (uint64, error)
3	GetProposal(id uint64) (Proposal, error)
4	GetProposalStatus(id uint64) (ProposalStatus, error)
5	Execute(id uint64) error
6}

ProposalState is the lifecycle: Pending, Active, Passed, Rejected, Executed, Expired.

Constraints

The composable half of the package. A proposal can carry constraints, and ValidateConstraints reports whether all of them hold, returning the list of reasons when they do not:

1func ValidateConstraints(p Proposal) (bool, []string)

That is what lets DAO behaviour be assembled from parts (a quorum constraint, a time-window constraint, a whitelist constraint) instead of baked into one implementation.

This package is interfaces plus ValidateConstraints; it has no DAO of its own. p/moul/xdao is a (partial) implementation of it.


Part of moul/gno-contracts — moul's versioned gno.land contracts. See the repository for the full catalog, build/test tooling, and usage.

⚠️ Disclaimer: provided as-is, without warranty; not security-audited. Full disclaimer: DISCLAIMER.

Overview

Package udao defines minimal interfaces for Decentralized Autonomous Organizations (DAOs). It intentionally does not expose members and votes, as these details are implementation-specific. Instead, it focuses on providing an external view of proposals and their statuses, which is what non-members and non-voters typically care about.

The package is designed to allow for composable DAO patterns, enabling flexible and modular implementations of various DAO structures and behaviors.

Constants 1

Functions 1

func ValidateConstraints

1func ValidateConstraints(p Proposal) (bool, []string)
source

ValidateConstraints checks if all constraints of a proposal are met

Types 5

type Constraint

interface
1type Constraint interface {
2	Validate() (bool, string)
3	Description() string
4}
source

Constraint defines an interface for proposal constraints

type DAO

interface
 1type DAO interface {
 2	// Propose submits a new proposal to the DAO
 3	Propose(prop Proposal) (id uint64, err error)
 4
 5	// GetProposalStatus retrieves the current status and metrics of a specific proposal
 6	GetProposalStatus(id uint64) (ProposalStatus, error)
 7
 8	// Execute attempts to execute a proposal if it has passed
 9	Execute(id uint64) error
10
11	// GetProposal retrieves the details of a specific proposal
12	GetProposal(id uint64) (Proposal, error)
13}
source

DAO defines a minimal interface for a Decentralized Autonomous Organization from an external point of view, hiding the internal details of members and voting.

type Proposal

interface
1type Proposal interface {
2	Title() string
3	Body() string
4	Constraints() []Constraint
5}
source

Proposal defines the interface for a DAO proposal

type ProposalState

ident
1type ProposalState int
source

ProposalState represents the current state of a proposal

type ProposalStatus

struct
1type ProposalStatus struct {
2	// status
3	State ProposalState
4
5	// metrics
6	YeaPercentage      float64
7	NayPercentage      float64
8	NonVoterPercentage float64
9}
source

ProposalStatus represents the current status and metrics of a proposal

Dependencies

Imports 0

Imports nothing.

/p/nym-moultest123/udao/v0

Imported by indexer

Source Files 4