Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
9 changes: 9 additions & 0 deletions contract/r/gnoswap/gov/governance/proposal.gno
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ func (p *Proposal) Metadata() *ProposalMetadata {
return p.metadata
}

/* Setter methods */
func (p *Proposal) SetID(id int64) { p.id = id }
func (p *Proposal) SetProposer(proposer address) { p.proposer = proposer }
func (p *Proposal) SetStatus(status *ProposalStatus) { p.status = status }
func (p *Proposal) SetMetadata(metadata *ProposalMetadata) { p.metadata = metadata }
func (p *Proposal) SetData(data *ProposalData) { p.data = data }
func (p *Proposal) SetCreatedAt(createdAt int64) { p.createdAt = createdAt }
func (p *Proposal) SetCreatedHeight(createdHeight int64) { p.createdHeight = createdHeight }
func (p *Proposal) SetConfigVersion(configVersion int64) { p.configVersion = configVersion }

// IsTextType checks if this is a text proposal.
func (p *Proposal) IsTextType() bool {
Expand Down
48 changes: 13 additions & 35 deletions contract/r/gnoswap/gov/governance/proposal_action_status.gno
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import (
"errors"
)

var (
errProposalNotExecutable = errors.New("proposal not executable")
)
var errProposalNotExecutable = errors.New("proposal not executable")

// ProposalActionStatus tracks the execution and cancellation status of a proposal.
// This structure manages the action-related state including who performed actions and when.
Expand All @@ -25,50 +23,30 @@ type ProposalActionStatus struct {
}

/* Getter methods */
func (p *ProposalActionStatus) Canceled() bool { return p.canceled }
func (p *ProposalActionStatus) CanceledAt() int64 { return p.canceledAt }
func (p *ProposalActionStatus) Canceled() bool { return p.canceled }
func (p *ProposalActionStatus) CanceledAt() int64 { return p.canceledAt }
func (p *ProposalActionStatus) CanceledHeight() int64 { return p.canceledHeight }
func (p *ProposalActionStatus) Executed() bool { return p.executed }
func (p *ProposalActionStatus) ExecutedAt() int64 { return p.executedAt }
func (p *ProposalActionStatus) Executed() bool { return p.executed }
func (p *ProposalActionStatus) ExecutedAt() int64 { return p.executedAt }
func (p *ProposalActionStatus) ExecutedHeight() int64 { return p.executedHeight }
func (p *ProposalActionStatus) Executable() bool { return p.executable }
func (p *ProposalActionStatus) Executable() bool { return p.executable }

/* Setter methods */
func (p *ProposalActionStatus) SetCanceled(canceled bool) {
p.canceled = canceled
}

func (p *ProposalActionStatus) SetCanceledAt(canceledAt int64) {
p.canceledAt = canceledAt
}

func (p *ProposalActionStatus) SetCanceled(canceled bool) { p.canceled = canceled }
func (p *ProposalActionStatus) SetCanceledAt(canceledAt int64) { p.canceledAt = canceledAt }
func (p *ProposalActionStatus) SetCanceledHeight(canceledHeight int64) {
p.canceledHeight = canceledHeight
}

func (p *ProposalActionStatus) SetCanceledBy(canceledBy address) {
p.canceledBy = canceledBy
}

func (p *ProposalActionStatus) SetExecuted(executed bool) {
p.executed = executed
}

func (p *ProposalActionStatus) SetExecutedAt(executedAt int64) {
p.executedAt = executedAt
}

func (p *ProposalActionStatus) SetCanceledBy(canceledBy address) { p.canceledBy = canceledBy }
func (p *ProposalActionStatus) SetExecuted(executed bool) { p.executed = executed }
func (p *ProposalActionStatus) SetExecutedAt(executedAt int64) { p.executedAt = executedAt }
func (p *ProposalActionStatus) SetExecutedHeight(executedHeight int64) {
p.executedHeight = executedHeight
}

func (p *ProposalActionStatus) SetExecutedBy(executedBy address) {
p.executedBy = executedBy
}

func (p *ProposalActionStatus) SetExecutable(executable bool) {
p.executable = executable
}
func (p *ProposalActionStatus) SetExecutedBy(executedBy address) { p.executedBy = executedBy }
func (p *ProposalActionStatus) SetExecutable(executable bool) { p.executable = executable }

// CanceledBy returns the address that canceled the proposal.
// Only meaningful if IsCanceled() returns true.
Expand Down
36 changes: 36 additions & 0 deletions contract/r/gnoswap/gov/governance/proposal_data.gno
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ func (p *ProposalMetadata) Description() string {
return p.description
}

/* Setter methods */
func (p *ProposalMetadata) SetTitle(title string) {
p.title = strings.TrimSpace(title)
}

func (p *ProposalMetadata) SetDescription(description string) {
p.description = strings.TrimSpace(description)
}

// NewProposalMetadata creates a new proposal metadata instance with trimmed input.
//
// Parameters:
Expand Down Expand Up @@ -74,6 +83,19 @@ func (p *ProposalData) Execution() *ExecutionInfo {
return p.execution
}

/* Setter methods */
func (p *ProposalData) SetProposalType(proposalType ProposalType) {
p.proposalType = proposalType
}

func (p *ProposalData) SetCommunityPoolSpend(communityPoolSpend *CommunityPoolSpendInfo) {
p.communityPoolSpend = communityPoolSpend
}

func (p *ProposalData) SetExecution(execution *ExecutionInfo) {
p.execution = execution
}

// NewProposalData creates a new proposal data instance with the specified components.
//
// Parameters:
Expand Down Expand Up @@ -111,6 +133,11 @@ func (i *CommunityPoolSpendInfo) To() address { return i.to }
func (i *CommunityPoolSpendInfo) TokenPath() string { return i.tokenPath }
func (i *CommunityPoolSpendInfo) Amount() int64 { return i.amount }

/* Setter methods */
func (i *CommunityPoolSpendInfo) SetTo(to address) { i.to = to }
func (i *CommunityPoolSpendInfo) SetTokenPath(tokenPath string) { i.tokenPath = tokenPath }
func (i *CommunityPoolSpendInfo) SetAmount(amount int64) { i.amount = amount }

// ExecutionInfo contains information for parameter change execution.
// Messages are encoded strings that specify function calls and parameters.
type ExecutionInfo struct {
Expand All @@ -129,6 +156,10 @@ func NewExecutionInfo(num int64, msgs []string) *ExecutionInfo {
func (i *ExecutionInfo) Num() int64 { return i.num }
func (i *ExecutionInfo) Msgs() []string { return i.msgs }

/* Setter methods */
func (i *ExecutionInfo) SetNum(num int64) { i.num = num }
func (i *ExecutionInfo) SetMsgs(msgs []string) { i.msgs = msgs }

// ParameterChangeInfo represents a single parameter change to be executed.
type ParameterChangeInfo struct {
pkgPath string // Package path of the target contract
Expand All @@ -148,3 +179,8 @@ func NewParameterChangeInfo(pkgPath string, function string, params []string) Pa
func (i *ParameterChangeInfo) PkgPath() string { return i.pkgPath }
func (i *ParameterChangeInfo) Function() string { return i.function }
func (i *ParameterChangeInfo) Params() []string { return i.params }

/* Setter methods */
func (i *ParameterChangeInfo) SetPkgPath(pkgPath string) { i.pkgPath = pkgPath }
func (i *ParameterChangeInfo) SetFunction(function string) { i.function = function }
func (i *ParameterChangeInfo) SetParams(params []string) { i.params = params }
16 changes: 4 additions & 12 deletions contract/r/gnoswap/gov/governance/proposal_vote_status.gno
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type ProposalVoteStatus struct {

/* Getter methods */
func (p *ProposalVoteStatus) MaxVotingWeight() int64 { return p.maxVotingWeight }
func (p *ProposalVoteStatus) QuorumAmount() int64 { return p.quorumAmount }
func (p *ProposalVoteStatus) QuorumAmount() int64 { return p.quorumAmount }

// YesWeight returns the total weight of "yes" votes.
//
Expand All @@ -30,22 +30,14 @@ func (p *ProposalVoteStatus) NoWeight() int64 {
}

/* Setter methods */
func (p *ProposalVoteStatus) SetYesWeight(yes int64) {
p.yea = yes
}

func (p *ProposalVoteStatus) SetNoWeight(no int64) {
p.nay = no
}
func (p *ProposalVoteStatus) SetYesWeight(yes int64) { p.yea = yes }
func (p *ProposalVoteStatus) SetNoWeight(no int64) { p.nay = no }

func (p *ProposalVoteStatus) SetQuorumAmount(quorumAmount int64) { p.quorumAmount = quorumAmount }
func (p *ProposalVoteStatus) SetMaxVotingWeight(maxVotingWeight int64) {
p.maxVotingWeight = maxVotingWeight
}

func (p *ProposalVoteStatus) SetQuorumAmount(quorumAmount int64) {
p.quorumAmount = quorumAmount
}

// NewProposalVoteStatus creates a new vote status for a proposal.
// Initializes vote tallies to zero and calculates the quorum requirement.
//
Expand Down
5 changes: 0 additions & 5 deletions contract/r/gnoswap/v1/gov/doc.gno

This file was deleted.

2 changes: 0 additions & 2 deletions contract/r/gnoswap/v1/gov/gnomod.toml

This file was deleted.

Loading