- Task 1.1/1.2: Add no_with_veto vote option with 33.4% veto threshold - New VoteOptionNoWithVeto constant and DefaultVetoThresholdBps (3340) - VetoVotes field on Proposal struct (proto field 15) - CastVote handles no_with_veto; TallyProposal rejects if veto > 33.4% - Task 1.3: Add MsgCancelProposal - New ErrUnauthorizedCancel (1411) and ErrProposalNotCancellable (1412) - ProposalStatusCancelled constant - CancelProposal keeper method: checks proposer, voting status, refunds deposit - Task 1.4: Add QueryTallyResult and QueryVoterVotes - QueryTallyResult returns counts, percentages (bps), pass/veto status - QueryVoterVotes walks Votes collection filtered by voter address - Task 1.5: ParamExecutor coverage for marketplace, reputation, messaging, modelregistry - All 4 modules tested via mock executor registration + ExecuteProposal - Task 1.6: Execution log fields - ExecutionHeight (proto field 16) and ExecutionError (proto field 17) on Proposal - ExecuteProposal sets these on both success and failure paths All 24 tests pass (5 existing + 19 new), go build ./... clean. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
54 lines
1.9 KiB
Go
54 lines
1.9 KiB
Go
package governance
|
|
|
|
import (
|
|
autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
|
|
|
|
"clawchain/x/governance/types"
|
|
)
|
|
|
|
// AutoCLIOptions implements the autocli.HasAutoCLIConfig interface.
|
|
func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
|
|
return &autocliv1.ModuleOptions{
|
|
Query: &autocliv1.ServiceCommandDescriptor{
|
|
Service: types.Query_serviceDesc.ServiceName,
|
|
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
|
|
{
|
|
RpcMethod: "Proposal",
|
|
Use: "proposal [proposal-id]",
|
|
Short: "Query a single governance proposal by ID",
|
|
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "proposal_id"}},
|
|
},
|
|
{
|
|
RpcMethod: "Proposals",
|
|
Use: "proposals",
|
|
Short: "Query all governance proposals",
|
|
},
|
|
{
|
|
RpcMethod: "Votes",
|
|
Use: "votes [proposal-id]",
|
|
Short: "Query all votes for a proposal",
|
|
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "proposal_id"}},
|
|
},
|
|
},
|
|
},
|
|
Tx: &autocliv1.ServiceCommandDescriptor{
|
|
Service: types.Msg_serviceDesc.ServiceName,
|
|
EnhanceCustomCommand: true,
|
|
RpcCommandOptions: []*autocliv1.RpcCommandOptions{
|
|
{
|
|
RpcMethod: "SubmitProposal",
|
|
Use: "submit-proposal [title] [description] [module] [param-key] [proposed-value] [deposit-amount]",
|
|
Short: "Submit a parameter change proposal",
|
|
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "title"}, {ProtoField: "description"}, {ProtoField: "module"}, {ProtoField: "param_key"}, {ProtoField: "proposed_value"}, {ProtoField: "deposit_amount"}},
|
|
},
|
|
{
|
|
RpcMethod: "Vote",
|
|
Use: "vote [proposal-id] [option]",
|
|
Short: "Vote on a governance proposal (yes/no/abstain)",
|
|
PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "proposal_id"}, {ProtoField: "option"}},
|
|
},
|
|
},
|
|
},
|
|
}
|
|
}
|