dao source realm
1
21
func AllowedDAOs
Actionfunc ExecuteOrRejectProposal
crossing ActionExecuteOrRejectProposal executes the proposal with the provided ProposalID or rejects it when there is an execution error. If the proposal was denied, it will return false. If the proposal is correctly executed, it will return true, unless execution fails with an error, in which case proposal is rejected with the error as the reason. This function allows to finish proposals by rejecting them when there is a state change or an error in the proposal parameters that makes execution fail, potentially leaving the proposal active forever because it can't be successfully executed.
func ExecuteProposal
crossing ActionExecuteProposal will try to execute the proposal with the provided ProposalID. If the proposal was denied, it will return false. If the proposal is correctly executed, it will return true. If something happens this function will panic.
func InAllowedDAOs
Actionfunc MustVoteOnProposal
crossing Actionfunc MustVoteOnProposalSimple
crossing ActionMustVoteOnProposalSimple is like MustVoteOnProposal but intended to be used through gnokey with basic types.
func Render
crossingRender calls directly to Render's DAO implementation. This allows to have this realm as the main entry point for everything.
func UpdateImpl
crossing ActionUpdateImpl is a method intended to be used on a proposal. This method will update the current govDAO implementation to a new one. AllowedDAOs are a list of realms that can call this method, in case the new DAO implementation had a breaking bug. Any value set as nil will be ignored. If AllowedDAOs field is not set correctly, the actual DAO implementation wont be able to execute new Proposals!
func VoteOnProposal
crossing ActionVoteOnProposal sends a vote to the actual govDAO implementation. If the voter cannot vote the specified proposal, this method will return an error with the explanation of why.
func GetProposal
ActionGetProposal gets created proposal by its ID. Non-crossing pure read: looks up the proposal in this realm's package var. Callable directly from any realm without cross-call syntax.
func MustGetProposal
Actionfunc CreateProposal
crossing ActionCreateProposal will try to create a new proposal, that will be validated by the actual govDAO implementation. If the proposal cannot be created, an error will be returned.
func MustCreateProposal
crossing ActionMustCreateProposal is an utility method that does the same as CreateProposal, but instead of erroing if something happens, it panics.
func NewProposalRequest
Actionfunc NewProposalRequestWithFilter
Actionfunc NewProposals
Actionfunc NewSafeExecutor
Actionfunc NewSimpleExecutor
Action1func NewSimpleExecutor(_ int, rlm realm, callback func(realm) error, description string) *SimpleExecutorNewSimpleExecutor constructs an Executor whose creationRealm is captured from rlm.PkgPath() at construction time. The IsCurrent() check rejects stale or stashed realm values so the captured value is the authentic caller realm. creationRealm is display-only (rendered as "Executor created in: ..." in proposal listings) — no auth gate downstream.
func NewUpdateRequest
ActionNewUpdateRequest copies allowedDAOs into a fresh slice owned by /r/gov/dao. Under the storage=authority model, if we stored the caller-passed slice directly, the base ArrayValue would retain PkgID = caller_realm: storage rent would attribute to caller, and /r/gov/dao could not mutate (e.g. append to) its own copy without a DidUpdate panic. The internal copy ensures the UpdateRequest and its AllowedDAOs both live entirely in /r/gov/dao's authority.
func NewVoteRequest
Actionfunc NewVoteRequestWithMetadata
Action12
type DAO
interface 1type DAO interface {
2 // PreCreateProposal is called just before creating a new Proposal
3 // It is intended to be used to get the address of the proposal, that
4 // may vary depending on the DAO implementation, and to validate that
5 // the requester is allowed to do a proposal
6 PreCreateProposal(_ int, rlm realm, r ProposalRequest) (address, error)
7
8 // PostCreateProposal is called after creating the Proposal. It is
9 // intended to be used as a way to store a new proposal status, that
10 // depends on the actuall govDAO implementation
11 PostCreateProposal(_ int, rlm realm, r ProposalRequest, pid ProposalID)
12
13 // VoteOnProposal will send a petition to vote for a specific proposal
14 // to the actual govDAO implementation
15 VoteOnProposal(_ int, rlm realm, r VoteRequest) error
16
17 // PreExecuteProposal is called when someone is trying to execute a proposal by ID.
18 // Is intended to be used to validate who can trigger the proposal execution.
19 PreExecuteProposal(_ int, rlm realm, pid ProposalID) (bool, error)
20
21 // ExecuteProposal executes the proposal executor and on error changes proposal
22 // status to denied with the error message being the denial reason.
23 // It returns the executor error when it fails.
24 ExecuteProposal(_ int, rlm realm, pid ProposalID, e Executor) error
25
26 // Render will return a human-readable string in markdown format that
27 // will be used to show new data through the dao proxy entrypoint.
28 // Crossing: the chain query layer auto-injects .cur, and
29 // implementations forward cur to internal rlm-aware helpers (mux
30 // RenderRlm + downstream cross(rlm) reads).
31 Render(cur realm, pkgpath string, path string) string
32}DAO is the govDAO implementation interface. All mutating/auth-gated methods take rlm as their realm-typed parameter in the second position (the `_ int, rlm realm` non-crossing form): callers thread the proxy's cur as data without forcing a realm transition, so the impl's existing unsafe.CurrentRealm()-based auth gates (isValidCall, memberstore.Get) continue to see the proxy realm. Render stays unchanged.
type Executor
interfacetype Filter
interfacetype Proposal
structMethods on Proposal
func AllowedDAOs
method on Proposalfunc Author
method on Proposalfunc Description
method on Proposalfunc ExecutorCreationRealm
method on Proposalfunc ExecutorString
method on Proposalfunc Title
method on Proposaltype ProposalID
identtype ProposalRequest
structtype Proposals
structtype SafeExecutor
structSafeExecutor wraps an Executor to only allow its execution by allowed govDAOs.
Methods on SafeExecutor
func CreationRealm
method on SafeExecutorfunc Execute
crossing method on SafeExecutorfunc String
method on SafeExecutortype SimpleExecutor
structSimpleExecutor implements the Executor interface using a callback function and a description string.
Methods on SimpleExecutor
func CreationRealm
method on SimpleExecutorfunc Execute
crossing method on SimpleExecutorfunc String
method on SimpleExecutortype UpdateRequest
structtype VoteOption
identVoteOption is the limited voting option for a DAO proposal New govDAOs can create their own VoteOptions if needed in the future.
type VoteRequest
struct6
- chain stdlib
- errors stdlib
- gno.land/p/nt/bptree/v0 package
- gno.land/p/nt/seqid/v0 package
- gno.land/p/nt/ufmt/v0 package
- strconv stdlib