Open oldremez opened 1 year ago
// This is only a try
// neutron-dao module
func ProposeCommand(cliCtx context.CLIContext, title, description string, msgs []Msg) (sdk.TxResponse, error) {
// Transform user-friendly inputs to wasm messages
proposeMsg := NewMsgPropose(title, description, msgs)
// Construct and broadcast the transaction
return utils.BuildAndBroadcast(cliCtx, []sdk.Msg{proposeMsg})
}
// CLI command registration
var (
CmdPropose = &cobra.Command{
Use: "propose",
Short: "Propose a governance action",
RunE: func(cmd *cobra.Command, args []string) error {
title, _ := cmd.Flags().GetString("title")
description, _ := cmd.Flags().GetString("description")
msgs, _ := cmd.Flags().GetString("msgs")
cliCtx := context.NewCLIContext().WithCodec(appCodec)
response, err := neutronDao.ProposeCommand(cliCtx, title, description, msgs)
// Handle response and error
},
}
)
// Add flags to the propose command
func init() {
CmdPropose.Flags().String("title", "", "Proposal title")
CmdPropose.Flags().String("description", "", "Proposal description")
CmdPropose.Flags().String("msgs", "", "JSON array of messages")
// Add other necessary flags here
// hmm... My code could be mess and wrong, but that what I came up with after taking a look at some of the files
}
Neutron DAO is based on CosmWasm contracts but still is the core part of Neutron chain. This means two things:
neutrond
binary, DAO contracts are a crucial part of Neutron, and having support for them inneutrond
binary is a good thing.The current process of making a proposal, voting for it, and executing it looks something like that:
The user here has to work with obscure addresses of specific contracts which should not be messed up, and also hast to manually craft the jsons for messages for any action. What would be great to have instead is something like that:
The same for queries, etc., etc.
It will require the following:
getDaoContracts
function))