1package governance23import (4 "errors"56 "gno.land/r/gnoswap/gov/governance"7)89type ProposalActionStatusResolver struct {10 *governance.ProposalActionStatus11}1213// NewProposalActionStatusResolver wraps a proposal action status for mutation14// and execution-state queries.15//16// Parameters:17// - status: proposal action status to resolve and update.18//19// Returns:20// - *ProposalActionStatusResolver: resolver backed by status.21func NewProposalActionStatusResolver(status *governance.ProposalActionStatus) *ProposalActionStatusResolver {22 return &ProposalActionStatusResolver{status}23}2425// cancel marks the proposal as canceled and records cancellation details.26// This method validates that the proposal is eligible for cancellation.27//28// Parameters:29// - canceledAt: timestamp when cancellation occurred30// - canceledHeight: block height when cancellation occurred31// - canceledBy: address performing the cancellation32//33// Returns:34// - error: already canceled error if proposal action status is already canceled35func (p *ProposalActionStatusResolver) cancel(36 canceledAt, canceledHeight int64,37 canceledBy address,38) error {39 if p.Canceled() {40 return errors.New(errAlreadyCanceledProposal)41 }4243 // Record cancellation details44 p.SetCanceled(true)45 p.SetCanceledAt(canceledAt)46 p.SetCanceledHeight(canceledHeight)47 p.SetCanceledBy(canceledBy)4849 return nil50}5152// Execute marks the proposal as executed and records execution details.53// This method validates that the proposal is eligible for execution.54//55// Parameters:56// - executedAt: Unix timestamp when execution occurred.57// - executedHeight: block height when execution occurred.58// - executedBy: address performing the execution.59//60// Returns:61// - error: nil on success; an error when the proposal is not executable or62// has already been canceled.63func (p *ProposalActionStatusResolver) Execute(64 executedAt, executedHeight int64,65 executedBy address,66) error {67 // Only executable proposals can be executed (text proposals cannot)68 if !p.IsExecutable() {69 return errors.New(errProposalNotExecutable)70 }7172 if p.Canceled() {73 return errors.New(errAlreadyCanceledProposal)74 }7576 // Record execution details77 p.SetExecuted(true)78 p.SetExecutedAt(executedAt)79 p.SetExecutedHeight(executedHeight)80 p.SetExecutedBy(executedBy)8182 return nil83}84Signatures reconstructed verbatim from vm/qfuncs — interface params keep their inline definitions.
vm/qrender output, sanitized (docs/render-security.md) and displayed in an empty-sandbox iframe — scripts, forms and popups cannot run. Links stay inert in-preview; right-click to open.