Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Feb 17, 2025
1 parent 50a4dcc commit cfc2b07
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,11 @@ func (am AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry) {}
func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation {
operations := make([]simtypes.WeightedOperation, 0)

// this line is used by starport scaffolding # simapp/module/operation

return operations
}

// ProposalMsgs returns msgs used for governance proposals for simulations.
func (am AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg {
return []simtypes.WeightedProposalMsg{
// this line is used by starport scaffolding # simapp/module/OpMsg
}
}
8 changes: 5 additions & 3 deletions ignite/templates/typed/simulation.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package typed

// TODO

import (
"fmt"
"strings"
Expand All @@ -26,20 +28,20 @@ func ModuleSimulationMsgModify(
typeName.UpperCamel,
fmt.Sprintf("%s_%s", strings.ToLower(msg), typeName.Snake),
)
content, err = xast.ModifyFunction(content, "WeightedOperationsX", xast.AppendFuncCode(replacementOp))
content, err = xast.ModifyFunction(content, "WeightedOperations", xast.AppendFuncCode(replacementOp))
if err != nil {
return "", err
}

// add proposal simulation operations for msgs having an authority as signer.
if strings.Contains(content, "ProposalMsgsX") && strings.EqualFold(msgSigner.Original, "authority") {
if strings.Contains(content, "ProposalMsgs") && strings.EqualFold(msgSigner.Original, "authority") {
replacementOpMsg := fmt.Sprintf(
`reg.Add(weights.Get("msg_%[2]v", 100), simulation.Msg%[1]v%[2]vFactory(am.keeper))`,
msg,
typeName.UpperCamel,
fmt.Sprintf("%s_%s", strings.ToLower(msg), typeName.Snake),
)
content, err = xast.ModifyFunction(content, "ProposalMsgsX", xast.AppendFuncCode(replacementOpMsg))
content, err = xast.ModifyFunction(content, "ProposalMsgs", xast.AppendFuncCode(replacementOpMsg))
if err != nil {
return "", err
}
Expand Down

0 comments on commit cfc2b07

Please sign in to comment.