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

dao state

Back to all declarations

dao

*impl.GovDAO

dao is the actual govDAO implementation, having all the needed business logic

Open
OID
01c9af…30af:64
dao details

Inspect pointer

allowedDAOs

[]string (len=1)

allowedDAOs contains realms that can be used to update the actual govDAO implementation, and validate Proposals. This is like that to be able to rollback using a previous govDAO implementation in case the latest implementation has a breaking bug. After a test period, a proposal can be executed to remove all previous govDAOs implementations and leave the last one.

Open
OID
05205d…f007:35
allowedDAOs details (len=1)

+1 more Inspect slice

proposals

*dao.Proposals

proposals contains all the proposals in history.

Open
OID
05205d…f007:6
proposals details

Inspect pointer

Render

func(p string) string

Render calls directly to Render's DAO implementation. This allows to have this realm as the main entry point for everything.

Open
OID
05205d…f007:10
Render details

Inspect func

MustCreateProposal

func(r dao.ProposalRequest) dao.ProposalID

MustCreateProposal is an utility method that does the same as CreateProposal, but instead of erroing if something happens, it panics.

Open
OID
05205d…f007:12
MustCreateProposal details

Inspect func

ExecuteProposal

func(pid dao.ProposalID) bool

ExecuteProposal 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.

Open
OID
05205d…f007:13
ExecuteProposal details

Inspect func

ExecuteOrRejectProposal

func(pid dao.ProposalID) bool

ExecuteOrRejectProposal 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.

Open
OID
05205d…f007:14
ExecuteOrRejectProposal details

Inspect func

CreateProposal

func(r dao.ProposalRequest) (dao.ProposalID, .uverse.error)

CreateProposal 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.

Open
OID
05205d…f007:15
CreateProposal details

Inspect func

MustVoteOnProposal

func(r dao.VoteRequest)
Open
OID
05205d…f007:16
MustVoteOnProposal details

Inspect func

VoteOnProposal

func(r dao.VoteRequest) .uverse.error

VoteOnProposal 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.

Open
OID
05205d…f007:17
VoteOnProposal details

Inspect func

MustVoteOnProposalSimple

func(pid int64, option string)

MustVoteOnProposalSimple is like MustVoteOnProposal but intended to be used through gnokey with basic types.

Open
OID
05205d…f007:18
MustVoteOnProposalSimple details

Inspect func

MustGetProposal

func(pid dao.ProposalID) *dao.Proposal
Open
OID
05205d…f007:19
MustGetProposal details

Inspect func

GetProposal

func(pid dao.ProposalID) (*dao.Proposal, .uverse.error)

GetProposal 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.

Open
OID
05205d…f007:20
GetProposal details

Inspect func

UpdateImpl

func(r dao.UpdateRequest)

UpdateImpl 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!

Open
OID
05205d…f007:21
UpdateImpl details

Inspect func

InAllowedDAOs

func(pkg string) bool
Open
OID
05205d…f007:23
InAllowedDAOs details

Inspect func

executeProposal

func(pid dao.ProposalID, execErrorRejects bool) bool
Open
OID
05205d…f007:24
executeProposal details

Inspect func

ProposalID

type

Value

dao.ProposalID

VoteOption

type

VoteOption is the limited voting option for a DAO proposal New govDAOs can create their own VoteOptions if needed in the future.

Value

dao.VoteOption

AbstainVote

dao.VoteOption

// Side is not chosen

Value

<gnolang.StringValue>

YesVote

dao.VoteOption

// Proposal should be accepted

Value

<gnolang.StringValue>

NoVote

dao.VoteOption

// Proposal should be rejected

Value

<gnolang.StringValue>

VoteRequest

type

Value

dao.VoteRequest

NewVoteRequest

func(option dao.VoteOption, proposalID dao.ProposalID) dao.VoteRequest
Open
OID
05205d…f007:25
NewVoteRequest details

Inspect func

NewVoteRequestWithMetadata

func(option dao.VoteOption, proposalID dao.ProposalID, metadata interface{...}) dao.VoteRequest
Open
OID
05205d…f007:27
NewVoteRequestWithMetadata details

Inspect func

NewProposalRequest

func(title string, description string, executor dao.Executor) dao.ProposalRequest
Open
OID
05205d…f007:28
NewProposalRequest details

Inspect func

NewProposalRequestWithFilter

func(title string, description string, executor dao.Executor, filter dao.Filter) dao.ProposalRequest
Open
OID
05205d…f007:29
NewProposalRequestWithFilter details

Inspect func

Filter

type

Value

dao.Filter

ProposalRequest

type

Value

dao.ProposalRequest

Proposal

type

Value

dao.Proposal

Proposals

type

Value

dao.Proposals

NewProposals

func() *dao.Proposals
Open
OID
05205d…f007:30
NewProposals details

Inspect func

Executor

type

Value

dao.Executor

NewSimpleExecutor

func(int, rlm .uverse.realm, callback func(...), description string) *dao.SimpleExecutor

NewSimpleExecutor 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.

Open
OID
05205d…f007:31
NewSimpleExecutor details

Inspect func

SimpleExecutor

type

SimpleExecutor implements the Executor interface using a callback function and a description string.

Value

dao.SimpleExecutor

NewSafeExecutor

func(e dao.Executor) *dao.SafeExecutor
Open
OID
05205d…f007:32
NewSafeExecutor details

Inspect func

SafeExecutor

type

SafeExecutor wraps an Executor to only allow its execution by allowed govDAOs.

Value

dao.SafeExecutor

DAO

type

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.

Value

dao.DAO

UpdateRequest

type

Value

dao.UpdateRequest

NewUpdateRequest

func(d dao.DAO, allowedDAOs []string) dao.UpdateRequest

NewUpdateRequest 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.

Open
OID
05205d…f007:33
NewUpdateRequest details

Inspect func
dao : *impl.GovDAO Inspect
allowedDAOs : []string (len=1) Inspect
proposals : *dao.Proposals Inspect
Render : func(p string) string Inspect
MustCreateProposal : func(r dao.ProposalRequest) dao.ProposalID Inspect
ExecuteProposal : func(pid dao.ProposalID) bool Inspect
ExecuteOrRejectProposal : func(pid dao.ProposalID) bool Inspect
CreateProposal : func(r dao.ProposalRequest) (dao.ProposalID, .uverse.error) Inspect
MustVoteOnProposal : func(r dao.VoteRequest) Inspect
VoteOnProposal : func(r dao.VoteRequest) .uverse.error Inspect
MustVoteOnProposalSimple : func(pid int64, option string) Inspect
MustGetProposal : func(pid dao.ProposalID) *dao.Proposal Inspect
GetProposal : func(pid dao.ProposalID) (*dao.Proposal, .uverse.error) Inspect
UpdateImpl : func(r dao.UpdateRequest) Inspect
AllowedDAOs : func() []string Inspect
InAllowedDAOs : func(pkg string) bool Inspect
executeProposal : func(pid dao.ProposalID, execErrorRejects bool) bool Inspect
ProposalID : type =dao.ProposalID
VoteOption : type =dao.VoteOption
AbstainVote : dao.VoteOption =<gnolang.StringValue>
YesVote : dao.VoteOption =<gnolang.StringValue>
NoVote : dao.VoteOption =<gnolang.StringValue>
VoteRequest : type =dao.VoteRequest
NewVoteRequest : func(option dao.VoteOption, proposalID dao.ProposalID) dao.VoteRequest Inspect
NewVoteRequestWithMetadata : func(option dao.VoteOption, proposalID dao.ProposalID, metadata interface{...}) dao.VoteRequest Inspect
NewProposalRequest : func(title string, description string, executor dao.Executor) dao.ProposalRequest Inspect
NewProposalRequestWithFilter : func(title string, description string, executor dao.Executor, filter dao.Filter) dao.ProposalRequest Inspect
Filter : type =dao.Filter
ProposalRequest : type =dao.ProposalRequest
Proposal : type =dao.Proposal
Proposals : type =dao.Proposals
NewProposals : func() *dao.Proposals Inspect
Executor : type =dao.Executor
NewSimpleExecutor : func(int, rlm .uverse.realm, callback func(...), description string) *dao.SimpleExecutor Inspect
SimpleExecutor : type =dao.SimpleExecutor
NewSafeExecutor : func(e dao.Executor) *dao.SafeExecutor Inspect
SafeExecutor : type =dao.SafeExecutor
DAO : type =dao.DAO
UpdateRequest : type =dao.UpdateRequest
NewUpdateRequest : func(d dao.DAO, allowedDAOs []string) dao.UpdateRequest Inspect