From cff38eaf92c577a688b3c57f75ef999a76748e72 Mon Sep 17 00:00:00 2001 From: tusoict Date: Sun, 29 Sep 2024 20:45:48 +0700 Subject: [PATCH 01/60] [tutm][Proposal1][initialize]: added note props#1 file --- blvlabs_note.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 blvlabs_note.md diff --git a/blvlabs_note.md b/blvlabs_note.md new file mode 100644 index 00000000..68a7ce9b --- /dev/null +++ b/blvlabs_note.md @@ -0,0 +1,48 @@ +Proposal to improve the Gov Module Mechanism by BLV Labs (KYCed) + +Enhancing the Oracle Module to Optimize the Calculation of Minimum Deposit for Proposals in the Gov Module +Problem: +As we know, the cryptocurrency market is always very volatile with large fluctuations, and so is #lunc, the price can also fluctuate with large amplitude, falling sharply or rising sharply + +In the current gov module logic, when creating a proposal, the creator will have to deposit #lunc (5 million lunc) first to push the proposal to the voting stage. So what will happen if the lunc price drops sharply? or rises sharply? This leads to the value of the proposal is not guaranteed. When the price is too small, it can lead to bad guys being able to spam many proposals online. + +So we decided to propose an improvement to the gov module to fix this problem: + +Objective: +Use Oracle module to update and calculate the minimum deposit required to create a proposal in the Gov module. + +In the event of a sharp drop or spike in LUNC price, the system will automatically increase the minimum margin to ensure the value of the proposal is maintained. + +The proposal value is kept at $500 (as suggested by the community), which will change the required lunc amount. + +Benefit: +This ensures that the required margin amount remains stable, unaffected by market price fluctuations, thus helping the network operate stably without being affected by price changes. + +Additionally, this mechanism prevents the network from being spammed with proposals if the LUNC price drops too low, which could allow bad actors to flood the network with spam proposals. + +Updated (28/8/2024) +After a quick check of v0.50, we decided to implement the logic as v0.50’s Canceling gov Proposal logic this helps avoid any conflicts if upgrading to v0.50 + +Updated (16/9/2024) +After listening to feedback from the community and validators, we have updated our proposal: + +Focus on feature #1: Enhancing the Oracle Module to Optimize the Calculation of Minimum Deposit for Proposals in the Gov Module + +Remove features #2 & #3, as this feature has been developed on SDK v.0.50 + +In the first proposal, we want to focus on small improvements and will complete well to demonstrate the team’s capabilities, as we are a new team on the Lunc Ecosystem We will continue to propose more complex improvements and features in the next proposals after completing this first proposal + +We hope that the community will trust and support us with the common goal of Lunc blockchain continuing to develop. + +Development Plan +Phase 1: Complete Enhancement 1 (*) +Research and delve into the Oracle and Gov modules. +Add supplementary API logic to the Oracle module to determine the price of LUNC. +Use the Oracle module API to add the minimum deposit calculation mechanism in the Gov module. +Complete the feature. +Conduct testing and write documentation. +Estimated Time: 4 weeks + +Timeline: 4 weeks +Total Budget: $5,000 +NOTED: This is a text proposal, not a community spend. We will put another proposal up for funding once we complete the work listed above. \ No newline at end of file From a92ee1bfbd1842c4fb05d4dc9cf323b9caa18723 Mon Sep 17 00:00:00 2001 From: duonghb53 Date: Sun, 29 Sep 2024 22:37:43 +0700 Subject: [PATCH 02/60] add new param, custom module gov --- custom/gov/client/cli/tx.go | 103 ++++++++++++++++++++++++++++ custom/gov/client/cli/util.go | 52 +++++++++++++++ custom/gov/keeper/deposit.go | 90 +++++++++++++++++++++++++ custom/gov/keeper/keeper.go | 87 ++++++++++++++++++++++++ custom/gov/keeper/msg_server.go | 100 ++++++++++++++++++++++++++++ custom/gov/keeper/proposal.go | 107 ++++++++++++++++++++++++++++++ custom/gov/module.go | 33 +++++++++ custom/gov/types/keys.go | 8 +++ proto/terra/gov/v2lunc1/gov.proto | 55 +++++++++++++++ 9 files changed, 635 insertions(+) create mode 100644 custom/gov/client/cli/tx.go create mode 100644 custom/gov/client/cli/util.go create mode 100644 custom/gov/keeper/deposit.go create mode 100644 custom/gov/keeper/keeper.go create mode 100644 custom/gov/keeper/msg_server.go create mode 100644 custom/gov/keeper/proposal.go create mode 100644 custom/gov/types/keys.go create mode 100644 proto/terra/gov/v2lunc1/gov.proto diff --git a/custom/gov/client/cli/tx.go b/custom/gov/client/cli/tx.go new file mode 100644 index 00000000..cf7c5517 --- /dev/null +++ b/custom/gov/client/cli/tx.go @@ -0,0 +1,103 @@ +package cli + +import ( + "fmt" + "strings" + + "github.com/spf13/cobra" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/cosmos/cosmos-sdk/version" + "github.com/cosmos/cosmos-sdk/x/bank/types" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" +) + +var FlagSplit = "split" + +// GetTxCmd returns the transaction commands for this module +func GetTxCmd() *cobra.Command { + txCmd := &cobra.Command{ + Use: types.ModuleName, + Short: "Bank transaction subcommands", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + txCmd.AddCommand(NewCmdSubmitProposal()) + + return txCmd +} + +// NewCmdSubmitProposal implements submitting a proposal transaction command. +func NewCmdSubmitProposal() *cobra.Command { + cmd := &cobra.Command{ + Use: "submit-proposal [path/to/proposal.json]", + Short: "Submit a proposal along with some messages, metadata and deposit", + Args: cobra.ExactArgs(1), + Long: strings.TrimSpace( + fmt.Sprintf(`Submit a proposal along with some messages, metadata and deposit. +They should be defined in a JSON file. + +Example: +$ %s tx gov submit-proposal path/to/proposal.json + +Where proposal.json contains: + +{ + // array of proto-JSON-encoded sdk.Msgs + "messages": [ + { + "@type": "/cosmos.bank.v1beta1.MsgSend", + "from_address": "cosmos1...", + "to_address": "cosmos1...", + "amount":[{"denom": "stake","amount": "10"}] + } + ], + // metadata can be any of base64 encoded, raw text, stringified json, IPFS link to json + // see below for example metadata + "metadata": "4pIMOgIGx1vZGU=", + "deposit": "10stake", + "title": "My proposal", + "summary": "A short summary of my proposal" +} + +metadata example: +{ + "title": "", + "authors": [""], + "summary": "", + "details": "", + "proposal_forum_url": "", + "vote_option_context": "", +} +`, + version.AppName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msgs, metadata, title, summary, deposit, err := parseSubmitProposal(clientCtx.Codec, args[0]) + if err != nil { + return err + } + + msg, err := v1.NewMsgSubmitProposal(msgs, deposit, clientCtx.GetFromAddress().String(), metadata, title, summary) + if err != nil { + return fmt.Errorf("invalid message: %w", err) + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/custom/gov/client/cli/util.go b/custom/gov/client/cli/util.go new file mode 100644 index 00000000..736569c7 --- /dev/null +++ b/custom/gov/client/cli/util.go @@ -0,0 +1,52 @@ +package cli + +import ( + "encoding/json" + "os" + + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// proposal defines the new Msg-based proposal. +type proposal struct { + // Msgs defines an array of sdk.Msgs proto-JSON-encoded as Anys. + Messages []json.RawMessage `json:"messages,omitempty"` + Metadata string `json:"metadata"` + Deposit string `json:"deposit"` + Title string `json:"title"` + Summary string `json:"summary"` +} + +// parseSubmitProposal reads and parses the proposal. +func parseSubmitProposal(cdc codec.Codec, path string) ([]sdk.Msg, string, string, string, sdk.Coins, error) { + var proposal proposal + + contents, err := os.ReadFile(path) + if err != nil { + return nil, "", "", "", nil, err + } + + err = json.Unmarshal(contents, &proposal) + if err != nil { + return nil, "", "", "", nil, err + } + + msgs := make([]sdk.Msg, len(proposal.Messages)) + for i, anyJSON := range proposal.Messages { + var msg sdk.Msg + err := cdc.UnmarshalInterfaceJSON(anyJSON, &msg) + if err != nil { + return nil, "", "", "", nil, err + } + + msgs[i] = msg + } + + deposit, err := sdk.ParseCoinsNormalized(proposal.Deposit) + if err != nil { + return nil, "", "", "", nil, err + } + + return msgs, proposal.Metadata, proposal.Title, proposal.Summary, deposit, nil +} diff --git a/custom/gov/keeper/deposit.go b/custom/gov/keeper/deposit.go new file mode 100644 index 00000000..ce710fa0 --- /dev/null +++ b/custom/gov/keeper/deposit.go @@ -0,0 +1,90 @@ +package keeper + +import ( + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/gov/types" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" +) + +// AddDeposit adds or updates a deposit of a specific depositor on a specific proposal. +// Activates voting period when appropriate and returns true in that case, else returns false. +func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress, depositAmount sdk.Coins) (bool, error) { + // Checks to see if proposal exists + proposal, ok := keeper.baseKeeper.GetProposal(ctx, proposalID) + if !ok { + return false, sdkerrors.Wrapf(types.ErrUnknownProposal, "%d", proposalID) + } + + // Check if proposal is still depositable + if (proposal.Status != v1.StatusDepositPeriod) && (proposal.Status != v1.StatusVotingPeriod) { + return false, sdkerrors.Wrapf(types.ErrInactiveProposal, "%d", proposalID) + } + + // update the governance module's account coins pool + err := keeper.bankKeeper.SendCoinsFromAccountToModule(ctx, depositorAddr, types.ModuleName, depositAmount) + if err != nil { + return false, err + } + + // Update proposal + proposal.TotalDeposit = sdk.NewCoins(proposal.TotalDeposit...).Add(depositAmount...) + keeper.baseKeeper.SetProposal(ctx, proposal) + + // Check if deposit has provided sufficient total funds to transition the proposal into the voting period + activatedVotingPeriod := false + + if proposal.Status == v1.StatusDepositPeriod && sdk.NewCoins(proposal.TotalDeposit...).IsAllGTE(keeper.baseKeeper.GetParams(ctx).MinDeposit) { + keeper.baseKeeper.ActivateVotingPeriod(ctx, proposal) + + activatedVotingPeriod = true + } + + // Add or update deposit object + deposit, found := keeper.baseKeeper.GetDeposit(ctx, proposalID, depositorAddr) + + if found { + deposit.Amount = sdk.NewCoins(deposit.Amount...).Add(depositAmount...) + } else { + deposit = v1.NewDeposit(proposalID, depositorAddr, depositAmount) + } + + // called when deposit has been added to a proposal, however the proposal may not be active + keeper.baseKeeper.Hooks().AfterProposalDeposit(ctx, proposalID, depositorAddr) + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeProposalDeposit, + sdk.NewAttribute(sdk.AttributeKeyAmount, depositAmount.String()), + sdk.NewAttribute(types.AttributeKeyProposalID, fmt.Sprintf("%d", proposalID)), + ), + ) + + keeper.baseKeeper.SetDeposit(ctx, deposit) + + return activatedVotingPeriod, nil +} + +// validateInitialDeposit validates if initial deposit is greater than or equal to the minimum +// required at the time of proposal submission. This threshold amount is determined by +// the deposit parameters. Returns nil on success, error otherwise. +func (keeper Keeper) validateInitialDeposit(ctx sdk.Context, initialDeposit sdk.Coins) error { + params := keeper.baseKeeper.GetParams(ctx) + minInitialDepositRatio, err := sdk.NewDecFromStr(params.MinInitialDepositRatio) + if err != nil { + return err + } + if minInitialDepositRatio.IsZero() { + return nil + } + minDepositCoins := params.MinDeposit + for i := range minDepositCoins { + minDepositCoins[i].Amount = sdk.NewDecFromInt(minDepositCoins[i].Amount).Mul(minInitialDepositRatio).RoundInt() + } + if !initialDeposit.IsAllGTE(minDepositCoins) { + return sdkerrors.Wrapf(types.ErrMinDepositTooSmall, "was (%s), need (%s)", initialDeposit, minDepositCoins) + } + return nil +} diff --git a/custom/gov/keeper/keeper.go b/custom/gov/keeper/keeper.go new file mode 100644 index 00000000..615f71b8 --- /dev/null +++ b/custom/gov/keeper/keeper.go @@ -0,0 +1,87 @@ +package keeper + +import ( + "fmt" + + markettypes "github.com/classic-terra/core/v3/x/market/types" + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/gov/keeper" + "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" +) + +// Keeper defines the governance module Keeper +type Keeper struct { + baseKeeper keeper.Keeper + authKeeper types.AccountKeeper + bankKeeper types.BankKeeper + oracleKeeper markettypes.OracleKeeper + + // The reference to the DelegationSet and ValidatorSet to get information about validators and delegators + sk types.StakingKeeper + + // GovHooks + hooks types.GovHooks + + // The (unexposed) keys used to access the stores from the Context. + storeKey storetypes.StoreKey + + // The codec for binary encoding/decoding. + cdc codec.BinaryCodec + + // Legacy Proposal router + legacyRouter v1beta1.Router + + // Msg server router + router *baseapp.MsgServiceRouter + + config types.Config + + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string +} + +// NewKeeper returns a governance keeper. It handles: +// - submitting governance proposals +// - depositing funds into proposals, and activating upon sufficient funds being deposited +// - users voting on proposals, with weight proportional to stake in the system +// - and tallying the result of the vote. +// +// CONTRACT: the parameter Subspace must have the param key table already initialized +func NewKeeper( + cdc codec.BinaryCodec, key storetypes.StoreKey, authKeeper types.AccountKeeper, + bankKeeper types.BankKeeper, sk types.StakingKeeper, + oracleKeeper markettypes.OracleKeeper, + router *baseapp.MsgServiceRouter, config types.Config, authority string, +) *Keeper { + // ensure governance module account is set + if addr := authKeeper.GetModuleAddress(types.ModuleName); addr == nil { + panic(fmt.Sprintf("%s module account has not been set", types.ModuleName)) + } + + if _, err := sdk.AccAddressFromBech32(authority); err != nil { + panic(fmt.Sprintf("invalid authority address: %s", authority)) + } + + // If MaxMetadataLen not set by app developer, set to default value. + if config.MaxMetadataLen == 0 { + config.MaxMetadataLen = types.DefaultConfig().MaxMetadataLen + } + + return &Keeper{ + storeKey: key, + baseKeeper: *keeper.NewKeeper(cdc, key, authKeeper, bankKeeper, sk, router, config, authority), + authKeeper: authKeeper, + bankKeeper: bankKeeper, + oracleKeeper: oracleKeeper, + sk: sk, + cdc: cdc, + router: router, + config: config, + authority: authority, + } +} diff --git a/custom/gov/keeper/msg_server.go b/custom/gov/keeper/msg_server.go new file mode 100644 index 00000000..71932318 --- /dev/null +++ b/custom/gov/keeper/msg_server.go @@ -0,0 +1,100 @@ +package keeper + +import ( + "context" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" +) + +type msgServer struct { + *Keeper +} + +// NewMsgServerImpl returns an implementation of the gov MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper *Keeper) v1.MsgServer { + return &msgServer{Keeper: keeper} +} + +var _ v1.MsgServer = msgServer{} + +// SubmitProposal implements the MsgServer.SubmitProposal method. +func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1.MsgSubmitProposal) (*v1.MsgSubmitProposalResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + initialDeposit := msg.GetInitialDeposit() + + if err := k.baseKeeper.validateInitialDeposit(ctx, initialDeposit); err != nil { + return nil, err + } + + proposalMsgs, err := msg.GetMsgs() + if err != nil { + return nil, err + } + + proposer, err := sdk.AccAddressFromBech32(msg.GetProposer()) + if err != nil { + return nil, err + } + + proposal, err := k.Keeper.SubmitProposal(ctx, proposalMsgs, msg.Metadata, msg.Title, msg.Summary, proposer) + if err != nil { + return nil, err + } + + bytes, err := proposal.Marshal() + if err != nil { + return nil, err + } + + // ref: https://github.com/cosmos/cosmos-sdk/issues/9683 + ctx.GasMeter().ConsumeGas( + 3*ctx.KVGasConfig().WriteCostPerByte*uint64(len(bytes)), + "submit proposal", + ) + + votingStarted, err := k.Keeper.AddDeposit(ctx, proposal.Id, proposer, msg.GetInitialDeposit()) + if err != nil { + return nil, err + } + + if votingStarted { + ctx.EventManager().EmitEvent( + sdk.NewEvent(govtypes.EventTypeSubmitProposal, + sdk.NewAttribute(govtypes.AttributeKeyVotingPeriodStart, fmt.Sprintf("%d", proposal.Id)), + ), + ) + } + + return &v1.MsgSubmitProposalResponse{ + ProposalId: proposal.Id, + }, nil +} + +// Deposit implements the MsgServer.Deposit method. +func (k msgServer) Deposit(goCtx context.Context, msg *v1.MsgDeposit) (*v1.MsgDepositResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + accAddr, err := sdk.AccAddressFromBech32(msg.Depositor) + if err != nil { + return nil, err + } + votingStarted, err := k.Keeper.AddDeposit(ctx, msg.ProposalId, accAddr, msg.Amount) + if err != nil { + return nil, err + } + + if votingStarted { + ctx.EventManager().EmitEvent( + sdk.NewEvent( + govtypes.EventTypeProposalDeposit, + sdk.NewAttribute(govtypes.AttributeKeyVotingPeriodStart, fmt.Sprintf("%d", msg.ProposalId)), + ), + ) + } + + return &v1.MsgDepositResponse{}, nil +} diff --git a/custom/gov/keeper/proposal.go b/custom/gov/keeper/proposal.go new file mode 100644 index 00000000..0b4cbcf5 --- /dev/null +++ b/custom/gov/keeper/proposal.go @@ -0,0 +1,107 @@ +package keeper + +import ( + "errors" + "fmt" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/gov/types" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" +) + +// SubmitProposal creates a new proposal given an array of messages +func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadata, title, summary string, proposer sdk.AccAddress) (v1.Proposal, error) { + err := keeper.baseKeeper.assertMetadataLength(metadata) + if err != nil { + return v1.Proposal{}, err + } + + // assert summary is no longer than predefined max length of metadata + err = keeper.baseKeeper.assertMetadataLength(summary) + if err != nil { + return v1.Proposal{}, err + } + + // assert title is no longer than predefined max length of metadata + err = keeper.baseKeeper.assertMetadataLength(title) + if err != nil { + return v1.Proposal{}, err + } + + // Will hold a comma-separated string of all Msg type URLs. + msgsStr := "" + + // Loop through all messages and confirm that each has a handler and the gov module account + // as the only signer + for _, msg := range messages { + msgsStr += fmt.Sprintf(",%s", sdk.MsgTypeURL(msg)) + + // perform a basic validation of the message + if err := msg.ValidateBasic(); err != nil { + return v1.Proposal{}, sdkerrors.Wrap(types.ErrInvalidProposalMsg, err.Error()) + } + + signers := msg.GetSigners() + if len(signers) != 1 { + return v1.Proposal{}, types.ErrInvalidSigner + } + + // assert that the governance module account is the only signer of the messages + if !signers[0].Equals(keeper.baseKeeper.GetGovernanceAccount(ctx).GetAddress()) { + return v1.Proposal{}, sdkerrors.Wrapf(types.ErrInvalidSigner, signers[0].String()) + } + + // use the msg service router to see that there is a valid route for that message. + handler := keeper.router.Handler(msg) + if handler == nil { + return v1.Proposal{}, sdkerrors.Wrap(types.ErrUnroutableProposalMsg, sdk.MsgTypeURL(msg)) + } + + // Only if it's a MsgExecLegacyContent do we try to execute the + // proposal in a cached context. + // For other Msgs, we do not verify the proposal messages any further. + // They may fail upon execution. + // ref: https://github.com/cosmos/cosmos-sdk/pull/10868#discussion_r784872842 + if msg, ok := msg.(*v1.MsgExecLegacyContent); ok { + cacheCtx, _ := ctx.CacheContext() + if _, err := handler(cacheCtx, msg); err != nil { + if errors.Is(types.ErrNoProposalHandlerExists, err) { + return v1.Proposal{}, err + } + return v1.Proposal{}, sdkerrors.Wrap(types.ErrInvalidProposalContent, err.Error()) + } + } + + } + + proposalID, err := keeper.baseKeeper.GetProposalID(ctx) + if err != nil { + return v1.Proposal{}, err + } + + submitTime := ctx.BlockHeader().Time + depositPeriod := keeper.baseKeeper.GetParams(ctx).MaxDepositPeriod + + proposal, err := v1.NewProposal(messages, proposalID, submitTime, submitTime.Add(*depositPeriod), metadata, title, summary, proposer) + if err != nil { + return v1.Proposal{}, err + } + + keeper.baseKeeper.SetProposal(ctx, proposal) + keeper.baseKeeper.InsertInactiveProposalQueue(ctx, proposalID, *proposal.DepositEndTime) + keeper.baseKeeper.SetProposalID(ctx, proposalID+1) + + // called right after a proposal is submitted + keeper.baseKeeper.Hooks().AfterProposalSubmission(ctx, proposalID) + + ctx.EventManager().EmitEvent( + sdk.NewEvent( + types.EventTypeSubmitProposal, + sdk.NewAttribute(types.AttributeKeyProposalID, fmt.Sprintf("%d", proposalID)), + sdk.NewAttribute(types.AttributeKeyProposalMessages, msgsStr), + ), + ) + + return proposal, nil +} diff --git a/custom/gov/module.go b/custom/gov/module.go index 360d2a13..b5bae01a 100644 --- a/custom/gov/module.go +++ b/custom/gov/module.go @@ -6,12 +6,18 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/gov" + "github.com/cosmos/cosmos-sdk/x/gov/keeper" + "github.com/spf13/cobra" + govclient "github.com/cosmos/cosmos-sdk/x/gov/client" govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + customcli "github.com/classic-terra/core/v3/custom/gov/client/cli" customtypes "github.com/classic-terra/core/v3/custom/gov/types" core "github.com/classic-terra/core/v3/types" + markettypes "github.com/classic-terra/core/v3/x/market/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) var _ module.AppModuleBasic = AppModuleBasic{} @@ -21,11 +27,38 @@ type AppModuleBasic struct { gov.AppModuleBasic } +// AppModule implements an application module for the gov module. +type AppModule struct { + gov.AppModule + accountKeeper govtypes.AccountKeeper + bankKeeper govtypes.BankKeeper + oracleKeeper markettypes.OracleKeeper + + // legacySubspace is used solely for migration of x/params managed parameters + legacySubspace govtypes.ParamSubspace +} + +// NewAppModule creates a new AppModule object +func NewAppModule(cdc codec.Codec, keeper *keeper.Keeper, accountKeeper govtypes.AccountKeeper, bankKeeper govtypes.BankKeeper, oracleKeeper markettypes.OracleKeeper, legacySubspace govtypes.ParamSubspace) AppModule { + return AppModule{ + AppModule: gov.NewAppModule(cdc, keeper, accountKeeper, bankKeeper, legacySubspace), + accountKeeper: accountKeeper, + bankKeeper: bankKeeper, + oracleKeeper: oracleKeeper, + legacySubspace: legacySubspace, + } +} + // NewAppModuleBasic creates a new AppModuleBasic object func NewAppModuleBasic(proposalHandlers []govclient.ProposalHandler) AppModuleBasic { return AppModuleBasic{gov.NewAppModuleBasic(proposalHandlers)} } +// GetTxCmd returns the root tx command for the bank module. +func (AppModuleBasic) GetTxCmd() *cobra.Command { + return customcli.GetTxCmd() +} + // RegisterLegacyAminoCodec registers the gov module's types for the given codec. func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { customtypes.RegisterLegacyAminoCodec(cdc) diff --git a/custom/gov/types/keys.go b/custom/gov/types/keys.go new file mode 100644 index 00000000..b667698a --- /dev/null +++ b/custom/gov/types/keys.go @@ -0,0 +1,8 @@ +package types + +// Keys for governance store +// Items are stored with the following key: values +var ( + // Minimum UUSD amount prefix + UUSDMinKeyPrefix = []byte{0x40} +) diff --git a/proto/terra/gov/v2lunc1/gov.proto b/proto/terra/gov/v2lunc1/gov.proto new file mode 100644 index 00000000..71edf099 --- /dev/null +++ b/proto/terra/gov/v2lunc1/gov.proto @@ -0,0 +1,55 @@ +syntax = "proto3"; +package terra.gov.v3; + +import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/duration.proto"; +import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; + +option go_package = "github.com/classic-terra/core/v3/x/gov/types"; + +// Params defines the parameters for the x/gov module. +// +// Since: cosmos-sdk 0.47 +message Params { + + // Deprecated: min_deposit is deprecated and replaced by the min_uusd_deposit + // Minimum deposit for a proposal to enter voting period. + repeated cosmos.base.v1beta1.Coin min_deposit = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + + // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + // months. + google.protobuf.Duration max_deposit_period = 2 [(gogoproto.stdduration) = true]; + + // Duration of the voting period. + google.protobuf.Duration voting_period = 3 [(gogoproto.stdduration) = true]; + + // Minimum percentage of total stake needed to vote for a result to be + // considered valid. + string quorum = 4 [(cosmos_proto.scalar) = "cosmos.Dec"]; + + // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. + string threshold = 5 [(cosmos_proto.scalar) = "cosmos.Dec"]; + + // Minimum value of Veto votes to Total votes ratio for proposal to be + // vetoed. Default value: 1/3. + string veto_threshold = 6 [(cosmos_proto.scalar) = "cosmos.Dec"]; + + // The ratio representing the proportion of the deposit value that must be paid at proposal submission. + string min_initial_deposit_ratio = 7 [(cosmos_proto.scalar) = "cosmos.Dec"]; + + // burn deposits if a proposal does not meet quorum + bool burn_vote_quorum = 13; + + // burn deposits if the proposal does not enter voting period + bool burn_proposal_deposit_prevote = 14; + + // burn deposits if quorum with vote type no_veto is met + bool burn_vote_veto = 15; + + // Minimal uusd deposit for a proposal to enter voting period + cosmos.base.v1beta1.Coin min_uusd_deposit = 16 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} \ No newline at end of file From ee4aa1a1b867660050d89d924802aeff99312988 Mon Sep 17 00:00:00 2001 From: duonghb53 Date: Mon, 30 Sep 2024 09:35:41 +0700 Subject: [PATCH 03/60] add proto --- go.mod | 1 + go.sum | 2 ++ proto/terra/gov/v2lunc1/gov.proto | 2 +- proto/terra/gov/v2lunc1/query.proto | 33 ++++++++++++++++++ proto/terra/gov/v2lunc1/tx.proto | 54 +++++++++++++++++++++++++++++ 5 files changed, 91 insertions(+), 1 deletion(-) create mode 100644 proto/terra/gov/v2lunc1/query.proto create mode 100644 proto/terra/gov/v2lunc1/tx.proto diff --git a/go.mod b/go.mod index 49caa391..c0954364 100644 --- a/go.mod +++ b/go.mod @@ -65,6 +65,7 @@ require ( github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae // indirect github.com/opencontainers/image-spec v1.1.0-rc2 // indirect github.com/opencontainers/runc v1.1.12 // indirect + github.com/regen-network/cosmos-proto v0.3.1 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/sirupsen/logrus v1.9.0 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect diff --git a/go.sum b/go.sum index 833ba593..43e20c4b 100644 --- a/go.sum +++ b/go.sum @@ -1079,6 +1079,8 @@ github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Ung github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= +github.com/regen-network/cosmos-proto v0.3.1 h1:rV7iM4SSFAagvy8RiyhiACbWEGotmqzywPxOvwMdxcg= +github.com/regen-network/cosmos-proto v0.3.1/go.mod h1:jO0sVX6a1B36nmE8C9xBFXpNwWejXC7QqCOnH3O0+YM= github.com/regen-network/protobuf v1.3.3-alpha.regen.1 h1:OHEc+q5iIAXpqiqFKeLpu5NwTIkVXUs48vFMwzqpqY4= github.com/regen-network/protobuf v1.3.3-alpha.regen.1/go.mod h1:2DjTFR1HhMQhiWC5sZ4OhQ3+NtdbZ6oBDKQwq5Ou+FI= github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= diff --git a/proto/terra/gov/v2lunc1/gov.proto b/proto/terra/gov/v2lunc1/gov.proto index 71edf099..6120a235 100644 --- a/proto/terra/gov/v2lunc1/gov.proto +++ b/proto/terra/gov/v2lunc1/gov.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package terra.gov.v3; +package terra.gov.v2lunc1; import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; diff --git a/proto/terra/gov/v2lunc1/query.proto b/proto/terra/gov/v2lunc1/query.proto new file mode 100644 index 00000000..30ebbc4d --- /dev/null +++ b/proto/terra/gov/v2lunc1/query.proto @@ -0,0 +1,33 @@ +syntax = "proto3"; +package terra.gov.v2lunc1; + +import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; +import "google/api/annotations.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/duration.proto"; +import "cosmos_proto/cosmos.proto"; +import "amino/amino.proto"; + +option go_package = "github.com/classic-terra/core/v3/x/gov/types"; + +// Query defines the gRPC querier service for gov module +service Query { + // Proposal queries proposal details based on ProposalID. + rpc Proposal(QueryProposalRequest) returns (QueryMinimalDepositProposalResponse) { + option (google.api.http).get = "/cosmos/gov/v1/proposals/minimal-deposits/{proposal_id}"; + } +} + +// QueryProposalRequest is the request type for the Query/Proposal RPC method. +message QueryProposalRequest { + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; +} + +// QueryVoteRequest is the request type for the Query/Vote RPC method. +message QueryMinimalDepositProposalResponse { + // proposal_id defines the unique id of the proposal. + repeated cosmos.base.v1beta1.Coin minimal_deposits = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} \ No newline at end of file diff --git a/proto/terra/gov/v2lunc1/tx.proto b/proto/terra/gov/v2lunc1/tx.proto new file mode 100644 index 00000000..7df99581 --- /dev/null +++ b/proto/terra/gov/v2lunc1/tx.proto @@ -0,0 +1,54 @@ +syntax = "proto3"; +package terra.gov.v2lunc1; + +import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/any.proto"; +import "google/protobuf/duration.proto"; +import "cosmos_proto/cosmos.proto"; +import "cosmos/msg/v1/msg.proto"; +import "amino/amino.proto"; + +option go_package = "github.com/classic-terra/core/v3/x/gov/types"; + +// Msg defines the gov Msg service. +service Msg { + option (cosmos.msg.v1.service) = true; + + // SubmitProposal defines a method to create new proposal given the messages. + rpc SubmitProposal(MsgSubmitProposal) returns (MsgSubmitProposalResponse); +} + +message MsgSubmitProposal { + option (cosmos.msg.v1.signer) = "proposer"; + option (amino.name) = "cosmos-sdk/v1/MsgSubmitProposal"; + + // messages are the arbitrary messages to be executed if proposal passes. + repeated google.protobuf.Any messages = 1; + + // initial_deposit is the deposit value that must be paid at proposal submission. + repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + + // proposer is the account address of the proposer. + string proposer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // metadata is any arbitrary metadata attached to the proposal. + string metadata = 4; + + // title is the title of the proposal. + // + // Since: cosmos-sdk 0.47 + string title = 5; + + // summary is the summary of the proposal + // + // Since: cosmos-sdk 0.47 + string summary = 6; +} + +// MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. +message MsgSubmitProposalResponse { + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; +} \ No newline at end of file From 02fc71c638aa0c15d7dd801382a8378b303d4d81 Mon Sep 17 00:00:00 2001 From: tusoict Date: Tue, 1 Oct 2024 10:09:24 +0700 Subject: [PATCH 04/60] generated pb.go files --- x/gov/types/gov.pb.go | 875 +++++++++++++++++++++++++++++++++++++ x/gov/types/query.pb.go | 595 +++++++++++++++++++++++++ x/gov/types/query.pb.gw.go | 189 ++++++++ x/gov/types/tx.pb.go | 874 ++++++++++++++++++++++++++++++++++++ 4 files changed, 2533 insertions(+) create mode 100644 x/gov/types/gov.pb.go create mode 100644 x/gov/types/query.pb.go create mode 100644 x/gov/types/query.pb.gw.go create mode 100644 x/gov/types/tx.pb.go diff --git a/x/gov/types/gov.pb.go b/x/gov/types/gov.pb.go new file mode 100644 index 00000000..ec234b53 --- /dev/null +++ b/x/gov/types/gov.pb.go @@ -0,0 +1,875 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: terra/gov/v2lunc1/gov.proto + +package types + +import ( + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/codec/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" + _ "github.com/gogo/protobuf/types" + io "io" + math "math" + math_bits "math/bits" + time "time" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf +var _ = time.Kitchen + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// Params defines the parameters for the x/gov module. +// +// Since: cosmos-sdk 0.47 +type Params struct { + // Deprecated: min_deposit is deprecated and replaced by the min_uusd_deposit + // Minimum deposit for a proposal to enter voting period. + MinDeposit []types.Coin `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3" json:"min_deposit"` + // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + // months. + MaxDepositPeriod *time.Duration `protobuf:"bytes,2,opt,name=max_deposit_period,json=maxDepositPeriod,proto3,stdduration" json:"max_deposit_period,omitempty"` + // Duration of the voting period. + VotingPeriod *time.Duration `protobuf:"bytes,3,opt,name=voting_period,json=votingPeriod,proto3,stdduration" json:"voting_period,omitempty"` + // Minimum percentage of total stake needed to vote for a result to be + // considered valid. + Quorum string `protobuf:"bytes,4,opt,name=quorum,proto3" json:"quorum,omitempty"` + // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. + Threshold string `protobuf:"bytes,5,opt,name=threshold,proto3" json:"threshold,omitempty"` + // Minimum value of Veto votes to Total votes ratio for proposal to be + // vetoed. Default value: 1/3. + VetoThreshold string `protobuf:"bytes,6,opt,name=veto_threshold,json=vetoThreshold,proto3" json:"veto_threshold,omitempty"` + // The ratio representing the proportion of the deposit value that must be paid at proposal submission. + MinInitialDepositRatio string `protobuf:"bytes,7,opt,name=min_initial_deposit_ratio,json=minInitialDepositRatio,proto3" json:"min_initial_deposit_ratio,omitempty"` + // burn deposits if a proposal does not meet quorum + BurnVoteQuorum bool `protobuf:"varint,13,opt,name=burn_vote_quorum,json=burnVoteQuorum,proto3" json:"burn_vote_quorum,omitempty"` + // burn deposits if the proposal does not enter voting period + BurnProposalDepositPrevote bool `protobuf:"varint,14,opt,name=burn_proposal_deposit_prevote,json=burnProposalDepositPrevote,proto3" json:"burn_proposal_deposit_prevote,omitempty"` + // burn deposits if quorum with vote type no_veto is met + BurnVoteVeto bool `protobuf:"varint,15,opt,name=burn_vote_veto,json=burnVoteVeto,proto3" json:"burn_vote_veto,omitempty"` + // Minimal uusd deposit for a proposal to enter voting period + MinUusdDeposit types.Coin `protobuf:"bytes,16,opt,name=min_uusd_deposit,json=minUusdDeposit,proto3" json:"min_uusd_deposit"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{0} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetMinDeposit() []types.Coin { + if m != nil { + return m.MinDeposit + } + return nil +} + +func (m *Params) GetMaxDepositPeriod() *time.Duration { + if m != nil { + return m.MaxDepositPeriod + } + return nil +} + +func (m *Params) GetVotingPeriod() *time.Duration { + if m != nil { + return m.VotingPeriod + } + return nil +} + +func (m *Params) GetQuorum() string { + if m != nil { + return m.Quorum + } + return "" +} + +func (m *Params) GetThreshold() string { + if m != nil { + return m.Threshold + } + return "" +} + +func (m *Params) GetVetoThreshold() string { + if m != nil { + return m.VetoThreshold + } + return "" +} + +func (m *Params) GetMinInitialDepositRatio() string { + if m != nil { + return m.MinInitialDepositRatio + } + return "" +} + +func (m *Params) GetBurnVoteQuorum() bool { + if m != nil { + return m.BurnVoteQuorum + } + return false +} + +func (m *Params) GetBurnProposalDepositPrevote() bool { + if m != nil { + return m.BurnProposalDepositPrevote + } + return false +} + +func (m *Params) GetBurnVoteVeto() bool { + if m != nil { + return m.BurnVoteVeto + } + return false +} + +func (m *Params) GetMinUusdDeposit() types.Coin { + if m != nil { + return m.MinUusdDeposit + } + return types.Coin{} +} + +func init() { + proto.RegisterType((*Params)(nil), "terra.gov.v2lunc1.Params") +} + +func init() { proto.RegisterFile("terra/gov/v2lunc1/gov.proto", fileDescriptor_ec6805a6cb6c4923) } + +var fileDescriptor_ec6805a6cb6c4923 = []byte{ + // 553 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4d, 0x4f, 0xd4, 0x4e, + 0x18, 0xdf, 0xfe, 0x81, 0xfd, 0xcb, 0x00, 0xeb, 0xd2, 0x18, 0xd3, 0xc5, 0x58, 0x36, 0xc6, 0x98, + 0x8d, 0x81, 0x4e, 0x80, 0xf8, 0x01, 0x5c, 0x57, 0x13, 0x0e, 0x1a, 0xdc, 0x28, 0x07, 0x2f, 0xcd, + 0xb4, 0x1d, 0xcb, 0x24, 0x3b, 0xf3, 0xd4, 0x99, 0x69, 0x03, 0xdf, 0xc2, 0xa3, 0x37, 0xaf, 0x1e, + 0x3d, 0xf8, 0x21, 0x38, 0x12, 0x4f, 0x9e, 0xd4, 0xc0, 0xc1, 0xaf, 0x61, 0xe6, 0xa5, 0x60, 0xc8, + 0x1e, 0xb8, 0x34, 0xd3, 0xe7, 0xf9, 0xbd, 0x3c, 0xbf, 0x79, 0x41, 0xf7, 0x34, 0x95, 0x92, 0xe0, + 0x12, 0x1a, 0xdc, 0xec, 0xce, 0x6a, 0x91, 0xef, 0x98, 0x75, 0x52, 0x49, 0xd0, 0x10, 0xae, 0xdb, + 0x66, 0x62, 0x0a, 0xbe, 0xb9, 0x11, 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0x79, 0x1c, 0x9c, 0x9d, 0xc7, 0xc1, 0xef, 0xf3, 0x38, 0xf8, 0x78, 0x11, 0x77, + 0xce, 0x2e, 0xe2, 0xce, 0x8f, 0x8b, 0xb8, 0xf3, 0x6e, 0xab, 0x64, 0xfa, 0xa8, 0xce, 0x92, 0x1c, + 0x38, 0xce, 0x67, 0x44, 0x29, 0x96, 0x6f, 0xbb, 0xe7, 0x9b, 0x83, 0xa4, 0xb8, 0xd9, 0xc3, 0xc7, + 0xf6, 0x21, 0xeb, 0x93, 0x8a, 0xaa, 0xac, 0x6b, 0x6f, 0xca, 0xde, 0xdf, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x98, 0x6e, 0xfb, 0x26, 0xe2, 0x03, 0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.MinUusdDeposit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + if m.BurnVoteVeto { + i-- + if m.BurnVoteVeto { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x78 + } + if m.BurnProposalDepositPrevote { + i-- + if m.BurnProposalDepositPrevote { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x70 + } + if m.BurnVoteQuorum { + i-- + if m.BurnVoteQuorum { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x68 + } + if len(m.MinInitialDepositRatio) > 0 { + i -= len(m.MinInitialDepositRatio) + copy(dAtA[i:], m.MinInitialDepositRatio) + i = encodeVarintGov(dAtA, i, uint64(len(m.MinInitialDepositRatio))) + i-- + dAtA[i] = 0x3a + } + if len(m.VetoThreshold) > 0 { + i -= len(m.VetoThreshold) + copy(dAtA[i:], m.VetoThreshold) + i = encodeVarintGov(dAtA, i, uint64(len(m.VetoThreshold))) + i-- + dAtA[i] = 0x32 + } + if len(m.Threshold) > 0 { + i -= len(m.Threshold) + copy(dAtA[i:], m.Threshold) + i = encodeVarintGov(dAtA, i, uint64(len(m.Threshold))) + i-- + dAtA[i] = 0x2a + } + if len(m.Quorum) > 0 { + i -= len(m.Quorum) + copy(dAtA[i:], m.Quorum) + i = encodeVarintGov(dAtA, i, uint64(len(m.Quorum))) + i-- + dAtA[i] = 0x22 + } + if m.VotingPeriod != nil { + n2, err2 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintGov(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x1a + } + if m.MaxDepositPeriod != nil { + n3, err3 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintGov(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x12 + } + if len(m.MinDeposit) > 0 { + for iNdEx := len(m.MinDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MinDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintGov(dAtA []byte, offset int, v uint64) int { + offset -= sovGov(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.MinDeposit) > 0 { + for _, e := range m.MinDeposit { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + if m.MaxDepositPeriod != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod) + n += 1 + l + sovGov(uint64(l)) + } + if m.VotingPeriod != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod) + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Quorum) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Threshold) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.VetoThreshold) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.MinInitialDepositRatio) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if m.BurnVoteQuorum { + n += 2 + } + if m.BurnProposalDepositPrevote { + n += 2 + } + if m.BurnVoteVeto { + n += 2 + } + l = m.MinUusdDeposit.Size() + n += 2 + l + sovGov(uint64(l)) + return n +} + +func sovGov(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGov(x uint64) (n int) { + return sovGov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinDeposit = append(m.MinDeposit, types.Coin{}) + if err := m.MinDeposit[len(m.MinDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxDepositPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MaxDepositPeriod == nil { + m.MaxDepositPeriod = new(time.Duration) + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.MaxDepositPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VotingPeriod == nil { + m.VotingPeriod = new(time.Duration) + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.VotingPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Quorum", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Quorum = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Threshold", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Threshold = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VetoThreshold", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VetoThreshold = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinInitialDepositRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinInitialDepositRatio = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BurnVoteQuorum", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BurnVoteQuorum = bool(v != 0) + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BurnProposalDepositPrevote", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BurnProposalDepositPrevote = bool(v != 0) + case 15: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BurnVoteVeto", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BurnVoteVeto = bool(v != 0) + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinUusdDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinUusdDeposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGov(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGov + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGov + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGov + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGov + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGov + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGov + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGov = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGov = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGov = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/gov/types/query.pb.go b/x/gov/types/query.pb.go new file mode 100644 index 00000000..664bb73d --- /dev/null +++ b/x/gov/types/query.pb.go @@ -0,0 +1,595 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: terra/gov/v2lunc1/query.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/codec/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "github.com/gogo/protobuf/types" + _ "google.golang.org/genproto/googleapis/api/annotations" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// QueryProposalRequest is the request type for the Query/Proposal RPC method. +type QueryProposalRequest struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` +} + +func (m *QueryProposalRequest) Reset() { *m = QueryProposalRequest{} } +func (m *QueryProposalRequest) String() string { return proto.CompactTextString(m) } +func (*QueryProposalRequest) ProtoMessage() {} +func (*QueryProposalRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_075d72aa1a1cda58, []int{0} +} +func (m *QueryProposalRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryProposalRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryProposalRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryProposalRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryProposalRequest.Merge(m, src) +} +func (m *QueryProposalRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryProposalRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryProposalRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryProposalRequest proto.InternalMessageInfo + +func (m *QueryProposalRequest) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +// QueryVoteRequest is the request type for the Query/Vote RPC method. +type QueryMinimalDepositProposalResponse struct { + // proposal_id defines the unique id of the proposal. + MinimalDeposits []types.Coin `protobuf:"bytes,1,rep,name=minimal_deposits,json=minimalDeposits,proto3" json:"minimal_deposits"` +} + +func (m *QueryMinimalDepositProposalResponse) Reset() { *m = QueryMinimalDepositProposalResponse{} } +func (m *QueryMinimalDepositProposalResponse) String() string { return proto.CompactTextString(m) } +func (*QueryMinimalDepositProposalResponse) ProtoMessage() {} +func (*QueryMinimalDepositProposalResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_075d72aa1a1cda58, []int{1} +} +func (m *QueryMinimalDepositProposalResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryMinimalDepositProposalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryMinimalDepositProposalResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryMinimalDepositProposalResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryMinimalDepositProposalResponse.Merge(m, src) +} +func (m *QueryMinimalDepositProposalResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryMinimalDepositProposalResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryMinimalDepositProposalResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryMinimalDepositProposalResponse proto.InternalMessageInfo + +func (m *QueryMinimalDepositProposalResponse) GetMinimalDeposits() []types.Coin { + if m != nil { + return m.MinimalDeposits + } + return nil +} + +func init() { + proto.RegisterType((*QueryProposalRequest)(nil), "terra.gov.v2lunc1.QueryProposalRequest") + proto.RegisterType((*QueryMinimalDepositProposalResponse)(nil), "terra.gov.v2lunc1.QueryMinimalDepositProposalResponse") +} + +func init() { proto.RegisterFile("terra/gov/v2lunc1/query.proto", fileDescriptor_075d72aa1a1cda58) } + +var fileDescriptor_075d72aa1a1cda58 = []byte{ + // 436 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0xcd, 0x6a, 0x14, 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0x5d, 0x64, 0xbd, 0x93, 0x45, 0xd6, + 0xfb, 0xb2, 0xc8, 0x7a, 0xcf, 0x6e, 0x95, 0xca, 0xbd, 0x68, 0x72, 0x5e, 0xa0, 0x86, 0xa2, 0x12, + 0x44, 0xaa, 0xd8, 0x0d, 0x6b, 0x5a, 0x60, 0x2d, 0xa1, 0xdd, 0x83, 0x97, 0xbe, 0x9b, 0x3b, 0xb2, + 0x92, 0xf2, 0x0b, 0xfe, 0xe3, 0xf6, 0x7e, 0x06, 0x00, 0x00, 0xff, 0xff, 0x67, 0xa0, 0x7c, 0x56, + 0xca, 0x02, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// QueryClient is the client API for Query service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type QueryClient interface { + // Proposal queries proposal details based on ProposalID. + Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryMinimalDepositProposalResponse, error) +} + +type queryClient struct { + cc grpc1.ClientConn +} + +func NewQueryClient(cc grpc1.ClientConn) QueryClient { + return &queryClient{cc} +} + +func (c *queryClient) Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryMinimalDepositProposalResponse, error) { + out := new(QueryMinimalDepositProposalResponse) + err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Query/Proposal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// QueryServer is the server API for Query service. +type QueryServer interface { + // Proposal queries proposal details based on ProposalID. + Proposal(context.Context, *QueryProposalRequest) (*QueryMinimalDepositProposalResponse, error) +} + +// UnimplementedQueryServer can be embedded to have forward compatible implementations. +type UnimplementedQueryServer struct { +} + +func (*UnimplementedQueryServer) Proposal(ctx context.Context, req *QueryProposalRequest) (*QueryMinimalDepositProposalResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Proposal not implemented") +} + +func RegisterQueryServer(s grpc1.Server, srv QueryServer) { + s.RegisterService(&_Query_serviceDesc, srv) +} + +func _Query_Proposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryProposalRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Proposal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terra.gov.v2lunc1.Query/Proposal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Proposal(ctx, req.(*QueryProposalRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _Query_serviceDesc = grpc.ServiceDesc{ + ServiceName: "terra.gov.v2lunc1.Query", + HandlerType: (*QueryServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Proposal", + Handler: _Query_Proposal_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "terra/gov/v2lunc1/query.proto", +} + +func (m *QueryProposalRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryProposalRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryProposalRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ProposalId != 0 { + i = encodeVarintQuery(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *QueryMinimalDepositProposalResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryMinimalDepositProposalResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryMinimalDepositProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.MinimalDeposits) > 0 { + for iNdEx := len(m.MinimalDeposits) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MinimalDeposits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *QueryProposalRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovQuery(uint64(m.ProposalId)) + } + return n +} + +func (m *QueryMinimalDepositProposalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.MinimalDeposits) > 0 { + for _, e := range m.MinimalDeposits { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + +func sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryProposalRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryProposalRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryMinimalDepositProposalResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryMinimalDepositProposalResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryMinimalDepositProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinimalDeposits", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinimalDeposits = append(m.MinimalDeposits, types.Coin{}) + if err := m.MinimalDeposits[len(m.MinimalDeposits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipQuery(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowQuery + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthQuery + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupQuery + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthQuery + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/gov/types/query.pb.gw.go b/x/gov/types/query.pb.gw.go new file mode 100644 index 00000000..a65153e1 --- /dev/null +++ b/x/gov/types/query.pb.gw.go @@ -0,0 +1,189 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: terra/gov/v2lunc1/query.proto + +/* +Package types is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package types + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/descriptor" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = descriptor.ForMessage +var _ = metadata.Join + +func request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryProposalRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["proposal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") + } + + protoReq.ProposalId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + msg, err := client.Proposal(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryProposalRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["proposal_id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "proposal_id") + } + + protoReq.ProposalId, err = runtime.Uint64(val) + + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) + } + + msg, err := server.Proposal(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". +// UnaryRPC :call QueryServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + + mux.Handle("GET", pattern_Query_Proposal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Proposal_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Proposal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterQueryHandler(ctx, mux, conn) +} + +// RegisterQueryHandler registers the http handlers for service Query to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) +} + +// RegisterQueryHandlerClient registers the http handlers for service Query +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "QueryClient" to call the correct interceptors. +func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + + mux.Handle("GET", pattern_Query_Proposal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Proposal_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Proposal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_Query_Proposal_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmos", "gov", "v1", "proposals", "minimal-deposits", "proposal_id"}, "", runtime.AssumeColonVerbOpt(false))) +) + +var ( + forward_Query_Proposal_0 = runtime.ForwardResponseMessage +) diff --git a/x/gov/types/tx.pb.go b/x/gov/types/tx.pb.go new file mode 100644 index 00000000..7ab58e97 --- /dev/null +++ b/x/gov/types/tx.pb.go @@ -0,0 +1,874 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: terra/gov/v2lunc1/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/codec/types" + types1 "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "github.com/gogo/protobuf/types" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type MsgSubmitProposal struct { + // messages are the arbitrary messages to be executed if proposal passes. + Messages []*types.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` + // initial_deposit is the deposit value that must be paid at proposal submission. + InitialDeposit []types1.Coin `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3" json:"initial_deposit"` + // proposer is the account address of the proposer. + Proposer string `protobuf:"bytes,3,opt,name=proposer,proto3" json:"proposer,omitempty"` + // metadata is any arbitrary metadata attached to the proposal. + Metadata string `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"` + // title is the title of the proposal. + // + // Since: cosmos-sdk 0.47 + Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"` + // summary is the summary of the proposal + // + // Since: cosmos-sdk 0.47 + Summary string `protobuf:"bytes,6,opt,name=summary,proto3" json:"summary,omitempty"` +} + +func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } +func (m *MsgSubmitProposal) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitProposal) ProtoMessage() {} +func (*MsgSubmitProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_9d64e87259bdff9f, []int{0} +} +func (m *MsgSubmitProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitProposal.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSubmitProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitProposal.Merge(m, src) +} +func (m *MsgSubmitProposal) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitProposal) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitProposal proto.InternalMessageInfo + +func (m *MsgSubmitProposal) GetMessages() []*types.Any { + if m != nil { + return m.Messages + } + return nil +} + +func (m *MsgSubmitProposal) GetInitialDeposit() []types1.Coin { + if m != nil { + return m.InitialDeposit + } + return nil +} + +func (m *MsgSubmitProposal) GetProposer() string { + if m != nil { + return m.Proposer + } + return "" +} + +func (m *MsgSubmitProposal) GetMetadata() string { + if m != nil { + return m.Metadata + } + return "" +} + +func (m *MsgSubmitProposal) GetTitle() string { + if m != nil { + return m.Title + } + return "" +} + +func (m *MsgSubmitProposal) GetSummary() string { + if m != nil { + return m.Summary + } + return "" +} + +// MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. +type MsgSubmitProposalResponse struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` +} + +func (m *MsgSubmitProposalResponse) Reset() { *m = MsgSubmitProposalResponse{} } +func (m *MsgSubmitProposalResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitProposalResponse) ProtoMessage() {} +func (*MsgSubmitProposalResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9d64e87259bdff9f, []int{1} +} +func (m *MsgSubmitProposalResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitProposalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitProposalResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgSubmitProposalResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitProposalResponse.Merge(m, src) +} +func (m *MsgSubmitProposalResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitProposalResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitProposalResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitProposalResponse proto.InternalMessageInfo + +func (m *MsgSubmitProposalResponse) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func init() { + proto.RegisterType((*MsgSubmitProposal)(nil), "terra.gov.v2lunc1.MsgSubmitProposal") + proto.RegisterType((*MsgSubmitProposalResponse)(nil), "terra.gov.v2lunc1.MsgSubmitProposalResponse") +} + +func init() { proto.RegisterFile("terra/gov/v2lunc1/tx.proto", fileDescriptor_9d64e87259bdff9f) } + +var fileDescriptor_9d64e87259bdff9f = []byte{ + // 513 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x31, 0x8f, 0xd3, 0x30, + 0x18, 0x6d, 0xae, 0xd7, 0xe3, 0xce, 0x27, 0x1d, 0x6a, 0x54, 0x89, 0x34, 0x43, 0x5a, 0x9d, 0x18, + 0xaa, 0xea, 0x6a, 0xd3, 0x1e, 0x13, 0x62, 0xb9, 0x82, 0x90, 0x18, 0x2a, 0xa1, 0xdc, 0xc6, 0x52, + 0x39, 0x89, 0x31, 0x16, 0x49, 0x1c, 0xf9, 0x73, 0xa2, 0xeb, 0x86, 0x18, 0x99, 0xf8, 0x19, 0x8c, + 0x1d, 0xf8, 0x11, 0xc7, 0x76, 0x62, 0x62, 0x42, 0xa8, 0x1d, 0xfa, 0x37, 0x50, 0x12, 0xb7, 0x43, + 0xbb, 0xb0, 0x24, 0xfe, 0xde, 0xfb, 0x9e, 0xbf, 0xa7, 0x67, 0x1b, 0xb9, 0x9a, 0x29, 0x45, 0x09, + 0x97, 0x05, 0x29, 0x26, 0x71, 0x9e, 0x86, 0x63, 0xa2, 0xef, 0x70, 0xa6, 0xa4, 0x96, 0x76, 0xbb, + 0xe2, 0x30, 0x97, 0x05, 0x36, 0x9c, 0xeb, 0x85, 0x12, 0x12, 0x09, 0x24, 0xa0, 0xc0, 0x48, 0x31, + 0x0e, 0x98, 0xa6, 0x63, 0x12, 0x4a, 0x91, 0xd6, 0x12, 0xb7, 0xc3, 0x25, 0x97, 0xd5, 0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, 0x4e, 0xf3, 0x04, 0xdf, 0x56, 0x03, 0x00, + 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MsgClient interface { + // SubmitProposal defines a method to create new proposal given the messages. + SubmitProposal(ctx context.Context, in *MsgSubmitProposal, opts ...grpc.CallOption) (*MsgSubmitProposalResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) SubmitProposal(ctx context.Context, in *MsgSubmitProposal, opts ...grpc.CallOption) (*MsgSubmitProposalResponse, error) { + out := new(MsgSubmitProposalResponse) + err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Msg/SubmitProposal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // SubmitProposal defines a method to create new proposal given the messages. + SubmitProposal(context.Context, *MsgSubmitProposal) (*MsgSubmitProposalResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) SubmitProposal(ctx context.Context, req *MsgSubmitProposal) (*MsgSubmitProposalResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmitProposal not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_SubmitProposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSubmitProposal) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SubmitProposal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terra.gov.v2lunc1.Msg/SubmitProposal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SubmitProposal(ctx, req.(*MsgSubmitProposal)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "terra.gov.v2lunc1.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "SubmitProposal", + Handler: _Msg_SubmitProposal_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "terra/gov/v2lunc1/tx.proto", +} + +func (m *MsgSubmitProposal) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSubmitProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Summary) > 0 { + i -= len(m.Summary) + copy(dAtA[i:], m.Summary) + i = encodeVarintTx(dAtA, i, uint64(len(m.Summary))) + i-- + dAtA[i] = 0x32 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintTx(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0x2a + } + if len(m.Metadata) > 0 { + i -= len(m.Metadata) + copy(dAtA[i:], m.Metadata) + i = encodeVarintTx(dAtA, i, uint64(len(m.Metadata))) + i-- + dAtA[i] = 0x22 + } + if len(m.Proposer) > 0 { + i -= len(m.Proposer) + copy(dAtA[i:], m.Proposer) + i = encodeVarintTx(dAtA, i, uint64(len(m.Proposer))) + i-- + dAtA[i] = 0x1a + } + if len(m.InitialDeposit) > 0 { + for iNdEx := len(m.InitialDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.InitialDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if len(m.Messages) > 0 { + for iNdEx := len(m.Messages) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Messages[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *MsgSubmitProposalResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgSubmitProposalResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ProposalId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintTx(dAtA []byte, offset int, v uint64) int { + offset -= sovTx(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgSubmitProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Messages) > 0 { + for _, e := range m.Messages { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + if len(m.InitialDeposit) > 0 { + for _, e := range m.InitialDeposit { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Proposer) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Metadata) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Title) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Summary) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgSubmitProposalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovTx(uint64(m.ProposalId)) + } + return n +} + +func sovTx(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSubmitProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Messages = append(m.Messages, &types.Any{}) + if err := m.Messages[len(m.Messages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InitialDeposit = append(m.InitialDeposit, types1.Coin{}) + if err := m.InitialDeposit[len(m.InitialDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Proposer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Metadata = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Summary", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Summary = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgSubmitProposalResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgSubmitProposalResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipTx(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +) From 062774be36fcd649e07ab52f7b58ff5744462a76 Mon Sep 17 00:00:00 2001 From: tusoict Date: Tue, 1 Oct 2024 11:10:32 +0700 Subject: [PATCH 05/60] added value in 500$ for param: minUusdDeposit --- .../gov/types/v2luncv1}/gov.pb.go | 0 custom/gov/types/v2luncv1/params.go | 112 ++++++++++++++++++ .../gov/types/v2luncv1}/query.pb.go | 0 .../gov/types/v2luncv1}/query.pb.gw.go | 2 +- .../gov/types/v2luncv1}/tx.pb.go | 2 +- 5 files changed, 114 insertions(+), 2 deletions(-) rename {x/gov/types => custom/gov/types/v2luncv1}/gov.pb.go (100%) create mode 100644 custom/gov/types/v2luncv1/params.go rename {x/gov/types => custom/gov/types/v2luncv1}/query.pb.go (100%) rename {x/gov/types => custom/gov/types/v2luncv1}/query.pb.gw.go (99%) rename {x/gov/types => custom/gov/types/v2luncv1}/tx.pb.go (99%) diff --git a/x/gov/types/gov.pb.go b/custom/gov/types/v2luncv1/gov.pb.go similarity index 100% rename from x/gov/types/gov.pb.go rename to custom/gov/types/v2luncv1/gov.pb.go diff --git a/custom/gov/types/v2luncv1/params.go b/custom/gov/types/v2luncv1/params.go new file mode 100644 index 00000000..86b0fdef --- /dev/null +++ b/custom/gov/types/v2luncv1/params.go @@ -0,0 +1,112 @@ +package v2luncv1 + +import ( + fmt "fmt" + "time" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// Default period for deposits & voting +const ( + DefaultPeriod time.Duration = time.Hour * 24 * 2 // 2 days +) + +// Default governance params +var ( + DefaultMinUusdDepositTokens = sdk.NewInt(500) // Minimal uusd deposit for a proposal to enter voting period +) + +// NewParams creates a new Params instance with given values. +func NewParams( + minDeposit sdk.Coins, maxDepositPeriod, votingPeriod time.Duration, + quorum, threshold, vetoThreshold, minInitialDepositRatio string, burnProposalDeposit, burnVoteQuorum, burnVoteVeto bool, minUusdDeposit sdk.Coin, +) Params { + return Params{ + MinDeposit: minDeposit, + MaxDepositPeriod: &maxDepositPeriod, + VotingPeriod: &votingPeriod, + Quorum: quorum, + Threshold: threshold, + VetoThreshold: vetoThreshold, + MinInitialDepositRatio: minInitialDepositRatio, + BurnProposalDepositPrevote: burnProposalDeposit, + BurnVoteQuorum: burnVoteQuorum, + BurnVoteVeto: burnVoteVeto, + MinUusdDeposit: minUusdDeposit, + } +} + +// ValidateBasic performs basic validation on governance parameters. +func (p Params) ValidateBasic() error { + if minDeposit := sdk.Coins(p.MinDeposit); minDeposit.Empty() || !minDeposit.IsValid() { + return fmt.Errorf("invalid minimum deposit: %s", minDeposit) + } + + if p.MaxDepositPeriod == nil { + return fmt.Errorf("maximum deposit period must not be nil: %d", p.MaxDepositPeriod) + } + + if p.MaxDepositPeriod.Seconds() <= 0 { + return fmt.Errorf("maximum deposit period must be positive: %d", p.MaxDepositPeriod) + } + + quorum, err := sdk.NewDecFromStr(p.Quorum) + if err != nil { + return fmt.Errorf("invalid quorum string: %w", err) + } + if quorum.IsNegative() { + return fmt.Errorf("quorom cannot be negative: %s", quorum) + } + if quorum.GT(math.LegacyOneDec()) { + return fmt.Errorf("quorom too large: %s", p.Quorum) + } + + threshold, err := sdk.NewDecFromStr(p.Threshold) + if err != nil { + return fmt.Errorf("invalid threshold string: %w", err) + } + if !threshold.IsPositive() { + return fmt.Errorf("vote threshold must be positive: %s", threshold) + } + if threshold.GT(math.LegacyOneDec()) { + return fmt.Errorf("vote threshold too large: %s", threshold) + } + + vetoThreshold, err := sdk.NewDecFromStr(p.VetoThreshold) + if err != nil { + return fmt.Errorf("invalid vetoThreshold string: %w", err) + } + if !vetoThreshold.IsPositive() { + return fmt.Errorf("veto threshold must be positive: %s", vetoThreshold) + } + if vetoThreshold.GT(math.LegacyOneDec()) { + return fmt.Errorf("veto threshold too large: %s", vetoThreshold) + } + + if p.VotingPeriod == nil { + return fmt.Errorf("voting period must not be nil: %d", p.VotingPeriod) + } + + if p.VotingPeriod.Seconds() <= 0 { + return fmt.Errorf("voting period must be positive: %s", p.VotingPeriod) + } + + minInitialDepositRatio, err := math.LegacyNewDecFromStr(p.MinInitialDepositRatio) + if err != nil { + return fmt.Errorf("invalid mininum initial deposit ratio of proposal: %w", err) + } + if minInitialDepositRatio.IsNegative() { + return fmt.Errorf("mininum initial deposit ratio of proposal must be positive: %s", minInitialDepositRatio) + } + if minInitialDepositRatio.GT(math.LegacyOneDec()) { + return fmt.Errorf("mininum initial deposit ratio of proposal is too large: %s", minInitialDepositRatio) + } + + if minUusdDeposit := p.MinUusdDeposit; !minUusdDeposit.IsValid() { + return fmt.Errorf("invalid minimum uusd deposit: %s", minUusdDeposit) + } + + return nil +} diff --git a/x/gov/types/query.pb.go b/custom/gov/types/v2luncv1/query.pb.go similarity index 100% rename from x/gov/types/query.pb.go rename to custom/gov/types/v2luncv1/query.pb.go diff --git a/x/gov/types/query.pb.gw.go b/custom/gov/types/v2luncv1/query.pb.gw.go similarity index 99% rename from x/gov/types/query.pb.gw.go rename to custom/gov/types/v2luncv1/query.pb.gw.go index a65153e1..b9a0daa6 100644 --- a/x/gov/types/query.pb.gw.go +++ b/custom/gov/types/v2luncv1/query.pb.gw.go @@ -6,7 +6,7 @@ Package types is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package types +package v2luncv1 import ( "context" diff --git a/x/gov/types/tx.pb.go b/custom/gov/types/v2luncv1/tx.pb.go similarity index 99% rename from x/gov/types/tx.pb.go rename to custom/gov/types/v2luncv1/tx.pb.go index 7ab58e97..72aa738f 100644 --- a/x/gov/types/tx.pb.go +++ b/custom/gov/types/v2luncv1/tx.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: terra/gov/v2lunc1/tx.proto -package types +package v2luncv1 import ( context "context" From 03990d2befd69bb96a76316f34e89e0c18082290 Mon Sep 17 00:00:00 2001 From: tusoict Date: Tue, 1 Oct 2024 13:58:46 +0700 Subject: [PATCH 06/60] added TotalDepositKey func --- custom/gov/types/keys.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/custom/gov/types/keys.go b/custom/gov/types/keys.go index b667698a..4dd72c4a 100644 --- a/custom/gov/types/keys.go +++ b/custom/gov/types/keys.go @@ -1,8 +1,22 @@ package types +import "encoding/binary" + // Keys for governance store // Items are stored with the following key: values var ( // Minimum UUSD amount prefix UUSDMinKeyPrefix = []byte{0x40} ) + +// GetProposalIDBytes returns the byte representation of the proposalID +func GetProposalIDBytes(proposalID uint64) (proposalIDBz []byte) { + proposalIDBz = make([]byte, 8) + binary.BigEndian.PutUint64(proposalIDBz, proposalID) + return +} + +// TotalDepositKey of the specific total amount to deposit based on the proposalID from the store +func TotalDepositKey(proposalID uint64) []byte { + return append(UUSDMinKeyPrefix, GetProposalIDBytes(proposalID)...) +} From 4e366a64c156c0bd32aa8123a93643d3542e5b0c Mon Sep 17 00:00:00 2001 From: tusoict Date: Tue, 1 Oct 2024 17:06:36 +0700 Subject: [PATCH 07/60] Implemented a logic: in the SubmitProposal function: - Get LUNC price based on UUSD - Calculate the amount of LUNC to send for the proposal during that time - Store the LUNC amount --- custom/gov/keeper/keeper.go | 9 ++++++++ custom/gov/keeper/params.go | 31 ++++++++++++++++++++++++++ custom/gov/keeper/proposal.go | 34 ++++++++++++++++++++++++++--- custom/gov/types/errors.go | 11 ++++++++++ custom/gov/types/v2luncv1/gov.pb.go | 2 +- 5 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 custom/gov/keeper/params.go create mode 100644 custom/gov/types/errors.go diff --git a/custom/gov/keeper/keeper.go b/custom/gov/keeper/keeper.go index 615f71b8..2d3b446e 100644 --- a/custom/gov/keeper/keeper.go +++ b/custom/gov/keeper/keeper.go @@ -85,3 +85,12 @@ func NewKeeper( authority: authority, } } + +// assertMetadataLength returns an error if given metadata length +// is greater than a pre-defined MaxMetadataLen. +func (keeper Keeper) assertMetadataLength(metadata string) error { + if metadata != "" && uint64(len(metadata)) > keeper.config.MaxMetadataLen { + return types.ErrMetadataTooLong.Wrapf("got metadata with length %d", len(metadata)) + } + return nil +} diff --git a/custom/gov/keeper/params.go b/custom/gov/keeper/params.go new file mode 100644 index 00000000..ecebf191 --- /dev/null +++ b/custom/gov/keeper/params.go @@ -0,0 +1,31 @@ +package keeper + +import ( + "github.com/CosmWasm/wasmd/x/wasm/types" + v2luncv1types "github.com/classic-terra/core/v3/custom/gov/types/v2luncv1" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// SetParams sets the gov module's parameters. +func (k Keeper) SetParams(ctx sdk.Context, params v2luncv1types.Params) error { + store := ctx.KVStore(k.storeKey) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + store.Set(types.ParamsKey, bz) + + return nil +} + +// GetParams gets the gov module's parameters. +func (k Keeper) GetParams(clientCtx sdk.Context) (params v2luncv1types.Params) { + store := clientCtx.KVStore(k.storeKey) + bz := store.Get(types.ParamsKey) + if bz == nil { + return params + } + + k.cdc.MustUnmarshal(bz, ¶ms) + return params +} diff --git a/custom/gov/keeper/proposal.go b/custom/gov/keeper/proposal.go index 0b4cbcf5..d7f4dc68 100644 --- a/custom/gov/keeper/proposal.go +++ b/custom/gov/keeper/proposal.go @@ -4,6 +4,10 @@ import ( "errors" "fmt" + "cosmossdk.io/math" + v2luncv1types "github.com/classic-terra/core/v3/custom/gov/types" + core "github.com/classic-terra/core/v3/types" + sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -12,19 +16,20 @@ import ( // SubmitProposal creates a new proposal given an array of messages func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadata, title, summary string, proposer sdk.AccAddress) (v1.Proposal, error) { - err := keeper.baseKeeper.assertMetadataLength(metadata) + err := keeper.assertMetadataLength(metadata) + if err != nil { return v1.Proposal{}, err } // assert summary is no longer than predefined max length of metadata - err = keeper.baseKeeper.assertMetadataLength(summary) + err = keeper.assertMetadataLength(summary) if err != nil { return v1.Proposal{}, err } // assert title is no longer than predefined max length of metadata - err = keeper.baseKeeper.assertMetadataLength(title) + err = keeper.assertMetadataLength(title) if err != nil { return v1.Proposal{}, err } @@ -92,6 +97,22 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat keeper.baseKeeper.InsertInactiveProposalQueue(ctx, proposalID, *proposal.DepositEndTime) keeper.baseKeeper.SetProposalID(ctx, proposalID+1) + // Get exchange rate betweent Lunc/uusd from oracle + // save it to store + amt := sdk.NewInt(10) + offerCoin := sdk.NewCoin(core.MicroUSDDenom, amt) + price, err := keeper.oracleKeeper.GetLunaExchangeRate(ctx, offerCoin.Denom) + if err != nil { + return v1.Proposal{}, sdkerrors.Wrap(v2luncv1types.ErrQueryExchangeRateUusdFail, err.Error()) + } + + minUusdDeposit := keeper.GetParams(ctx).MinUusdDeposit + totalLuncDeposit, err := minUusdDeposit.Amount.SafeQuo(price.RoundInt()) + if err != nil { + return v1.Proposal{}, sdkerrors.Wrap(v2luncv1types.ErrQueryExchangeRateUusdFail, err.Error()) + } + keeper.SetPriceLuncBaseUusd(ctx, proposalID, math.LegacyDec(totalLuncDeposit)) + // called right after a proposal is submitted keeper.baseKeeper.Hooks().AfterProposalSubmission(ctx, proposalID) @@ -105,3 +126,10 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat return proposal, nil } + +// SetPriceLuncBaseUusd sets a price Lunc base on Uusd to store. +func (keeper Keeper) SetPriceLuncBaseUusd(ctx sdk.Context, proposalID uint64, amount sdk.Dec) { + store := ctx.KVStore(keeper.storeKey) + key := v2luncv1types.TotalDepositKey(proposalID) + store.Set(key, []byte(amount.String())) +} diff --git a/custom/gov/types/errors.go b/custom/gov/types/errors.go new file mode 100644 index 00000000..a084976b --- /dev/null +++ b/custom/gov/types/errors.go @@ -0,0 +1,11 @@ +package types + +import ( + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +// x/gov module sentinel errors +var ( + ErrQueryExchangeRateUusdFail = sdkerrors.Register(govtypes.ModuleName, 17, "Get exchange rate lunc-uusd from oracle failed") +) diff --git a/custom/gov/types/v2luncv1/gov.pb.go b/custom/gov/types/v2luncv1/gov.pb.go index ec234b53..e5f3b4fe 100644 --- a/custom/gov/types/v2luncv1/gov.pb.go +++ b/custom/gov/types/v2luncv1/gov.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: terra/gov/v2lunc1/gov.proto -package types +package v2luncv1 import ( fmt "fmt" From 9b22f54edf2470396fdfd60baf4eb4fd272f2350 Mon Sep 17 00:00:00 2001 From: tusoict Date: Tue, 1 Oct 2024 20:20:33 +0700 Subject: [PATCH 08/60] Updated the converting logic in SubmitProposal Func --- custom/gov/keeper/proposal.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom/gov/keeper/proposal.go b/custom/gov/keeper/proposal.go index d7f4dc68..3d8f34d6 100644 --- a/custom/gov/keeper/proposal.go +++ b/custom/gov/keeper/proposal.go @@ -105,9 +105,9 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat if err != nil { return v1.Proposal{}, sdkerrors.Wrap(v2luncv1types.ErrQueryExchangeRateUusdFail, err.Error()) } - minUusdDeposit := keeper.GetParams(ctx).MinUusdDeposit - totalLuncDeposit, err := minUusdDeposit.Amount.SafeQuo(price.RoundInt()) + totalLuncDeposit := sdk.NewDecFromInt(minUusdDeposit.Amount).Quo(price).TruncateInt() + if err != nil { return v1.Proposal{}, sdkerrors.Wrap(v2luncv1types.ErrQueryExchangeRateUusdFail, err.Error()) } From 22141bdc186b4440ba891855f8c03ea31a018bd6 Mon Sep 17 00:00:00 2001 From: tusoict Date: Wed, 2 Oct 2024 10:44:40 +0700 Subject: [PATCH 09/60] marshall amount before store in SetPriceLuncBaseUusd func --- custom/gov/keeper/proposal.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/custom/gov/keeper/proposal.go b/custom/gov/keeper/proposal.go index 3d8f34d6..581f43be 100644 --- a/custom/gov/keeper/proposal.go +++ b/custom/gov/keeper/proposal.go @@ -99,7 +99,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat // Get exchange rate betweent Lunc/uusd from oracle // save it to store - amt := sdk.NewInt(10) + amt := sdk.NewInt(1000000) offerCoin := sdk.NewCoin(core.MicroUSDDenom, amt) price, err := keeper.oracleKeeper.GetLunaExchangeRate(ctx, offerCoin.Denom) if err != nil { @@ -131,5 +131,9 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat func (keeper Keeper) SetPriceLuncBaseUusd(ctx sdk.Context, proposalID uint64, amount sdk.Dec) { store := ctx.KVStore(keeper.storeKey) key := v2luncv1types.TotalDepositKey(proposalID) - store.Set(key, []byte(amount.String())) + + bz, err := amount.Marshal() + if err == nil { + store.Set(key, bz) + } } From 6d7fa291f15cc8460fe1393f5c91a0fb10327f43 Mon Sep 17 00:00:00 2001 From: tusoict Date: Wed, 2 Oct 2024 12:09:32 +0700 Subject: [PATCH 10/60] Handle the CheckLimitlDeposit rule in AddDeposit func: --- custom/gov/keeper/deposit.go | 27 ++++++++++++++++++++++++++- custom/gov/keeper/proposal.go | 13 +++++++++---- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/custom/gov/keeper/deposit.go b/custom/gov/keeper/deposit.go index ce710fa0..59c5f0dc 100644 --- a/custom/gov/keeper/deposit.go +++ b/custom/gov/keeper/deposit.go @@ -3,6 +3,7 @@ package keeper import ( "fmt" + v2luncv1types "github.com/classic-terra/core/v3/custom/gov/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -36,7 +37,15 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd // Check if deposit has provided sufficient total funds to transition the proposal into the voting period activatedVotingPeriod := false - if proposal.Status == v1.StatusDepositPeriod && sdk.NewCoins(proposal.TotalDeposit...).IsAllGTE(keeper.baseKeeper.GetParams(ctx).MinDeposit) { + // HandleCheckLimitlDeposit + minDeposit := keeper.baseKeeper.GetParams(ctx).MinDeposit + requiredAmount := keeper.GetDepositLimitBaseUusd(ctx, proposalID).TruncateInt() + + requiredDepositCoins := sdk.NewCoins( + sdk.NewCoin(minDeposit[0].Denom, requiredAmount), + ) + + if proposal.Status == v1.StatusDepositPeriod && sdk.NewCoins(proposal.TotalDeposit...).IsAllGTE(requiredDepositCoins) && requiredAmount.GT(sdk.ZeroInt()) { keeper.baseKeeper.ActivateVotingPeriod(ctx, proposal) activatedVotingPeriod = true @@ -88,3 +97,19 @@ func (keeper Keeper) validateInitialDeposit(ctx sdk.Context, initialDeposit sdk. } return nil } + +// GetDepositLimitBaseUUSD gets the deposit limit (Lunc) for a specific proposal +func (keeper Keeper) GetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64) (depositLimit sdk.Dec) { + store := ctx.KVStore(keeper.storeKey) + key := v2luncv1types.TotalDepositKey(proposalID) + bz := store.Get(key) + if bz == nil { + return sdk.ZeroDec() + } + err := depositLimit.Unmarshal(bz) + if err == nil { + return sdk.ZeroDec() + } + + return depositLimit +} diff --git a/custom/gov/keeper/proposal.go b/custom/gov/keeper/proposal.go index 581f43be..a4e0df42 100644 --- a/custom/gov/keeper/proposal.go +++ b/custom/gov/keeper/proposal.go @@ -102,7 +102,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat amt := sdk.NewInt(1000000) offerCoin := sdk.NewCoin(core.MicroUSDDenom, amt) price, err := keeper.oracleKeeper.GetLunaExchangeRate(ctx, offerCoin.Denom) - if err != nil { + if err != nil && price.LTE(sdk.ZeroDec()) { return v1.Proposal{}, sdkerrors.Wrap(v2luncv1types.ErrQueryExchangeRateUusdFail, err.Error()) } minUusdDeposit := keeper.GetParams(ctx).MinUusdDeposit @@ -111,7 +111,11 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat if err != nil { return v1.Proposal{}, sdkerrors.Wrap(v2luncv1types.ErrQueryExchangeRateUusdFail, err.Error()) } - keeper.SetPriceLuncBaseUusd(ctx, proposalID, math.LegacyDec(totalLuncDeposit)) + + er := keeper.SetDepositLimitBaseUusd(ctx, proposalID, math.LegacyDec(totalLuncDeposit)) + if er != nil { + return v1.Proposal{}, sdkerrors.Wrap(v2luncv1types.ErrQueryExchangeRateUusdFail, er.Error()) + } // called right after a proposal is submitted keeper.baseKeeper.Hooks().AfterProposalSubmission(ctx, proposalID) @@ -127,8 +131,8 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat return proposal, nil } -// SetPriceLuncBaseUusd sets a price Lunc base on Uusd to store. -func (keeper Keeper) SetPriceLuncBaseUusd(ctx sdk.Context, proposalID uint64, amount sdk.Dec) { +// SetDepositLimitBaseUusd sets a limit deposit(Lunc) base on Uusd to store. +func (keeper Keeper) SetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64, amount sdk.Dec) error { store := ctx.KVStore(keeper.storeKey) key := v2luncv1types.TotalDepositKey(proposalID) @@ -136,4 +140,5 @@ func (keeper Keeper) SetPriceLuncBaseUusd(ctx sdk.Context, proposalID uint64, am if err == nil { store.Set(key, bz) } + return err } From b80170f826e252094a62baa87cf8891426f712d5 Mon Sep 17 00:00:00 2001 From: tusoict Date: Thu, 3 Oct 2024 12:31:06 +0700 Subject: [PATCH 11/60] Updated the HandleCheckMinInitialDeposit logic in ante of auth module --- custom/auth/ante/min_initial_deposit.go | 25 ++++++++++---------- custom/gov/keeper/params.go | 6 ++--- custom/gov/keeper/proposal.go | 31 ++++++++++++++++--------- custom/gov/types/v2luncv1/query.pb.go | 2 +- 4 files changed, 37 insertions(+), 27 deletions(-) diff --git a/custom/auth/ante/min_initial_deposit.go b/custom/auth/ante/min_initial_deposit.go index aba11758..48f8fe94 100644 --- a/custom/auth/ante/min_initial_deposit.go +++ b/custom/auth/ante/min_initial_deposit.go @@ -4,9 +4,9 @@ import ( "fmt" errorsmod "cosmossdk.io/errors" + govv2luncv1 "github.com/classic-terra/core/v3/custom/gov/keeper" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" @@ -15,12 +15,12 @@ import ( // MinInitialDeposit Decorator will check Initial Deposits for MsgSubmitProposal type MinInitialDepositDecorator struct { - govKeeper govkeeper.Keeper + govKeeper govv2luncv1.Keeper treasuryKeeper TreasuryKeeper } // NewMinInitialDeposit returns new min initial deposit decorator instance -func NewMinInitialDepositDecorator(govKeeper govkeeper.Keeper, treasuryKeeper TreasuryKeeper) MinInitialDepositDecorator { +func NewMinInitialDepositDecorator(govKeeper govv2luncv1.Keeper, treasuryKeeper TreasuryKeeper) MinInitialDepositDecorator { return MinInitialDepositDecorator{ govKeeper: govKeeper, treasuryKeeper: treasuryKeeper, @@ -38,28 +38,29 @@ func IsMsgSubmitProposal(msg sdk.Msg) bool { } // HandleCheckMinInitialDeposit -func HandleCheckMinInitialDeposit(ctx sdk.Context, msg sdk.Msg, govKeeper govkeeper.Keeper, treasuryKeeper TreasuryKeeper) (err error) { +func HandleCheckMinInitialDeposit(ctx sdk.Context, msg sdk.Msg, govKeeper govv2luncv1.Keeper, treasuryKeeper TreasuryKeeper) (err error) { var initialDepositCoins sdk.Coins switch submitPropMsg := msg.(type) { case *govv1beta1.MsgSubmitProposal: initialDepositCoins = submitPropMsg.GetInitialDeposit() + case *govv1.MsgSubmitProposal: initialDepositCoins = submitPropMsg.GetInitialDeposit() default: return fmt.Errorf("could not dereference msg as MsgSubmitProposal") } - minDeposit := govKeeper.GetParams(ctx).MinDeposit - requiredAmount := sdk.NewDecFromInt(minDeposit[0].Amount).Mul(treasuryKeeper.GetMinInitialDepositRatio(ctx)).TruncateInt() - requiredDepositCoins := sdk.NewCoins( - sdk.NewCoin(core.MicroLunaDenom, requiredAmount), - ) + err, requiredAmount := govKeeper.GetMinimumDepositBaseUusd(ctx) + if err == nil { + requiredDepositCoins := sdk.NewCoins( + sdk.NewCoin(core.MicroLunaDenom, requiredAmount), + ) - if !initialDepositCoins.IsAllGTE(requiredDepositCoins) { - return fmt.Errorf("not enough initial deposit provided. Expected %q; got %q", requiredDepositCoins, initialDepositCoins) + if !initialDepositCoins.IsAllGTE(requiredDepositCoins) { + return fmt.Errorf("not enough initial deposit provided. Expected %q; got %q", requiredDepositCoins, initialDepositCoins) + } } - return nil } diff --git a/custom/gov/keeper/params.go b/custom/gov/keeper/params.go index ecebf191..8124fb56 100644 --- a/custom/gov/keeper/params.go +++ b/custom/gov/keeper/params.go @@ -2,12 +2,12 @@ package keeper import ( "github.com/CosmWasm/wasmd/x/wasm/types" - v2luncv1types "github.com/classic-terra/core/v3/custom/gov/types/v2luncv1" + v2luncv1 "github.com/classic-terra/core/v3/custom/gov/types/v2luncv1" sdk "github.com/cosmos/cosmos-sdk/types" ) // SetParams sets the gov module's parameters. -func (k Keeper) SetParams(ctx sdk.Context, params v2luncv1types.Params) error { +func (k Keeper) SetParams(ctx sdk.Context, params v2luncv1.Params) error { store := ctx.KVStore(k.storeKey) bz, err := k.cdc.Marshal(¶ms) if err != nil { @@ -19,7 +19,7 @@ func (k Keeper) SetParams(ctx sdk.Context, params v2luncv1types.Params) error { } // GetParams gets the gov module's parameters. -func (k Keeper) GetParams(clientCtx sdk.Context) (params v2luncv1types.Params) { +func (k Keeper) GetParams(clientCtx sdk.Context) (params v2luncv1.Params) { store := clientCtx.KVStore(k.storeKey) bz := store.Get(types.ParamsKey) if bz == nil { diff --git a/custom/gov/keeper/proposal.go b/custom/gov/keeper/proposal.go index a4e0df42..0e6a927b 100644 --- a/custom/gov/keeper/proposal.go +++ b/custom/gov/keeper/proposal.go @@ -97,17 +97,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat keeper.baseKeeper.InsertInactiveProposalQueue(ctx, proposalID, *proposal.DepositEndTime) keeper.baseKeeper.SetProposalID(ctx, proposalID+1) - // Get exchange rate betweent Lunc/uusd from oracle - // save it to store - amt := sdk.NewInt(1000000) - offerCoin := sdk.NewCoin(core.MicroUSDDenom, amt) - price, err := keeper.oracleKeeper.GetLunaExchangeRate(ctx, offerCoin.Denom) - if err != nil && price.LTE(sdk.ZeroDec()) { - return v1.Proposal{}, sdkerrors.Wrap(v2luncv1types.ErrQueryExchangeRateUusdFail, err.Error()) - } - minUusdDeposit := keeper.GetParams(ctx).MinUusdDeposit - totalLuncDeposit := sdk.NewDecFromInt(minUusdDeposit.Amount).Quo(price).TruncateInt() - + err, totalLuncDeposit := keeper.GetMinimumDepositBaseUusd(ctx) if err != nil { return v1.Proposal{}, sdkerrors.Wrap(v2luncv1types.ErrQueryExchangeRateUusdFail, err.Error()) } @@ -142,3 +132,22 @@ func (keeper Keeper) SetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64, } return err } + +// GetDepositLimitBaseUusd: calculate the minimum LUNC amount to deposit base on Uusd for the proposal +func (keeper Keeper) GetMinimumDepositBaseUusd(ctx sdk.Context) (error, math.Int) { + // Get exchange rate betweent Lunc/uusd from oracle + // save it to store + amt := sdk.NewInt(1000000) + offerCoin := sdk.NewCoin(core.MicroUSDDenom, amt) + price, err := keeper.oracleKeeper.GetLunaExchangeRate(ctx, offerCoin.Denom) + if err != nil && price.LTE(sdk.ZeroDec()) { + return err, sdk.ZeroInt() + } + minUusdDeposit := keeper.GetParams(ctx).MinUusdDeposit + totalLuncDeposit := sdk.NewDecFromInt(minUusdDeposit.Amount).Quo(price).TruncateInt() + + if err != nil { + return err, sdk.ZeroInt() + } + return nil, totalLuncDeposit +} diff --git a/custom/gov/types/v2luncv1/query.pb.go b/custom/gov/types/v2luncv1/query.pb.go index 664bb73d..708b82e2 100644 --- a/custom/gov/types/v2luncv1/query.pb.go +++ b/custom/gov/types/v2luncv1/query.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: terra/gov/v2lunc1/query.proto -package types +package v2luncv1 import ( context "context" From 76927b6f3bc3ac49db665c516eb56fb4d0d43809 Mon Sep 17 00:00:00 2001 From: tusoict Date: Thu, 3 Oct 2024 21:49:10 +0700 Subject: [PATCH 12/60] Overided keeper instance in keeper.go (gov module) --- app/keepers/keepers.go | 5 ++++- custom/gov/keeper/deposit.go | 36 +++++++-------------------------- custom/gov/keeper/keeper.go | 4 ++-- custom/gov/keeper/msg_server.go | 2 +- custom/gov/keeper/proposal.go | 18 ++++++++--------- 5 files changed, 22 insertions(+), 43 deletions(-) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 6a9470f9..26260990 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -60,6 +60,8 @@ import ( customwasmkeeper "github.com/classic-terra/core/v3/custom/wasm/keeper" terrawasm "github.com/classic-terra/core/v3/wasmbinding" + customgovkeeper "github.com/classic-terra/core/v3/custom/gov/keeper" + dyncommkeeper "github.com/classic-terra/core/v3/x/dyncomm/keeper" dyncommtypes "github.com/classic-terra/core/v3/x/dyncomm/types" marketkeeper "github.com/classic-terra/core/v3/x/market/keeper" @@ -439,12 +441,13 @@ func NewAppKeepers( // register the proposal types govRouter := appKeepers.newGovRouter() govConfig := govtypes.DefaultConfig() - govKeeper := govkeeper.NewKeeper( + govKeeper := customgovkeeper.NewKeeper( appCodec, appKeepers.keys[govtypes.StoreKey], appKeepers.AccountKeeper, appKeepers.BankKeeper, appKeepers.StakingKeeper, + appKeepers.OracleKeeper, bApp.MsgServiceRouter(), govConfig, authtypes.NewModuleAddress(govtypes.ModuleName).String(), diff --git a/custom/gov/keeper/deposit.go b/custom/gov/keeper/deposit.go index 59c5f0dc..fbb3d4d9 100644 --- a/custom/gov/keeper/deposit.go +++ b/custom/gov/keeper/deposit.go @@ -14,7 +14,7 @@ import ( // Activates voting period when appropriate and returns true in that case, else returns false. func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress, depositAmount sdk.Coins) (bool, error) { // Checks to see if proposal exists - proposal, ok := keeper.baseKeeper.GetProposal(ctx, proposalID) + proposal, ok := keeper.GetProposal(ctx, proposalID) if !ok { return false, sdkerrors.Wrapf(types.ErrUnknownProposal, "%d", proposalID) } @@ -32,13 +32,13 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd // Update proposal proposal.TotalDeposit = sdk.NewCoins(proposal.TotalDeposit...).Add(depositAmount...) - keeper.baseKeeper.SetProposal(ctx, proposal) + keeper.SetProposal(ctx, proposal) // Check if deposit has provided sufficient total funds to transition the proposal into the voting period activatedVotingPeriod := false // HandleCheckLimitlDeposit - minDeposit := keeper.baseKeeper.GetParams(ctx).MinDeposit + minDeposit := keeper.GetParams(ctx).MinDeposit requiredAmount := keeper.GetDepositLimitBaseUusd(ctx, proposalID).TruncateInt() requiredDepositCoins := sdk.NewCoins( @@ -46,13 +46,13 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd ) if proposal.Status == v1.StatusDepositPeriod && sdk.NewCoins(proposal.TotalDeposit...).IsAllGTE(requiredDepositCoins) && requiredAmount.GT(sdk.ZeroInt()) { - keeper.baseKeeper.ActivateVotingPeriod(ctx, proposal) + keeper.ActivateVotingPeriod(ctx, proposal) activatedVotingPeriod = true } // Add or update deposit object - deposit, found := keeper.baseKeeper.GetDeposit(ctx, proposalID, depositorAddr) + deposit, found := keeper.GetDeposit(ctx, proposalID, depositorAddr) if found { deposit.Amount = sdk.NewCoins(deposit.Amount...).Add(depositAmount...) @@ -61,7 +61,7 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd } // called when deposit has been added to a proposal, however the proposal may not be active - keeper.baseKeeper.Hooks().AfterProposalDeposit(ctx, proposalID, depositorAddr) + keeper.Hooks().AfterProposalDeposit(ctx, proposalID, depositorAddr) ctx.EventManager().EmitEvent( sdk.NewEvent( @@ -71,33 +71,11 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd ), ) - keeper.baseKeeper.SetDeposit(ctx, deposit) + keeper.SetDeposit(ctx, deposit) return activatedVotingPeriod, nil } -// validateInitialDeposit validates if initial deposit is greater than or equal to the minimum -// required at the time of proposal submission. This threshold amount is determined by -// the deposit parameters. Returns nil on success, error otherwise. -func (keeper Keeper) validateInitialDeposit(ctx sdk.Context, initialDeposit sdk.Coins) error { - params := keeper.baseKeeper.GetParams(ctx) - minInitialDepositRatio, err := sdk.NewDecFromStr(params.MinInitialDepositRatio) - if err != nil { - return err - } - if minInitialDepositRatio.IsZero() { - return nil - } - minDepositCoins := params.MinDeposit - for i := range minDepositCoins { - minDepositCoins[i].Amount = sdk.NewDecFromInt(minDepositCoins[i].Amount).Mul(minInitialDepositRatio).RoundInt() - } - if !initialDeposit.IsAllGTE(minDepositCoins) { - return sdkerrors.Wrapf(types.ErrMinDepositTooSmall, "was (%s), need (%s)", initialDeposit, minDepositCoins) - } - return nil -} - // GetDepositLimitBaseUUSD gets the deposit limit (Lunc) for a specific proposal func (keeper Keeper) GetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64) (depositLimit sdk.Dec) { store := ctx.KVStore(keeper.storeKey) diff --git a/custom/gov/keeper/keeper.go b/custom/gov/keeper/keeper.go index 2d3b446e..c6558359 100644 --- a/custom/gov/keeper/keeper.go +++ b/custom/gov/keeper/keeper.go @@ -15,7 +15,7 @@ import ( // Keeper defines the governance module Keeper type Keeper struct { - baseKeeper keeper.Keeper + *keeper.Keeper authKeeper types.AccountKeeper bankKeeper types.BankKeeper oracleKeeper markettypes.OracleKeeper @@ -73,8 +73,8 @@ func NewKeeper( } return &Keeper{ + Keeper: keeper.NewKeeper(cdc, key, authKeeper, bankKeeper, sk, router, config, authority), storeKey: key, - baseKeeper: *keeper.NewKeeper(cdc, key, authKeeper, bankKeeper, sk, router, config, authority), authKeeper: authKeeper, bankKeeper: bankKeeper, oracleKeeper: oracleKeeper, diff --git a/custom/gov/keeper/msg_server.go b/custom/gov/keeper/msg_server.go index 71932318..735a3205 100644 --- a/custom/gov/keeper/msg_server.go +++ b/custom/gov/keeper/msg_server.go @@ -27,7 +27,7 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1.MsgSubmitPropos initialDeposit := msg.GetInitialDeposit() - if err := k.baseKeeper.validateInitialDeposit(ctx, initialDeposit); err != nil { + if err := k.validateInitialDeposit(ctx, initialDeposit); err != nil { return nil, err } diff --git a/custom/gov/keeper/proposal.go b/custom/gov/keeper/proposal.go index 0e6a927b..20096f36 100644 --- a/custom/gov/keeper/proposal.go +++ b/custom/gov/keeper/proposal.go @@ -53,7 +53,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat } // assert that the governance module account is the only signer of the messages - if !signers[0].Equals(keeper.baseKeeper.GetGovernanceAccount(ctx).GetAddress()) { + if !signers[0].Equals(keeper.GetGovernanceAccount(ctx).GetAddress()) { return v1.Proposal{}, sdkerrors.Wrapf(types.ErrInvalidSigner, signers[0].String()) } @@ -80,22 +80,22 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat } - proposalID, err := keeper.baseKeeper.GetProposalID(ctx) + proposalID, err := keeper.GetProposalID(ctx) if err != nil { return v1.Proposal{}, err } submitTime := ctx.BlockHeader().Time - depositPeriod := keeper.baseKeeper.GetParams(ctx).MaxDepositPeriod + depositPeriod := keeper.GetParams(ctx).MaxDepositPeriod proposal, err := v1.NewProposal(messages, proposalID, submitTime, submitTime.Add(*depositPeriod), metadata, title, summary, proposer) if err != nil { return v1.Proposal{}, err } - keeper.baseKeeper.SetProposal(ctx, proposal) - keeper.baseKeeper.InsertInactiveProposalQueue(ctx, proposalID, *proposal.DepositEndTime) - keeper.baseKeeper.SetProposalID(ctx, proposalID+1) + keeper.SetProposal(ctx, proposal) + keeper.InsertInactiveProposalQueue(ctx, proposalID, *proposal.DepositEndTime) + keeper.SetProposalID(ctx, proposalID+1) err, totalLuncDeposit := keeper.GetMinimumDepositBaseUusd(ctx) if err != nil { @@ -108,7 +108,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat } // called right after a proposal is submitted - keeper.baseKeeper.Hooks().AfterProposalSubmission(ctx, proposalID) + keeper.Hooks().AfterProposalSubmission(ctx, proposalID) ctx.EventManager().EmitEvent( sdk.NewEvent( @@ -137,9 +137,7 @@ func (keeper Keeper) SetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64, func (keeper Keeper) GetMinimumDepositBaseUusd(ctx sdk.Context) (error, math.Int) { // Get exchange rate betweent Lunc/uusd from oracle // save it to store - amt := sdk.NewInt(1000000) - offerCoin := sdk.NewCoin(core.MicroUSDDenom, amt) - price, err := keeper.oracleKeeper.GetLunaExchangeRate(ctx, offerCoin.Denom) + price, err := keeper.oracleKeeper.GetLunaExchangeRate(ctx, core.MicroUSDDenom) if err != nil && price.LTE(sdk.ZeroDec()) { return err, sdk.ZeroInt() } From 2badfc1ae9bc3554d8d73c549583d1bccb956100 Mon Sep 17 00:00:00 2001 From: duonghb53 Date: Thu, 3 Oct 2024 23:30:25 +0700 Subject: [PATCH 13/60] chang proto --- custom/gov/client/cli/query.go | 80 +++ custom/gov/client/cli/tx.go | 2 +- custom/gov/keeper/common_test.go | 127 +++++ custom/gov/keeper/deposit.go | 8 +- custom/gov/keeper/keeper_test.go | 124 +++++ custom/gov/keeper/msg_server.go | 19 +- custom/gov/keeper/params.go | 2 +- custom/gov/keeper/proposal.go | 26 +- custom/gov/keeper/proposal_test.go | 210 ++++++++ custom/gov/types/{v2luncv1 => }/gov.pb.go | 74 +-- custom/gov/types/keys.go | 12 + custom/gov/types/{v2luncv1 => }/query.pb.go | 81 +-- .../gov/types/{v2luncv1 => }/query.pb.gw.go | 26 +- custom/gov/types/{v2luncv1 => }/tx.pb.go | 505 ++++++++++++++++-- custom/gov/types/v2luncv1/params.go | 112 ---- proto/terra/gov/v2lunc1/gov.proto | 2 +- proto/terra/gov/v2lunc1/query.proto | 4 +- proto/terra/gov/v2lunc1/tx.proto | 25 +- 18 files changed, 1181 insertions(+), 258 deletions(-) create mode 100644 custom/gov/client/cli/query.go create mode 100644 custom/gov/keeper/common_test.go create mode 100644 custom/gov/keeper/keeper_test.go create mode 100644 custom/gov/keeper/proposal_test.go rename custom/gov/types/{v2luncv1 => }/gov.pb.go (85%) rename custom/gov/types/{v2luncv1 => }/query.pb.go (78%) rename custom/gov/types/{v2luncv1 => }/query.pb.gw.go (74%) rename custom/gov/types/{v2luncv1 => }/tx.pb.go (59%) delete mode 100644 custom/gov/types/v2luncv1/params.go diff --git a/custom/gov/client/cli/query.go b/custom/gov/client/cli/query.go new file mode 100644 index 00000000..dde924e4 --- /dev/null +++ b/custom/gov/client/cli/query.go @@ -0,0 +1,80 @@ +package cli + +import ( + "fmt" + "strconv" + "strings" + + "github.com/spf13/cobra" + + v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/version" + "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +// GetQueryCmd returns the cli query commands for this module +func GetQueryCmd() *cobra.Command { + // Group gov queries under a subcommand + govQueryCmd := &cobra.Command{ + Use: types.ModuleName, + Short: "Querying commands for the governance module", + DisableFlagParsing: true, + SuggestionsMinimumDistance: 2, + RunE: client.ValidateCmd, + } + + govQueryCmd.AddCommand( + GetCmdQueryMinimalDeposit(), + ) + + return govQueryCmd +} + +// GetCmdQueryMinimalDeposit implements the query proposal command. +func GetCmdQueryMinimalDeposit() *cobra.Command { + cmd := &cobra.Command{ + Use: "proposal [proposal-id] get-minimal-deposit", + Args: cobra.ExactArgs(1), + Short: "Query minimal deposit of a single proposal", + Long: strings.TrimSpace( + fmt.Sprintf(`Query minimal deposit for a proposal. You can find the +proposal-id by running "%s query gov proposals". + +Example: +$ %s query gov proposal 1 +`, + version.AppName, version.AppName, + ), + ), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := v2lunc1types.NewQueryClient(clientCtx) + + // validate that the proposal id is a uint + proposalID, err := strconv.ParseUint(args[0], 10, 64) + if err != nil { + return fmt.Errorf("proposal-id %s not a valid uint, please input a valid proposal-id", args[0]) + } + + // Query the proposal + res, err := queryClient.ProposalMinimalLUNCByUusd( + cmd.Context(), + &v2lunc1types.QueryProposalRequest{ProposalId: proposalID}, + ) + if err != nil { + return err + } + + return clientCtx.PrintProto(&res.MinimalDeposits) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/custom/gov/client/cli/tx.go b/custom/gov/client/cli/tx.go index cf7c5517..9ddb3334 100644 --- a/custom/gov/client/cli/tx.go +++ b/custom/gov/client/cli/tx.go @@ -20,7 +20,7 @@ var FlagSplit = "split" func GetTxCmd() *cobra.Command { txCmd := &cobra.Command{ Use: types.ModuleName, - Short: "Bank transaction subcommands", + Short: "Governance transaction subcommands", DisableFlagParsing: true, SuggestionsMinimumDistance: 2, RunE: client.ValidateCmd, diff --git a/custom/gov/keeper/common_test.go b/custom/gov/keeper/common_test.go new file mode 100644 index 00000000..95718be0 --- /dev/null +++ b/custom/gov/keeper/common_test.go @@ -0,0 +1,127 @@ +package keeper_test + +import ( + "fmt" + "testing" + + "cosmossdk.io/math" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + tmtime "github.com/cometbft/cometbft/types/time" + "github.com/golang/mock/gomock" + + "github.com/classic-terra/core/v3/custom/gov/keeper" + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/testutil" + "github.com/cosmos/cosmos-sdk/testutil/testdata" + sdk "github.com/cosmos/cosmos-sdk/types" + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + govtestutil "github.com/cosmos/cosmos-sdk/x/gov/testutil" + "github.com/cosmos/cosmos-sdk/x/gov/types" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + + v2luncv1types "github.com/classic-terra/core/v3/custom/gov/types" +) + +var ( + _, _, addr = testdata.KeyTestPubAddr() + govAcct = authtypes.NewModuleAddress(types.ModuleName) + TestProposal = getTestProposal() +) + +// getTestProposal creates and returns a test proposal message. +func getTestProposal() []sdk.Msg { + legacyProposalMsg, err := v1.NewLegacyContent(v1beta1.NewTextProposal("Title", "description"), authtypes.NewModuleAddress(types.ModuleName).String()) + if err != nil { + panic(err) + } + + return []sdk.Msg{ + banktypes.NewMsgSend(govAcct, addr, sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(1000)))), + legacyProposalMsg, + } +} + +// setupGovKeeper creates a govKeeper as well as all its dependencies. +func setupGovKeeper(t *testing.T) ( + *keeper.Keeper, + *govtestutil.MockAccountKeeper, + *govtestutil.MockBankKeeper, + *govtestutil.MockStakingKeeper, + moduletestutil.TestEncodingConfig, + sdk.Context, +) { + key := sdk.NewKVStoreKey(types.StoreKey) + testCtx := testutil.DefaultContextWithDB(t, key, sdk.NewTransientStoreKey("transient_test")) + ctx := testCtx.Ctx.WithBlockHeader(tmproto.Header{Time: tmtime.Now()}) + encCfg := moduletestutil.MakeTestEncodingConfig() + v1.RegisterInterfaces(encCfg.InterfaceRegistry) + v1beta1.RegisterInterfaces(encCfg.InterfaceRegistry) + banktypes.RegisterInterfaces(encCfg.InterfaceRegistry) + + // Create MsgServiceRouter, but don't populate it before creating the gov + // keeper. + msr := baseapp.NewMsgServiceRouter() + + // gomock initializations + ctrl := gomock.NewController(t) + acctKeeper := govtestutil.NewMockAccountKeeper(ctrl) + bankKeeper := govtestutil.NewMockBankKeeper(ctrl) + stakingKeeper := govtestutil.NewMockStakingKeeper(ctrl) + acctKeeper.EXPECT().GetModuleAddress(types.ModuleName).Return(govAcct).AnyTimes() + acctKeeper.EXPECT().GetModuleAccount(gomock.Any(), types.ModuleName).Return(authtypes.NewEmptyModuleAccount(types.ModuleName)).AnyTimes() + trackMockBalances(bankKeeper) + stakingKeeper.EXPECT().TokensFromConsensusPower(ctx, gomock.Any()).DoAndReturn(func(ctx sdk.Context, power int64) math.Int { + return sdk.TokensFromConsensusPower(power, math.NewIntFromUint64(1000000)) + }).AnyTimes() + stakingKeeper.EXPECT().BondDenom(ctx).Return("stake").AnyTimes() + stakingKeeper.EXPECT().IterateBondedValidatorsByPower(gomock.Any(), gomock.Any()).AnyTimes() + stakingKeeper.EXPECT().IterateDelegations(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() + stakingKeeper.EXPECT().TotalBondedTokens(gomock.Any()).Return(math.NewInt(10000000)).AnyTimes() + + // Gov keeper initializations + govKeeper := keeper.NewKeeper(encCfg.Codec, key, acctKeeper, bankKeeper, stakingKeeper, msr, types.DefaultConfig(), govAcct.String()) + govKeeper.baseKeeper.SetProposalID(ctx, 1) + govRouter := v1beta1.NewRouter() // Also register legacy gov handlers to test them too. + govRouter.AddRoute(types.RouterKey, v1beta1.ProposalHandler) + govKeeper.SetLegacyRouter(govRouter) + govKeeper.SetParams(ctx, v2luncv1types.DefaultParams()) + + // Register all handlers for the MegServiceRouter. + msr.SetInterfaceRegistry(encCfg.InterfaceRegistry) + v1.RegisterMsgServer(msr, keeper.NewMsgServerImpl(govKeeper)) + banktypes.RegisterMsgServer(msr, nil) // Nil is fine here as long as we never execute the proposal's Msgs. + + return govKeeper, acctKeeper, bankKeeper, stakingKeeper, encCfg, ctx +} + +// trackMockBalances sets up expected calls on the Mock BankKeeper, and also +// locally tracks accounts balances (not modules balances). +func trackMockBalances(bankKeeper *govtestutil.MockBankKeeper) { + balances := make(map[string]sdk.Coins) + + // We don't track module account balances. + bankKeeper.EXPECT().MintCoins(gomock.Any(), minttypes.ModuleName, gomock.Any()).AnyTimes() + bankKeeper.EXPECT().BurnCoins(gomock.Any(), types.ModuleName, gomock.Any()).AnyTimes() + bankKeeper.EXPECT().SendCoinsFromModuleToModule(gomock.Any(), minttypes.ModuleName, types.ModuleName, gomock.Any()).AnyTimes() + + // But we do track normal account balances. + bankKeeper.EXPECT().SendCoinsFromAccountToModule(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()).DoAndReturn(func(_ sdk.Context, sender sdk.AccAddress, _ string, coins sdk.Coins) error { + newBalance, negative := balances[sender.String()].SafeSub(coins...) + if negative { + return fmt.Errorf("not enough balance") + } + balances[sender.String()] = newBalance + return nil + }).AnyTimes() + bankKeeper.EXPECT().SendCoinsFromModuleToAccount(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(func(_ sdk.Context, module string, rcpt sdk.AccAddress, coins sdk.Coins) error { + balances[rcpt.String()] = balances[rcpt.String()].Add(coins...) + return nil + }).AnyTimes() + bankKeeper.EXPECT().GetAllBalances(gomock.Any(), gomock.Any()).DoAndReturn(func(_ sdk.Context, addr sdk.AccAddress) sdk.Coins { + return balances[addr.String()] + }).AnyTimes() +} diff --git a/custom/gov/keeper/deposit.go b/custom/gov/keeper/deposit.go index ce710fa0..ae1701c9 100644 --- a/custom/gov/keeper/deposit.go +++ b/custom/gov/keeper/deposit.go @@ -3,6 +3,7 @@ package keeper import ( "fmt" + core "github.com/classic-terra/core/v3/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -36,7 +37,12 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd // Check if deposit has provided sufficient total funds to transition the proposal into the voting period activatedVotingPeriod := false - if proposal.Status == v1.StatusDepositPeriod && sdk.NewCoins(proposal.TotalDeposit...).IsAllGTE(keeper.baseKeeper.GetParams(ctx).MinDeposit) { + minLUNCBaseUusd, err := keeper.GetDepositLimitBaseUusd(ctx, proposalID) + if err != nil { + return false, err + } + minDeposit := sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, minLUNCBaseUusd.TruncateInt())) + if proposal.Status == v1.StatusDepositPeriod && sdk.NewCoins(proposal.TotalDeposit...).IsAllGTE(minDeposit) { keeper.baseKeeper.ActivateVotingPeriod(ctx, proposal) activatedVotingPeriod = true diff --git a/custom/gov/keeper/keeper_test.go b/custom/gov/keeper/keeper_test.go new file mode 100644 index 00000000..9e8d2009 --- /dev/null +++ b/custom/gov/keeper/keeper_test.go @@ -0,0 +1,124 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + "github.com/stretchr/testify/suite" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/codec" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/gov/keeper" + govtestutil "github.com/cosmos/cosmos-sdk/x/gov/testutil" + "github.com/cosmos/cosmos-sdk/x/gov/types" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" +) + +type KeeperTestSuite struct { + suite.Suite + + cdc codec.Codec + ctx sdk.Context + govKeeper *keeper.Keeper + acctKeeper *govtestutil.MockAccountKeeper + bankKeeper *govtestutil.MockBankKeeper + stakingKeeper *govtestutil.MockStakingKeeper + queryClient v1.QueryClient + legacyQueryClient v1beta1.QueryClient + addrs []sdk.AccAddress + msgSrvr v1.MsgServer + legacyMsgSrvr v1beta1.MsgServer +} + +func (suite *KeeperTestSuite) SetupSuite() { + suite.reset() +} + +func (suite *KeeperTestSuite) reset() { + govKeeper, acctKeeper, bankKeeper, stakingKeeper, encCfg, ctx := setupGovKeeper(suite.T()) + + // Populate the gov account with some coins, as the TestProposal we have + // is a MsgSend from the gov account. + coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000))) + err := bankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) + suite.NoError(err) + err = bankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, types.ModuleName, coins) + suite.NoError(err) + + queryHelper := baseapp.NewQueryServerTestHelper(ctx, encCfg.InterfaceRegistry) + v1.RegisterQueryServer(queryHelper, govKeeper) + legacyQueryHelper := baseapp.NewQueryServerTestHelper(ctx, encCfg.InterfaceRegistry) + v1beta1.RegisterQueryServer(legacyQueryHelper, keeper.NewLegacyQueryServer(govKeeper)) + queryClient := v1.NewQueryClient(queryHelper) + legacyQueryClient := v1beta1.NewQueryClient(legacyQueryHelper) + + suite.ctx = ctx + suite.govKeeper = govKeeper + suite.acctKeeper = acctKeeper + suite.bankKeeper = bankKeeper + suite.stakingKeeper = stakingKeeper + suite.cdc = encCfg.Codec + suite.queryClient = queryClient + suite.legacyQueryClient = legacyQueryClient + suite.msgSrvr = keeper.NewMsgServerImpl(suite.govKeeper) + + suite.legacyMsgSrvr = keeper.NewLegacyMsgServerImpl(govAcct.String(), suite.msgSrvr) + suite.addrs = simtestutil.AddTestAddrsIncremental(bankKeeper, stakingKeeper, ctx, 3, sdk.NewInt(30000000)) +} + +func TestIncrementProposalNumber(t *testing.T) { + govKeeper, _, _, _, _, ctx := setupGovKeeper(t) + + tp := TestProposal + _, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) + require.NoError(t, err) + _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) + require.NoError(t, err) + _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) + require.NoError(t, err) + _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) + require.NoError(t, err) + _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) + require.NoError(t, err) + proposal6, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) + require.NoError(t, err) + + require.Equal(t, uint64(6), proposal6.Id) +} + +func TestProposalQueues(t *testing.T) { + govKeeper, _, _, _, _, ctx := setupGovKeeper(t) + + // create test proposals + tp := TestProposal + proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) + require.NoError(t, err) + + inactiveIterator := govKeeper.InactiveProposalQueueIterator(ctx, *proposal.DepositEndTime) + require.True(t, inactiveIterator.Valid()) + + proposalID := types.GetProposalIDFromBytes(inactiveIterator.Value()) + require.Equal(t, proposalID, proposal.Id) + inactiveIterator.Close() + + govKeeper.ActivateVotingPeriod(ctx, proposal) + + proposal, ok := govKeeper.GetProposal(ctx, proposal.Id) + require.True(t, ok) + + activeIterator := govKeeper.ActiveProposalQueueIterator(ctx, *proposal.VotingEndTime) + require.True(t, activeIterator.Valid()) + + proposalID, _ = types.SplitActiveProposalQueueKey(activeIterator.Key()) + require.Equal(t, proposalID, proposal.Id) + + activeIterator.Close() +} + +func TestKeeperTestSuite(t *testing.T) { + suite.Run(t, new(KeeperTestSuite)) +} diff --git a/custom/gov/keeper/msg_server.go b/custom/gov/keeper/msg_server.go index 71932318..a53330b2 100644 --- a/custom/gov/keeper/msg_server.go +++ b/custom/gov/keeper/msg_server.go @@ -4,9 +4,10 @@ import ( "context" "fmt" + v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types" sdk "github.com/cosmos/cosmos-sdk/types" + sdktx "github.com/cosmos/cosmos-sdk/types/tx" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) type msgServer struct { @@ -15,23 +16,23 @@ type msgServer struct { // NewMsgServerImpl returns an implementation of the gov MsgServer interface // for the provided Keeper. -func NewMsgServerImpl(keeper *Keeper) v1.MsgServer { +func NewMsgServerImpl(keeper *Keeper) v2lunc1types.MsgServer { return &msgServer{Keeper: keeper} } -var _ v1.MsgServer = msgServer{} +var _ v2lunc1types.MsgServer = msgServer{} // SubmitProposal implements the MsgServer.SubmitProposal method. -func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1.MsgSubmitProposal) (*v1.MsgSubmitProposalResponse, error) { +func (k msgServer) SubmitProposal(goCtx context.Context, msg *v2lunc1types.MsgSubmitProposal) (*v2lunc1types.MsgSubmitProposalResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) initialDeposit := msg.GetInitialDeposit() - if err := k.baseKeeper.validateInitialDeposit(ctx, initialDeposit); err != nil { + if err := k.validateInitialDeposit(ctx, initialDeposit); err != nil { return nil, err } - proposalMsgs, err := msg.GetMsgs() + proposalMsgs, err := sdktx.GetMsgs(msg.Messages, "sdk.MsgProposal") if err != nil { return nil, err } @@ -70,13 +71,13 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *v1.MsgSubmitPropos ) } - return &v1.MsgSubmitProposalResponse{ + return &v2lunc1types.MsgSubmitProposalResponse{ ProposalId: proposal.Id, }, nil } // Deposit implements the MsgServer.Deposit method. -func (k msgServer) Deposit(goCtx context.Context, msg *v1.MsgDeposit) (*v1.MsgDepositResponse, error) { +func (k msgServer) Deposit(goCtx context.Context, msg *v2lunc1types.MsgDeposit) (*v2lunc1types.MsgDepositResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) accAddr, err := sdk.AccAddressFromBech32(msg.Depositor) if err != nil { @@ -96,5 +97,5 @@ func (k msgServer) Deposit(goCtx context.Context, msg *v1.MsgDeposit) (*v1.MsgDe ) } - return &v1.MsgDepositResponse{}, nil + return &v2lunc1types.MsgDepositResponse{}, nil } diff --git a/custom/gov/keeper/params.go b/custom/gov/keeper/params.go index ecebf191..4f9d6787 100644 --- a/custom/gov/keeper/params.go +++ b/custom/gov/keeper/params.go @@ -2,7 +2,7 @@ package keeper import ( "github.com/CosmWasm/wasmd/x/wasm/types" - v2luncv1types "github.com/classic-terra/core/v3/custom/gov/types/v2luncv1" + v2luncv1types "github.com/classic-terra/core/v3/custom/gov/types" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/custom/gov/keeper/proposal.go b/custom/gov/keeper/proposal.go index 3d8f34d6..934dbb70 100644 --- a/custom/gov/keeper/proposal.go +++ b/custom/gov/keeper/proposal.go @@ -99,9 +99,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat // Get exchange rate betweent Lunc/uusd from oracle // save it to store - amt := sdk.NewInt(10) - offerCoin := sdk.NewCoin(core.MicroUSDDenom, amt) - price, err := keeper.oracleKeeper.GetLunaExchangeRate(ctx, offerCoin.Denom) + price, err := keeper.oracleKeeper.GetLunaExchangeRate(ctx, core.MicroUSDDenom) if err != nil { return v1.Proposal{}, sdkerrors.Wrap(v2luncv1types.ErrQueryExchangeRateUusdFail, err.Error()) } @@ -131,5 +129,25 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat func (keeper Keeper) SetPriceLuncBaseUusd(ctx sdk.Context, proposalID uint64, amount sdk.Dec) { store := ctx.KVStore(keeper.storeKey) key := v2luncv1types.TotalDepositKey(proposalID) - store.Set(key, []byte(amount.String())) + + bz, err := amount.Marshal() + if err == nil { + store.Set(key, bz) + } +} + +// GetDepositLimitBaseUUSD gets the deposit limit (Lunc) for a specific proposal +func (keeper Keeper) GetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64) (depositLimit sdk.Dec, err error) { + store := ctx.KVStore(keeper.storeKey) + key := v2luncv1types.TotalDepositKey(proposalID) + bz := store.Get(key) + if bz == nil { + return sdk.ZeroDec(), err + } + err = depositLimit.Unmarshal(bz) + if err == nil { + return sdk.ZeroDec(), err + } + + return depositLimit, nil } diff --git a/custom/gov/keeper/proposal_test.go b/custom/gov/keeper/proposal_test.go new file mode 100644 index 00000000..876edd6f --- /dev/null +++ b/custom/gov/keeper/proposal_test.go @@ -0,0 +1,210 @@ +package keeper_test + +import ( + "errors" + "fmt" + "strings" + "testing" + "time" + + "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/testutil/testdata" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/gov/types" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" +) + +func (suite *KeeperTestSuite) TestGetSetProposal() { + tp := TestProposal + proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) + suite.Require().NoError(err) + proposalID := proposal.Id + suite.govKeeper.SetProposal(suite.ctx, proposal) + + gotProposal, ok := suite.govKeeper.GetProposal(suite.ctx, proposalID) + suite.Require().True(ok) + suite.Require().Equal(proposal, gotProposal) +} + +func (suite *KeeperTestSuite) TestDeleteProposal() { + // delete non-existing proposal + suite.Require().PanicsWithValue(fmt.Sprintf("couldn't find proposal with id#%d", 10), + func() { + suite.govKeeper.DeleteProposal(suite.ctx, 10) + }, + ) + tp := TestProposal + proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) + suite.Require().NoError(err) + proposalID := proposal.Id + suite.govKeeper.SetProposal(suite.ctx, proposal) + suite.Require().NotPanics(func() { + suite.govKeeper.DeleteProposal(suite.ctx, proposalID) + }, "") +} + +func (suite *KeeperTestSuite) TestActivateVotingPeriod() { + tp := TestProposal + proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) + suite.Require().NoError(err) + + suite.Require().Nil(proposal.VotingStartTime) + + suite.govKeeper.ActivateVotingPeriod(suite.ctx, proposal) + + proposal, ok := suite.govKeeper.GetProposal(suite.ctx, proposal.Id) + suite.Require().True(ok) + suite.Require().True(proposal.VotingStartTime.Equal(suite.ctx.BlockHeader().Time)) + + activeIterator := suite.govKeeper.ActiveProposalQueueIterator(suite.ctx, *proposal.VotingEndTime) + suite.Require().True(activeIterator.Valid()) + + proposalID := types.GetProposalIDFromBytes(activeIterator.Value()) + suite.Require().Equal(proposalID, proposal.Id) + activeIterator.Close() + + // delete the proposal to avoid issues with other tests + suite.Require().NotPanics(func() { + suite.govKeeper.DeleteProposal(suite.ctx, proposalID) + }, "") +} + +func (suite *KeeperTestSuite) TestDeleteProposalInVotingPeriod() { + suite.reset() + tp := TestProposal + proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) + suite.Require().NoError(err) + suite.Require().Nil(proposal.VotingStartTime) + + suite.govKeeper.ActivateVotingPeriod(suite.ctx, proposal) + + proposal, ok := suite.govKeeper.GetProposal(suite.ctx, proposal.Id) + suite.Require().True(ok) + suite.Require().True(proposal.VotingStartTime.Equal(suite.ctx.BlockHeader().Time)) + + activeIterator := suite.govKeeper.ActiveProposalQueueIterator(suite.ctx, *proposal.VotingEndTime) + suite.Require().True(activeIterator.Valid()) + + proposalID := types.GetProposalIDFromBytes(activeIterator.Value()) + suite.Require().Equal(proposalID, proposal.Id) + activeIterator.Close() + + // add vote + voteOptions := []*v1.WeightedVoteOption{{Option: v1.OptionYes, Weight: "1.0"}} + err = suite.govKeeper.AddVote(suite.ctx, proposal.Id, sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), voteOptions, "") + suite.Require().NoError(err) + + suite.Require().NotPanics(func() { + suite.govKeeper.DeleteProposal(suite.ctx, proposalID) + }, "") + + // add vote but proposal is deleted along with its VotingPeriodProposalKey + err = suite.govKeeper.AddVote(suite.ctx, proposal.Id, sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), voteOptions, "") + suite.Require().ErrorContains(err, ": inactive proposal") +} + +type invalidProposalRoute struct{ v1beta1.TextProposal } + +func (invalidProposalRoute) ProposalRoute() string { return "nonexistingroute" } + +func (suite *KeeperTestSuite) TestSubmitProposal() { + govAcct := suite.govKeeper.GetGovernanceAccount(suite.ctx).GetAddress().String() + _, _, randomAddr := testdata.KeyTestPubAddr() + tp := v1beta1.TextProposal{Title: "title", Description: "description"} + + testCases := []struct { + content v1beta1.Content + authority string + metadata string + expectedErr error + }{ + {&tp, govAcct, "", nil}, + // Keeper does not check the validity of title and description, no error + {&v1beta1.TextProposal{Title: "", Description: "description"}, govAcct, "", nil}, + {&v1beta1.TextProposal{Title: strings.Repeat("1234567890", 100), Description: "description"}, govAcct, "", nil}, + {&v1beta1.TextProposal{Title: "title", Description: ""}, govAcct, "", nil}, + {&v1beta1.TextProposal{Title: "title", Description: strings.Repeat("1234567890", 1000)}, govAcct, "", nil}, + // error when metadata is too long (>10000) + {&tp, govAcct, strings.Repeat("a", 100001), types.ErrMetadataTooLong}, + // error when signer is not gov acct + {&tp, randomAddr.String(), "", types.ErrInvalidSigner}, + // error only when invalid route + {&invalidProposalRoute{}, govAcct, "", types.ErrNoProposalHandlerExists}, + } + + for i, tc := range testCases { + prop, err := v1.NewLegacyContent(tc.content, tc.authority) + suite.Require().NoError(err) + _, err = suite.govKeeper.SubmitProposal(suite.ctx, []sdk.Msg{prop}, tc.metadata, "title", "", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) + suite.Require().True(errors.Is(tc.expectedErr, err), "tc #%d; got: %v, expected: %v", i, err, tc.expectedErr) + } +} + +func (suite *KeeperTestSuite) TestGetProposalsFiltered() { + proposalID := uint64(1) + status := []v1.ProposalStatus{v1.StatusDepositPeriod, v1.StatusVotingPeriod} + + addr1 := sdk.AccAddress("foo_________________") + + for _, s := range status { + for i := 0; i < 50; i++ { + p, err := v1.NewProposal(TestProposal, proposalID, time.Now(), time.Now(), "", "title", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) + suite.Require().NoError(err) + + p.Status = s + + if i%2 == 0 { + d := v1.NewDeposit(proposalID, addr1, nil) + v := v1.NewVote(proposalID, addr1, v1.NewNonSplitVoteOption(v1.OptionYes), "") + suite.govKeeper.SetDeposit(suite.ctx, d) + suite.govKeeper.SetVote(suite.ctx, v) + } + + suite.govKeeper.SetProposal(suite.ctx, p) + proposalID++ + } + } + + testCases := []struct { + params v1.QueryProposalsParams + expectedNumResults int + }{ + {v1.NewQueryProposalsParams(1, 50, v1.StatusNil, nil, nil), 50}, + {v1.NewQueryProposalsParams(1, 50, v1.StatusDepositPeriod, nil, nil), 50}, + {v1.NewQueryProposalsParams(1, 50, v1.StatusVotingPeriod, nil, nil), 50}, + {v1.NewQueryProposalsParams(1, 25, v1.StatusNil, nil, nil), 25}, + {v1.NewQueryProposalsParams(2, 25, v1.StatusNil, nil, nil), 25}, + {v1.NewQueryProposalsParams(1, 50, v1.StatusRejected, nil, nil), 0}, + {v1.NewQueryProposalsParams(1, 50, v1.StatusNil, addr1, nil), 50}, + {v1.NewQueryProposalsParams(1, 50, v1.StatusNil, nil, addr1), 50}, + {v1.NewQueryProposalsParams(1, 50, v1.StatusNil, addr1, addr1), 50}, + {v1.NewQueryProposalsParams(1, 50, v1.StatusDepositPeriod, addr1, addr1), 25}, + {v1.NewQueryProposalsParams(1, 50, v1.StatusDepositPeriod, nil, nil), 50}, + {v1.NewQueryProposalsParams(1, 50, v1.StatusVotingPeriod, nil, nil), 50}, + } + + for i, tc := range testCases { + suite.Run(fmt.Sprintf("Test Case %d", i), func() { + proposals := suite.govKeeper.GetProposalsFiltered(suite.ctx, tc.params) + suite.Require().Len(proposals, tc.expectedNumResults) + + for _, p := range proposals { + if v1.ValidProposalStatus(tc.params.ProposalStatus) { + suite.Require().Equal(tc.params.ProposalStatus, p.Status) + } + } + }) + } +} + +func TestMigrateProposalMessages(t *testing.T) { + content := v1beta1.NewTextProposal("Test", "description") + contentMsg, err := v1.NewLegacyContent(content, sdk.AccAddress("test1").String()) + require.NoError(t, err) + content, err = v1.LegacyContentFromMessage(contentMsg) + require.NoError(t, err) + require.Equal(t, "Test", content.GetTitle()) + require.Equal(t, "description", content.GetDescription()) +} diff --git a/custom/gov/types/v2luncv1/gov.pb.go b/custom/gov/types/gov.pb.go similarity index 85% rename from custom/gov/types/v2luncv1/gov.pb.go rename to custom/gov/types/gov.pb.go index e5f3b4fe..3efa87d3 100644 --- a/custom/gov/types/v2luncv1/gov.pb.go +++ b/custom/gov/types/gov.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: terra/gov/v2lunc1/gov.proto -package v2luncv1 +package types import ( fmt "fmt" @@ -180,42 +180,42 @@ func init() { func init() { proto.RegisterFile("terra/gov/v2lunc1/gov.proto", fileDescriptor_ec6805a6cb6c4923) } var fileDescriptor_ec6805a6cb6c4923 = []byte{ - // 553 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4d, 0x4f, 0xd4, 0x4e, - 0x18, 0xdf, 0xfe, 0x81, 0xfd, 0xcb, 0x00, 0xeb, 0xd2, 0x18, 0xd3, 0xc5, 0x58, 0x36, 0xc6, 0x98, - 0x8d, 0x81, 0x4e, 0x80, 0xf8, 0x01, 0x5c, 0x57, 0x13, 0x0e, 0x1a, 0xdc, 0x28, 0x07, 0x2f, 0xcd, - 0xb4, 0x1d, 0xcb, 0x24, 0x3b, 0xf3, 0xd4, 0x99, 0x69, 0x03, 0xdf, 0xc2, 0xa3, 0x37, 0xaf, 0x1e, - 0x3d, 0xf8, 0x21, 0x38, 0x12, 0x4f, 0x9e, 0xd4, 0xc0, 0xc1, 0xaf, 0x61, 0xe6, 0xa5, 0x60, 0xc8, - 0x1e, 0xb8, 0x34, 0xd3, 0xe7, 0xf9, 0xbd, 0x3c, 0xbf, 0x79, 0x41, 0xf7, 0x34, 0x95, 0x92, 0xe0, - 0x12, 0x1a, 0xdc, 0xec, 0xce, 0x6a, 0x91, 0xef, 0x98, 0x75, 0x52, 0x49, 0xd0, 0x10, 0xae, 0xdb, - 0x66, 0x62, 0x0a, 0xbe, 0xb9, 0x11, 0xe7, 0xa0, 0x38, 0x28, 0x9c, 0x11, 0x45, 0x71, 0xb3, 0x93, - 0x51, 0x4d, 0x76, 0x70, 0x0e, 0x4c, 0x38, 0xca, 0xc6, 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b, 0xb8, 0xf3, 0x6e, 0xab, 0x64, 0xfa, 0xa8, 0xce, 0x92, 0x1c, - 0x38, 0xce, 0x67, 0x44, 0x29, 0x96, 0x6f, 0xbb, 0xe7, 0x9b, 0x83, 0xa4, 0xb8, 0xd9, 0xc3, 0xc7, - 0xf6, 0x21, 0xeb, 0x93, 0x8a, 0xaa, 0xac, 0x6b, 0x6f, 0xca, 0xde, 0xdf, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x98, 0x6e, 0xfb, 0x26, 0xe2, 0x03, 0x00, 0x00, + // 554 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4d, 0x4f, 0xd4, 0x40, + 0x18, 0xde, 0x0a, 0xac, 0x32, 0xc0, 0xba, 0x34, 0xc6, 0x74, 0x31, 0x96, 0x8d, 0x31, 0x66, 0x63, + 0xa4, 0x93, 0x85, 0xf8, 0x03, 0x5c, 0xd7, 0x03, 0x31, 0x1a, 0xdc, 0x28, 0x07, 0x2f, 0xcd, 0xb4, + 0x1d, 0xcb, 0x24, 0x3b, 0xf3, 0xd6, 0x99, 0x69, 0x03, 0xff, 0xc2, 0xa3, 0x37, 0xaf, 0x1e, 0x3d, + 0xf8, 0x23, 0x38, 0x12, 0x4f, 0x9e, 0xd4, 0xc0, 0xc1, 0xbf, 0x61, 0xe6, 0xa3, 0x60, 0x08, 0x07, + 0x2e, 0xcd, 0xf4, 0x7d, 0x9f, 0x8f, 0xf7, 0x99, 0x0f, 0x74, 0x4f, 0x53, 0x29, 0x09, 0x2e, 0xa1, + 0xc1, 0xcd, 0xf6, 0xbc, 0x16, 0xf9, 0xd8, 0xac, 0x93, 0x4a, 0x82, 0x86, 0x70, 0xdd, 0x36, 0x13, + 0x53, 0xf0, 0xcd, 0x8d, 0x38, 0x07, 0xc5, 0x41, 0xe1, 0x8c, 0x28, 0x8a, 0x9b, 0x71, 0x46, 0x35, + 0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, 0xb8, 0x73, 0x72, + 0x16, 0x77, 0x7e, 0x9e, 0xc5, 0x9d, 0xf7, 0xe3, 0x92, 0xe9, 0x83, 0x3a, 0x4b, 0x72, 0xe0, 0x38, + 0x9f, 0x13, 0xa5, 0x58, 0xbe, 0xe5, 0x9e, 0x6f, 0x0e, 0x92, 0xe2, 0x66, 0x07, 0xe7, 0xb5, 0xd2, + 0xc0, 0xed, 0x6b, 0xd6, 0x47, 0x15, 0x55, 0x59, 0xd7, 0x5e, 0x97, 0x9d, 0x7f, 0x01, 0x00, 0x00, + 0xff, 0xff, 0x42, 0xc6, 0x06, 0xf8, 0xe7, 0x03, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/custom/gov/types/keys.go b/custom/gov/types/keys.go index 4dd72c4a..09f1975b 100644 --- a/custom/gov/types/keys.go +++ b/custom/gov/types/keys.go @@ -16,6 +16,18 @@ func GetProposalIDBytes(proposalID uint64) (proposalIDBz []byte) { return } +// GetAmountBytes returns the byte representation of the amount +func GetAmountBytes(amount uint64) (amountBz []byte) { + amountBz = make([]byte, 8) + binary.BigEndian.PutUint64(amountBz, amount) + return +} + +// GetAmountFromBytes returns amount in uint64 format from a byte array +func GetAmountFromBytes(bz []byte) (amount uint64) { + return binary.BigEndian.Uint64(bz) +} + // TotalDepositKey of the specific total amount to deposit based on the proposalID from the store func TotalDepositKey(proposalID uint64) []byte { return append(UUSDMinKeyPrefix, GetProposalIDBytes(proposalID)...) diff --git a/custom/gov/types/v2luncv1/query.pb.go b/custom/gov/types/query.pb.go similarity index 78% rename from custom/gov/types/v2luncv1/query.pb.go rename to custom/gov/types/query.pb.go index 664bb73d..c1a456b9 100644 --- a/custom/gov/types/v2luncv1/query.pb.go +++ b/custom/gov/types/query.pb.go @@ -134,35 +134,36 @@ func init() { func init() { proto.RegisterFile("terra/gov/v2lunc1/query.proto", fileDescriptor_075d72aa1a1cda58) } var fileDescriptor_075d72aa1a1cda58 = []byte{ - // 436 bytes of a gzipped FileDescriptorProto + // 449 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0xcd, 0x6a, 0x14, 0x41, - 0x10, 0xde, 0xf6, 0x0f, 0x9d, 0x1c, 0x34, 0x43, 0x0e, 0xc9, 0xa2, 0xb3, 0x61, 0x3d, 0x18, 0xc4, - 0x74, 0xb1, 0x1b, 0x30, 0x78, 0x12, 0xa2, 0x08, 0x1e, 0x44, 0xdd, 0xa3, 0x97, 0xa5, 0x67, 0xb6, - 0x1d, 0x1b, 0xa6, 0xbb, 0x3a, 0x53, 0x3d, 0x83, 0x41, 0xbc, 0xf8, 0x04, 0x82, 0x2f, 0xe1, 0xc1, - 0x83, 0x27, 0x9f, 0x21, 0xc7, 0x80, 0x17, 0x4f, 0x22, 0xbb, 0x82, 0xaf, 0x21, 0xdb, 0xdd, 0x83, - 0xba, 0x6a, 0x2e, 0x4d, 0x77, 0x7d, 0x5f, 0x55, 0x7d, 0xf5, 0x75, 0x25, 0xd7, 0x9c, 0xac, 0x6b, - 0x01, 0x25, 0xb6, 0xd0, 0x8e, 0xab, 0xc6, 0x14, 0x23, 0x38, 0x6c, 0x64, 0x7d, 0xc4, 0x6d, 0x8d, - 0x0e, 0xd3, 0x75, 0x0f, 0xf3, 0x12, 0x5b, 0x1e, 0xe1, 0x7e, 0x56, 0x20, 0x69, 0x24, 0xc8, 0x05, - 0x49, 0x68, 0x47, 0xb9, 0x74, 0x62, 0x04, 0x05, 0x2a, 0x13, 0x52, 0xfa, 0x1b, 0x25, 0x96, 0xe8, - 0xaf, 0xb0, 0xbc, 0xc5, 0xe8, 0xd5, 0x12, 0xb1, 0xac, 0x24, 0x08, 0xab, 0x40, 0x18, 0x83, 0x4e, - 0x38, 0x85, 0x86, 0x22, 0x3a, 0x88, 0xa8, 0x7f, 0xe5, 0xcd, 0x73, 0x70, 0x4a, 0x4b, 0x72, 0x42, - 0xdb, 0x48,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 0xf4, + 0x8a, 0xfa, 0xa3, 0x3e, 0x8d, 0x3f, 0x05, 0xe1, 0x45, 0xdb, 0x38, 0xfa, 0x18, 0x84, 0xfd, 0xae, + 0x9f, 0x57, 0xf1, 0xf0, 0xe8, 0xf1, 0xe1, 0x64, 0x7e, 0xd4, 0x50, 0x1e, 0xdd, 0x64, 0x7f, 0x7d, + 0x25, 0xfb, 0xd7, 0xa4, 0x83, 0xdb, 0xff, 0x23, 0x9e, 0x3d, 0xd9, 0xe8, 0xee, 0x9b, 0xcf, 0xdf, + 0xdf, 0x9d, 0xbb, 0x13, 0x1d, 0x78, 0x8f, 0xdd, 0x4e, 0x25, 0xd0, 0x79, 0x44, 0xe0, 0xa5, 0xef, + 0x75, 0x83, 0xc3, 0xab, 0xdf, 0x2c, 0x7d, 0x3d, 0x79, 0x70, 0xb2, 0x88, 0x83, 0xd3, 0x45, 0x1c, + 0x7c, 0x5b, 0xc4, 0xc1, 0xdb, 0x65, 0xdc, 0x3b, 0x5d, 0xc6, 0xbd, 0x2f, 0xcb, 0xb8, 0xf7, 0x3c, + 0x29, 0xa4, 0x79, 0xd9, 0xa4, 0x2c, 0x43, 0x05, 0x59, 0xc9, 0x89, 0x64, 0xb6, 0xe7, 0xf6, 0x36, + 0xc3, 0x5a, 0x40, 0xbb, 0x0f, 0x59, 0x43, 0x06, 0x95, 0x6d, 0x69, 0xe6, 0x95, 0xa0, 0xf4, 0x92, + 0xfd, 0xce, 0xfd, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xab, 0xb5, 0x49, 0x20, 0xe0, 0x02, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -178,7 +179,7 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { // Proposal queries proposal details based on ProposalID. - Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryMinimalDepositProposalResponse, error) + ProposalMinimalLUNCByUusd(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryMinimalDepositProposalResponse, error) } type queryClient struct { @@ -189,9 +190,9 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) Proposal(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryMinimalDepositProposalResponse, error) { +func (c *queryClient) ProposalMinimalLUNCByUusd(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryMinimalDepositProposalResponse, error) { out := new(QueryMinimalDepositProposalResponse) - err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Query/Proposal", in, out, opts...) + err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Query/ProposalMinimalLUNCByUusd", in, out, opts...) if err != nil { return nil, err } @@ -201,35 +202,35 @@ func (c *queryClient) Proposal(ctx context.Context, in *QueryProposalRequest, op // QueryServer is the server API for Query service. type QueryServer interface { // Proposal queries proposal details based on ProposalID. - Proposal(context.Context, *QueryProposalRequest) (*QueryMinimalDepositProposalResponse, error) + ProposalMinimalLUNCByUusd(context.Context, *QueryProposalRequest) (*QueryMinimalDepositProposalResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) Proposal(ctx context.Context, req *QueryProposalRequest) (*QueryMinimalDepositProposalResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Proposal not implemented") +func (*UnimplementedQueryServer) ProposalMinimalLUNCByUusd(ctx context.Context, req *QueryProposalRequest) (*QueryMinimalDepositProposalResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ProposalMinimalLUNCByUusd not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_Proposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Query_ProposalMinimalLUNCByUusd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryProposalRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).Proposal(ctx, in) + return srv.(QueryServer).ProposalMinimalLUNCByUusd(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/terra.gov.v2lunc1.Query/Proposal", + FullMethod: "/terra.gov.v2lunc1.Query/ProposalMinimalLUNCByUusd", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Proposal(ctx, req.(*QueryProposalRequest)) + return srv.(QueryServer).ProposalMinimalLUNCByUusd(ctx, req.(*QueryProposalRequest)) } return interceptor(ctx, in, info, handler) } @@ -239,8 +240,8 @@ var _Query_serviceDesc = grpc.ServiceDesc{ HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "Proposal", - Handler: _Query_Proposal_Handler, + MethodName: "ProposalMinimalLUNCByUusd", + Handler: _Query_ProposalMinimalLUNCByUusd_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/custom/gov/types/v2luncv1/query.pb.gw.go b/custom/gov/types/query.pb.gw.go similarity index 74% rename from custom/gov/types/v2luncv1/query.pb.gw.go rename to custom/gov/types/query.pb.gw.go index b9a0daa6..f68f755b 100644 --- a/custom/gov/types/v2luncv1/query.pb.gw.go +++ b/custom/gov/types/query.pb.gw.go @@ -6,7 +6,7 @@ Package types is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package v2luncv1 +package types import ( "context" @@ -33,7 +33,7 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join -func request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_Query_ProposalMinimalLUNCByUusd_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryProposalRequest var metadata runtime.ServerMetadata @@ -55,12 +55,12 @@ func request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marshaler, return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) } - msg, err := client.Proposal(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.ProposalMinimalLUNCByUusd(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Query_ProposalMinimalLUNCByUusd_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryProposalRequest var metadata runtime.ServerMetadata @@ -82,7 +82,7 @@ func local_request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marsh return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) } - msg, err := server.Proposal(ctx, &protoReq) + msg, err := server.ProposalMinimalLUNCByUusd(ctx, &protoReq) return msg, metadata, err } @@ -93,7 +93,7 @@ func local_request_Query_Proposal_0(ctx context.Context, marshaler runtime.Marsh // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_Proposal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ProposalMinimalLUNCByUusd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -104,7 +104,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_Proposal_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_ProposalMinimalLUNCByUusd_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -112,7 +112,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_Proposal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ProposalMinimalLUNCByUusd_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -157,7 +157,7 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_Proposal_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ProposalMinimalLUNCByUusd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -166,14 +166,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_Proposal_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_ProposalMinimalLUNCByUusd_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_Proposal_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ProposalMinimalLUNCByUusd_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -181,9 +181,9 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Proposal_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmos", "gov", "v1", "proposals", "minimal-deposits", "proposal_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ProposalMinimalLUNCByUusd_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmos", "gov", "v1", "proposals", "minimal-deposits", "proposal_id"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( - forward_Query_Proposal_0 = runtime.ForwardResponseMessage + forward_Query_ProposalMinimalLUNCByUusd_0 = runtime.ForwardResponseMessage ) diff --git a/custom/gov/types/v2luncv1/tx.pb.go b/custom/gov/types/tx.pb.go similarity index 59% rename from custom/gov/types/v2luncv1/tx.pb.go rename to custom/gov/types/tx.pb.go index 72aa738f..dbf5c2f2 100644 --- a/custom/gov/types/v2luncv1/tx.pb.go +++ b/custom/gov/types/tx.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: terra/gov/v2lunc1/tx.proto -package v2luncv1 +package types import ( context "context" @@ -174,48 +174,157 @@ func (m *MsgSubmitProposalResponse) GetProposalId() uint64 { return 0 } +// MsgDeposit defines a message to submit a deposit to an existing proposal. +type MsgDeposit struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id"` + // depositor defines the deposit addresses from the proposals. + Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` + // amount to be deposited by depositor. + Amount []types1.Coin `protobuf:"bytes,3,rep,name=amount,proto3" json:"amount"` +} + +func (m *MsgDeposit) Reset() { *m = MsgDeposit{} } +func (m *MsgDeposit) String() string { return proto.CompactTextString(m) } +func (*MsgDeposit) ProtoMessage() {} +func (*MsgDeposit) Descriptor() ([]byte, []int) { + return fileDescriptor_9d64e87259bdff9f, []int{2} +} +func (m *MsgDeposit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeposit.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDeposit) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeposit.Merge(m, src) +} +func (m *MsgDeposit) XXX_Size() int { + return m.Size() +} +func (m *MsgDeposit) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeposit.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeposit proto.InternalMessageInfo + +func (m *MsgDeposit) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *MsgDeposit) GetDepositor() string { + if m != nil { + return m.Depositor + } + return "" +} + +func (m *MsgDeposit) GetAmount() []types1.Coin { + if m != nil { + return m.Amount + } + return nil +} + +// MsgDepositResponse defines the Msg/Deposit response type. +type MsgDepositResponse struct { +} + +func (m *MsgDepositResponse) Reset() { *m = MsgDepositResponse{} } +func (m *MsgDepositResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDepositResponse) ProtoMessage() {} +func (*MsgDepositResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_9d64e87259bdff9f, []int{3} +} +func (m *MsgDepositResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDepositResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDepositResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgDepositResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDepositResponse.Merge(m, src) +} +func (m *MsgDepositResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDepositResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDepositResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDepositResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgSubmitProposal)(nil), "terra.gov.v2lunc1.MsgSubmitProposal") proto.RegisterType((*MsgSubmitProposalResponse)(nil), "terra.gov.v2lunc1.MsgSubmitProposalResponse") + proto.RegisterType((*MsgDeposit)(nil), "terra.gov.v2lunc1.MsgDeposit") + proto.RegisterType((*MsgDepositResponse)(nil), "terra.gov.v2lunc1.MsgDepositResponse") } func init() { proto.RegisterFile("terra/gov/v2lunc1/tx.proto", fileDescriptor_9d64e87259bdff9f) } var fileDescriptor_9d64e87259bdff9f = []byte{ - // 513 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x31, 0x8f, 0xd3, 0x30, - 0x18, 0x6d, 0xae, 0xd7, 0xe3, 0xce, 0x27, 0x1d, 0x6a, 0x54, 0x89, 0x34, 0x43, 0x5a, 0x9d, 0x18, - 0xaa, 0xea, 0x6a, 0xd3, 0x1e, 0x13, 0x62, 0xb9, 0x82, 0x90, 0x18, 0x2a, 0xa1, 0xdc, 0xc6, 0x52, - 0x39, 0x89, 0x31, 0x16, 0x49, 0x1c, 0xf9, 0x73, 0xa2, 0xeb, 0x86, 0x18, 0x99, 0xf8, 0x19, 0x8c, - 0x1d, 0xf8, 0x11, 0xc7, 0x76, 0x62, 0x62, 0x42, 0xa8, 0x1d, 0xfa, 0x37, 0x50, 0x12, 0xb7, 0x43, - 0xbb, 0xb0, 0x24, 0xfe, 0xde, 0xfb, 0x9e, 0xbf, 0xa7, 0x67, 0x1b, 0xb9, 0x9a, 0x29, 0x45, 0x09, - 0x97, 0x05, 0x29, 0x26, 0x71, 0x9e, 0x86, 0x63, 0xa2, 0xef, 0x70, 0xa6, 0xa4, 0x96, 0x76, 0xbb, - 0xe2, 0x30, 0x97, 0x05, 0x36, 0x9c, 0xeb, 0x85, 0x12, 0x12, 0x09, 0x24, 0xa0, 0xc0, 0x48, 0x31, - 0x0e, 0x98, 0xa6, 0x63, 0x12, 0x4a, 0x91, 0xd6, 0x12, 0xb7, 0xc3, 0x25, 0x97, 0xd5, 0x92, 0x94, - 0x2b, 0x83, 0xf6, 0xb8, 0x94, 0x3c, 0x66, 0xa4, 0xaa, 0x82, 0xfc, 0x03, 0xd1, 0x22, 0x61, 0xa0, - 0x69, 0x92, 0x99, 0x86, 0xee, 0x7e, 0x03, 0x4d, 0x17, 0x86, 0xf2, 0xf6, 0xa9, 0x28, 0x57, 0x54, - 0x0b, 0xb9, 0x9d, 0xd8, 0xad, 0x1d, 0xcd, 0xeb, 0xa1, 0x75, 0x61, 0xa8, 0x27, 0xc6, 0x6c, 0x02, - 0x9c, 0x14, 0xe3, 0xf2, 0x67, 0x88, 0x36, 0x4d, 0x44, 0x2a, 0x49, 0xf5, 0xad, 0xa1, 0xcb, 0x9f, - 0x47, 0xa8, 0x3d, 0x03, 0x7e, 0x9b, 0x07, 0x89, 0xd0, 0xef, 0x94, 0xcc, 0x24, 0xd0, 0xd8, 0x7e, - 0x86, 0x4e, 0x13, 0x06, 0x40, 0x39, 0x03, 0xc7, 0xea, 0x37, 0x07, 0xe7, 0x93, 0x0e, 0xae, 0xfd, - 0xe0, 0xad, 0x1f, 0x7c, 0x93, 0x2e, 0xfc, 0x5d, 0x97, 0x3d, 0x43, 0x8f, 0x45, 0x2a, 0xb4, 0xa0, - 0xf1, 0x3c, 0x62, 0x99, 0x04, 0xa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, 0x7d, 0x73, 0xbf, 0xf2, 0xac, 0x87, 0x95, - 0x67, 0xfd, 0x5d, 0x79, 0xd6, 0xb7, 0xb5, 0xd7, 0x78, 0x58, 0x7b, 0x8d, 0xdf, 0x6b, 0xaf, 0xf1, - 0xfe, 0x8a, 0x0b, 0xfd, 0x31, 0x0f, 0x70, 0x28, 0x13, 0x12, 0xc6, 0x14, 0x40, 0x84, 0xa3, 0xfa, - 0xc9, 0x84, 0x52, 0x31, 0x52, 0x5c, 0x93, 0xbb, 0xea, 0xf1, 0xe8, 0x45, 0xc6, 0x20, 0x38, 0xa9, - 0x6e, 0xc5, 0xf5, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x4e, 0xf3, 0x04, 0xdf, 0x56, 0x03, 0x00, - 0x00, + // 611 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcf, 0x6b, 0x14, 0x31, + 0x14, 0xc7, 0x77, 0xba, 0xfd, 0x99, 0x42, 0xa5, 0x61, 0xc1, 0xec, 0x80, 0xb3, 0x65, 0x51, 0x28, + 0xd5, 0x26, 0x6e, 0xab, 0x1e, 0x4a, 0x2f, 0x5d, 0xbd, 0x88, 0x2c, 0xca, 0xf4, 0xe6, 0xa5, 0x64, + 0x66, 0x62, 0x0c, 0x4e, 0x26, 0xc3, 0x24, 0x33, 0xb8, 0x37, 0xf1, 0xe8, 0xc9, 0x3f, 0xc3, 0x63, + 0x0f, 0xfe, 0x07, 0x5e, 0xea, 0xad, 0x78, 0xf2, 0x54, 0xa4, 0x05, 0x0b, 0xfe, 0x15, 0x32, 0x33, + 0x99, 0x6d, 0xe9, 0x16, 0x7f, 0x5c, 0x76, 0xf3, 0xde, 0xf7, 0xbd, 0x97, 0xef, 0x7e, 0xb2, 0x09, + 0x70, 0x0d, 0xcb, 0x32, 0x4a, 0xb8, 0x2a, 0x48, 0xb1, 0x15, 0xe7, 0x49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, 0x8b, 0x69, 0x25, 0x2d, 0x34, 0x45, 0xcb, + 0xfe, 0xb2, 0x7e, 0x07, 0xc0, 0x8b, 0xa8, 0xe1, 0xb3, 0xf5, 0xc5, 0x01, 0xed, 0x91, 0xe6, 0x30, + 0x02, 0x2b, 0x57, 0xfe, 0x8c, 0xb7, 0xf1, 0xd4, 0x7d, 0xc4, 0x53, 0x9c, 0xdd, 0x7b, 0xff, 0x52, + 0x35, 0x39, 0x8d, 0xe7, 0x60, 0xa1, 0x01, 0x7d, 0xeb, 0xfa, 0x46, 0x2b, 0xbb, 0x77, 0xfe, 0x28, + 0x37, 0x03, 0xdd, 0xb9, 0x77, 0x25, 0x90, 0xe1, 0xb3, 0xa3, 0x53, 0xcf, 0x39, 0x3e, 0xf5, 0x9c, + 0x1f, 0xa7, 0x9e, 0xf3, 0xf1, 0xcc, 0x6b, 0x1d, 0x9f, 0x79, 0xad, 0xef, 0x67, 0x5e, 0xeb, 0xe5, + 0x80, 0x0b, 0xf3, 0x3a, 0x0f, 0x70, 0xa8, 0x24, 0x09, 0x63, 0xaa, 0xb5, 0x08, 0x37, 0xeb, 0x37, + 0x28, 0x54, 0x19, 0x23, 0xc5, 0x36, 0x09, 0x73, 0x6d, 0x94, 0xac, 0x9e, 0x24, 0x33, 0x4e, 0x99, + 0x0e, 0xe6, 0xab, 0xbb, 0xb6, 0xfd, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x4e, 0x63, 0x51, 0xbf, 0xac, + 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -232,6 +341,8 @@ const _ = grpc.SupportPackageIsVersion4 type MsgClient interface { // SubmitProposal defines a method to create new proposal given the messages. SubmitProposal(ctx context.Context, in *MsgSubmitProposal, opts ...grpc.CallOption) (*MsgSubmitProposalResponse, error) + // Deposit defines a method to add deposit on a specific proposal. + Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) } type msgClient struct { @@ -251,10 +362,21 @@ func (c *msgClient) SubmitProposal(ctx context.Context, in *MsgSubmitProposal, o return out, nil } +func (c *msgClient) Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) { + out := new(MsgDepositResponse) + err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Msg/Deposit", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // SubmitProposal defines a method to create new proposal given the messages. SubmitProposal(context.Context, *MsgSubmitProposal) (*MsgSubmitProposalResponse, error) + // Deposit defines a method to add deposit on a specific proposal. + Deposit(context.Context, *MsgDeposit) (*MsgDepositResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -264,6 +386,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) SubmitProposal(ctx context.Context, req *MsgSubmitProposal) (*MsgSubmitProposalResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SubmitProposal not implemented") } +func (*UnimplementedMsgServer) Deposit(ctx context.Context, req *MsgDeposit) (*MsgDepositResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -287,6 +412,24 @@ func _Msg_SubmitProposal_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _Msg_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDeposit) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Deposit(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terra.gov.v2lunc1.Msg/Deposit", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Deposit(ctx, req.(*MsgDeposit)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "terra.gov.v2lunc1.Msg", HandlerType: (*MsgServer)(nil), @@ -295,6 +438,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "SubmitProposal", Handler: _Msg_SubmitProposal_Handler, }, + { + MethodName: "Deposit", + Handler: _Msg_Deposit_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "terra/gov/v2lunc1/tx.proto", @@ -407,6 +554,78 @@ func (m *MsgSubmitProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } +func (m *MsgDeposit) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgDeposit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintTx(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *MsgDepositResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgDepositResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -467,6 +686,37 @@ func (m *MsgSubmitProposalResponse) Size() (n int) { return n } +func (m *MsgDeposit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovTx(uint64(m.ProposalId)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgDepositResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -788,6 +1038,191 @@ func (m *MsgSubmitProposalResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgDeposit) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDeposit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeposit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Depositor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = append(m.Amount, types1.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgDepositResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgDepositResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/custom/gov/types/v2luncv1/params.go b/custom/gov/types/v2luncv1/params.go deleted file mode 100644 index 86b0fdef..00000000 --- a/custom/gov/types/v2luncv1/params.go +++ /dev/null @@ -1,112 +0,0 @@ -package v2luncv1 - -import ( - fmt "fmt" - "time" - - "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// Default period for deposits & voting -const ( - DefaultPeriod time.Duration = time.Hour * 24 * 2 // 2 days -) - -// Default governance params -var ( - DefaultMinUusdDepositTokens = sdk.NewInt(500) // Minimal uusd deposit for a proposal to enter voting period -) - -// NewParams creates a new Params instance with given values. -func NewParams( - minDeposit sdk.Coins, maxDepositPeriod, votingPeriod time.Duration, - quorum, threshold, vetoThreshold, minInitialDepositRatio string, burnProposalDeposit, burnVoteQuorum, burnVoteVeto bool, minUusdDeposit sdk.Coin, -) Params { - return Params{ - MinDeposit: minDeposit, - MaxDepositPeriod: &maxDepositPeriod, - VotingPeriod: &votingPeriod, - Quorum: quorum, - Threshold: threshold, - VetoThreshold: vetoThreshold, - MinInitialDepositRatio: minInitialDepositRatio, - BurnProposalDepositPrevote: burnProposalDeposit, - BurnVoteQuorum: burnVoteQuorum, - BurnVoteVeto: burnVoteVeto, - MinUusdDeposit: minUusdDeposit, - } -} - -// ValidateBasic performs basic validation on governance parameters. -func (p Params) ValidateBasic() error { - if minDeposit := sdk.Coins(p.MinDeposit); minDeposit.Empty() || !minDeposit.IsValid() { - return fmt.Errorf("invalid minimum deposit: %s", minDeposit) - } - - if p.MaxDepositPeriod == nil { - return fmt.Errorf("maximum deposit period must not be nil: %d", p.MaxDepositPeriod) - } - - if p.MaxDepositPeriod.Seconds() <= 0 { - return fmt.Errorf("maximum deposit period must be positive: %d", p.MaxDepositPeriod) - } - - quorum, err := sdk.NewDecFromStr(p.Quorum) - if err != nil { - return fmt.Errorf("invalid quorum string: %w", err) - } - if quorum.IsNegative() { - return fmt.Errorf("quorom cannot be negative: %s", quorum) - } - if quorum.GT(math.LegacyOneDec()) { - return fmt.Errorf("quorom too large: %s", p.Quorum) - } - - threshold, err := sdk.NewDecFromStr(p.Threshold) - if err != nil { - return fmt.Errorf("invalid threshold string: %w", err) - } - if !threshold.IsPositive() { - return fmt.Errorf("vote threshold must be positive: %s", threshold) - } - if threshold.GT(math.LegacyOneDec()) { - return fmt.Errorf("vote threshold too large: %s", threshold) - } - - vetoThreshold, err := sdk.NewDecFromStr(p.VetoThreshold) - if err != nil { - return fmt.Errorf("invalid vetoThreshold string: %w", err) - } - if !vetoThreshold.IsPositive() { - return fmt.Errorf("veto threshold must be positive: %s", vetoThreshold) - } - if vetoThreshold.GT(math.LegacyOneDec()) { - return fmt.Errorf("veto threshold too large: %s", vetoThreshold) - } - - if p.VotingPeriod == nil { - return fmt.Errorf("voting period must not be nil: %d", p.VotingPeriod) - } - - if p.VotingPeriod.Seconds() <= 0 { - return fmt.Errorf("voting period must be positive: %s", p.VotingPeriod) - } - - minInitialDepositRatio, err := math.LegacyNewDecFromStr(p.MinInitialDepositRatio) - if err != nil { - return fmt.Errorf("invalid mininum initial deposit ratio of proposal: %w", err) - } - if minInitialDepositRatio.IsNegative() { - return fmt.Errorf("mininum initial deposit ratio of proposal must be positive: %s", minInitialDepositRatio) - } - if minInitialDepositRatio.GT(math.LegacyOneDec()) { - return fmt.Errorf("mininum initial deposit ratio of proposal is too large: %s", minInitialDepositRatio) - } - - if minUusdDeposit := p.MinUusdDeposit; !minUusdDeposit.IsValid() { - return fmt.Errorf("invalid minimum uusd deposit: %s", minUusdDeposit) - } - - return nil -} diff --git a/proto/terra/gov/v2lunc1/gov.proto b/proto/terra/gov/v2lunc1/gov.proto index 6120a235..9d76dcaf 100644 --- a/proto/terra/gov/v2lunc1/gov.proto +++ b/proto/terra/gov/v2lunc1/gov.proto @@ -9,7 +9,7 @@ import "google/protobuf/duration.proto"; import "cosmos_proto/cosmos.proto"; import "amino/amino.proto"; -option go_package = "github.com/classic-terra/core/v3/x/gov/types"; +option go_package = "github.com/classic-terra/core/v3/custom/gov/types"; // Params defines the parameters for the x/gov module. // diff --git a/proto/terra/gov/v2lunc1/query.proto b/proto/terra/gov/v2lunc1/query.proto index 30ebbc4d..a1b07974 100644 --- a/proto/terra/gov/v2lunc1/query.proto +++ b/proto/terra/gov/v2lunc1/query.proto @@ -10,12 +10,12 @@ import "google/protobuf/duration.proto"; import "cosmos_proto/cosmos.proto"; import "amino/amino.proto"; -option go_package = "github.com/classic-terra/core/v3/x/gov/types"; +option go_package = "github.com/classic-terra/core/v3/custom/gov/types"; // Query defines the gRPC querier service for gov module service Query { // Proposal queries proposal details based on ProposalID. - rpc Proposal(QueryProposalRequest) returns (QueryMinimalDepositProposalResponse) { + rpc ProposalMinimalLUNCByUusd(QueryProposalRequest) returns (QueryMinimalDepositProposalResponse) { option (google.api.http).get = "/cosmos/gov/v1/proposals/minimal-deposits/{proposal_id}"; } } diff --git a/proto/terra/gov/v2lunc1/tx.proto b/proto/terra/gov/v2lunc1/tx.proto index 7df99581..9745d796 100644 --- a/proto/terra/gov/v2lunc1/tx.proto +++ b/proto/terra/gov/v2lunc1/tx.proto @@ -10,7 +10,7 @@ import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; import "amino/amino.proto"; -option go_package = "github.com/classic-terra/core/v3/x/gov/types"; +option go_package = "github.com/classic-terra/core/v3/custom/gov/types"; // Msg defines the gov Msg service. service Msg { @@ -18,6 +18,9 @@ service Msg { // SubmitProposal defines a method to create new proposal given the messages. rpc SubmitProposal(MsgSubmitProposal) returns (MsgSubmitProposalResponse); + + // Deposit defines a method to add deposit on a specific proposal. + rpc Deposit(MsgDeposit) returns (MsgDepositResponse); } message MsgSubmitProposal { @@ -51,4 +54,22 @@ message MsgSubmitProposal { message MsgSubmitProposalResponse { // proposal_id defines the unique id of the proposal. uint64 proposal_id = 1; -} \ No newline at end of file +} + +// MsgDeposit defines a message to submit a deposit to an existing proposal. +message MsgDeposit { + option (cosmos.msg.v1.signer) = "depositor"; + option (amino.name) = "cosmos-sdk/v1/MsgDeposit"; + + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; + + // depositor defines the deposit addresses from the proposals. + string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // amount to be deposited by depositor. + repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} + +// MsgDepositResponse defines the Msg/Deposit response type. +message MsgDepositResponse {} \ No newline at end of file From e26da00bcf72206ff5ec86e40fbc6025822976a1 Mon Sep 17 00:00:00 2001 From: tusoict Date: Thu, 3 Oct 2024 21:49:10 +0700 Subject: [PATCH 14/60] Overided keeper instance in keeper.go (gov module) --- app/keepers/keepers.go | 5 ++- custom/gov/keeper/deposit.go | 59 +++++++++++++++++------------------ custom/gov/keeper/keeper.go | 4 +-- custom/gov/keeper/proposal.go | 39 ++++++++++++----------- 4 files changed, 54 insertions(+), 53 deletions(-) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 6a9470f9..26260990 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -60,6 +60,8 @@ import ( customwasmkeeper "github.com/classic-terra/core/v3/custom/wasm/keeper" terrawasm "github.com/classic-terra/core/v3/wasmbinding" + customgovkeeper "github.com/classic-terra/core/v3/custom/gov/keeper" + dyncommkeeper "github.com/classic-terra/core/v3/x/dyncomm/keeper" dyncommtypes "github.com/classic-terra/core/v3/x/dyncomm/types" marketkeeper "github.com/classic-terra/core/v3/x/market/keeper" @@ -439,12 +441,13 @@ func NewAppKeepers( // register the proposal types govRouter := appKeepers.newGovRouter() govConfig := govtypes.DefaultConfig() - govKeeper := govkeeper.NewKeeper( + govKeeper := customgovkeeper.NewKeeper( appCodec, appKeepers.keys[govtypes.StoreKey], appKeepers.AccountKeeper, appKeepers.BankKeeper, appKeepers.StakingKeeper, + appKeepers.OracleKeeper, bApp.MsgServiceRouter(), govConfig, authtypes.NewModuleAddress(govtypes.ModuleName).String(), diff --git a/custom/gov/keeper/deposit.go b/custom/gov/keeper/deposit.go index ae1701c9..fbb3d4d9 100644 --- a/custom/gov/keeper/deposit.go +++ b/custom/gov/keeper/deposit.go @@ -3,7 +3,7 @@ package keeper import ( "fmt" - core "github.com/classic-terra/core/v3/types" + v2luncv1types "github.com/classic-terra/core/v3/custom/gov/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -14,7 +14,7 @@ import ( // Activates voting period when appropriate and returns true in that case, else returns false. func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress, depositAmount sdk.Coins) (bool, error) { // Checks to see if proposal exists - proposal, ok := keeper.baseKeeper.GetProposal(ctx, proposalID) + proposal, ok := keeper.GetProposal(ctx, proposalID) if !ok { return false, sdkerrors.Wrapf(types.ErrUnknownProposal, "%d", proposalID) } @@ -32,24 +32,27 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd // Update proposal proposal.TotalDeposit = sdk.NewCoins(proposal.TotalDeposit...).Add(depositAmount...) - keeper.baseKeeper.SetProposal(ctx, proposal) + keeper.SetProposal(ctx, proposal) // Check if deposit has provided sufficient total funds to transition the proposal into the voting period activatedVotingPeriod := false - minLUNCBaseUusd, err := keeper.GetDepositLimitBaseUusd(ctx, proposalID) - if err != nil { - return false, err - } - minDeposit := sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, minLUNCBaseUusd.TruncateInt())) - if proposal.Status == v1.StatusDepositPeriod && sdk.NewCoins(proposal.TotalDeposit...).IsAllGTE(minDeposit) { - keeper.baseKeeper.ActivateVotingPeriod(ctx, proposal) + // HandleCheckLimitlDeposit + minDeposit := keeper.GetParams(ctx).MinDeposit + requiredAmount := keeper.GetDepositLimitBaseUusd(ctx, proposalID).TruncateInt() + + requiredDepositCoins := sdk.NewCoins( + sdk.NewCoin(minDeposit[0].Denom, requiredAmount), + ) + + if proposal.Status == v1.StatusDepositPeriod && sdk.NewCoins(proposal.TotalDeposit...).IsAllGTE(requiredDepositCoins) && requiredAmount.GT(sdk.ZeroInt()) { + keeper.ActivateVotingPeriod(ctx, proposal) activatedVotingPeriod = true } // Add or update deposit object - deposit, found := keeper.baseKeeper.GetDeposit(ctx, proposalID, depositorAddr) + deposit, found := keeper.GetDeposit(ctx, proposalID, depositorAddr) if found { deposit.Amount = sdk.NewCoins(deposit.Amount...).Add(depositAmount...) @@ -58,7 +61,7 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd } // called when deposit has been added to a proposal, however the proposal may not be active - keeper.baseKeeper.Hooks().AfterProposalDeposit(ctx, proposalID, depositorAddr) + keeper.Hooks().AfterProposalDeposit(ctx, proposalID, depositorAddr) ctx.EventManager().EmitEvent( sdk.NewEvent( @@ -68,29 +71,23 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd ), ) - keeper.baseKeeper.SetDeposit(ctx, deposit) + keeper.SetDeposit(ctx, deposit) return activatedVotingPeriod, nil } -// validateInitialDeposit validates if initial deposit is greater than or equal to the minimum -// required at the time of proposal submission. This threshold amount is determined by -// the deposit parameters. Returns nil on success, error otherwise. -func (keeper Keeper) validateInitialDeposit(ctx sdk.Context, initialDeposit sdk.Coins) error { - params := keeper.baseKeeper.GetParams(ctx) - minInitialDepositRatio, err := sdk.NewDecFromStr(params.MinInitialDepositRatio) - if err != nil { - return err - } - if minInitialDepositRatio.IsZero() { - return nil +// GetDepositLimitBaseUUSD gets the deposit limit (Lunc) for a specific proposal +func (keeper Keeper) GetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64) (depositLimit sdk.Dec) { + store := ctx.KVStore(keeper.storeKey) + key := v2luncv1types.TotalDepositKey(proposalID) + bz := store.Get(key) + if bz == nil { + return sdk.ZeroDec() } - minDepositCoins := params.MinDeposit - for i := range minDepositCoins { - minDepositCoins[i].Amount = sdk.NewDecFromInt(minDepositCoins[i].Amount).Mul(minInitialDepositRatio).RoundInt() + err := depositLimit.Unmarshal(bz) + if err == nil { + return sdk.ZeroDec() } - if !initialDeposit.IsAllGTE(minDepositCoins) { - return sdkerrors.Wrapf(types.ErrMinDepositTooSmall, "was (%s), need (%s)", initialDeposit, minDepositCoins) - } - return nil + + return depositLimit } diff --git a/custom/gov/keeper/keeper.go b/custom/gov/keeper/keeper.go index 2d3b446e..c6558359 100644 --- a/custom/gov/keeper/keeper.go +++ b/custom/gov/keeper/keeper.go @@ -15,7 +15,7 @@ import ( // Keeper defines the governance module Keeper type Keeper struct { - baseKeeper keeper.Keeper + *keeper.Keeper authKeeper types.AccountKeeper bankKeeper types.BankKeeper oracleKeeper markettypes.OracleKeeper @@ -73,8 +73,8 @@ func NewKeeper( } return &Keeper{ + Keeper: keeper.NewKeeper(cdc, key, authKeeper, bankKeeper, sk, router, config, authority), storeKey: key, - baseKeeper: *keeper.NewKeeper(cdc, key, authKeeper, bankKeeper, sk, router, config, authority), authKeeper: authKeeper, bankKeeper: bankKeeper, oracleKeeper: oracleKeeper, diff --git a/custom/gov/keeper/proposal.go b/custom/gov/keeper/proposal.go index 934dbb70..c48753e3 100644 --- a/custom/gov/keeper/proposal.go +++ b/custom/gov/keeper/proposal.go @@ -53,7 +53,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat } // assert that the governance module account is the only signer of the messages - if !signers[0].Equals(keeper.baseKeeper.GetGovernanceAccount(ctx).GetAddress()) { + if !signers[0].Equals(keeper.GetGovernanceAccount(ctx).GetAddress()) { return v1.Proposal{}, sdkerrors.Wrapf(types.ErrInvalidSigner, signers[0].String()) } @@ -80,22 +80,22 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat } - proposalID, err := keeper.baseKeeper.GetProposalID(ctx) + proposalID, err := keeper.GetProposalID(ctx) if err != nil { return v1.Proposal{}, err } submitTime := ctx.BlockHeader().Time - depositPeriod := keeper.baseKeeper.GetParams(ctx).MaxDepositPeriod + depositPeriod := keeper.GetParams(ctx).MaxDepositPeriod proposal, err := v1.NewProposal(messages, proposalID, submitTime, submitTime.Add(*depositPeriod), metadata, title, summary, proposer) if err != nil { return v1.Proposal{}, err } - keeper.baseKeeper.SetProposal(ctx, proposal) - keeper.baseKeeper.InsertInactiveProposalQueue(ctx, proposalID, *proposal.DepositEndTime) - keeper.baseKeeper.SetProposalID(ctx, proposalID+1) + keeper.SetProposal(ctx, proposal) + keeper.InsertInactiveProposalQueue(ctx, proposalID, *proposal.DepositEndTime) + keeper.SetProposalID(ctx, proposalID+1) // Get exchange rate betweent Lunc/uusd from oracle // save it to store @@ -112,7 +112,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat keeper.SetPriceLuncBaseUusd(ctx, proposalID, math.LegacyDec(totalLuncDeposit)) // called right after a proposal is submitted - keeper.baseKeeper.Hooks().AfterProposalSubmission(ctx, proposalID) + keeper.Hooks().AfterProposalSubmission(ctx, proposalID) ctx.EventManager().EmitEvent( sdk.NewEvent( @@ -136,18 +136,19 @@ func (keeper Keeper) SetPriceLuncBaseUusd(ctx sdk.Context, proposalID uint64, am } } -// GetDepositLimitBaseUUSD gets the deposit limit (Lunc) for a specific proposal -func (keeper Keeper) GetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64) (depositLimit sdk.Dec, err error) { - store := ctx.KVStore(keeper.storeKey) - key := v2luncv1types.TotalDepositKey(proposalID) - bz := store.Get(key) - if bz == nil { - return sdk.ZeroDec(), err - } - err = depositLimit.Unmarshal(bz) - if err == nil { - return sdk.ZeroDec(), err +// GetDepositLimitBaseUusd: calculate the minimum LUNC amount to deposit base on Uusd for the proposal +func (keeper Keeper) GetMinimumDepositBaseUusd(ctx sdk.Context) (error, math.Int) { + // Get exchange rate betweent Lunc/uusd from oracle + // save it to store + price, err := keeper.oracleKeeper.GetLunaExchangeRate(ctx, core.MicroUSDDenom) + if err != nil && price.LTE(sdk.ZeroDec()) { + return err, sdk.ZeroInt() } + minUusdDeposit := keeper.GetParams(ctx).MinUusdDeposit + totalLuncDeposit := sdk.NewDecFromInt(minUusdDeposit.Amount).Quo(price).TruncateInt() - return depositLimit, nil + if err != nil { + return err, sdk.ZeroInt() + } + return nil, totalLuncDeposit } From f63eefbcc20ba2b05627cb1d63a575bfe6524111 Mon Sep 17 00:00:00 2001 From: duonghb53 Date: Thu, 3 Oct 2024 23:49:14 +0700 Subject: [PATCH 15/60] add get query cmd --- custom/gov/keeper/common_test.go | 2 +- custom/gov/module.go | 5 +++++ custom/gov/types/keys.go | 12 ------------ 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/custom/gov/keeper/common_test.go b/custom/gov/keeper/common_test.go index 95718be0..e63d77dc 100644 --- a/custom/gov/keeper/common_test.go +++ b/custom/gov/keeper/common_test.go @@ -84,7 +84,7 @@ func setupGovKeeper(t *testing.T) ( // Gov keeper initializations govKeeper := keeper.NewKeeper(encCfg.Codec, key, acctKeeper, bankKeeper, stakingKeeper, msr, types.DefaultConfig(), govAcct.String()) - govKeeper.baseKeeper.SetProposalID(ctx, 1) + govKeeper.SetProposalID(ctx, 1) govRouter := v1beta1.NewRouter() // Also register legacy gov handlers to test them too. govRouter.AddRoute(types.RouterKey, v1beta1.ProposalHandler) govKeeper.SetLegacyRouter(govRouter) diff --git a/custom/gov/module.go b/custom/gov/module.go index b5bae01a..20ddf3d7 100644 --- a/custom/gov/module.go +++ b/custom/gov/module.go @@ -59,6 +59,11 @@ func (AppModuleBasic) GetTxCmd() *cobra.Command { return customcli.GetTxCmd() } +// GetQueryCmd returns no root query command for the oracle module. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return customcli.GetQueryCmd() +} + // RegisterLegacyAminoCodec registers the gov module's types for the given codec. func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { customtypes.RegisterLegacyAminoCodec(cdc) diff --git a/custom/gov/types/keys.go b/custom/gov/types/keys.go index 09f1975b..4dd72c4a 100644 --- a/custom/gov/types/keys.go +++ b/custom/gov/types/keys.go @@ -16,18 +16,6 @@ func GetProposalIDBytes(proposalID uint64) (proposalIDBz []byte) { return } -// GetAmountBytes returns the byte representation of the amount -func GetAmountBytes(amount uint64) (amountBz []byte) { - amountBz = make([]byte, 8) - binary.BigEndian.PutUint64(amountBz, amount) - return -} - -// GetAmountFromBytes returns amount in uint64 format from a byte array -func GetAmountFromBytes(bz []byte) (amount uint64) { - return binary.BigEndian.Uint64(bz) -} - // TotalDepositKey of the specific total amount to deposit based on the proposalID from the store func TotalDepositKey(proposalID uint64) []byte { return append(UUSDMinKeyPrefix, GetProposalIDBytes(proposalID)...) From b422289350edcdd7fcb55e6cb55badba6de5f74e Mon Sep 17 00:00:00 2001 From: duonghb53 Date: Fri, 4 Oct 2024 21:32:01 +0700 Subject: [PATCH 16/60] move gov types to v2lunc1 --- custom/gov/types/{ => v2lunc1}/gov.pb.go | 74 +++++++++---------- custom/gov/types/{ => v2lunc1}/query.pb.go | 60 +++++++-------- custom/gov/types/{ => v2lunc1}/query.pb.gw.go | 4 +- custom/gov/types/{ => v2lunc1}/tx.pb.go | 24 +++--- proto/terra/gov/v2lunc1/gov.proto | 2 +- proto/terra/gov/v2lunc1/query.proto | 2 +- proto/terra/gov/v2lunc1/tx.proto | 2 +- 7 files changed, 84 insertions(+), 84 deletions(-) rename custom/gov/types/{ => v2lunc1}/gov.pb.go (85%) rename custom/gov/types/{ => v2lunc1}/query.pb.go (84%) rename custom/gov/types/{ => v2lunc1}/query.pb.gw.go (99%) rename custom/gov/types/{ => v2lunc1}/tx.pb.go (97%) diff --git a/custom/gov/types/gov.pb.go b/custom/gov/types/v2lunc1/gov.pb.go similarity index 85% rename from custom/gov/types/gov.pb.go rename to custom/gov/types/v2lunc1/gov.pb.go index 3efa87d3..8907c82e 100644 --- a/custom/gov/types/gov.pb.go +++ b/custom/gov/types/v2lunc1/gov.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: terra/gov/v2lunc1/gov.proto -package types +package v2lunc1 import ( fmt "fmt" @@ -180,42 +180,42 @@ func init() { func init() { proto.RegisterFile("terra/gov/v2lunc1/gov.proto", fileDescriptor_ec6805a6cb6c4923) } var fileDescriptor_ec6805a6cb6c4923 = []byte{ - // 554 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4d, 0x4f, 0xd4, 0x40, - 0x18, 0xde, 0x0a, 0xac, 0x32, 0xc0, 0xba, 0x34, 0xc6, 0x74, 0x31, 0x96, 0x8d, 0x31, 0x66, 0x63, - 0xa4, 0x93, 0x85, 0xf8, 0x03, 0x5c, 0xd7, 0x03, 0x31, 0x1a, 0xdc, 0x28, 0x07, 0x2f, 0xcd, 0xb4, - 0x1d, 0xcb, 0x24, 0x3b, 0xf3, 0xd6, 0x99, 0x69, 0x03, 0xff, 0xc2, 0xa3, 0x37, 0xaf, 0x1e, 0x3d, - 0xf8, 0x23, 0x38, 0x12, 0x4f, 0x9e, 0xd4, 0xc0, 0xc1, 0xbf, 0x61, 0xe6, 0xa3, 0x60, 0x08, 0x07, - 0x2e, 0xcd, 0xf4, 0x7d, 0x9f, 0x8f, 0xf7, 0x99, 0x0f, 0x74, 0x4f, 0x53, 0x29, 0x09, 0x2e, 0xa1, - 0xc1, 0xcd, 0xf6, 0xbc, 0x16, 0xf9, 0xd8, 0xac, 0x93, 0x4a, 0x82, 0x86, 0x70, 0xdd, 0x36, 0x13, - 0x53, 0xf0, 0xcd, 0x8d, 0x38, 0x07, 0xc5, 0x41, 0xe1, 0x8c, 0x28, 0x8a, 0x9b, 0x71, 0x46, 0x35, - 0x19, 0xe3, 0x1c, 0x98, 0x70, 0x94, 0x8d, 0x3b, 0x25, 0x94, 0x60, 0x97, 0xd8, 0xac, 0x7c, 0x75, - 0xb3, 0x04, 0x28, 0xe7, 0x14, 0xdb, 0xbf, 0xac, 0xfe, 0x80, 0x35, 0xe3, 0x54, 0x69, 0xc2, 0x2b, - 0x0f, 0x18, 0x5c, 0x06, 0x10, 0x71, 0xe4, 0x5b, 0xf1, 0xe5, 0x56, 0x51, 0x4b, 0xa2, 0x19, 0xb4, - 0x8e, 0x03, 0x37, 0x51, 0xea, 0x4c, 0xdd, 0x8f, 0x6f, 0xad, 0x13, 0xce, 0x04, 0x60, 0xfb, 0x75, - 0xa5, 0x07, 0x5f, 0x96, 0x50, 0x77, 0x8f, 0x48, 0xc2, 0x55, 0xf8, 0x02, 0xad, 0x70, 0x26, 0xd2, - 0x82, 0x56, 0xa0, 0x98, 0x8e, 0x82, 0xe1, 0xc2, 0x68, 0x65, 0x7b, 0x90, 0x78, 0x05, 0x13, 0x30, - 0xf1, 0x01, 0x93, 0xe7, 0xc0, 0xc4, 0x64, 0xf9, 0xf8, 0xd7, 0x66, 0xe7,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0x59, 0x49, 0xa8, 0x40, 0xfd, 0x67, 0x5b, 0x49, 0x6a, 0xd8, 0x51, 0xcf, 0xd2, 0x36, 0x0c, 0x68, - 0xcf, 0x63, 0xda, 0x93, 0x70, 0x88, 0xf0, 0x21, 0xea, 0x5d, 0x98, 0x99, 0x48, 0xd1, 0x6d, 0xcb, - 0x59, 0x6d, 0xad, 0xf6, 0xa9, 0x86, 0xf0, 0x35, 0xea, 0x9b, 0x74, 0x75, 0xad, 0x8a, 0xf3, 0xbb, - 0xd4, 0xf7, 0x67, 0x76, 0x9d, 0xbb, 0xd4, 0xe3, 0x4c, 0xbc, 0xab, 0x55, 0xe1, 0xcd, 0x27, 0x2f, - 0x8f, 0x4f, 0xe3, 0xe0, 0xe4, 0x34, 0x0e, 0xfe, 0x9c, 0xc6, 0xc1, 0xa7, 0xb3, 0xb8, 0x73, 0x72, - 0x16, 0x77, 0x7e, 0x9e, 0xc5, 0x9d, 0xf7, 0xe3, 0x92, 0xe9, 0x83, 0x3a, 0x4b, 0x72, 0xe0, 0x38, - 0x9f, 0x13, 0xa5, 0x58, 0xbe, 0xe5, 0x9e, 0x6f, 0x0e, 0x92, 0xe2, 0x66, 0x07, 0xe7, 0xb5, 0xd2, - 0xc0, 0xed, 0x6b, 0xd6, 0x47, 0x15, 0x55, 0x59, 0xd7, 0x5e, 0x97, 0x9d, 0x7f, 0x01, 0x00, 0x00, - 0xff, 0xff, 0x42, 0xc6, 0x06, 0xf8, 0xe7, 0x03, 0x00, 0x00, + // 558 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xbb, 0x6e, 0xd4, 0x4c, + 0x14, 0x5e, 0xff, 0x49, 0xf6, 0x27, 0x93, 0x64, 0xd9, 0x58, 0x08, 0x79, 0x83, 0x70, 0x56, 0x08, + 0xa1, 0x15, 0x22, 0x1e, 0x25, 0x11, 0x05, 0x25, 0xcb, 0x52, 0xa4, 0x00, 0x85, 0x05, 0x52, 0xd0, + 0x58, 0x63, 0x7b, 0x70, 0x46, 0xda, 0x99, 0x63, 0x66, 0xc6, 0x56, 0xf2, 0x16, 0x94, 0x74, 0xb4, + 0x94, 0x14, 0x3c, 0x44, 0xca, 0x88, 0x8a, 0x0a, 0x50, 0x52, 0xf0, 0x1a, 0x68, 0x2e, 0x4e, 0x50, + 0xb4, 0x45, 0x1a, 0x6b, 0x7c, 0xce, 0x77, 0x39, 0xdf, 0x5c, 0xd0, 0x1d, 0x4d, 0xa5, 0x24, 0xb8, + 0x84, 0x06, 0x37, 0x3b, 0xb3, 0x5a, 0xe4, 0xdb, 0x66, 0x9d, 0x54, 0x12, 0x34, 0x84, 0xeb, 0xb6, + 0x99, 0x98, 0x82, 0x6f, 0x6e, 0xc4, 0x39, 0x28, 0x0e, 0x0a, 0x67, 0x44, 0x51, 0xdc, 0x6c, 0x67, + 0x54, 0x93, 0x6d, 0x9c, 0x03, 0x13, 0x8e, 0xb2, 0x71, 0xab, 0x84, 0x12, 0xec, 0x12, 0x9b, 0x95, + 0xaf, 0x6e, 0x96, 0x00, 0xe5, 0x8c, 0x62, 0xfb, 0x97, 0xd5, 0xef, 0xb1, 0x66, 0x9c, 0x2a, 0x4d, + 0x78, 0xe5, 0x01, 0x83, 0xab, 0x00, 0x22, 0x8e, 0x7d, 0x2b, 0xbe, 0xda, 0x2a, 0x6a, 0x49, 0x34, + 0x83, 0xd6, 0x71, 0xe0, 0x26, 0x4a, 0x9d, 0xa9, 0xfb, 0xf1, 0xad, 0x75, 0xc2, 0x99, 0x00, 0x6c, + 0xbf, 0xae, 0x74, 0xef, 0xf3, 0x12, 0xea, 0xee, 0x13, 0x49, 0xb8, 0x0a, 0x9f, 0xa3, 0x15, 0xce, + 0x44, 0x5a, 0xd0, 0x0a, 0x14, 0xd3, 0x51, 0x30, 0x5c, 0x18, 0xad, 0xec, 0x0c, 0x12, 0xaf, 0x60, + 0x02, 0x26, 0x3e, 0x60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0x2b, 0x97, 0xec, 0x29, 0xba, + 0x6b, 0x91, 0x95, 0x84, 0x0a, 0xd4, 0x3f, 0xb6, 0x95, 0xa4, 0x86, 0x1d, 0xf5, 0x2c, 0x6d, 0xc3, + 0x80, 0xf6, 0x3d, 0xa6, 0x3d, 0x09, 0x87, 0x08, 0xef, 0xa3, 0xde, 0xa5, 0x99, 0x89, 0x14, 0xdd, + 0xb4, 0x9c, 0xd5, 0xd6, 0xea, 0x80, 0x6a, 0x08, 0x5f, 0xa2, 0xbe, 0x49, 0x57, 0xd7, 0xaa, 0xb8, + 0xb8, 0x4b, 0x7d, 0x7f, 0x66, 0xd7, 0xb9, 0x4b, 0x3d, 0xce, 0xc4, 0xdb, 0x5a, 0x15, 0xde, 0x7c, + 0xfc, 0xfa, 0xe4, 0x2c, 0x0e, 0x4e, 0xcf, 0xe2, 0xe0, 0xf7, 0x59, 0x1c, 0x7c, 0x3c, 0x8f, 0x3b, + 0xa7, 0xe7, 0x71, 0xe7, 0xc7, 0x79, 0xdc, 0x79, 0xf7, 0xa4, 0x64, 0xfa, 0xb0, 0xce, 0x92, 0x1c, + 0x38, 0xce, 0x67, 0x44, 0x29, 0x96, 0x6f, 0xb9, 0xe7, 0x9b, 0x83, 0xa4, 0xb8, 0xd9, 0xc5, 0x79, + 0xad, 0x34, 0x70, 0xfb, 0x9a, 0xf5, 0x71, 0x45, 0x55, 0xfb, 0xa6, 0xb3, 0xae, 0xbd, 0x36, 0xbb, + 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xfd, 0xbd, 0x52, 0x32, 0xef, 0x03, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/custom/gov/types/query.pb.go b/custom/gov/types/v2lunc1/query.pb.go similarity index 84% rename from custom/gov/types/query.pb.go rename to custom/gov/types/v2lunc1/query.pb.go index c1a456b9..57c66292 100644 --- a/custom/gov/types/query.pb.go +++ b/custom/gov/types/v2lunc1/query.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: terra/gov/v2lunc1/query.proto -package types +package v2lunc1 import ( context "context" @@ -134,36 +134,36 @@ func init() { func init() { proto.RegisterFile("terra/gov/v2lunc1/query.proto", fileDescriptor_075d72aa1a1cda58) } var fileDescriptor_075d72aa1a1cda58 = []byte{ - // 449 bytes of a gzipped FileDescriptorProto + // 452 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0xcd, 0x6a, 0x14, 0x41, - 0x10, 0xde, 0xf1, 0x0f, 0x9c, 0x1c, 0x34, 0x43, 0x0e, 0xd9, 0x45, 0x67, 0xc3, 0x7a, 0x30, 0x08, - 0xe9, 0x62, 0x36, 0x60, 0xf0, 0x24, 0x6c, 0xbc, 0x88, 0xff, 0x0b, 0xb9, 0x78, 0x59, 0x7a, 0x66, - 0xda, 0xb1, 0x61, 0xba, 0x6b, 0x32, 0xd5, 0x33, 0xb0, 0x88, 0x17, 0x9f, 0x40, 0xf0, 0x25, 0x3c, - 0xfa, 0x02, 0x9e, 0xcd, 0x31, 0xe0, 0xc5, 0x93, 0xc8, 0xae, 0xe0, 0x6b, 0xc8, 0x76, 0xf7, 0xa0, - 0xae, 0x9a, 0x4b, 0xd3, 0x5d, 0xdf, 0x57, 0x55, 0x5f, 0x7d, 0x5d, 0xe1, 0x75, 0x23, 0xea, 0x9a, - 0x43, 0x81, 0x2d, 0xb4, 0xe3, 0xb2, 0xd1, 0x59, 0x02, 0xc7, 0x8d, 0xa8, 0xe7, 0xac, 0xaa, 0xd1, - 0x60, 0xb4, 0x69, 0x61, 0x56, 0x60, 0xcb, 0x3c, 0x3c, 0x88, 0x33, 0x24, 0x85, 0x04, 0x29, 0x27, - 0x01, 0x6d, 0x92, 0x0a, 0xc3, 0x13, 0xc8, 0x50, 0x6a, 0x97, 0x32, 0xd8, 0x2a, 0xb0, 0x40, 0x7b, - 0x85, 0xd5, 0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, 0xdb, 0xdd, 0x83, + 0x1a, 0x7f, 0x2e, 0x4d, 0x77, 0x7d, 0x5f, 0x55, 0x7d, 0xf5, 0x75, 0x45, 0xd7, 0xad, 0xac, 0x6b, + 0x01, 0x05, 0xb6, 0xd0, 0x8e, 0xcb, 0xc6, 0x64, 0x23, 0x38, 0x6e, 0x64, 0x3d, 0xe7, 0x55, 0x8d, + 0x16, 0xe3, 0x75, 0x07, 0xf3, 0x02, 0x5b, 0x1e, 0xe0, 0x7e, 0x92, 0x21, 0x69, 0x24, 0x48, 0x05, + 0x49, 0x68, 0x47, 0xa9, 0xb4, 0x62, 0x04, 0x19, 0x2a, 0xe3, 0x53, 0xfa, 0x1b, 0x05, 0x16, 0xe8, + 0xae, 0xb0, 0xba, 0x85, 0xe8, 0xb5, 0x02, 0xb1, 0x28, 0x25, 0x88, 0x4a, 0x81, 0x30, 0x06, 0xad, + 0xb0, 0x0a, 0x0d, 0x05, 0x74, 0x10, 0x50, 0xf7, 0x4a, 0x9b, 0xe7, 0x60, 0x95, 0x96, 0x64, 0x85, + 0xae, 0x02, 0x61, 0xeb, 0x2c, 0x41, 0x98, 0x20, 0xb1, 0x9f, 0x9c, 0x85, 0xf2, 0xa6, 0x76, 0xc5, + 0xbb, 0x54, 0xaf, 0x77, 0xe6, 0x25, 0xf9, 0x47, 0x80, 0xd6, 0x85, 0x56, 0x06, 0xc1, 0x9d, 0x3e, + 0x34, 0xdc, 0x8f, 0x36, 0x9e, 0xac, 0xe6, 0x7f, 0x5c, 0x63, 0x85, 0x24, 0xca, 0xa9, 0x3c, 0x6e, + 0x24, 0xd9, 0x78, 0x10, 0xad, 0x55, 0x21, 0x34, 0x53, 0xf9, 0x26, 0xdb, 0x66, 0x3b, 0x17, 0xa6, + 0x51, 0x17, 0xba, 0x97, 0x0f, 0xdb, 0xe8, 0x86, 0x4b, 0x7c, 0xa0, 0x8c, 0xd2, 0xa2, 0xbc, 0x2b, + 0x2b, 0x24, 0x65, 0x7f, 0x96, 0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, 0x20, 0xc5, 0xc6, 0x34, + 0xe8, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/custom/gov/types/query.pb.gw.go b/custom/gov/types/v2lunc1/query.pb.gw.go similarity index 99% rename from custom/gov/types/query.pb.gw.go rename to custom/gov/types/v2lunc1/query.pb.gw.go index f68f755b..a84ec909 100644 --- a/custom/gov/types/query.pb.gw.go +++ b/custom/gov/types/v2lunc1/query.pb.gw.go @@ -2,11 +2,11 @@ // source: terra/gov/v2lunc1/query.proto /* -Package types is a reverse proxy. +Package v2lunc1 is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package types +package v2lunc1 import ( "context" diff --git a/custom/gov/types/tx.pb.go b/custom/gov/types/v2lunc1/tx.pb.go similarity index 97% rename from custom/gov/types/tx.pb.go rename to custom/gov/types/v2lunc1/tx.pb.go index dbf5c2f2..fa945b69 100644 --- a/custom/gov/types/tx.pb.go +++ b/custom/gov/types/v2lunc1/tx.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: terra/gov/v2lunc1/tx.proto -package types +package v2lunc1 import ( context "context" @@ -285,10 +285,10 @@ func init() { func init() { proto.RegisterFile("terra/gov/v2lunc1/tx.proto", fileDescriptor_9d64e87259bdff9f) } var fileDescriptor_9d64e87259bdff9f = []byte{ - // 611 bytes of a gzipped FileDescriptorProto + // 614 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcf, 0x6b, 0x14, 0x31, 0x14, 0xc7, 0x77, 0xba, 0xfd, 0x99, 0x42, 0xa5, 0x61, 0xc1, 0xec, 0x80, 0xb3, 0x65, 0x51, 0x28, - 0xd5, 0x26, 0x6e, 0xab, 0x1e, 0x4a, 0x2f, 0x5d, 0xbd, 0x88, 0x2c, 0xca, 0xf4, 0xe6, 0xa5, 0x64, + 0xd5, 0x26, 0x6e, 0xab, 0x82,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12, 0xe6, 0xda, 0x28, 0x59, 0x3d, 0x49, 0x66, 0x9c, 0x32, + 0xdd, 0x3c, 0x4c, 0xc1, 0x7c, 0x75, 0xe7, 0xb6, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x6d, 0xe8, + 0x36, 0x8b, 0xb4, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/proto/terra/gov/v2lunc1/gov.proto b/proto/terra/gov/v2lunc1/gov.proto index 9d76dcaf..293d3072 100644 --- a/proto/terra/gov/v2lunc1/gov.proto +++ b/proto/terra/gov/v2lunc1/gov.proto @@ -9,7 +9,7 @@ import "google/protobuf/duration.proto"; import "cosmos_proto/cosmos.proto"; import "amino/amino.proto"; -option go_package = "github.com/classic-terra/core/v3/custom/gov/types"; +option go_package = "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1"; // Params defines the parameters for the x/gov module. // diff --git a/proto/terra/gov/v2lunc1/query.proto b/proto/terra/gov/v2lunc1/query.proto index a1b07974..ca261e7b 100644 --- a/proto/terra/gov/v2lunc1/query.proto +++ b/proto/terra/gov/v2lunc1/query.proto @@ -10,7 +10,7 @@ import "google/protobuf/duration.proto"; import "cosmos_proto/cosmos.proto"; import "amino/amino.proto"; -option go_package = "github.com/classic-terra/core/v3/custom/gov/types"; +option go_package = "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1"; // Query defines the gRPC querier service for gov module service Query { diff --git a/proto/terra/gov/v2lunc1/tx.proto b/proto/terra/gov/v2lunc1/tx.proto index 9745d796..bed1a16d 100644 --- a/proto/terra/gov/v2lunc1/tx.proto +++ b/proto/terra/gov/v2lunc1/tx.proto @@ -10,7 +10,7 @@ import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; import "amino/amino.proto"; -option go_package = "github.com/classic-terra/core/v3/custom/gov/types"; +option go_package = "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1"; // Msg defines the gov Msg service. service Msg { From 5e4b6324c7f27b5c2048674f8587ff813e5da389 Mon Sep 17 00:00:00 2001 From: tusoict Date: Fri, 4 Oct 2024 22:34:24 +0700 Subject: [PATCH 17/60] update types the HandleCheckMinInitialDeposit logic in ante of auth module --- app/keepers/keepers.go | 4 ++-- custom/auth/ante/ante.go | 2 +- custom/gov/keeper/keeper.go | 11 +++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 26260990..2155df89 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -40,7 +40,6 @@ import ( evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" "github.com/cosmos/cosmos-sdk/x/feegrant" feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper" - govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" govtypesv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" @@ -87,7 +86,7 @@ type AppKeepers struct { SlashingKeeper slashingkeeper.Keeper MintKeeper mintkeeper.Keeper DistrKeeper distrkeeper.Keeper - GovKeeper govkeeper.Keeper + GovKeeper customgovkeeper.Keeper CrisisKeeper *crisiskeeper.Keeper UpgradeKeeper *upgradekeeper.Keeper ParamsKeeper paramskeeper.Keeper @@ -454,6 +453,7 @@ func NewAppKeepers( ) // Set legacy router for backwards compatibility with gov v1beta1 govKeeper.SetLegacyRouter(govRouter) + appKeepers.GovKeeper = *govKeeper.SetHooks( govtypes.NewMultiGovHooks( // register the governance hooks diff --git a/custom/auth/ante/ante.go b/custom/auth/ante/ante.go index 75400c61..0647e454 100644 --- a/custom/auth/ante/ante.go +++ b/custom/auth/ante/ante.go @@ -2,13 +2,13 @@ package ante import ( errorsmod "cosmossdk.io/errors" + govkeeper "github.com/classic-terra/core/v3/custom/gov/keeper" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/ante" "github.com/cosmos/cosmos-sdk/x/auth/signing" distributionkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" - govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" dyncommante "github.com/classic-terra/core/v3/x/dyncomm/ante" dyncommkeeper "github.com/classic-terra/core/v3/x/dyncomm/keeper" diff --git a/custom/gov/keeper/keeper.go b/custom/gov/keeper/keeper.go index c6558359..06da7b6c 100644 --- a/custom/gov/keeper/keeper.go +++ b/custom/gov/keeper/keeper.go @@ -94,3 +94,14 @@ func (keeper Keeper) assertMetadataLength(metadata string) error { } return nil } + +// SetHooks sets the hooks for governance +func (keeper *Keeper) SetHooks(gh types.GovHooks) *Keeper { + if keeper.hooks != nil { + panic("cannot set governance hooks twice") + } + + keeper.hooks = gh + + return keeper +} From 562e6101037a665964ae29f5b5e80e0a50ddf568 Mon Sep 17 00:00:00 2001 From: duonghb53 Date: Fri, 4 Oct 2024 21:32:01 +0700 Subject: [PATCH 18/60] move gov types to v2lunc1 --- custom/gov/client/cli/query.go | 4 +- custom/gov/keeper/msg_server.go | 10 +- custom/gov/keeper/params.go | 2 +- custom/gov/types/{ => v2lunc1}/gov.pb.go | 74 ++++++------- custom/gov/types/{ => v2lunc1}/query.pb.go | 102 ++++++++---------- custom/gov/types/{ => v2lunc1}/query.pb.gw.go | 4 +- custom/gov/types/{ => v2lunc1}/tx.pb.go | 24 ++--- proto/terra/gov/v2lunc1/gov.proto | 2 +- proto/terra/gov/v2lunc1/query.proto | 4 +- proto/terra/gov/v2lunc1/tx.proto | 2 +- 10 files changed, 109 insertions(+), 119 deletions(-) rename custom/gov/types/{ => v2lunc1}/gov.pb.go (85%) rename custom/gov/types/{ => v2lunc1}/query.pb.go (79%) rename custom/gov/types/{ => v2lunc1}/query.pb.gw.go (99%) rename custom/gov/types/{ => v2lunc1}/tx.pb.go (97%) diff --git a/custom/gov/client/cli/query.go b/custom/gov/client/cli/query.go index dde924e4..3a09d48d 100644 --- a/custom/gov/client/cli/query.go +++ b/custom/gov/client/cli/query.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" - v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types" + v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/version" @@ -70,7 +70,7 @@ $ %s query gov proposal 1 return err } - return clientCtx.PrintProto(&res.MinimalDeposits) + return clientCtx.PrintProto(&res.MinimalDeposit) }, } diff --git a/custom/gov/keeper/msg_server.go b/custom/gov/keeper/msg_server.go index a53330b2..cbbbb7b2 100644 --- a/custom/gov/keeper/msg_server.go +++ b/custom/gov/keeper/msg_server.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types" + v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" sdk "github.com/cosmos/cosmos-sdk/types" sdktx "github.com/cosmos/cosmos-sdk/types/tx" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -26,11 +26,11 @@ var _ v2lunc1types.MsgServer = msgServer{} func (k msgServer) SubmitProposal(goCtx context.Context, msg *v2lunc1types.MsgSubmitProposal) (*v2lunc1types.MsgSubmitProposalResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - initialDeposit := msg.GetInitialDeposit() + // initialDeposit := msg.GetInitialDeposit() - if err := k.validateInitialDeposit(ctx, initialDeposit); err != nil { - return nil, err - } + // if err := k.validateInitialDeposit(ctx, initialDeposit); err != nil { + // return nil, err + // } proposalMsgs, err := sdktx.GetMsgs(msg.Messages, "sdk.MsgProposal") if err != nil { diff --git a/custom/gov/keeper/params.go b/custom/gov/keeper/params.go index 4f9d6787..06d633fe 100644 --- a/custom/gov/keeper/params.go +++ b/custom/gov/keeper/params.go @@ -2,7 +2,7 @@ package keeper import ( "github.com/CosmWasm/wasmd/x/wasm/types" - v2luncv1types "github.com/classic-terra/core/v3/custom/gov/types" + v2luncv1types "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" sdk "github.com/cosmos/cosmos-sdk/types" ) diff --git a/custom/gov/types/gov.pb.go b/custom/gov/types/v2lunc1/gov.pb.go similarity index 85% rename from custom/gov/types/gov.pb.go rename to custom/gov/types/v2lunc1/gov.pb.go index 3efa87d3..8907c82e 100644 --- a/custom/gov/types/gov.pb.go +++ b/custom/gov/types/v2lunc1/gov.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: terra/gov/v2lunc1/gov.proto -package types +package v2lunc1 import ( fmt "fmt" @@ -180,42 +180,42 @@ func init() { func init() { proto.RegisterFile("terra/gov/v2lunc1/gov.proto", fileDescriptor_ec6805a6cb6c4923) } var fileDescriptor_ec6805a6cb6c4923 = []byte{ - // 554 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4d, 0x4f, 0xd4, 0x40, - 0x18, 0xde, 0x0a, 0xac, 0x32, 0xc0, 0xba, 0x34, 0xc6, 0x74, 0x31, 0x96, 0x8d, 0x31, 0x66, 0x63, - 0xa4, 0x93, 0x85, 0xf8, 0x03, 0x5c, 0xd7, 0x03, 0x31, 0x1a, 0xdc, 0x28, 0x07, 0x2f, 0xcd, 0xb4, - 0x1d, 0xcb, 0x24, 0x3b, 0xf3, 0xd6, 0x99, 0x69, 0x03, 0xff, 0xc2, 0xa3, 0x37, 0xaf, 0x1e, 0x3d, - 0xf8, 0x23, 0x38, 0x12, 0x4f, 0x9e, 0xd4, 0xc0, 0xc1, 0xbf, 0x61, 0xe6, 0xa3, 0x60, 0x08, 0x07, - 0x2e, 0xcd, 0xf4, 0x7d, 0x9f, 0x8f, 0xf7, 0x99, 0x0f, 0x74, 0x4f, 0x53, 0x29, 0x09, 0x2e, 0xa1, - 0xc1, 0xcd, 0xf6, 0xbc, 0x16, 0xf9, 0xd8, 0xac, 0x93, 0x4a, 0x82, 0x86, 0x70, 0xdd, 0x36, 0x13, - 0x53, 0xf0, 0xcd, 0x8d, 0x38, 0x07, 0xc5, 0x41, 0xe1, 0x8c, 0x28, 0x8a, 0x9b, 0x71, 0x46, 0x35, - 0x19, 0xe3, 0x1c, 0x98, 0x70, 0x94, 0x8d, 0x3b, 0x25, 0x94, 0x60, 0x97, 0xd8, 0xac, 0x7c, 0x75, - 0xb3, 0x04, 0x28, 0xe7, 0x14, 0xdb, 0xbf, 0xac, 0xfe, 0x80, 0x35, 0xe3, 0x54, 0x69, 0xc2, 0x2b, - 0x0f, 0x18, 0x5c, 0x06, 0x10, 0x71, 0xe4, 0x5b, 0xf1, 0xe5, 0x56, 0x51, 0x4b, 0xa2, 0x19, 0xb4, - 0x8e, 0x03, 0x37, 0x51, 0xea, 0x4c, 0xdd, 0x8f, 0x6f, 0xad, 0x13, 0xce, 0x04, 0x60, 0xfb, 0x75, - 0xa5, 0x07, 0x5f, 0x96, 0x50, 0x77, 0x8f, 0x48, 0xc2, 0x55, 0xf8, 0x02, 0xad, 0x70, 0x26, 0xd2, - 0x82, 0x56, 0xa0, 0x98, 0x8e, 0x82, 0xe1, 0xc2, 0x68, 0x65, 0x7b, 0x90, 0x78, 0x05, 0x13, 0x30, - 0xf1, 0x01, 0x93, 0xe7, 0xc0, 0xc4, 0x64, 0xf9, 0xf8, 0xd7, 0x66, 0xe7, 0xeb, 0xdf, 0x6f, 0x8f, - 0x83, 0x19, 0xe2, 0x4c, 0x4c, 0x1d, 0x2f, 0x7c, 0x85, 0x42, 0x4e, 0x0e, 0x5b, 0x99, 0xb4, 0xa2, - 0x92, 0x41, 0x11, 0xdd, 0x18, 0x06, 0x56, 0xcd, 0x0d, 0x9f, 0xb4, 0xc3, 0x27, 0x53, 0x3f, 0xfc, - 0x64, 0xf1, 0xf3, 0xef, 0xcd,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, 0x75, 0xad, 0x8a, 0xf3, 0xbb, - 0xd4, 0xf7, 0x67, 0x76, 0x9d, 0xbb, 0xd4, 0xe3, 0x4c, 0xbc, 0xab, 0x55, 0xe1, 0xcd, 0x27, 0x2f, - 0x8f, 0x4f, 0xe3, 0xe0, 0xe4, 0x34, 0x0e, 0xfe, 0x9c, 0xc6, 0xc1, 0xa7, 0xb3, 0xb8, 0x73, 0x72, - 0x16, 0x77, 0x7e, 0x9e, 0xc5, 0x9d, 0xf7, 0xe3, 0x92, 0xe9, 0x83, 0x3a, 0x4b, 0x72, 0xe0, 0x38, - 0x9f, 0x13, 0xa5, 0x58, 0xbe, 0xe5, 0x9e, 0x6f, 0x0e, 0x92, 0xe2, 0x66, 0x07, 0xe7, 0xb5, 0xd2, - 0xc0, 0xed, 0x6b, 0xd6, 0x47, 0x15, 0x55, 0x59, 0xd7, 0x5e, 0x97, 0x9d, 0x7f, 0x01, 0x00, 0x00, - 0xff, 0xff, 0x42, 0xc6, 0x06, 0xf8, 0xe7, 0x03, 0x00, 0x00, + // 558 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xbb, 0x6e, 0xd4, 0x4c, + 0x14, 0x5e, 0xff, 0x49, 0xf6, 0x27, 0x93, 0x64, 0xd9, 0x58, 0x08, 0x79, 0x83, 0x70, 0x56, 0x08, + 0xa1, 0x15, 0x22, 0x1e, 0x25, 0x11, 0x05, 0x25, 0xcb, 0x52, 0xa4, 0x00, 0x85, 0x05, 0x52, 0xd0, + 0x58, 0x63, 0x7b, 0x70, 0x46, 0xda, 0x99, 0x63, 0x66, 0xc6, 0x56, 0xf2, 0x16, 0x94, 0x74, 0xb4, + 0x94, 0x14, 0x3c, 0x44, 0xca, 0x88, 0x8a, 0x0a, 0x50, 0x52, 0xf0, 0x1a, 0x68, 0x2e, 0x4e, 0x50, + 0xb4, 0x45, 0x1a, 0x6b, 0x7c, 0xce, 0x77, 0x39, 0xdf, 0x5c, 0xd0, 0x1d, 0x4d, 0xa5, 0x24, 0xb8, + 0x84, 0x06, 0x37, 0x3b, 0xb3, 0x5a, 0xe4, 0xdb, 0x66, 0x9d, 0x54, 0x12, 0x34, 0x84, 0xeb, 0xb6, + 0x99, 0x98, 0x82, 0x6f, 0x6e, 0xc4, 0x39, 0x28, 0x0e, 0x0a, 0x67, 0x44, 0x51, 0xdc, 0x6c, 0x67, + 0x54, 0x93, 0x6d, 0x9c, 0x03, 0x13, 0x8e, 0xb2, 0x71, 0xab, 0x84, 0x12, 0xec, 0x12, 0x9b, 0x95, + 0xaf, 0x6e, 0x96, 0x00, 0xe5, 0x8c, 0x62, 0xfb, 0x97, 0xd5, 0xef, 0xb1, 0x66, 0x9c, 0x2a, 0x4d, + 0x78, 0xe5, 0x01, 0x83, 0xab, 0x00, 0x22, 0x8e, 0x7d, 0x2b, 0xbe, 0xda, 0x2a, 0x6a, 0x49, 0x34, + 0x83, 0xd6, 0x71, 0xe0, 0x26, 0x4a, 0x9d, 0xa9, 0xfb, 0xf1, 0xad, 0x75, 0xc2, 0x99, 0x00, 0x6c, + 0xbf, 0xae, 0x74, 0xef, 0xf3, 0x12, 0xea, 0xee, 0x13, 0x49, 0xb8, 0x0a, 0x9f, 0xa3, 0x15, 0xce, + 0x44, 0x5a, 0xd0, 0x0a, 0x14, 0xd3, 0x51, 0x30, 0x5c, 0x18, 0xad, 0xec, 0x0c, 0x12, 0xaf, 0x60, + 0x02, 0x26, 0x3e, 0x60, 0xf2, 0x0c, 0x98, 0x18, 0x2f, 0x9f, 0xfc, 0xdc, 0xec, 0x7c, 0xf9, 0xf3, + 0xf5, 0x61, 0x30, 0x45, 0x9c, 0x89, 0x89, 0xe3, 0x85, 0x2f, 0x50, 0xc8, 0xc9, 0x51, 0x2b, 0x93, + 0x56, 0x54, 0x32, 0x28, 0xa2, 0xff, 0x86, 0x81, 0x55, 0x73, 0xc3, 0x27, 0xed, 0xf0, 0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, 0x80, 0x6a, 0x08, 0x5f, 0xa2, 0xbe, 0x49, 0x57, 0xd7, 0xaa, 0xb8, + 0xb8, 0x4b, 0x7d, 0x7f, 0x66, 0xd7, 0xb9, 0x4b, 0x3d, 0xce, 0xc4, 0xdb, 0x5a, 0x15, 0xde, 0x7c, + 0xfc, 0xfa, 0xe4, 0x2c, 0x0e, 0x4e, 0xcf, 0xe2, 0xe0, 0xf7, 0x59, 0x1c, 0x7c, 0x3c, 0x8f, 0x3b, + 0xa7, 0xe7, 0x71, 0xe7, 0xc7, 0x79, 0xdc, 0x79, 0xf7, 0xa4, 0x64, 0xfa, 0xb0, 0xce, 0x92, 0x1c, + 0x38, 0xce, 0x67, 0x44, 0x29, 0x96, 0x6f, 0xb9, 0xe7, 0x9b, 0x83, 0xa4, 0xb8, 0xd9, 0xc5, 0x79, + 0xad, 0x34, 0x70, 0xfb, 0x9a, 0xf5, 0x71, 0x45, 0x55, 0xfb, 0xa6, 0xb3, 0xae, 0xbd, 0x36, 0xbb, + 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xfd, 0xbd, 0x52, 0x32, 0xef, 0x03, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { diff --git a/custom/gov/types/query.pb.go b/custom/gov/types/v2lunc1/query.pb.go similarity index 79% rename from custom/gov/types/query.pb.go rename to custom/gov/types/v2lunc1/query.pb.go index c1a456b9..aba94ff7 100644 --- a/custom/gov/types/query.pb.go +++ b/custom/gov/types/v2lunc1/query.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: terra/gov/v2lunc1/query.proto -package types +package v2lunc1 import ( context "context" @@ -83,7 +83,7 @@ func (m *QueryProposalRequest) GetProposalId() uint64 { // QueryVoteRequest is the request type for the Query/Vote RPC method. type QueryMinimalDepositProposalResponse struct { // proposal_id defines the unique id of the proposal. - MinimalDeposits []types.Coin `protobuf:"bytes,1,rep,name=minimal_deposits,json=minimalDeposits,proto3" json:"minimal_deposits"` + MinimalDeposit types.Coin `protobuf:"bytes,1,opt,name=minimal_deposit,json=minimalDeposit,proto3" json:"minimal_deposit"` } func (m *QueryMinimalDepositProposalResponse) Reset() { *m = QueryMinimalDepositProposalResponse{} } @@ -119,11 +119,11 @@ func (m *QueryMinimalDepositProposalResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryMinimalDepositProposalResponse proto.InternalMessageInfo -func (m *QueryMinimalDepositProposalResponse) GetMinimalDeposits() []types.Coin { +func (m *QueryMinimalDepositProposalResponse) GetMinimalDeposit() types.Coin { if m != nil { - return m.MinimalDeposits + return m.MinimalDeposit } - return nil + return types.Coin{} } func init() { @@ -134,36 +134,35 @@ func init() { func init() { proto.RegisterFile("terra/gov/v2lunc1/query.proto", fileDescriptor_075d72aa1a1cda58) } var fileDescriptor_075d72aa1a1cda58 = []byte{ - // 449 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0xcd, 0x6a, 0x14, 0x41, - 0x10, 0xde, 0xf1, 0x0f, 0x9c, 0x1c, 0x34, 0x43, 0x0e, 0xd9, 0x45, 0x67, 0xc3, 0x7a, 0x30, 0x08, - 0xe9, 0x62, 0x36, 0x60, 0xf0, 0x24, 0x6c, 0xbc, 0x88, 0xff, 0x0b, 0xb9, 0x78, 0x59, 0x7a, 0x66, - 0xda, 0xb1, 0x61, 0xba, 0x6b, 0x32, 0xd5, 0x33, 0xb0, 0x88, 0x17, 0x9f, 0x40, 0xf0, 0x25, 0x3c, - 0xfa, 0x02, 0x9e, 0xcd, 0x31, 0xe0, 0xc5, 0x93, 0xc8, 0xae, 0xe0, 0x6b, 0xc8, 0x76, 0xf7, 0xa0, - 0xae, 0x9a, 0x4b, 0xd3, 0x5d, 0xdf, 0x57, 0x55, 0x5f, 0x7d, 0x5d, 0xe1, 0x75, 0x23, 0xea, 0x9a, - 0x43, 0x81, 0x2d, 0xb4, 0xe3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x65, 0x2c, 0xf3, 0xc6, - 0xb2, 0x43, 0x94, 0x7a, 0x72, 0xf9, 0xe4, 0xeb, 0xb0, 0xf7, 0xfe, 0xc7, 0x87, 0x5b, 0xc1, 0xf4, - 0x8a, 0xfa, 0xa3, 0x3e, 0x8d, 0x3f, 0x05, 0xe1, 0x45, 0xdb, 0x38, 0xfa, 0x18, 0x84, 0xfd, 0xae, - 0x9f, 0x57, 0xf1, 0xf0, 0xe8, 0xf1, 0xe1, 0x64, 0x7e, 0xd4, 0x50, 0x1e, 0xdd, 0x64, 0x7f, 0x7d, - 0x25, 0xfb, 0xd7, 0xa4, 0x83, 0xdb, 0xff, 0x23, 0x9e, 0x3d, 0xd9, 0xe8, 0xee, 0x9b, 0xcf, 0xdf, - 0xdf, 0x9d, 0xbb, 0x13, 0x1d, 0x78, 0x8f, 0xdd, 0x4e, 0x25, 0xd0, 0x79, 0x44, 0xe0, 0xa5, 0xef, - 0x75, 0x83, 0xc3, 0xab, 0xdf, 0x2c, 0x7d, 0x3d, 0x79, 0x70, 0xb2, 0x88, 0x83, 0xd3, 0x45, 0x1c, - 0x7c, 0x5b, 0xc4, 0xc1, 0xdb, 0x65, 0xdc, 0x3b, 0x5d, 0xc6, 0xbd, 0x2f, 0xcb, 0xb8, 0xf7, 0x3c, - 0x29, 0xa4, 0x79, 0xd9, 0xa4, 0x2c, 0x43, 0x05, 0x59, 0xc9, 0x89, 0x64, 0xb6, 0xe7, 0xf6, 0x36, - 0xc3, 0x5a, 0x40, 0xbb, 0x0f, 0x59, 0x43, 0x06, 0x95, 0x6d, 0x69, 0xe6, 0x95, 0xa0, 0xf4, 0x92, - 0xfd, 0xce, 0xfd, 0x9f, 0x01, 0x00, 0x00, 0xff, 0xff, 0xab, 0xb5, 0x49, 0x20, 0xe0, 0x02, 0x00, - 0x00, + // 447 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0xcd, 0x8a, 0x13, 0x41, + 0x10, 0xce, 0x88, 0x0a, 0xce, 0x82, 0xb2, 0xc3, 0x1e, 0x4c, 0xd0, 0x89, 0xc4, 0x83, 0x22, 0x6c, + 0x17, 0xc9, 0x82, 0xcb, 0x9e, 0x84, 0xac, 0x17, 0xc1, 0x15, 0x8d, 0xec, 0xc5, 0x4b, 0xe8, 0x99, + 0x69, 0xc7, 0x86, 0xe9, 0xae, 0xd9, 0xa9, 0xee, 0x81, 0x20, 0x5e, 0x7c, 0x02, 0xc1, 0x97, 0xf0, + 0xe8, 0x0b, 0x78, 0x76, 0x8f, 0x0b, 0x5e, 0x3c, 0x89, 0x24, 0x82, 0xaf, 0x21, 0xe9, 0xee, 0x41, + 0x8d, 0x3f, 0x97, 0xa6, 0xbb, 0xbe, 0xaf, 0xaa, 0xbe, 0xfa, 0xba, 0xe2, 0xeb, 0x46, 0x34, 0x0d, + 0x87, 0x12, 0x5b, 0x68, 0x27, 0x95, 0xd5, 0xf9, 0x18, 0x4e, 0xac, 0x68, 0x16, 0xac, 0x6e, 0xd0, + 0x60, 0xb2, 0xed, 0x60, 0x56, 0x62, 0xcb, 0x02, 0x3c, 0x48, 0x73, 0x24, 0x85, 0x04, 0x19, 0x27, + 0x01, 0xed, 0x38, 0x13, 0x86, 0x8f, 0x21, 0x47, 0xa9, 0x7d, 0xca, 0x60, 0xa7, 0xc4, 0x12, 0xdd, + 0x15, 0xd6, 0xb7, 0x10, 0xbd, 0x56, 0x22, 0x96, 0x95, 0x00, 0x5e, 0x4b, 0xe0, 0x5a, 0xa3, 0xe1, + 0x46, 0xa2, 0xa6, 0x80, 0x0e, 0x03, 0xea, 0x5e, 0x99, 0x7d, 0x0e, 0x46, 0x2a, 0x41, 0x86, 0xab, + 0x3a, 0x10, 0xfa, 0x9b, 0x04, 0xae, 0x83, 0xc4, 0x41, 0xba, 0x09, 0x15, 0xb6, 0x71, 0xc5, 0xbb, + 0x54, 0xaf, 0x77, 0xee, 0x25, 0x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xcb, 0x34, 0xfa, 0xba, 0x4c, 0xa3, + 0x37, 0xab, 0xb4, 0x77, 0xb6, 0x4a, 0x7b, 0x9f, 0x57, 0x69, 0xef, 0xd9, 0x41, 0x29, 0xcd, 0x0b, + 0x9b, 0xb1, 0x1c, 0x15, 0xe4, 0x15, 0x27, 0x92, 0xf9, 0xae, 0xdf, 0xda, 0x1c, 0x1b, 0x01, 0xed, + 0x1e, 0xe4, 0x96, 0x0c, 0x2a, 0xd7, 0xd2, 0x2c, 0x6a, 0x41, 0xdd, 0x2a, 0x67, 0x17, 0xdd, 0xa7, + 0xee, 0xfd, 0x08, 0x00, 0x00, 0xff, 0xff, 0x87, 0x87, 0x74, 0x01, 0xe6, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -296,20 +295,16 @@ func (m *QueryMinimalDepositProposalResponse) MarshalToSizedBuffer(dAtA []byte) _ = i var l int _ = l - if len(m.MinimalDeposits) > 0 { - for iNdEx := len(m.MinimalDeposits) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.MinimalDeposits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + { + size, err := m.MinimalDeposit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -342,12 +337,8 @@ func (m *QueryMinimalDepositProposalResponse) Size() (n int) { } var l int _ = l - if len(m.MinimalDeposits) > 0 { - for _, e := range m.MinimalDeposits { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } + l = m.MinimalDeposit.Size() + n += 1 + l + sovQuery(uint64(l)) return n } @@ -457,7 +448,7 @@ func (m *QueryMinimalDepositProposalResponse) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinimalDeposits", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MinimalDeposit", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -484,8 +475,7 @@ func (m *QueryMinimalDepositProposalResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.MinimalDeposits = append(m.MinimalDeposits, types.Coin{}) - if err := m.MinimalDeposits[len(m.MinimalDeposits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.MinimalDeposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/custom/gov/types/query.pb.gw.go b/custom/gov/types/v2lunc1/query.pb.gw.go similarity index 99% rename from custom/gov/types/query.pb.gw.go rename to custom/gov/types/v2lunc1/query.pb.gw.go index f68f755b..a84ec909 100644 --- a/custom/gov/types/query.pb.gw.go +++ b/custom/gov/types/v2lunc1/query.pb.gw.go @@ -2,11 +2,11 @@ // source: terra/gov/v2lunc1/query.proto /* -Package types is a reverse proxy. +Package v2lunc1 is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package types +package v2lunc1 import ( "context" diff --git a/custom/gov/types/tx.pb.go b/custom/gov/types/v2lunc1/tx.pb.go similarity index 97% rename from custom/gov/types/tx.pb.go rename to custom/gov/types/v2lunc1/tx.pb.go index dbf5c2f2..fa945b69 100644 --- a/custom/gov/types/tx.pb.go +++ b/custom/gov/types/v2lunc1/tx.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. // source: terra/gov/v2lunc1/tx.proto -package types +package v2lunc1 import ( context "context" @@ -285,10 +285,10 @@ func init() { func init() { proto.RegisterFile("terra/gov/v2lunc1/tx.proto", fileDescriptor_9d64e87259bdff9f) } var fileDescriptor_9d64e87259bdff9f = []byte{ - // 611 bytes of a gzipped FileDescriptorProto + // 614 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcf, 0x6b, 0x14, 0x31, 0x14, 0xc7, 0x77, 0xba, 0xfd, 0x99, 0x42, 0xa5, 0x61, 0xc1, 0xec, 0x80, 0xb3, 0x65, 0x51, 0x28, - 0xd5, 0x26, 0x6e, 0xab, 0x1e, 0x4a, 0x2f, 0x5d, 0xbd, 0x88, 0x2c, 0xca, 0xf4, 0xe6, 0xa5, 0x64, + 0xd5, 0x26, 0x6e, 0xab, 0x82, 0xa5, 0x97, 0xae, 0x5e, 0x3c, 0x2c, 0xca, 0xf4, 0xe6, 0xa5, 0x64, 0x66, 0x62, 0x0c, 0x4e, 0x26, 0xc3, 0x24, 0x33, 0xb8, 0x37, 0xf1, 0xe8, 0xc9, 0x3f, 0xc3, 0x63, 0x0f, 0xfe, 0x07, 0x5e, 0xea, 0xad, 0x78, 0xf2, 0x54, 0xa4, 0x05, 0x0b, 0xfe, 0x15, 0x32, 0x33, 0x99, 0x6d, 0xe9, 0x16, 0x7f, 0x5c, 0x76, 0xf3, 0xde, 0xf7, 0xbd, 0x97, 0xef, 0x7e, 0xb2, 0x09, @@ -303,8 +303,8 @@ var fileDescriptor_9d64e87259bdff9f = []byte{ 0x5e, 0x64, 0x2a, 0x55, 0x9a, 0xc6, 0xf0, 0x3e, 0x58, 0x94, 0x4c, 0x6b, 0xca, 0x99, 0x46, 0xce, 0x5a, 0x7b, 0x7d, 0x79, 0xab, 0x83, 0x6b, 0x3f, 0xb8, 0xf1, 0x83, 0xf7, 0x92, 0xb1, 0x3f, 0xa9, 0x82, 0x23, 0x70, 0x43, 0x24, 0xc2, 0x08, 0x1a, 0x1f, 0x44, 0x2c, 0x55, 0x5a, 0x18, 0x34, 0x53, - 0x35, 0x76, 0xb1, 0xf5, 0x56, 0xa2, 0xc3, 0x16, 0x1d, 0x7e, 0xac, 0x44, 0x32, 0x5c, 0x3a, 0x3a, - 0xe9, 0xb5, 0x3e, 0x9d, 0x1f, 0x6e, 0x38, 0xfe, 0x8a, 0x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, 0x1c, 0x9f, 0x7a, 0xce, + 0x8f, 0x53, 0xcf, 0xf9, 0x78, 0xe6, 0xb5, 0x8e, 0xcf, 0xbc, 0xd6, 0xf7, 0x33, 0xaf, 0xf5, 0xf2, + 0x31, 0x17, 0xe6, 0x75, 0x1e, 0xe0, 0x50, 0x49, 0x12, 0xc6, 0x54, 0x6b, 0x11, 0x6e, 0xd6, 0x6f, + 0x50, 0xa8, 0x32, 0x46, 0x8a, 0x6d, 0x12, 0xe6, 0xda, 0x28, 0x59, 0x3d, 0x49, 0x66, 0x9c, 0x32, + 0xdd, 0x3c, 0x4c, 0xc1, 0x7c, 0x75, 0xe7, 0xb6, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x6d, 0xe8, + 0x36, 0x8b, 0xb4, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/proto/terra/gov/v2lunc1/gov.proto b/proto/terra/gov/v2lunc1/gov.proto index 9d76dcaf..293d3072 100644 --- a/proto/terra/gov/v2lunc1/gov.proto +++ b/proto/terra/gov/v2lunc1/gov.proto @@ -9,7 +9,7 @@ import "google/protobuf/duration.proto"; import "cosmos_proto/cosmos.proto"; import "amino/amino.proto"; -option go_package = "github.com/classic-terra/core/v3/custom/gov/types"; +option go_package = "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1"; // Params defines the parameters for the x/gov module. // diff --git a/proto/terra/gov/v2lunc1/query.proto b/proto/terra/gov/v2lunc1/query.proto index a1b07974..432139e5 100644 --- a/proto/terra/gov/v2lunc1/query.proto +++ b/proto/terra/gov/v2lunc1/query.proto @@ -10,7 +10,7 @@ import "google/protobuf/duration.proto"; import "cosmos_proto/cosmos.proto"; import "amino/amino.proto"; -option go_package = "github.com/classic-terra/core/v3/custom/gov/types"; +option go_package = "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1"; // Query defines the gRPC querier service for gov module service Query { @@ -29,5 +29,5 @@ message QueryProposalRequest { // QueryVoteRequest is the request type for the Query/Vote RPC method. message QueryMinimalDepositProposalResponse { // proposal_id defines the unique id of the proposal. - repeated cosmos.base.v1beta1.Coin minimal_deposits = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + cosmos.base.v1beta1.Coin minimal_deposit = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } \ No newline at end of file diff --git a/proto/terra/gov/v2lunc1/tx.proto b/proto/terra/gov/v2lunc1/tx.proto index 9745d796..bed1a16d 100644 --- a/proto/terra/gov/v2lunc1/tx.proto +++ b/proto/terra/gov/v2lunc1/tx.proto @@ -10,7 +10,7 @@ import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; import "amino/amino.proto"; -option go_package = "github.com/classic-terra/core/v3/custom/gov/types"; +option go_package = "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1"; // Msg defines the gov Msg service. service Msg { From 435086ab06cd3882f5efe47b9c3f1d6aa1e643d1 Mon Sep 17 00:00:00 2001 From: tusoict Date: Mon, 7 Oct 2024 18:18:05 +0700 Subject: [PATCH 19/60] Updated a logic in genesis module --- custom/auth/ante/min_initial_deposit_test.go | 3 +- custom/gov/module.go | 5 +- custom/gov/types/v2lunc1/genesis.go | 21 + custom/gov/types/v2lunc1/genesis.pb.go | 755 ++++ custom/gov/types/v2lunc1/gov.pb.go | 3574 ++++++++++++++++-- custom/gov/types/v2lunc1/params.go | 140 + proto/terra/gov/v2lunc1/genesis.proto | 32 + proto/terra/gov/v2lunc1/gov.proto | 155 +- 8 files changed, 4350 insertions(+), 335 deletions(-) create mode 100644 custom/gov/types/v2lunc1/genesis.go create mode 100644 custom/gov/types/v2lunc1/genesis.pb.go create mode 100644 custom/gov/types/v2lunc1/params.go create mode 100644 proto/terra/gov/v2lunc1/genesis.proto diff --git a/custom/auth/ante/min_initial_deposit_test.go b/custom/auth/ante/min_initial_deposit_test.go index 73f13b58..db4f54b2 100644 --- a/custom/auth/ante/min_initial_deposit_test.go +++ b/custom/auth/ante/min_initial_deposit_test.go @@ -19,6 +19,7 @@ import ( // cosmosante "github.com/cosmos/cosmos-sdk/x/auth/ante" // "github.com/cosmos/cosmos-sdk/x/auth/types" // minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + govv2lunc1 "github.com/classic-terra/core/v3/custom/gov/keeper" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) @@ -31,7 +32,7 @@ func (suite *AnteTestSuite) TestMinInitialDepositRatioDefault() { antehandler := sdk.ChainAnteDecorators(midd) // set required deposit to uluna - suite.app.GovKeeper.SetParams(suite.ctx, govv1.DefaultParams()) + suite.app.GovKeeper.SetParams(suite.ctx, govv2lunc1.DefaultParams()) govparams := suite.app.GovKeeper.GetParams(suite.ctx) govparams.MinDeposit = sdk.NewCoins( sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(1_000_000)), diff --git a/custom/gov/module.go b/custom/gov/module.go index 20ddf3d7..e0c3da8a 100644 --- a/custom/gov/module.go +++ b/custom/gov/module.go @@ -7,11 +7,12 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/gov" "github.com/cosmos/cosmos-sdk/x/gov/keeper" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" "github.com/spf13/cobra" + v2lunc1 "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" govclient "github.com/cosmos/cosmos-sdk/x/gov/client" govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" - v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" customcli "github.com/classic-terra/core/v3/custom/gov/client/cli" customtypes "github.com/classic-terra/core/v3/custom/gov/types" @@ -75,7 +76,7 @@ func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { // module. func (am AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { // customize to set default genesis state deposit denom to uluna - defaultGenesisState := v1.DefaultGenesisState() + defaultGenesisState := v2lunc1.DefaultGenesisState() defaultGenesisState.Params.MinDeposit[0].Denom = core.MicroLunaDenom return cdc.MustMarshalJSON(defaultGenesisState) diff --git a/custom/gov/types/v2lunc1/genesis.go b/custom/gov/types/v2lunc1/genesis.go new file mode 100644 index 00000000..c26d3a87 --- /dev/null +++ b/custom/gov/types/v2lunc1/genesis.go @@ -0,0 +1,21 @@ +package v2lunc1 + +import ( + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" +) + +// NewGenesisState creates a new genesis state for the governance module +func NewGenesisState(startingProposalID uint64, params Params) *GenesisState { + return &GenesisState{ + StartingProposalId: startingProposalID, + Params: ¶ms, + } +} + +// DefaultGenesisState defines the default governance genesis state +func DefaultGenesisState() *GenesisState { + return NewGenesisState( + v1.DefaultStartingProposalID, + DefaultParams(), + ) +} diff --git a/custom/gov/types/v2lunc1/genesis.pb.go b/custom/gov/types/v2lunc1/genesis.pb.go new file mode 100644 index 00000000..1c0c9095 --- /dev/null +++ b/custom/gov/types/v2lunc1/genesis.pb.go @@ -0,0 +1,755 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: terra/gov/v2lunc1/genesis.proto + +package v2lunc1 + +import ( + fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// GenesisState defines the gov module's genesis state. +type GenesisState struct { + // starting_proposal_id is the ID of the starting proposal. + StartingProposalId uint64 `protobuf:"varint,1,opt,name=starting_proposal_id,json=startingProposalId,proto3" json:"starting_proposal_id,omitempty"` + // deposits defines all the deposits present at genesis. + Deposits []*Deposit `protobuf:"bytes,2,rep,name=deposits,proto3" json:"deposits,omitempty"` + // votes defines all the votes present at genesis. + Votes []*Vote `protobuf:"bytes,3,rep,name=votes,proto3" json:"votes,omitempty"` + // proposals defines all the proposals present at genesis. + Proposals []*Proposal `protobuf:"bytes,4,rep,name=proposals,proto3" json:"proposals,omitempty"` + // Deprecated: Prefer to use `params` instead. + // deposit_params defines all the paramaters of related to deposit. + DepositParams *DepositParams `protobuf:"bytes,5,opt,name=deposit_params,json=depositParams,proto3" json:"deposit_params,omitempty"` // Deprecated: Do not use. + // Deprecated: Prefer to use `params` instead. + // voting_params defines all the paramaters of related to voting. + VotingParams *VotingParams `protobuf:"bytes,6,opt,name=voting_params,json=votingParams,proto3" json:"voting_params,omitempty"` // Deprecated: Do not use. + // Deprecated: Prefer to use `params` instead. + // tally_params defines all the paramaters of related to tally. + TallyParams *TallyParams `protobuf:"bytes,7,opt,name=tally_params,json=tallyParams,proto3" json:"tally_params,omitempty"` // Deprecated: Do not use. + // params defines all the paramaters of x/gov module. + // + // Since: cosmos-sdk 0.47 + Params *Params `protobuf:"bytes,8,opt,name=params,proto3" json:"params,omitempty"` +} + +func (m *GenesisState) Reset() { *m = GenesisState{} } +func (m *GenesisState) String() string { return proto.CompactTextString(m) } +func (*GenesisState) ProtoMessage() {} +func (*GenesisState) Descriptor() ([]byte, []int) { + return fileDescriptor_a6436cbb1ac17fc7, []int{0} +} +func (m *GenesisState) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisState.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *GenesisState) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisState.Merge(m, src) +} +func (m *GenesisState) XXX_Size() int { + return m.Size() +} +func (m *GenesisState) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisState.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisState proto.InternalMessageInfo + +func (m *GenesisState) GetStartingProposalId() uint64 { + if m != nil { + return m.StartingProposalId + } + return 0 +} + +func (m *GenesisState) GetDeposits() []*Deposit { + if m != nil { + return m.Deposits + } + return nil +} + +func (m *GenesisState) GetVotes() []*Vote { + if m != nil { + return m.Votes + } + return nil +} + +func (m *GenesisState) GetProposals() []*Proposal { + if m != nil { + return m.Proposals + } + return nil +} + +// Deprecated: Do not use. +func (m *GenesisState) GetDepositParams() *DepositParams { + if m != nil { + return m.DepositParams + } + return nil +} + +// Deprecated: Do not use. +func (m *GenesisState) GetVotingParams() *VotingParams { + if m != nil { + return m.VotingParams + } + return nil +} + +// Deprecated: Do not use. +func (m *GenesisState) GetTallyParams() *TallyParams { + if m != nil { + return m.TallyParams + } + return nil +} + +func (m *GenesisState) GetParams() *Params { + if m != nil { + return m.Params + } + return nil +} + +func init() { + proto.RegisterType((*GenesisState)(nil), "terra.gov.v2lunc1.GenesisState") +} + +func init() { proto.RegisterFile("terra/gov/v2lunc1/genesis.proto", fileDescriptor_a6436cbb1ac17fc7) } + +var fileDescriptor_a6436cbb1ac17fc7 = []byte{ + // 372 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xcd, 0x6a, 0xf2, 0x40, + 0x14, 0x86, 0x8d, 0x7f, 0x9f, 0xdf, 0xa8, 0x85, 0x0e, 0x85, 0xa6, 0x0a, 0x31, 0x74, 0xe5, 0xc6, + 0xa4, 0x2a, 0x14, 0xdc, 0x4a, 0x4b, 0x5b, 0xba, 0x91, 0x58, 0xba, 0xe8, 0x46, 0xc6, 0x64, 0x48, + 0x03, 0xd1, 0x13, 0x32, 0xc7, 0x01, 0xef, 0xa2, 0x97, 0xd5, 0xa5, 0xcb, 0x2e, 0x8b, 0x5e, 0x42, + 0x6f, 0xa0, 0x38, 0x49, 0xaa, 0xd0, 0x74, 0x7b, 0xe6, 0x79, 0x9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a, 0xc8, 0xa3, 0x09, 0xbd, 0x25, 0x0d, 0x64, 0x61, 0xb8, 0xce, 0x44, 0xff, 0x94, 0xc8, + 0xc8, 0x11, 0x3d, 0xed, 0xb1, 0x23, 0x4f, 0x1d, 0x0f, 0x03, 0xda, 0x27, 0xd5, 0x54, 0x50, 0x53, + 0x82, 0x8b, 0xbc, 0xad, 0x28, 0xc0, 0x49, 0xc1, 0xf1, 0xf4, 0x7d, 0x6b, 0x68, 0x9b, 0xad, 0xa1, + 0x7d, 0x6e, 0x0d, 0xed, 0x6d, 0x67, 0x14, 0x36, 0x3b, 0xa3, 0xf0, 0xb1, 0x33, 0x0a, 0x2f, 0x23, + 0x3f, 0xc0, 0xd7, 0xd5, 0xdc, 0x72, 0x61, 0x61, 0xbb, 0x21, 0x13, 0x22, 0x70, 0x7b, 0xc9, 0xfd, + 0xb8, 0x10, 0x73, 0x5b, 0x0e, 0x6d, 0x77, 0x25, 0x10, 0x16, 0xea, 0x9c, 0x70, 0x1d, 0x71, 0x91, + 0x1d, 0xd5, 0xbc, 0xaa, 0x2e, 0x6a, 0xf8, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x56, 0x65, 0x1d, 0xfd, + 0xa4, 0x02, 0x00, 0x00, +} + +func (m *GenesisState) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *GenesisState) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Params != nil { + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + if m.TallyParams != nil { + { + size, err := m.TallyParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + if m.VotingParams != nil { + { + size, err := m.VotingParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + if m.DepositParams != nil { + { + size, err := m.DepositParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + if len(m.Proposals) > 0 { + for iNdEx := len(m.Proposals) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Proposals[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Votes) > 0 { + for iNdEx := len(m.Votes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Votes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Deposits) > 0 { + for iNdEx := len(m.Deposits) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Deposits[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.StartingProposalId != 0 { + i = encodeVarintGenesis(dAtA, i, uint64(m.StartingProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.StartingProposalId != 0 { + n += 1 + sovGenesis(uint64(m.StartingProposalId)) + } + if len(m.Deposits) > 0 { + for _, e := range m.Deposits { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.Votes) > 0 { + for _, e := range m.Votes { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.Proposals) > 0 { + for _, e := range m.Proposals { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if m.DepositParams != nil { + l = m.DepositParams.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + if m.VotingParams != nil { + l = m.VotingParams.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + if m.TallyParams != nil { + l = m.TallyParams.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StartingProposalId", wireType) + } + m.StartingProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StartingProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Deposits", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Deposits = append(m.Deposits, &Deposit{}) + if err := m.Deposits[len(m.Deposits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Votes", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Votes = append(m.Votes, &Vote{}) + if err := m.Votes[len(m.Votes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposals", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Proposals = append(m.Proposals, &Proposal{}) + if err := m.Proposals[len(m.Proposals)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DepositParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DepositParams == nil { + m.DepositParams = &DepositParams{} + } + if err := m.DepositParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VotingParams == nil { + m.VotingParams = &VotingParams{} + } + if err := m.VotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TallyParams", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.TallyParams == nil { + m.TallyParams = &TallyParams{} + } + if err := m.TallyParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Params == nil { + m.Params = &Params{} + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipGenesis(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowGenesis + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthGenesis + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupGenesis + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthGenesis + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") +) diff --git a/custom/gov/types/v2lunc1/gov.pb.go b/custom/gov/types/v2lunc1/gov.pb.go index 8907c82e..7d60395b 100644 --- a/custom/gov/types/v2lunc1/gov.pb.go +++ b/custom/gov/types/v2lunc1/gov.pb.go @@ -6,7 +6,7 @@ package v2lunc1 import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/codec/types" + types2 "github.com/cosmos/cosmos-sdk/codec/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" @@ -31,6 +31,95 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// VoteOption enumerates the valid vote options for a given governance proposal. +type VoteOption int32 + +const ( + // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + VoteOption_VOTE_OPTION_UNSPECIFIED VoteOption = 0 + // VOTE_OPTION_YES defines a yes vote option. + VoteOption_VOTE_OPTION_YES VoteOption = 1 + // VOTE_OPTION_ABSTAIN defines an abstain vote option. + VoteOption_VOTE_OPTION_ABSTAIN VoteOption = 2 + // VOTE_OPTION_NO defines a no vote option. + VoteOption_VOTE_OPTION_NO VoteOption = 3 + // VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. + VoteOption_VOTE_OPTION_NO_WITH_VETO VoteOption = 4 +) + +var VoteOption_name = map[int32]string{ + 0: "VOTE_OPTION_UNSPECIFIED", + 1: "VOTE_OPTION_YES", + 2: "VOTE_OPTION_ABSTAIN", + 3: "VOTE_OPTION_NO", + 4: "VOTE_OPTION_NO_WITH_VETO", +} + +var VoteOption_value = map[string]int32{ + "VOTE_OPTION_UNSPECIFIED": 0, + "VOTE_OPTION_YES": 1, + "VOTE_OPTION_ABSTAIN": 2, + "VOTE_OPTION_NO": 3, + "VOTE_OPTION_NO_WITH_VETO": 4, +} + +func (x VoteOption) String() string { + return proto.EnumName(VoteOption_name, int32(x)) +} + +func (VoteOption) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{0} +} + +// ProposalStatus enumerates the valid statuses of a proposal. +type ProposalStatus int32 + +const ( + // PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. + ProposalStatus_PROPOSAL_STATUS_UNSPECIFIED ProposalStatus = 0 + // PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + // period. + ProposalStatus_PROPOSAL_STATUS_DEPOSIT_PERIOD ProposalStatus = 1 + // PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + // period. + ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD ProposalStatus = 2 + // PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + // passed. + ProposalStatus_PROPOSAL_STATUS_PASSED ProposalStatus = 3 + // PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + // been rejected. + ProposalStatus_PROPOSAL_STATUS_REJECTED ProposalStatus = 4 + // PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + // failed. + ProposalStatus_PROPOSAL_STATUS_FAILED ProposalStatus = 5 +) + +var ProposalStatus_name = map[int32]string{ + 0: "PROPOSAL_STATUS_UNSPECIFIED", + 1: "PROPOSAL_STATUS_DEPOSIT_PERIOD", + 2: "PROPOSAL_STATUS_VOTING_PERIOD", + 3: "PROPOSAL_STATUS_PASSED", + 4: "PROPOSAL_STATUS_REJECTED", + 5: "PROPOSAL_STATUS_FAILED", +} + +var ProposalStatus_value = map[string]int32{ + "PROPOSAL_STATUS_UNSPECIFIED": 0, + "PROPOSAL_STATUS_DEPOSIT_PERIOD": 1, + "PROPOSAL_STATUS_VOTING_PERIOD": 2, + "PROPOSAL_STATUS_PASSED": 3, + "PROPOSAL_STATUS_REJECTED": 4, + "PROPOSAL_STATUS_FAILED": 5, +} + +func (x ProposalStatus) String() string { + return proto.EnumName(ProposalStatus_name, int32(x)) +} + +func (ProposalStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{1} +} + // Params defines the parameters for the x/gov module. // // Since: cosmos-sdk 0.47 @@ -173,246 +262,3094 @@ func (m *Params) GetMinUusdDeposit() types.Coin { return types.Coin{} } -func init() { - proto.RegisterType((*Params)(nil), "terra.gov.v2lunc1.Params") +// WeightedVoteOption defines a unit of vote for vote split. +type WeightedVoteOption struct { + // option defines the valid vote options, it must not contain duplicate vote options. + Option VoteOption `protobuf:"varint,1,opt,name=option,proto3,enum=terra.gov.v2lunc1.VoteOption" json:"option,omitempty"` + // weight is the vote weight associated with the vote option. + Weight string `protobuf:"bytes,2,opt,name=weight,proto3" json:"weight,omitempty"` } -func init() { proto.RegisterFile("terra/gov/v2lunc1/gov.proto", fileDescriptor_ec6805a6cb6c4923) } +func (m *WeightedVoteOption) Reset() { *m = WeightedVoteOption{} } +func (m *WeightedVoteOption) String() string { return proto.CompactTextString(m) } +func (*WeightedVoteOption) ProtoMessage() {} +func (*WeightedVoteOption) Descriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{1} +} +func (m *WeightedVoteOption) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WeightedVoteOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WeightedVoteOption.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *WeightedVoteOption) XXX_Merge(src proto.Message) { + xxx_messageInfo_WeightedVoteOption.Merge(m, src) +} +func (m *WeightedVoteOption) XXX_Size() int { + return m.Size() +} +func (m *WeightedVoteOption) XXX_DiscardUnknown() { + xxx_messageInfo_WeightedVoteOption.DiscardUnknown(m) +} -var fileDescriptor_ec6805a6cb6c4923 = []byte{ - // 558 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xbb, 0x6e, 0xd4, 0x4c, - 0x14, 0x5e, 0xff, 0x49, 0xf6, 0x27, 0x93, 0x64, 0xd9, 0x58, 0x08, 0x79, 0x83, 0x70, 0x56, 0x08, - 0xa1, 0x15, 0x22, 0x1e, 0x25, 0x11, 0x05, 0x25, 0xcb, 0x52, 0xa4, 0x00, 0x85, 0x05, 0x52, 0xd0, - 0x58, 0x63, 0x7b, 0x70, 0x46, 0xda, 0x99, 0x63, 0x66, 0xc6, 0x56, 0xf2, 0x16, 0x94, 0x74, 0xb4, - 0x94, 0x14, 0x3c, 0x44, 0xca, 0x88, 0x8a, 0x0a, 0x50, 0x52, 0xf0, 0x1a, 0x68, 0x2e, 0x4e, 0x50, - 0xb4, 0x45, 0x1a, 0x6b, 0x7c, 0xce, 0x77, 0x39, 0xdf, 0x5c, 0xd0, 0x1d, 0x4d, 0xa5, 0x24, 0xb8, - 0x84, 0x06, 0x37, 0x3b, 0xb3, 0x5a, 0xe4, 0xdb, 0x66, 0x9d, 0x54, 0x12, 0x34, 0x84, 0xeb, 0xb6, - 0x99, 0x98, 0x82, 0x6f, 0x6e, 0xc4, 0x39, 0x28, 0x0e, 0x0a, 0x67, 0x44, 0x51, 0xdc, 0x6c, 0x67, - 0x54, 0x93, 0x6d, 0x9c, 0x03, 0x13, 0x8e, 0xb2, 0x71, 0xab, 0x84, 0x12, 0xec, 0x12, 0x9b, 0x95, - 0xaf, 0x6e, 0x96, 0x00, 0xe5, 0x8c, 0x62, 0xfb, 0x97, 0xd5, 0xef, 0xb1, 0x66, 0x9c, 0x2a, 0x4d, - 0x78, 0xe5, 0x01, 0x83, 0xab, 0x00, 0x22, 0x8e, 0x7d, 0x2b, 0xbe, 0xda, 0x2a, 0x6a, 0x49, 0x34, - 0x83, 0xd6, 0x71, 0xe0, 0x26, 0x4a, 0x9d, 0xa9, 0xfb, 0xf1, 0xad, 0x75, 0xc2, 0x99, 0x00, 0x6c, - 0xbf, 0xae, 0x74, 0xef, 0xf3, 0x12, 0xea, 0xee, 0x13, 0x49, 0xb8, 0x0a, 0x9f, 0xa3, 0x15, 0xce, - 0x44, 0x5a, 0xd0, 0x0a, 0x14, 0xd3, 0x51, 0x30, 0x5c, 0x18, 0xad, 0xec, 0x0c, 0x12, 0xaf, 0x60, - 0x02, 0x26, 0x3e, 0x60, 0xf2, 0x0c, 0x98, 0x18, 0x2f, 0x9f, 0xfc, 0xdc, 0xec, 0x7c, 0xf9, 0xf3, - 0xf5, 0x61, 0x30, 0x45, 0x9c, 0x89, 0x89, 0x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 0xc3, - 0x80, 0xf6, 0x3d, 0xa6, 0x3d, 0x09, 0x87, 0x08, 0xef, 0xa3, 0xde, 0xa5, 0x99, 0x89, 0x14, 0xdd, - 0xb4, 0x9c, 0xd5, 0xd6, 0xea, 0x80, 0x6a, 0x08, 0x5f, 0xa2, 0xbe, 0x49, 0x57, 0xd7, 0xaa, 0xb8, - 0xb8, 0x4b, 0x7d, 0x7f, 0x66, 0xd7, 0xb9, 0x4b, 0x3d, 0xce, 0xc4, 0xdb, 0x5a, 0x15, 0xde, 0x7c, - 0xfc, 0xfa, 0xe4, 0x2c, 0x0e, 0x4e, 0xcf, 0xe2, 0xe0, 0xf7, 0x59, 0x1c, 0x7c, 0x3c, 0x8f, 0x3b, - 0xa7, 0xe7, 0x71, 0xe7, 0xc7, 0x79, 0xdc, 0x79, 0xf7, 0xa4, 0x64, 0xfa, 0xb0, 0xce, 0x92, 0x1c, - 0x38, 0xce, 0x67, 0x44, 0x29, 0x96, 0x6f, 0xb9, 0xe7, 0x9b, 0x83, 0xa4, 0xb8, 0xd9, 0xc5, 0x79, - 0xad, 0x34, 0x70, 0xfb, 0x9a, 0xf5, 0x71, 0x45, 0x55, 0xfb, 0xa6, 0xb3, 0xae, 0xbd, 0x36, 0xbb, - 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xfd, 0xbd, 0x52, 0x32, 0xef, 0x03, 0x00, 0x00, +var xxx_messageInfo_WeightedVoteOption proto.InternalMessageInfo + +func (m *WeightedVoteOption) GetOption() VoteOption { + if m != nil { + return m.Option + } + return VoteOption_VOTE_OPTION_UNSPECIFIED } -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *WeightedVoteOption) GetWeight() string { + if m != nil { + return m.Weight } - return dAtA[:n], nil + return "" } -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +// Deposit defines an amount deposited by an account address to an active +// proposal. +type Deposit struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + // depositor defines the deposit addresses from the proposals. + Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` + // amount to be deposited by depositor. + Amount []types.Coin `protobuf:"bytes,3,rep,name=amount,proto3" json:"amount"` } -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.MinUusdDeposit.MarshalToSizedBuffer(dAtA[:i]) +func (m *Deposit) Reset() { *m = Deposit{} } +func (m *Deposit) String() string { return proto.CompactTextString(m) } +func (*Deposit) ProtoMessage() {} +func (*Deposit) Descriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{2} +} +func (m *Deposit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Deposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Deposit.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) if err != nil { - return 0, err + return nil, err } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) + return b[:n], nil } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x82 - if m.BurnVoteVeto { - i-- - if m.BurnVoteVeto { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x78 +} +func (m *Deposit) XXX_Merge(src proto.Message) { + xxx_messageInfo_Deposit.Merge(m, src) +} +func (m *Deposit) XXX_Size() int { + return m.Size() +} +func (m *Deposit) XXX_DiscardUnknown() { + xxx_messageInfo_Deposit.DiscardUnknown(m) +} + +var xxx_messageInfo_Deposit proto.InternalMessageInfo + +func (m *Deposit) GetProposalId() uint64 { + if m != nil { + return m.ProposalId } - if m.BurnProposalDepositPrevote { - i-- - if m.BurnProposalDepositPrevote { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x70 + return 0 +} + +func (m *Deposit) GetDepositor() string { + if m != nil { + return m.Depositor } - if m.BurnVoteQuorum { - i-- - if m.BurnVoteQuorum { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + return "" +} + +func (m *Deposit) GetAmount() []types.Coin { + if m != nil { + return m.Amount + } + return nil +} + +// Proposal defines the core field members of a governance proposal. +type Proposal struct { + // id defines the unique id of the proposal. + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // messages are the arbitrary messages to be executed if the proposal passes. + Messages []*types2.Any `protobuf:"bytes,2,rep,name=messages,proto3" json:"messages,omitempty"` + // status defines the proposal status. + Status ProposalStatus `protobuf:"varint,3,opt,name=status,proto3,enum=terra.gov.v2lunc1.ProposalStatus" json:"status,omitempty"` + // final_tally_result is the final tally result of the proposal. When + // querying a proposal via gRPC, this field is not populated until the + // proposal's voting period has ended. + FinalTallyResult *TallyResult `protobuf:"bytes,4,opt,name=final_tally_result,json=finalTallyResult,proto3" json:"final_tally_result,omitempty"` + // submit_time is the time of proposal submission. + SubmitTime *time.Time `protobuf:"bytes,5,opt,name=submit_time,json=submitTime,proto3,stdtime" json:"submit_time,omitempty"` + // deposit_end_time is the end time for deposition. + DepositEndTime *time.Time `protobuf:"bytes,6,opt,name=deposit_end_time,json=depositEndTime,proto3,stdtime" json:"deposit_end_time,omitempty"` + // total_deposit is the total deposit on the proposal. + TotalDeposit []types.Coin `protobuf:"bytes,7,rep,name=total_deposit,json=totalDeposit,proto3" json:"total_deposit"` + // voting_start_time is the starting time to vote on a proposal. + VotingStartTime *time.Time `protobuf:"bytes,8,opt,name=voting_start_time,json=votingStartTime,proto3,stdtime" json:"voting_start_time,omitempty"` + // voting_end_time is the end time of voting on a proposal. + VotingEndTime *time.Time `protobuf:"bytes,9,opt,name=voting_end_time,json=votingEndTime,proto3,stdtime" json:"voting_end_time,omitempty"` + // metadata is any arbitrary metadata attached to the proposal. + // the recommended format of the metadata is to be found here: + // https://docs.cosmos.network/v0.47/modules/gov#proposal-3 + Metadata string `protobuf:"bytes,10,opt,name=metadata,proto3" json:"metadata,omitempty"` + // title is the title of the proposal + // + // Since: cosmos-sdk 0.47 + Title string `protobuf:"bytes,11,opt,name=title,proto3" json:"title,omitempty"` + // summary is a short summary of the proposal + // + // Since: cosmos-sdk 0.47 + Summary string `protobuf:"bytes,12,opt,name=summary,proto3" json:"summary,omitempty"` + // proposer is the address of the proposal sumbitter + // + // Since: cosmos-sdk 0.47 + Proposer string `protobuf:"bytes,13,opt,name=proposer,proto3" json:"proposer,omitempty"` + // expedited defines if the proposal is expedited + // + // Since: cosmos-sdk 0.50 + Expedited bool `protobuf:"varint,14,opt,name=expedited,proto3" json:"expedited,omitempty"` + // failed_reason defines the reason why the proposal failed + // + // Since: cosmos-sdk 0.50 + FailedReason string `protobuf:"bytes,15,opt,name=failed_reason,json=failedReason,proto3" json:"failed_reason,omitempty"` +} + +func (m *Proposal) Reset() { *m = Proposal{} } +func (m *Proposal) String() string { return proto.CompactTextString(m) } +func (*Proposal) ProtoMessage() {} +func (*Proposal) Descriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{3} +} +func (m *Proposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Proposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Proposal.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } - i-- - dAtA[i] = 0x68 + return b[:n], nil } - if len(m.MinInitialDepositRatio) > 0 { - i -= len(m.MinInitialDepositRatio) - copy(dAtA[i:], m.MinInitialDepositRatio) - i = encodeVarintGov(dAtA, i, uint64(len(m.MinInitialDepositRatio))) - i-- - dAtA[i] = 0x3a +} +func (m *Proposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_Proposal.Merge(m, src) +} +func (m *Proposal) XXX_Size() int { + return m.Size() +} +func (m *Proposal) XXX_DiscardUnknown() { + xxx_messageInfo_Proposal.DiscardUnknown(m) +} + +var xxx_messageInfo_Proposal proto.InternalMessageInfo + +func (m *Proposal) GetId() uint64 { + if m != nil { + return m.Id } - if len(m.VetoThreshold) > 0 { - i -= len(m.VetoThreshold) - copy(dAtA[i:], m.VetoThreshold) - i = encodeVarintGov(dAtA, i, uint64(len(m.VetoThreshold))) - i-- - dAtA[i] = 0x32 + return 0 +} + +func (m *Proposal) GetMessages() []*types2.Any { + if m != nil { + return m.Messages } - if len(m.Threshold) > 0 { - i -= len(m.Threshold) - copy(dAtA[i:], m.Threshold) - i = encodeVarintGov(dAtA, i, uint64(len(m.Threshold))) - i-- - dAtA[i] = 0x2a + return nil +} + +func (m *Proposal) GetStatus() ProposalStatus { + if m != nil { + return m.Status } - if len(m.Quorum) > 0 { - i -= len(m.Quorum) - copy(dAtA[i:], m.Quorum) - i = encodeVarintGov(dAtA, i, uint64(len(m.Quorum))) - i-- - dAtA[i] = 0x22 + return ProposalStatus_PROPOSAL_STATUS_UNSPECIFIED +} + +func (m *Proposal) GetFinalTallyResult() *TallyResult { + if m != nil { + return m.FinalTallyResult } - if m.VotingPeriod != nil { - n2, err2 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) - if err2 != nil { - return 0, err2 - } - i -= n2 - i = encodeVarintGov(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x1a + return nil +} + +func (m *Proposal) GetSubmitTime() *time.Time { + if m != nil { + return m.SubmitTime } - if m.MaxDepositPeriod != nil { - n3, err3 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) - if err3 != nil { - return 0, err3 - } - i -= n3 - i = encodeVarintGov(dAtA, i, uint64(n3)) - i-- - dAtA[i] = 0x12 + return nil +} + +func (m *Proposal) GetDepositEndTime() *time.Time { + if m != nil { + return m.DepositEndTime } - if len(m.MinDeposit) > 0 { - for iNdEx := len(m.MinDeposit) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.MinDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } + return nil +} + +func (m *Proposal) GetTotalDeposit() []types.Coin { + if m != nil { + return m.TotalDeposit } - return len(dAtA) - i, nil + return nil } -func encodeVarintGov(dAtA []byte, offset int, v uint64) int { - offset -= sovGov(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +func (m *Proposal) GetVotingStartTime() *time.Time { + if m != nil { + return m.VotingStartTime } - dAtA[offset] = uint8(v) - return base + return nil } -func (m *Params) Size() (n int) { - if m == nil { - return 0 + +func (m *Proposal) GetVotingEndTime() *time.Time { + if m != nil { + return m.VotingEndTime } - var l int - _ = l - if len(m.MinDeposit) > 0 { - for _, e := range m.MinDeposit { - l = e.Size() - n += 1 + l + sovGov(uint64(l)) - } + return nil +} + +func (m *Proposal) GetMetadata() string { + if m != nil { + return m.Metadata } - if m.MaxDepositPeriod != nil { - l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod) - n += 1 + l + sovGov(uint64(l)) + return "" +} + +func (m *Proposal) GetTitle() string { + if m != nil { + return m.Title } - if m.VotingPeriod != nil { - l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod) - n += 1 + l + sovGov(uint64(l)) + return "" +} + +func (m *Proposal) GetSummary() string { + if m != nil { + return m.Summary } - l = len(m.Quorum) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) + return "" +} + +func (m *Proposal) GetProposer() string { + if m != nil { + return m.Proposer } - l = len(m.Threshold) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) + return "" +} + +func (m *Proposal) GetExpedited() bool { + if m != nil { + return m.Expedited } - l = len(m.VetoThreshold) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) + return false +} + +func (m *Proposal) GetFailedReason() string { + if m != nil { + return m.FailedReason } - l = len(m.MinInitialDepositRatio) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) + return "" +} + +// TallyResult defines a standard tally for a governance proposal. +type TallyResult struct { + // yes_count is the number of yes votes on a proposal. + YesCount string `protobuf:"bytes,1,opt,name=yes_count,json=yesCount,proto3" json:"yes_count,omitempty"` + // abstain_count is the number of abstain votes on a proposal. + AbstainCount string `protobuf:"bytes,2,opt,name=abstain_count,json=abstainCount,proto3" json:"abstain_count,omitempty"` + // no_count is the number of no votes on a proposal. + NoCount string `protobuf:"bytes,3,opt,name=no_count,json=noCount,proto3" json:"no_count,omitempty"` + // no_with_veto_count is the number of no with veto votes on a proposal. + NoWithVetoCount string `protobuf:"bytes,4,opt,name=no_with_veto_count,json=noWithVetoCount,proto3" json:"no_with_veto_count,omitempty"` +} + +func (m *TallyResult) Reset() { *m = TallyResult{} } +func (m *TallyResult) String() string { return proto.CompactTextString(m) } +func (*TallyResult) ProtoMessage() {} +func (*TallyResult) Descriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{4} +} +func (m *TallyResult) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TallyResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TallyResult.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - if m.BurnVoteQuorum { - n += 2 +} +func (m *TallyResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_TallyResult.Merge(m, src) +} +func (m *TallyResult) XXX_Size() int { + return m.Size() +} +func (m *TallyResult) XXX_DiscardUnknown() { + xxx_messageInfo_TallyResult.DiscardUnknown(m) +} + +var xxx_messageInfo_TallyResult proto.InternalMessageInfo + +func (m *TallyResult) GetYesCount() string { + if m != nil { + return m.YesCount } - if m.BurnProposalDepositPrevote { - n += 2 + return "" +} + +func (m *TallyResult) GetAbstainCount() string { + if m != nil { + return m.AbstainCount } - if m.BurnVoteVeto { - n += 2 + return "" +} + +func (m *TallyResult) GetNoCount() string { + if m != nil { + return m.NoCount + } + return "" +} + +func (m *TallyResult) GetNoWithVetoCount() string { + if m != nil { + return m.NoWithVetoCount + } + return "" +} + +// Vote defines a vote on a governance proposal. +// A Vote consists of a proposal ID, the voter, and the vote option. +type Vote struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + // voter is the voter address of the proposal. + Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` + // options is the weighted vote options. + Options []*WeightedVoteOption `protobuf:"bytes,4,rep,name=options,proto3" json:"options,omitempty"` + // metadata is any arbitrary metadata attached to the vote. + // the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/gov#vote-5 + Metadata string `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"` +} + +func (m *Vote) Reset() { *m = Vote{} } +func (m *Vote) String() string { return proto.CompactTextString(m) } +func (*Vote) ProtoMessage() {} +func (*Vote) Descriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{5} +} +func (m *Vote) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Vote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Vote.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Vote) XXX_Merge(src proto.Message) { + xxx_messageInfo_Vote.Merge(m, src) +} +func (m *Vote) XXX_Size() int { + return m.Size() +} +func (m *Vote) XXX_DiscardUnknown() { + xxx_messageInfo_Vote.DiscardUnknown(m) +} + +var xxx_messageInfo_Vote proto.InternalMessageInfo + +func (m *Vote) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *Vote) GetVoter() string { + if m != nil { + return m.Voter + } + return "" +} + +func (m *Vote) GetOptions() []*WeightedVoteOption { + if m != nil { + return m.Options + } + return nil +} + +func (m *Vote) GetMetadata() string { + if m != nil { + return m.Metadata + } + return "" +} + +// DepositParams defines the params for deposits on governance proposals. +// +// Deprecated: Do not use. +type DepositParams struct { + // Minimum deposit for a proposal to enter voting period. + MinDeposit []types.Coin `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3" json:"min_deposit,omitempty"` + // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + // months. + MaxDepositPeriod *time.Duration `protobuf:"bytes,2,opt,name=max_deposit_period,json=maxDepositPeriod,proto3,stdduration" json:"max_deposit_period,omitempty"` +} + +func (m *DepositParams) Reset() { *m = DepositParams{} } +func (m *DepositParams) String() string { return proto.CompactTextString(m) } +func (*DepositParams) ProtoMessage() {} +func (*DepositParams) Descriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{6} +} +func (m *DepositParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DepositParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DepositParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *DepositParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_DepositParams.Merge(m, src) +} +func (m *DepositParams) XXX_Size() int { + return m.Size() +} +func (m *DepositParams) XXX_DiscardUnknown() { + xxx_messageInfo_DepositParams.DiscardUnknown(m) +} + +var xxx_messageInfo_DepositParams proto.InternalMessageInfo + +func (m *DepositParams) GetMinDeposit() []types.Coin { + if m != nil { + return m.MinDeposit + } + return nil +} + +func (m *DepositParams) GetMaxDepositPeriod() *time.Duration { + if m != nil { + return m.MaxDepositPeriod + } + return nil +} + +// VotingParams defines the params for voting on governance proposals. +// +// Deprecated: Do not use. +type VotingParams struct { + // Duration of the voting period. + VotingPeriod *time.Duration `protobuf:"bytes,1,opt,name=voting_period,json=votingPeriod,proto3,stdduration" json:"voting_period,omitempty"` +} + +func (m *VotingParams) Reset() { *m = VotingParams{} } +func (m *VotingParams) String() string { return proto.CompactTextString(m) } +func (*VotingParams) ProtoMessage() {} +func (*VotingParams) Descriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{7} +} +func (m *VotingParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VotingParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VotingParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *VotingParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_VotingParams.Merge(m, src) +} +func (m *VotingParams) XXX_Size() int { + return m.Size() +} +func (m *VotingParams) XXX_DiscardUnknown() { + xxx_messageInfo_VotingParams.DiscardUnknown(m) +} + +var xxx_messageInfo_VotingParams proto.InternalMessageInfo + +func (m *VotingParams) GetVotingPeriod() *time.Duration { + if m != nil { + return m.VotingPeriod + } + return nil +} + +// TallyParams defines the params for tallying votes on governance proposals. +// +// Deprecated: Do not use. +type TallyParams struct { + // Minimum percentage of total stake needed to vote for a result to be + // considered valid. + Quorum string `protobuf:"bytes,1,opt,name=quorum,proto3" json:"quorum,omitempty"` + // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. + Threshold string `protobuf:"bytes,2,opt,name=threshold,proto3" json:"threshold,omitempty"` + // Minimum value of Veto votes to Total votes ratio for proposal to be + // vetoed. Default value: 1/3. + VetoThreshold string `protobuf:"bytes,3,opt,name=veto_threshold,json=vetoThreshold,proto3" json:"veto_threshold,omitempty"` +} + +func (m *TallyParams) Reset() { *m = TallyParams{} } +func (m *TallyParams) String() string { return proto.CompactTextString(m) } +func (*TallyParams) ProtoMessage() {} +func (*TallyParams) Descriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{8} +} +func (m *TallyParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TallyParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TallyParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TallyParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_TallyParams.Merge(m, src) +} +func (m *TallyParams) XXX_Size() int { + return m.Size() +} +func (m *TallyParams) XXX_DiscardUnknown() { + xxx_messageInfo_TallyParams.DiscardUnknown(m) +} + +var xxx_messageInfo_TallyParams proto.InternalMessageInfo + +func (m *TallyParams) GetQuorum() string { + if m != nil { + return m.Quorum + } + return "" +} + +func (m *TallyParams) GetThreshold() string { + if m != nil { + return m.Threshold + } + return "" +} + +func (m *TallyParams) GetVetoThreshold() string { + if m != nil { + return m.VetoThreshold + } + return "" +} + +func init() { + proto.RegisterEnum("terra.gov.v2lunc1.VoteOption", VoteOption_name, VoteOption_value) + proto.RegisterEnum("terra.gov.v2lunc1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) + proto.RegisterType((*Params)(nil), "terra.gov.v2lunc1.Params") + proto.RegisterType((*WeightedVoteOption)(nil), "terra.gov.v2lunc1.WeightedVoteOption") + proto.RegisterType((*Deposit)(nil), "terra.gov.v2lunc1.Deposit") + proto.RegisterType((*Proposal)(nil), "terra.gov.v2lunc1.Proposal") + proto.RegisterType((*TallyResult)(nil), "terra.gov.v2lunc1.TallyResult") + proto.RegisterType((*Vote)(nil), "terra.gov.v2lunc1.Vote") + proto.RegisterType((*DepositParams)(nil), "terra.gov.v2lunc1.DepositParams") + proto.RegisterType((*VotingParams)(nil), "terra.gov.v2lunc1.VotingParams") + proto.RegisterType((*TallyParams)(nil), "terra.gov.v2lunc1.TallyParams") +} + +func init() { proto.RegisterFile("terra/gov/v2lunc1/gov.proto", fileDescriptor_ec6805a6cb6c4923) } + +var fileDescriptor_ec6805a6cb6c4923 = []byte{ + // 1371 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0x4f, 0x6f, 0xdb, 0xc6, + 0x12, 0x37, 0x65, 0x59, 0x96, 0x46, 0xb6, 0xcc, 0x6c, 0xfc, 0x12, 0xda, 0x89, 0x65, 0x47, 0x2f, + 0xef, 0xc1, 0x2f, 0x2f, 0x91, 0x1a, 0xa7, 0x29, 0x90, 0xb6, 0x40, 0x21, 0x5b, 0x4c, 0xc3, 0xc0, + 0xb5, 0x54, 0x4a, 0x71, 0x9a, 0x5e, 0x08, 0x4a, 0xdc, 0xc8, 0x0b, 0x88, 0x5c, 0x95, 0xbb, 0x74, + 0xa2, 0x8f, 0x50, 0xa0, 0x87, 0x1c, 0x7b, 0x6a, 0x7b, 0xec, 0xb1, 0x87, 0x9c, 0xfa, 0x09, 0x72, + 0x2a, 0x82, 0x5c, 0xda, 0x4b, 0xd3, 0x22, 0x39, 0x14, 0xc8, 0xa7, 0x28, 0x76, 0xb9, 0x94, 0x64, + 0x5b, 0x68, 0xe4, 0x5c, 0x04, 0x72, 0xe6, 0xf7, 0x9b, 0x3f, 0xbb, 0x33, 0xa3, 0x21, 0x5c, 0xe0, + 0x38, 0x0c, 0xdd, 0x4a, 0x97, 0x1e, 0x56, 0x0e, 0xb7, 0x7a, 0x51, 0xd0, 0xb9, 0x2e, 0x9e, 0xcb, + 0xfd, 0x90, 0x72, 0x8a, 0xce, 0x48, 0x65, 0x59, 0x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x90, + 0x44, 0x54, 0x83, 0xc5, 0x43, 0xca, 0x49, 0xd0, 0x4d, 0x2c, 0xcd, 0x4e, 0x67, 0x69, 0x21, 0x66, + 0x29, 0x2b, 0xff, 0x85, 0xcc, 0x57, 0x11, 0x0d, 0x23, 0xdf, 0x48, 0x6f, 0x68, 0x9b, 0xb9, 0xed, + 0xc2, 0x8b, 0xa7, 0xd7, 0x40, 0x65, 0x56, 0xc3, 0x1d, 0x5b, 0x69, 0xd1, 0x55, 0xc8, 0xf1, 0x83, + 0x10, 0xb3, 0x03, 0xda, 0xf3, 0x8c, 0xb9, 0x89, 0xd0, 0x11, 0x00, 0xdd, 0x84, 0xc2, 0x21, 0xe6, + 0xd4, 0x19, 0x51, 0x32, 0x13, 0x29, 0x8b, 0x02, 0xd5, 0x1a, 0xd2, 0x2c, 0x58, 0x11, 0x07, 0x4d, + 0x02, 0xc2, 0x89, 0xdb, 0x1b, 0x9e, 0x94, 0x0c, 0xdf, 0x98, 0x9f, 0x68, 0xe1, 0x9c, 0x4f, 0x02, + 0x2b, 0xc6, 0xab, 0xe3, 0xb1, 0x05, 0x1a, 0x6d, 0x82, 0xde, 0x8e, 0xc2, 0xc0, 0x39, 0xa4, 0x1c, + 0x3b, 0x2a, 0xc3, 0xc5, 0x0d, 0x6d, 0x33, 0x6b, 0x17, 0x84, 0x7c, 0x9f, 0x72, 0xfc, 0x79, 0x9c, + 0x59, 0x15, 0xd6, 0x24, 0xb2, 0x1f, 0xd2, 0x3e, 0x65, 0x63, 0x6e, 0xfb, 0x21, 0x16, 0x6c, 0xa3, + 0x20, 0x69, 0xab, 0x02, 0xd4, 0x50, 0x98, 0xe4, 0x26, 0x62, 0x04, 0xba, 0x0c, 0x85, 0x91, 0x33, + 0x91, 0x92, 0xb1, 0x24, 0x39, 0x0b, 0x89, 0xab, 0x7d, 0xcc, 0x29, 0xda, 0x03, 0x5d, 0x64, 0x17, + 0x45, 0xcc, 0x1b, 0xd6, 0x92, 0xae, 0xee, 0x6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7, 0xd7, + 0x1b, 0x38, 0x21, 0x66, 0x51, 0x8f, 0xcb, 0x46, 0xcb, 0x6f, 0x15, 0x27, 0x98, 0x69, 0x09, 0x98, + 0x2d, 0x51, 0xb6, 0x2e, 0x99, 0x63, 0x12, 0x54, 0x85, 0x3c, 0x8b, 0xda, 0x3e, 0xe1, 0x8e, 0x18, + 0x8a, 0xb2, 0x09, 0xf3, 0x5b, 0xab, 0x27, 0xa2, 0x6f, 0x25, 0x13, 0x73, 0x3b, 0xfd, 0x44, 0xf4, + 0x3b, 0xc4, 0x24, 0x21, 0x46, 0x77, 0x41, 0x4f, 0xaa, 0x1b, 0x07, 0x5e, 0x6c, 0x27, 0x33, 0xa5, + 0x9d, 0x82, 0x62, 0x9a, 0x81, 0x27, 0x6d, 0x59, 0xb0, 0xc8, 0x29, 0x1f, 0xf5, 0x8b, 0x31, 0x7f, + 0x8a, 0xbb, 0x5a, 0x90, 0xd4, 0xa4, 0x90, 0x76, 0xe1, 0x8c, 0x1a, 0x65, 0x8c, 0xbb, 0xa1, 0xca, + 0x2f, 0x3b, 0x65, 0x5c, 0x4b, 0x31, 0xb5, 0x29, 0x98, 0x32, 0xb0, 0x3b, 0xa0, 0x44, 0xa3, 0x1c, + 0x73, 0x53, 0xda, 0x52, 0x13, 0x35, 0x49, 0x71, 0x55, 0x14, 0x0b, 0x77, 0x3d, 0x97, 0xbb, 0x06, + 0x88, 0xf2, 0xb5, 0x87, 0xef, 0x68, 0x19, 0xe6, 0x38, 0xe1, 0x3d, 0x6c, 0xe4, 0xa5, 0x22, 0x7e, + 0x41, 0x06, 0xcc, 0xb3, 0xc8, 0xf7, 0xdd, 0x70, 0x60, 0x2c, 0x48, 0x79, 0xf2, 0x8a, 0xde, 0x87, + 0x6c, 0xdc, 0x19, 0x38, 0x94, 0x83, 0xe8, 0x9f, 0x5a, 0x61, 0x88, 0x44, 0x17, 0x21, 0x87, 0x1f, + 0xf7, 0xb1, 0x47, 0x38, 0xf6, 0xd4, 0x20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 0xda, 0x56, 0xbd, 0xa6, 0x6b, 0xe8, 0x12, 0xac, 0x1d, 0xc7, 0xec, 0xd7, 0x5b, + 0xd6, 0xde, 0xa7, 0x09, 0x24, 0x85, 0x56, 0xe1, 0xdc, 0x71, 0x48, 0xa3, 0xda, 0x6c, 0x9a, 0xb5, + 0x38, 0xe8, 0xe3, 0x3a, 0xdb, 0xbc, 0x6b, 0xee, 0xb4, 0xcc, 0x9a, 0x9e, 0x9e, 0xc4, 0xbc, 0x5d, + 0xb5, 0x76, 0xcd, 0x9a, 0x3e, 0xb7, 0xdd, 0x7c, 0xf6, 0xaa, 0xa8, 0x3d, 0x7f, 0x55, 0xd4, 0xfe, + 0x7c, 0x55, 0xd4, 0x9e, 0xbc, 0x2e, 0xce, 0x3c, 0x7f, 0x5d, 0x9c, 0xf9, 0xed, 0x75, 0x71, 0xe6, + 0xcb, 0x5b, 0x5d, 0xc2, 0x0f, 0xa2, 0x76, 0xb9, 0x43, 0xfd, 0x4a, 0xa7, 0xe7, 0x32, 0x46, 0x3a, + 0xd7, 0xe2, 0x8f, 0x96, 0x0e, 0x0d, 0x71, 0xe5, 0xf0, 0x46, 0xa5, 0x13, 0x31, 0x4e, 0x7d, 0xf9, + 0x0d, 0xc3, 0x07, 0x7d, 0xcc, 0x92, 0x2f, 0x99, 0x76, 0x46, 0x56, 0xdf, 0x8d, 0xbf, 0x03, 0x00, + 0x00, 0xff, 0xff, 0xbf, 0x46, 0x38, 0x51, 0xe5, 0x0c, 0x00, 0x00, +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.MinUusdDeposit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + if m.BurnVoteVeto { + i-- + if m.BurnVoteVeto { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x78 + } + if m.BurnProposalDepositPrevote { + i-- + if m.BurnProposalDepositPrevote { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x70 + } + if m.BurnVoteQuorum { + i-- + if m.BurnVoteQuorum { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x68 + } + if len(m.MinInitialDepositRatio) > 0 { + i -= len(m.MinInitialDepositRatio) + copy(dAtA[i:], m.MinInitialDepositRatio) + i = encodeVarintGov(dAtA, i, uint64(len(m.MinInitialDepositRatio))) + i-- + dAtA[i] = 0x3a + } + if len(m.VetoThreshold) > 0 { + i -= len(m.VetoThreshold) + copy(dAtA[i:], m.VetoThreshold) + i = encodeVarintGov(dAtA, i, uint64(len(m.VetoThreshold))) + i-- + dAtA[i] = 0x32 + } + if len(m.Threshold) > 0 { + i -= len(m.Threshold) + copy(dAtA[i:], m.Threshold) + i = encodeVarintGov(dAtA, i, uint64(len(m.Threshold))) + i-- + dAtA[i] = 0x2a + } + if len(m.Quorum) > 0 { + i -= len(m.Quorum) + copy(dAtA[i:], m.Quorum) + i = encodeVarintGov(dAtA, i, uint64(len(m.Quorum))) + i-- + dAtA[i] = 0x22 + } + if m.VotingPeriod != nil { + n2, err2 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintGov(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x1a + } + if m.MaxDepositPeriod != nil { + n3, err3 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintGov(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x12 + } + if len(m.MinDeposit) > 0 { + for iNdEx := len(m.MinDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MinDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WeightedVoteOption) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WeightedVoteOption) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Weight) > 0 { + i -= len(m.Weight) + copy(dAtA[i:], m.Weight) + i = encodeVarintGov(dAtA, i, uint64(len(m.Weight))) + i-- + dAtA[i] = 0x12 + } + if m.Option != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.Option)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Deposit) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Deposit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Deposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintGov(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Proposal) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Proposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FailedReason) > 0 { + i -= len(m.FailedReason) + copy(dAtA[i:], m.FailedReason) + i = encodeVarintGov(dAtA, i, uint64(len(m.FailedReason))) + i-- + dAtA[i] = 0x7a + } + if m.Expedited { + i-- + if m.Expedited { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x70 + } + if len(m.Proposer) > 0 { + i -= len(m.Proposer) + copy(dAtA[i:], m.Proposer) + i = encodeVarintGov(dAtA, i, uint64(len(m.Proposer))) + i-- + dAtA[i] = 0x6a + } + if len(m.Summary) > 0 { + i -= len(m.Summary) + copy(dAtA[i:], m.Summary) + i = encodeVarintGov(dAtA, i, uint64(len(m.Summary))) + i-- + dAtA[i] = 0x62 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintGov(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0x5a + } + if len(m.Metadata) > 0 { + i -= len(m.Metadata) + copy(dAtA[i:], m.Metadata) + i = encodeVarintGov(dAtA, i, uint64(len(m.Metadata))) + i-- + dAtA[i] = 0x52 + } + if m.VotingEndTime != nil { + n4, err4 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.VotingEndTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.VotingEndTime):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintGov(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x4a + } + if m.VotingStartTime != nil { + n5, err5 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.VotingStartTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.VotingStartTime):]) + if err5 != nil { + return 0, err5 + } + i -= n5 + i = encodeVarintGov(dAtA, i, uint64(n5)) + i-- + dAtA[i] = 0x42 + } + if len(m.TotalDeposit) > 0 { + for iNdEx := len(m.TotalDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TotalDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + } + if m.DepositEndTime != nil { + n6, err6 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.DepositEndTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.DepositEndTime):]) + if err6 != nil { + return 0, err6 + } + i -= n6 + i = encodeVarintGov(dAtA, i, uint64(n6)) + i-- + dAtA[i] = 0x32 + } + if m.SubmitTime != nil { + n7, err7 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.SubmitTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.SubmitTime):]) + if err7 != nil { + return 0, err7 + } + i -= n7 + i = encodeVarintGov(dAtA, i, uint64(n7)) + i-- + dAtA[i] = 0x2a + } + if m.FinalTallyResult != nil { + { + size, err := m.FinalTallyResult.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.Status != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x18 + } + if len(m.Messages) > 0 { + for iNdEx := len(m.Messages) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Messages[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Id != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *TallyResult) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TallyResult) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TallyResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NoWithVetoCount) > 0 { + i -= len(m.NoWithVetoCount) + copy(dAtA[i:], m.NoWithVetoCount) + i = encodeVarintGov(dAtA, i, uint64(len(m.NoWithVetoCount))) + i-- + dAtA[i] = 0x22 + } + if len(m.NoCount) > 0 { + i -= len(m.NoCount) + copy(dAtA[i:], m.NoCount) + i = encodeVarintGov(dAtA, i, uint64(len(m.NoCount))) + i-- + dAtA[i] = 0x1a + } + if len(m.AbstainCount) > 0 { + i -= len(m.AbstainCount) + copy(dAtA[i:], m.AbstainCount) + i = encodeVarintGov(dAtA, i, uint64(len(m.AbstainCount))) + i-- + dAtA[i] = 0x12 + } + if len(m.YesCount) > 0 { + i -= len(m.YesCount) + copy(dAtA[i:], m.YesCount) + i = encodeVarintGov(dAtA, i, uint64(len(m.YesCount))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Vote) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Vote) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Metadata) > 0 { + i -= len(m.Metadata) + copy(dAtA[i:], m.Metadata) + i = encodeVarintGov(dAtA, i, uint64(len(m.Metadata))) + i-- + dAtA[i] = 0x2a + } + if len(m.Options) > 0 { + for iNdEx := len(m.Options) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Options[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintGov(dAtA, i, uint64(len(m.Voter))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *DepositParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DepositParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DepositParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MaxDepositPeriod != nil { + n9, err9 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) + if err9 != nil { + return 0, err9 + } + i -= n9 + i = encodeVarintGov(dAtA, i, uint64(n9)) + i-- + dAtA[i] = 0x12 + } + if len(m.MinDeposit) > 0 { + for iNdEx := len(m.MinDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MinDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *VotingParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VotingParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VotingParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.VotingPeriod != nil { + n10, err10 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) + if err10 != nil { + return 0, err10 + } + i -= n10 + i = encodeVarintGov(dAtA, i, uint64(n10)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TallyParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TallyParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TallyParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.VetoThreshold) > 0 { + i -= len(m.VetoThreshold) + copy(dAtA[i:], m.VetoThreshold) + i = encodeVarintGov(dAtA, i, uint64(len(m.VetoThreshold))) + i-- + dAtA[i] = 0x1a + } + if len(m.Threshold) > 0 { + i -= len(m.Threshold) + copy(dAtA[i:], m.Threshold) + i = encodeVarintGov(dAtA, i, uint64(len(m.Threshold))) + i-- + dAtA[i] = 0x12 + } + if len(m.Quorum) > 0 { + i -= len(m.Quorum) + copy(dAtA[i:], m.Quorum) + i = encodeVarintGov(dAtA, i, uint64(len(m.Quorum))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintGov(dAtA []byte, offset int, v uint64) int { + offset -= sovGov(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.MinDeposit) > 0 { + for _, e := range m.MinDeposit { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + if m.MaxDepositPeriod != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod) + n += 1 + l + sovGov(uint64(l)) + } + if m.VotingPeriod != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod) + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Quorum) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Threshold) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.VetoThreshold) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.MinInitialDepositRatio) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if m.BurnVoteQuorum { + n += 2 + } + if m.BurnProposalDepositPrevote { + n += 2 + } + if m.BurnVoteVeto { + n += 2 + } + l = m.MinUusdDeposit.Size() + n += 2 + l + sovGov(uint64(l)) + return n +} + +func (m *WeightedVoteOption) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Option != 0 { + n += 1 + sovGov(uint64(m.Option)) + } + l = len(m.Weight) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *Deposit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovGov(uint64(m.ProposalId)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + return n +} + +func (m *Proposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovGov(uint64(m.Id)) + } + if len(m.Messages) > 0 { + for _, e := range m.Messages { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + if m.Status != 0 { + n += 1 + sovGov(uint64(m.Status)) + } + if m.FinalTallyResult != nil { + l = m.FinalTallyResult.Size() + n += 1 + l + sovGov(uint64(l)) + } + if m.SubmitTime != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.SubmitTime) + n += 1 + l + sovGov(uint64(l)) + } + if m.DepositEndTime != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.DepositEndTime) + n += 1 + l + sovGov(uint64(l)) + } + if len(m.TotalDeposit) > 0 { + for _, e := range m.TotalDeposit { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + if m.VotingStartTime != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.VotingStartTime) + n += 1 + l + sovGov(uint64(l)) + } + if m.VotingEndTime != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.VotingEndTime) + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Metadata) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Title) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Summary) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Proposer) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if m.Expedited { + n += 2 + } + l = len(m.FailedReason) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *TallyResult) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.YesCount) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.AbstainCount) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.NoCount) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.NoWithVetoCount) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *Vote) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovGov(uint64(m.ProposalId)) + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if len(m.Options) > 0 { + for _, e := range m.Options { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + l = len(m.Metadata) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *DepositParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.MinDeposit) > 0 { + for _, e := range m.MinDeposit { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + if m.MaxDepositPeriod != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod) + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *VotingParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.VotingPeriod != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod) + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *TallyParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Quorum) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Threshold) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.VetoThreshold) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func sovGov(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGov(x uint64) (n int) { + return sovGov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinDeposit = append(m.MinDeposit, types.Coin{}) + if err := m.MinDeposit[len(m.MinDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxDepositPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MaxDepositPeriod == nil { + m.MaxDepositPeriod = new(time.Duration) + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.MaxDepositPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VotingPeriod == nil { + m.VotingPeriod = new(time.Duration) + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.VotingPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Quorum", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Quorum = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Threshold", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Threshold = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VetoThreshold", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VetoThreshold = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinInitialDepositRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinInitialDepositRatio = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BurnVoteQuorum", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BurnVoteQuorum = bool(v != 0) + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BurnProposalDepositPrevote", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BurnProposalDepositPrevote = bool(v != 0) + case 15: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BurnVoteVeto", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BurnVoteVeto = bool(v != 0) + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinUusdDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinUusdDeposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *WeightedVoteOption) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WeightedVoteOption: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WeightedVoteOption: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) + } + m.Option = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Option |= VoteOption(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Weight", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Weight = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Deposit) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Deposit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Deposit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Depositor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Proposal) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Proposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Proposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Messages = append(m.Messages, &types2.Any{}) + if err := m.Messages[len(m.Messages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= ProposalStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FinalTallyResult", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.FinalTallyResult == nil { + m.FinalTallyResult = &TallyResult{} + } + if err := m.FinalTallyResult.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubmitTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SubmitTime == nil { + m.SubmitTime = new(time.Time) + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.SubmitTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DepositEndTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DepositEndTime == nil { + m.DepositEndTime = new(time.Time) + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.DepositEndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TotalDeposit = append(m.TotalDeposit, types.Coin{}) + if err := m.TotalDeposit[len(m.TotalDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingStartTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VotingStartTime == nil { + m.VotingStartTime = new(time.Time) + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.VotingStartTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingEndTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VotingEndTime == nil { + m.VotingEndTime = new(time.Time) + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.VotingEndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Metadata = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Summary", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Summary = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Proposer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Expedited", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Expedited = bool(v != 0) + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FailedReason", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FailedReason = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TallyResult) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TallyResult: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TallyResult: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field YesCount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.YesCount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AbstainCount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AbstainCount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NoCount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NoCount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NoWithVetoCount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NoWithVetoCount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Vote) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Vote: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Vote: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Options = append(m.Options, &WeightedVoteOption{}) + if err := m.Options[len(m.Options)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Metadata = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } } - l = m.MinUusdDeposit.Size() - n += 2 + l + sovGov(uint64(l)) - return n -} -func sovGov(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGov(x uint64) (n int) { - return sovGov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } -func (m *Params) Unmarshal(dAtA []byte) error { +func (m *DepositParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -435,10 +3372,10 @@ func (m *Params) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") + return fmt.Errorf("proto: DepositParams: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DepositParams: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -511,7 +3448,57 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VotingParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VotingParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VotingParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field VotingPeriod", wireType) } @@ -547,41 +3534,59 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Quorum", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err } - intStringLen := int(stringLen) - if intStringLen < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthGov } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } - if postIndex > l { + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TallyParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { return io.ErrUnexpectedEOF } - m.Quorum = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TallyParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TallyParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Threshold", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Quorum", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -609,11 +3614,11 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Threshold = string(dAtA[iNdEx:postIndex]) + m.Quorum = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VetoThreshold", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Threshold", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -641,11 +3646,11 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.VetoThreshold = string(dAtA[iNdEx:postIndex]) + m.Threshold = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 7: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinInitialDepositRatio", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field VetoThreshold", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -673,100 +3678,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.MinInitialDepositRatio = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 13: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BurnVoteQuorum", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.BurnVoteQuorum = bool(v != 0) - case 14: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BurnProposalDepositPrevote", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.BurnProposalDepositPrevote = bool(v != 0) - case 15: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BurnVoteVeto", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.BurnVoteVeto = bool(v != 0) - case 16: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinUusdDeposit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MinUusdDeposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.VetoThreshold = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex diff --git a/custom/gov/types/v2lunc1/params.go b/custom/gov/types/v2lunc1/params.go new file mode 100644 index 00000000..f265ec6a --- /dev/null +++ b/custom/gov/types/v2lunc1/params.go @@ -0,0 +1,140 @@ +package v2lunc1 + +import ( + fmt "fmt" + "time" + + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// Default period for deposits & voting +const ( + DefaultPeriod time.Duration = time.Hour * 24 * 2 // 2 days +) + +// Default governance params + +// Default governance params +var ( + DefaultMinDepositTokens = sdk.NewInt(10000000) + DefaultQuorum = sdk.NewDecWithPrec(334, 3) + DefaultThreshold = sdk.NewDecWithPrec(5, 1) + DefaultVetoThreshold = sdk.NewDecWithPrec(334, 3) + DefaultMinInitialDepositRatio = sdk.ZeroDec() + DefaultBurnProposalPrevote = false // set to false to replicate behavior of when this change was made (0.47) + DefaultBurnVoteQuorom = false // set to false to replicate behavior of when this change was made (0.47) + DefaultBurnVoteVeto = true // set to true to replicate behavior of when this change was made (0.47) + DefaultMinUusdDepositTokens = sdk.NewInt(500) // Minimal uusd deposit for a proposal to enter voting period + +) + +// NewParams creates a new Params instance with given values. +func NewParams( + minDeposit sdk.Coins, maxDepositPeriod, votingPeriod time.Duration, + quorum, threshold, vetoThreshold, minInitialDepositRatio string, burnProposalDeposit, burnVoteQuorum, burnVoteVeto bool, minUusdDeposit sdk.Coin, +) Params { + return Params{ + MinDeposit: minDeposit, + MaxDepositPeriod: &maxDepositPeriod, + VotingPeriod: &votingPeriod, + Quorum: quorum, + Threshold: threshold, + VetoThreshold: vetoThreshold, + MinInitialDepositRatio: minInitialDepositRatio, + BurnProposalDepositPrevote: burnProposalDeposit, + BurnVoteQuorum: burnVoteQuorum, + BurnVoteVeto: burnVoteVeto, + MinUusdDeposit: minUusdDeposit, + } +} + +// DefaultParams returns the default governance params +func DefaultParams() Params { + return NewParams( + sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, DefaultMinDepositTokens)), + DefaultPeriod, + DefaultPeriod, + DefaultQuorum.String(), + DefaultThreshold.String(), + DefaultVetoThreshold.String(), + DefaultMinInitialDepositRatio.String(), + DefaultBurnProposalPrevote, + DefaultBurnVoteQuorom, + DefaultBurnVoteVeto, + sdk.NewCoin(sdk.DefaultBondDenom, DefaultMinUusdDepositTokens), + ) +} + +// ValidateBasic performs basic validation on governance parameters. +func (p Params) ValidateBasic() error { + if minDeposit := sdk.Coins(p.MinDeposit); minDeposit.Empty() || !minDeposit.IsValid() { + return fmt.Errorf("invalid minimum deposit: %s", minDeposit) + } + + if p.MaxDepositPeriod == nil { + return fmt.Errorf("maximum deposit period must not be nil: %d", p.MaxDepositPeriod) + } + + if p.MaxDepositPeriod.Seconds() <= 0 { + return fmt.Errorf("maximum deposit period must be positive: %d", p.MaxDepositPeriod) + } + + quorum, err := sdk.NewDecFromStr(p.Quorum) + if err != nil { + return fmt.Errorf("invalid quorum string: %w", err) + } + if quorum.IsNegative() { + return fmt.Errorf("quorom cannot be negative: %s", quorum) + } + if quorum.GT(math.LegacyOneDec()) { + return fmt.Errorf("quorom too large: %s", p.Quorum) + } + + threshold, err := sdk.NewDecFromStr(p.Threshold) + if err != nil { + return fmt.Errorf("invalid threshold string: %w", err) + } + if !threshold.IsPositive() { + return fmt.Errorf("vote threshold must be positive: %s", threshold) + } + if threshold.GT(math.LegacyOneDec()) { + return fmt.Errorf("vote threshold too large: %s", threshold) + } + + vetoThreshold, err := sdk.NewDecFromStr(p.VetoThreshold) + if err != nil { + return fmt.Errorf("invalid vetoThreshold string: %w", err) + } + if !vetoThreshold.IsPositive() { + return fmt.Errorf("veto threshold must be positive: %s", vetoThreshold) + } + if vetoThreshold.GT(math.LegacyOneDec()) { + return fmt.Errorf("veto threshold too large: %s", vetoThreshold) + } + + if p.VotingPeriod == nil { + return fmt.Errorf("voting period must not be nil: %d", p.VotingPeriod) + } + + if p.VotingPeriod.Seconds() <= 0 { + return fmt.Errorf("voting period must be positive: %s", p.VotingPeriod) + } + + minInitialDepositRatio, err := math.LegacyNewDecFromStr(p.MinInitialDepositRatio) + if err != nil { + return fmt.Errorf("invalid mininum initial deposit ratio of proposal: %w", err) + } + if minInitialDepositRatio.IsNegative() { + return fmt.Errorf("mininum initial deposit ratio of proposal must be positive: %s", minInitialDepositRatio) + } + if minInitialDepositRatio.GT(math.LegacyOneDec()) { + return fmt.Errorf("mininum initial deposit ratio of proposal is too large: %s", minInitialDepositRatio) + } + + if minUusdDeposit := p.MinUusdDeposit; !minUusdDeposit.IsValid() { + return fmt.Errorf("invalid minimum uusd deposit: %s", minUusdDeposit) + } + + return nil +} diff --git a/proto/terra/gov/v2lunc1/genesis.proto b/proto/terra/gov/v2lunc1/genesis.proto new file mode 100644 index 00000000..4de9326b --- /dev/null +++ b/proto/terra/gov/v2lunc1/genesis.proto @@ -0,0 +1,32 @@ +syntax = "proto3"; +package terra.gov.v2lunc1; + +import "terra/gov/v2lunc1/gov.proto"; + +option go_package = "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1"; + +// GenesisState defines the gov module's genesis state. +message GenesisState { + // starting_proposal_id is the ID of the starting proposal. + uint64 starting_proposal_id = 1; + // deposits defines all the deposits present at genesis. + repeated Deposit deposits = 2; + // votes defines all the votes present at genesis. + repeated Vote votes = 3; + // proposals defines all the proposals present at genesis. + repeated Proposal proposals = 4; + // Deprecated: Prefer to use `params` instead. + // deposit_params defines all the paramaters of related to deposit. + DepositParams deposit_params = 5 [deprecated = true]; + // Deprecated: Prefer to use `params` instead. + // voting_params defines all the paramaters of related to voting. + VotingParams voting_params = 6 [deprecated = true]; + // Deprecated: Prefer to use `params` instead. + // tally_params defines all the paramaters of related to tally. + TallyParams tally_params = 7 [deprecated = true]; + // params defines all the paramaters of x/gov module. + // + // Since: cosmos-sdk 0.47 + Params params = 8; + +} diff --git a/proto/terra/gov/v2lunc1/gov.proto b/proto/terra/gov/v2lunc1/gov.proto index 293d3072..7d20af9d 100644 --- a/proto/terra/gov/v2lunc1/gov.proto +++ b/proto/terra/gov/v2lunc1/gov.proto @@ -11,6 +11,159 @@ import "amino/amino.proto"; option go_package = "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1"; +// VoteOption enumerates the valid vote options for a given governance proposal. +enum VoteOption { + // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + VOTE_OPTION_UNSPECIFIED = 0; + // VOTE_OPTION_YES defines a yes vote option. + VOTE_OPTION_YES = 1; + // VOTE_OPTION_ABSTAIN defines an abstain vote option. + VOTE_OPTION_ABSTAIN = 2; + // VOTE_OPTION_NO defines a no vote option. + VOTE_OPTION_NO = 3; + // VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. + VOTE_OPTION_NO_WITH_VETO = 4; +} +// WeightedVoteOption defines a unit of vote for vote split. +message WeightedVoteOption { + // option defines the valid vote options, it must not contain duplicate vote options. + VoteOption option = 1; + // weight is the vote weight associated with the vote option. + string weight = 2 [(cosmos_proto.scalar) = "cosmos.Dec"]; +} +// Deposit defines an amount deposited by an account address to an active +// proposal. +message Deposit { + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; + // depositor defines the deposit addresses from the proposals. + string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // amount to be deposited by depositor. + repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; +} +// Proposal defines the core field members of a governance proposal. +message Proposal { + // id defines the unique id of the proposal. + uint64 id = 1; + // messages are the arbitrary messages to be executed if the proposal passes. + repeated google.protobuf.Any messages = 2; + // status defines the proposal status. + ProposalStatus status = 3; + // final_tally_result is the final tally result of the proposal. When + // querying a proposal via gRPC, this field is not populated until the + // proposal's voting period has ended. + TallyResult final_tally_result = 4; + // submit_time is the time of proposal submission. + google.protobuf.Timestamp submit_time = 5 [(gogoproto.stdtime) = true]; + // deposit_end_time is the end time for deposition. + google.protobuf.Timestamp deposit_end_time = 6 [(gogoproto.stdtime) = true]; + // total_deposit is the total deposit on the proposal. + repeated cosmos.base.v1beta1.Coin total_deposit = 7 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + // voting_start_time is the starting time to vote on a proposal. + google.protobuf.Timestamp voting_start_time = 8 [(gogoproto.stdtime) = true]; + // voting_end_time is the end time of voting on a proposal. + google.protobuf.Timestamp voting_end_time = 9 [(gogoproto.stdtime) = true]; + // metadata is any arbitrary metadata attached to the proposal. + // the recommended format of the metadata is to be found here: + // https://docs.cosmos.network/v0.47/modules/gov#proposal-3 + string metadata = 10; + // title is the title of the proposal + // + // Since: cosmos-sdk 0.47 + string title = 11; + // summary is a short summary of the proposal + // + // Since: cosmos-sdk 0.47 + string summary = 12; + // proposer is the address of the proposal sumbitter + // + // Since: cosmos-sdk 0.47 + string proposer = 13 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // expedited defines if the proposal is expedited + // + // Since: cosmos-sdk 0.50 + bool expedited = 14; + // failed_reason defines the reason why the proposal failed + // + // Since: cosmos-sdk 0.50 + string failed_reason = 15; +} +// ProposalStatus enumerates the valid statuses of a proposal. +enum ProposalStatus { + // PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. + PROPOSAL_STATUS_UNSPECIFIED = 0; + // PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + // period. + PROPOSAL_STATUS_DEPOSIT_PERIOD = 1; + // PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + // period. + PROPOSAL_STATUS_VOTING_PERIOD = 2; + // PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + // passed. + PROPOSAL_STATUS_PASSED = 3; + // PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + // been rejected. + PROPOSAL_STATUS_REJECTED = 4; + // PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + // failed. + PROPOSAL_STATUS_FAILED = 5; +} +// TallyResult defines a standard tally for a governance proposal. +message TallyResult { + // yes_count is the number of yes votes on a proposal. + string yes_count = 1 [(cosmos_proto.scalar) = "cosmos.Int"]; + // abstain_count is the number of abstain votes on a proposal. + string abstain_count = 2 [(cosmos_proto.scalar) = "cosmos.Int"]; + // no_count is the number of no votes on a proposal. + string no_count = 3 [(cosmos_proto.scalar) = "cosmos.Int"]; + // no_with_veto_count is the number of no with veto votes on a proposal. + string no_with_veto_count = 4 [(cosmos_proto.scalar) = "cosmos.Int"]; +} +// Vote defines a vote on a governance proposal. +// A Vote consists of a proposal ID, the voter, and the vote option. +message Vote { + // proposal_id defines the unique id of the proposal. + uint64 proposal_id = 1; + // voter is the voter address of the proposal. + string voter = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + reserved 3; + // options is the weighted vote options. + repeated WeightedVoteOption options = 4; + // metadata is any arbitrary metadata attached to the vote. + // the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/gov#vote-5 + string metadata = 5; +} +// DepositParams defines the params for deposits on governance proposals. +message DepositParams { + option deprecated = true; + // Minimum deposit for a proposal to enter voting period. + repeated cosmos.base.v1beta1.Coin min_deposit = 1 + [(gogoproto.nullable) = false, (gogoproto.jsontag) = "min_deposit,omitempty"]; + // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + // months. + google.protobuf.Duration max_deposit_period = 2 + [(gogoproto.stdduration) = true, (gogoproto.jsontag) = "max_deposit_period,omitempty"]; +} +// VotingParams defines the params for voting on governance proposals. +message VotingParams { + option deprecated = true; + // Duration of the voting period. + google.protobuf.Duration voting_period = 1 [(gogoproto.stdduration) = true]; +} +// TallyParams defines the params for tallying votes on governance proposals. +message TallyParams { + option deprecated = true; + // Minimum percentage of total stake needed to vote for a result to be + // considered valid. + string quorum = 1 [(cosmos_proto.scalar) = "cosmos.Dec"]; + // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. + string threshold = 2 [(cosmos_proto.scalar) = "cosmos.Dec"]; + // Minimum value of Veto votes to Total votes ratio for proposal to be + // vetoed. Default value: 1/3. + string veto_threshold = 3 [(cosmos_proto.scalar) = "cosmos.Dec"]; +} + + // Params defines the parameters for the x/gov module. // // Since: cosmos-sdk 0.47 @@ -52,4 +205,4 @@ message Params { // Minimal uusd deposit for a proposal to enter voting period cosmos.base.v1beta1.Coin min_uusd_deposit = 16 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; -} \ No newline at end of file +} From c7429a4a0e5bde195b78f56ac641900e186e7f83 Mon Sep 17 00:00:00 2001 From: tusoict Date: Tue, 8 Oct 2024 16:58:48 +0700 Subject: [PATCH 20/60] Fixed types in MinInitialDeposit.go --- custom/auth/ante/min_initial_deposit.go | 3 ++- custom/auth/ante/min_initial_deposit_test.go | 10 ++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/custom/auth/ante/min_initial_deposit.go b/custom/auth/ante/min_initial_deposit.go index 0ff8446b..eca4926f 100644 --- a/custom/auth/ante/min_initial_deposit.go +++ b/custom/auth/ante/min_initial_deposit.go @@ -61,7 +61,8 @@ func HandleCheckMinInitialDeposit(ctx sdk.Context, msg sdk.Msg, govKeeper govv2l return fmt.Errorf("not enough initial deposit provided. Expected %q; got %q", requiredDepositCoins, initialDepositCoins) } } - return nil + + return fmt.Errorf("could not get minimum deposit base uusd") } // AnteHandle handles checking MsgSubmitProposal diff --git a/custom/auth/ante/min_initial_deposit_test.go b/custom/auth/ante/min_initial_deposit_test.go index db4f54b2..adbc7d91 100644 --- a/custom/auth/ante/min_initial_deposit_test.go +++ b/custom/auth/ante/min_initial_deposit_test.go @@ -19,7 +19,9 @@ import ( // cosmosante "github.com/cosmos/cosmos-sdk/x/auth/ante" // "github.com/cosmos/cosmos-sdk/x/auth/types" // minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - govv2lunc1 "github.com/classic-terra/core/v3/custom/gov/keeper" + + govv2lunc1types "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) @@ -32,7 +34,7 @@ func (suite *AnteTestSuite) TestMinInitialDepositRatioDefault() { antehandler := sdk.ChainAnteDecorators(midd) // set required deposit to uluna - suite.app.GovKeeper.SetParams(suite.ctx, govv2lunc1.DefaultParams()) + suite.app.GovKeeper.SetParams(suite.ctx, govv2lunc1types.DefaultParams()) govparams := suite.app.GovKeeper.GetParams(suite.ctx) govparams.MinDeposit = sdk.NewCoins( sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(1_000_000)), @@ -87,7 +89,7 @@ func (suite *AnteTestSuite) TestMinInitialDepositRatioWithSufficientDeposit() { antehandler := sdk.ChainAnteDecorators(midd) // set required deposit to uluna - suite.app.GovKeeper.SetParams(suite.ctx, govv1.DefaultParams()) + suite.app.GovKeeper.SetParams(suite.ctx, govv2lunc1types.DefaultParams()) govparams := suite.app.GovKeeper.GetParams(suite.ctx) govparams.MinDeposit = sdk.NewCoins( sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(1_000_000)), @@ -144,7 +146,7 @@ func (suite *AnteTestSuite) TestMinInitialDepositRatioWithInsufficientDeposit() antehandler := sdk.ChainAnteDecorators(midd) // set required deposit to uluna - suite.app.GovKeeper.SetParams(suite.ctx, govv1.DefaultParams()) + suite.app.GovKeeper.SetParams(suite.ctx, govv2lunc1types.DefaultParams()) govparams := suite.app.GovKeeper.GetParams(suite.ctx) govparams.MinDeposit = sdk.NewCoins( sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(1_000_000)), From 869d296dd27e4a01cf707363caff74365261c62e Mon Sep 17 00:00:00 2001 From: tusoict Date: Thu, 10 Oct 2024 11:23:26 +0700 Subject: [PATCH 21/60] add keys_test.go (unitest for keys.go) --- custom/gov/types/keys_test.go | 66 +++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 custom/gov/types/keys_test.go diff --git a/custom/gov/types/keys_test.go b/custom/gov/types/keys_test.go new file mode 100644 index 00000000..08c07d26 --- /dev/null +++ b/custom/gov/types/keys_test.go @@ -0,0 +1,66 @@ +package types + +import ( + "testing" + "time" + + "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +var addr = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + +func TestProposalKeys(t *testing.T) { + // key proposal + key := govtypes.ProposalKey(1) + proposalID := govtypes.SplitProposalKey(key) + require.Equal(t, int(proposalID), 1) + + // key active proposal queue + now := time.Now() + key = govtypes.ActiveProposalQueueKey(3, now) + proposalID, expTime := govtypes.SplitActiveProposalQueueKey(key) + require.Equal(t, int(proposalID), 3) + require.True(t, now.Equal(expTime)) + + // key inactive proposal queue + key = govtypes.InactiveProposalQueueKey(3, now) + proposalID, expTime = govtypes.SplitInactiveProposalQueueKey(key) + require.Equal(t, int(proposalID), 3) + require.True(t, now.Equal(expTime)) + + // invalid key + require.Panics(t, func() { govtypes.SplitProposalKey([]byte("test")) }) + require.Panics(t, func() { govtypes.SplitInactiveProposalQueueKey([]byte("test")) }) +} + +func TestDepositKeys(t *testing.T) { + key := govtypes.DepositsKey(2) + proposalID := govtypes.SplitProposalKey(key) + require.Equal(t, int(proposalID), 2) + + key = govtypes.DepositKey(2, addr) + proposalID, depositorAddr := govtypes.SplitKeyDeposit(key) + require.Equal(t, int(proposalID), 2) + require.Equal(t, addr, depositorAddr) +} + +func TestVoteKeys(t *testing.T) { + key := govtypes.VotesKey(2) + proposalID := govtypes.SplitProposalKey(key) + require.Equal(t, int(proposalID), 2) + + key = govtypes.VoteKey(2, addr) + proposalID, voterAddr := govtypes.SplitKeyDeposit(key) + require.Equal(t, int(proposalID), 2) + require.Equal(t, addr, voterAddr) +} + +func TestTotalDepositKeys(t *testing.T) { + key := TotalDepositKey(2) + proposalID := govtypes.SplitProposalKey(key) + require.Equal(t, int(proposalID), 2) +} From eeef11a6c3adb8f3368898682f8a1fd2542fa9ad Mon Sep 17 00:00:00 2001 From: tusoict Date: Sat, 12 Oct 2024 15:58:53 +0700 Subject: [PATCH 22/60] Completed migrate from version 4 to 5. --- app/modules.go | 4 +- custom/auth/ante/ante.go | 4 +- custom/auth/ante/min_initial_deposit.go | 26 +- custom/auth/ante/min_initial_deposit_test.go | 10 +- custom/distribution/types/codec.go | 3 - custom/gov/client/cli/query.go | 11 + custom/gov/genesis.go | 80 + custom/gov/keeper/common_test.go | 4 +- custom/gov/keeper/keeper.go | 3 +- custom/gov/keeper/migrator.go | 44 + custom/gov/keeper/msg_server.go | 132 +- custom/gov/keeper/proposal.go | 10 +- custom/gov/migrations/v5/store.go | 50 + custom/gov/module.go | 216 +- custom/gov/types/v2lunc1/codec.go | 58 + custom/gov/types/v2lunc1/genesis.go | 103 +- custom/gov/types/v2lunc1/genesis.pb.go | 95 +- custom/gov/types/v2lunc1/gov.pb.go | 3580 ++---------------- custom/gov/types/v2lunc1/params.go | 82 +- custom/gov/types/v2lunc1/tx.pb.go | 1080 ++---- custom/params/types/codec.go | 6 - custom/upgrade/types/codec.go | 7 - proto/terra/gov/v2lunc1/genesis.proto | 20 +- proto/terra/gov/v2lunc1/gov.proto | 4 +- proto/terra/gov/v2lunc1/tx.proto | 79 +- 25 files changed, 1453 insertions(+), 4258 deletions(-) create mode 100644 custom/gov/genesis.go create mode 100644 custom/gov/keeper/migrator.go create mode 100644 custom/gov/migrations/v5/store.go create mode 100644 custom/gov/types/v2lunc1/codec.go diff --git a/app/modules.go b/app/modules.go index 491f1d35..4f947226 100644 --- a/app/modules.go +++ b/app/modules.go @@ -167,7 +167,7 @@ func appModules( bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), - gov.NewAppModule(appCodec, app.GovKeeper.Keeper, app.AccountKeeper, app.BankKeeper, app.OracleKeeper, app.GetSubspace(govtypes.ModuleName)), + gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.OracleKeeper, app.GetSubspace(govtypes.ModuleName)), mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName)), distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), @@ -202,7 +202,7 @@ func simulationModules( custombank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), - gov.NewAppModule(appCodec, app.GovKeeper.Keeper, app.AccountKeeper, app.BankKeeper, app.OracleKeeper, app.GetSubspace(govtypes.ModuleName)), + gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.OracleKeeper, app.GetSubspace(govtypes.ModuleName)), mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName)), distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), diff --git a/custom/auth/ante/ante.go b/custom/auth/ante/ante.go index 0647e454..aaf1b293 100644 --- a/custom/auth/ante/ante.go +++ b/custom/auth/ante/ante.go @@ -2,7 +2,6 @@ package ante import ( errorsmod "cosmossdk.io/errors" - govkeeper "github.com/classic-terra/core/v3/custom/gov/keeper" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -10,6 +9,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/signing" distributionkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + customgovkeeper "github.com/classic-terra/core/v3/custom/gov/keeper" dyncommante "github.com/classic-terra/core/v3/x/dyncomm/ante" dyncommkeeper "github.com/classic-terra/core/v3/x/dyncomm/keeper" "github.com/cosmos/cosmos-sdk/codec" @@ -35,7 +35,7 @@ type HandlerOptions struct { IBCKeeper ibckeeper.Keeper WasmKeeper *wasmkeeper.Keeper DistributionKeeper distributionkeeper.Keeper - GovKeeper govkeeper.Keeper + GovKeeper customgovkeeper.Keeper WasmConfig *wasmtypes.WasmConfig TXCounterStoreKey storetypes.StoreKey DyncommKeeper dyncommkeeper.Keeper diff --git a/custom/auth/ante/min_initial_deposit.go b/custom/auth/ante/min_initial_deposit.go index eca4926f..6cc0f991 100644 --- a/custom/auth/ante/min_initial_deposit.go +++ b/custom/auth/ante/min_initial_deposit.go @@ -4,23 +4,23 @@ import ( "fmt" errorsmod "cosmossdk.io/errors" - govv2lunc1 "github.com/classic-terra/core/v3/custom/gov/keeper" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + customgovkeeper "github.com/classic-terra/core/v3/custom/gov/keeper" core "github.com/classic-terra/core/v3/types" ) // MinInitialDeposit Decorator will check Initial Deposits for MsgSubmitProposal type MinInitialDepositDecorator struct { - govKeeper govv2lunc1.Keeper + govKeeper customgovkeeper.Keeper treasuryKeeper TreasuryKeeper } // NewMinInitialDeposit returns new min initial deposit decorator instance -func NewMinInitialDepositDecorator(govKeeper govv2lunc1.Keeper, treasuryKeeper TreasuryKeeper) MinInitialDepositDecorator { +func NewMinInitialDepositDecorator(govKeeper customgovkeeper.Keeper, treasuryKeeper TreasuryKeeper) MinInitialDepositDecorator { return MinInitialDepositDecorator{ govKeeper: govKeeper, treasuryKeeper: treasuryKeeper, @@ -38,31 +38,29 @@ func IsMsgSubmitProposal(msg sdk.Msg) bool { } // HandleCheckMinInitialDeposit -func HandleCheckMinInitialDeposit(ctx sdk.Context, msg sdk.Msg, govKeeper govv2lunc1.Keeper, treasuryKeeper TreasuryKeeper) (err error) { +func HandleCheckMinInitialDeposit(ctx sdk.Context, msg sdk.Msg, govKeeper customgovkeeper.Keeper, treasuryKeeper TreasuryKeeper) (err error) { var initialDepositCoins sdk.Coins switch submitPropMsg := msg.(type) { case *govv1beta1.MsgSubmitProposal: initialDepositCoins = submitPropMsg.GetInitialDeposit() - case *govv1.MsgSubmitProposal: initialDepositCoins = submitPropMsg.GetInitialDeposit() default: return fmt.Errorf("could not dereference msg as MsgSubmitProposal") } + minDeposit := govKeeper.GetParams(ctx).MinDeposit + requiredAmount := sdk.NewDecFromInt(minDeposit[0].Amount).Mul(treasuryKeeper.GetMinInitialDepositRatio(ctx)).TruncateInt() - err, requiredAmount := govKeeper.GetMinimumDepositBaseUusd(ctx) - if err == nil { - requiredDepositCoins := sdk.NewCoins( - sdk.NewCoin(core.MicroLunaDenom, requiredAmount), - ) + requiredDepositCoins := sdk.NewCoins( + sdk.NewCoin(core.MicroLunaDenom, requiredAmount), + ) - if !initialDepositCoins.IsAllGTE(requiredDepositCoins) { - return fmt.Errorf("not enough initial deposit provided. Expected %q; got %q", requiredDepositCoins, initialDepositCoins) - } + if !initialDepositCoins.IsAllGTE(requiredDepositCoins) { + return fmt.Errorf("not enough initial deposit provided. Expected %q; got %q", requiredDepositCoins, initialDepositCoins) } - return fmt.Errorf("could not get minimum deposit base uusd") + return nil } // AnteHandle handles checking MsgSubmitProposal diff --git a/custom/auth/ante/min_initial_deposit_test.go b/custom/auth/ante/min_initial_deposit_test.go index adbc7d91..789c44c9 100644 --- a/custom/auth/ante/min_initial_deposit_test.go +++ b/custom/auth/ante/min_initial_deposit_test.go @@ -19,9 +19,7 @@ import ( // cosmosante "github.com/cosmos/cosmos-sdk/x/auth/ante" // "github.com/cosmos/cosmos-sdk/x/auth/types" // minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - - govv2lunc1types "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" - + govv2lunc1 "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) @@ -34,7 +32,7 @@ func (suite *AnteTestSuite) TestMinInitialDepositRatioDefault() { antehandler := sdk.ChainAnteDecorators(midd) // set required deposit to uluna - suite.app.GovKeeper.SetParams(suite.ctx, govv2lunc1types.DefaultParams()) + suite.app.GovKeeper.SetParams(suite.ctx, govv2lunc1.DefaultParams()) govparams := suite.app.GovKeeper.GetParams(suite.ctx) govparams.MinDeposit = sdk.NewCoins( sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(1_000_000)), @@ -89,7 +87,7 @@ func (suite *AnteTestSuite) TestMinInitialDepositRatioWithSufficientDeposit() { antehandler := sdk.ChainAnteDecorators(midd) // set required deposit to uluna - suite.app.GovKeeper.SetParams(suite.ctx, govv2lunc1types.DefaultParams()) + suite.app.GovKeeper.SetParams(suite.ctx, govv2lunc1.DefaultParams()) govparams := suite.app.GovKeeper.GetParams(suite.ctx) govparams.MinDeposit = sdk.NewCoins( sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(1_000_000)), @@ -146,7 +144,7 @@ func (suite *AnteTestSuite) TestMinInitialDepositRatioWithInsufficientDeposit() antehandler := sdk.ChainAnteDecorators(midd) // set required deposit to uluna - suite.app.GovKeeper.SetParams(suite.ctx, govv2lunc1types.DefaultParams()) + suite.app.GovKeeper.SetParams(suite.ctx, govv2lunc1.DefaultParams()) govparams := suite.app.GovKeeper.GetParams(suite.ctx) govparams.MinDeposit = sdk.NewCoins( sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(1_000_000)), diff --git a/custom/distribution/types/codec.go b/custom/distribution/types/codec.go index ca563fcb..6672264a 100644 --- a/custom/distribution/types/codec.go +++ b/custom/distribution/types/codec.go @@ -5,8 +5,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec/legacy" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/x/distribution/types" - - govtypes "github.com/classic-terra/core/v3/custom/gov/types" ) // RegisterLegacyAminoCodec registers the necessary x/distribution interfaces and concrete types @@ -31,5 +29,4 @@ func init() { cryptocodec.RegisterCrypto(amino) amino.Seal() - govtypes.RegisterProposalTypeCodec(types.CommunityPoolSpendProposal{}, "distribution/CommunityPoolSpendProposal") } diff --git a/custom/gov/client/cli/query.go b/custom/gov/client/cli/query.go index 3a09d48d..fc5aaccd 100644 --- a/custom/gov/client/cli/query.go +++ b/custom/gov/client/cli/query.go @@ -11,6 +11,7 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/version" + govcli "github.com/cosmos/cosmos-sdk/x/gov/client/cli" "github.com/cosmos/cosmos-sdk/x/gov/types" ) @@ -27,6 +28,16 @@ func GetQueryCmd() *cobra.Command { govQueryCmd.AddCommand( GetCmdQueryMinimalDeposit(), + govcli.GetCmdQueryProposal(), + govcli.GetCmdQueryProposals(), + govcli.GetCmdQueryVote(), + govcli.GetCmdQueryVotes(), + govcli.GetCmdQueryParams(), + govcli.GetCmdQueryParam(), + govcli.GetCmdQueryProposer(), + govcli.GetCmdQueryDeposit(), + govcli.GetCmdQueryDeposits(), + govcli.GetCmdQueryTally(), ) return govQueryCmd diff --git a/custom/gov/genesis.go b/custom/gov/genesis.go new file mode 100644 index 00000000..e0f5d1ca --- /dev/null +++ b/custom/gov/genesis.go @@ -0,0 +1,80 @@ +package gov + +import ( + "fmt" + + "github.com/classic-terra/core/v3/custom/gov/keeper" + "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" +) + +// InitGenesis - store genesis parameters +func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, k *keeper.Keeper, data *v2lunc1.GenesisState) { + k.SetProposalID(ctx, data.StartingProposalId) + k.SetParams(ctx, *data.Params) + + // check if the deposits pool account exists + moduleAcc := k.GetGovernanceAccount(ctx) + if moduleAcc == nil { + panic(fmt.Sprintf("%s module account has not been set", types.ModuleName)) + } + + var totalDeposits sdk.Coins + for _, deposit := range data.Deposits { + k.SetDeposit(ctx, *deposit) + totalDeposits = totalDeposits.Add(deposit.Amount...) + } + + for _, vote := range data.Votes { + k.SetVote(ctx, *vote) + } + + for _, proposal := range data.Proposals { + switch proposal.Status { + case govv1.StatusDepositPeriod: + k.InsertInactiveProposalQueue(ctx, proposal.Id, *proposal.DepositEndTime) + case govv1.StatusVotingPeriod: + k.InsertActiveProposalQueue(ctx, proposal.Id, *proposal.VotingEndTime) + } + k.SetProposal(ctx, *proposal) + } + + // if account has zero balance it probably means it's not set, so we set it + balance := bk.GetAllBalances(ctx, moduleAcc.GetAddress()) + if balance.IsZero() { + ak.SetModuleAccount(ctx, moduleAcc) + } + + // check if total deposits equals balance, if it doesn't panic because there were export/import errors + if !balance.IsEqual(totalDeposits) { + panic(fmt.Sprintf("expected module account was %s but we got %s", balance.String(), totalDeposits.String())) + } +} + +// ExportGenesis - output genesis parameters +func ExportGenesis(ctx sdk.Context, k *keeper.Keeper) *v2lunc1.GenesisState { + startingProposalID, _ := k.GetProposalID(ctx) + proposals := k.GetProposals(ctx) + params := k.GetParams(ctx) + + var proposalsDeposits govv1.Deposits + var proposalsVotes govv1.Votes + for _, proposal := range proposals { + deposits := k.GetDeposits(ctx, proposal.Id) + proposalsDeposits = append(proposalsDeposits, deposits...) + + votes := k.GetVotes(ctx, proposal.Id) + proposalsVotes = append(proposalsVotes, votes...) + } + + return &v2lunc1.GenesisState{ + StartingProposalId: startingProposalID, + Deposits: proposalsDeposits, + Votes: proposalsVotes, + Proposals: proposals, + Params: ¶ms, + } +} diff --git a/custom/gov/keeper/common_test.go b/custom/gov/keeper/common_test.go index 7d28f63f..c610c6f0 100644 --- a/custom/gov/keeper/common_test.go +++ b/custom/gov/keeper/common_test.go @@ -23,7 +23,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types" + v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" ) var ( @@ -92,7 +92,7 @@ func setupGovKeeper(t *testing.T) ( // Register all handlers for the MegServiceRouter. msr.SetInterfaceRegistry(encCfg.InterfaceRegistry) - v1.RegisterMsgServer(msr, keeper.NewMsgServerImpl(govKeeper)) + v2lunc1types.RegisterMsgServer(msr, keeper.NewMsgServerImpl(govKeeper)) banktypes.RegisterMsgServer(msr, nil) // Nil is fine here as long as we never execute the proposal's Msgs. return govKeeper, acctKeeper, bankKeeper, stakingKeeper, encCfg, ctx diff --git a/custom/gov/keeper/keeper.go b/custom/gov/keeper/keeper.go index 06da7b6c..144b1432 100644 --- a/custom/gov/keeper/keeper.go +++ b/custom/gov/keeper/keeper.go @@ -95,7 +95,6 @@ func (keeper Keeper) assertMetadataLength(metadata string) error { return nil } -// SetHooks sets the hooks for governance func (keeper *Keeper) SetHooks(gh types.GovHooks) *Keeper { if keeper.hooks != nil { panic("cannot set governance hooks twice") @@ -104,4 +103,4 @@ func (keeper *Keeper) SetHooks(gh types.GovHooks) *Keeper { keeper.hooks = gh return keeper -} +} \ No newline at end of file diff --git a/custom/gov/keeper/migrator.go b/custom/gov/keeper/migrator.go new file mode 100644 index 00000000..78921c53 --- /dev/null +++ b/custom/gov/keeper/migrator.go @@ -0,0 +1,44 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/gov/exported" + v2 "github.com/cosmos/cosmos-sdk/x/gov/migrations/v2" + v3 "github.com/cosmos/cosmos-sdk/x/gov/migrations/v3" + v4 "github.com/cosmos/cosmos-sdk/x/gov/migrations/v4" + v5 "github.com/classic-terra/core/v3/custom/gov/migrations/v5" +) + +// Migrator is a struct for handling in-place store migrations. +type Migrator struct { + keeper *Keeper + legacySubspace exported.ParamSubspace +} + +// NewMigrator returns a new Migrator. +func NewMigrator(keeper *Keeper, legacySubspace exported.ParamSubspace) Migrator { + return Migrator{ + keeper: keeper, + legacySubspace: legacySubspace, + } +} + +// Migrate1to2 migrates from version 1 to 2. +func (m Migrator) Migrate1to2(ctx sdk.Context) error { + return v2.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc) +} + +// Migrate2to3 migrates from version 2 to 3. +func (m Migrator) Migrate2to3(ctx sdk.Context) error { + return v3.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc) +} + +// Migrate3to4 migrates from version 3 to 4. +func (m Migrator) Migrate3to4(ctx sdk.Context) error { + return v4.MigrateStore(ctx, m.keeper.storeKey, m.legacySubspace, m.keeper.cdc) +} + +// Migrate4to5 migrates from version 4 to 5. +func (m Migrator) Migrate4to5(ctx sdk.Context) error { + return v5.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc) +} \ No newline at end of file diff --git a/custom/gov/keeper/msg_server.go b/custom/gov/keeper/msg_server.go index cbbbb7b2..43341020 100644 --- a/custom/gov/keeper/msg_server.go +++ b/custom/gov/keeper/msg_server.go @@ -4,26 +4,34 @@ import ( "context" "fmt" - v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + "cosmossdk.io/errors" + v2lunc1 "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" sdk "github.com/cosmos/cosmos-sdk/types" sdktx "github.com/cosmos/cosmos-sdk/types/tx" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) type msgServer struct { *Keeper + v1MsgServer govv1.MsgServer } // NewMsgServerImpl returns an implementation of the gov MsgServer interface // for the provided Keeper. -func NewMsgServerImpl(keeper *Keeper) v2lunc1types.MsgServer { - return &msgServer{Keeper: keeper} +func NewMsgServerImpl(keeper *Keeper) v2lunc1.MsgServer { + return &msgServer{ + Keeper: keeper, + v1MsgServer: govkeeper.NewMsgServerImpl(keeper.Keeper), + } } -var _ v2lunc1types.MsgServer = msgServer{} +var _ v2lunc1.MsgServer = msgServer{} // SubmitProposal implements the MsgServer.SubmitProposal method. -func (k msgServer) SubmitProposal(goCtx context.Context, msg *v2lunc1types.MsgSubmitProposal) (*v2lunc1types.MsgSubmitProposalResponse, error) { +func (k msgServer) SubmitProposal(goCtx context.Context, msg *govv1.MsgSubmitProposal) (*govv1.MsgSubmitProposalResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) // initialDeposit := msg.GetInitialDeposit() @@ -71,13 +79,13 @@ func (k msgServer) SubmitProposal(goCtx context.Context, msg *v2lunc1types.MsgSu ) } - return &v2lunc1types.MsgSubmitProposalResponse{ + return &govv1.MsgSubmitProposalResponse{ ProposalId: proposal.Id, }, nil } // Deposit implements the MsgServer.Deposit method. -func (k msgServer) Deposit(goCtx context.Context, msg *v2lunc1types.MsgDeposit) (*v2lunc1types.MsgDepositResponse, error) { +func (k msgServer) Deposit(goCtx context.Context, msg *govv1.MsgDeposit) (*govv1.MsgDepositResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) accAddr, err := sdk.AccAddressFromBech32(msg.Depositor) if err != nil { @@ -97,5 +105,113 @@ func (k msgServer) Deposit(goCtx context.Context, msg *v2lunc1types.MsgDeposit) ) } - return &v2lunc1types.MsgDepositResponse{}, nil + return &govv1.MsgDepositResponse{}, nil +} + +func (k msgServer) ExecLegacyContent(goCtx context.Context, msg *govv1.MsgExecLegacyContent) (*govv1.MsgExecLegacyContentResponse, error) { + return k.v1MsgServer.ExecLegacyContent(goCtx, msg) +} + +func (k msgServer) Vote(goCtx context.Context, msg *govv1.MsgVote) (*govv1.MsgVoteResponse, error) { + return k.v1MsgServer.Vote(goCtx, msg) +} + +func (k msgServer) VoteWeighted(goCtx context.Context, msg *govv1.MsgVoteWeighted) (*govv1.MsgVoteWeightedResponse, error) { + return k.v1MsgServer.VoteWeighted(goCtx, msg) +} + +func (k msgServer) UpdateParams(goCtx context.Context, msg *v2lunc1.MsgUpdateParams) (*v2lunc1.MsgUpdateParamsResponse, error) { + if k.authority != msg.Authority { + return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := k.SetParams(ctx, msg.Params); err != nil { + return nil, err + } + + return &v2lunc1.MsgUpdateParamsResponse{}, nil +} + +type legacyMsgServer struct { + govAcct string + server v2lunc1.MsgServer +} + +// NewLegacyMsgServerImpl returns an implementation of the v1beta1 legacy MsgServer interface. It wraps around +// the current MsgServer +func NewLegacyMsgServerImpl(govAcct string, v2lunc1Server v2lunc1.MsgServer) govv1beta1.MsgServer { + return &legacyMsgServer{govAcct: govAcct, server: v2lunc1Server} +} + +var _ govv1beta1.MsgServer = legacyMsgServer{} + +func (k legacyMsgServer) SubmitProposal(goCtx context.Context, msg *govv1beta1.MsgSubmitProposal) (*govv1beta1.MsgSubmitProposalResponse, error) { + contentMsg, err := govv1.NewLegacyContent(msg.GetContent(), k.govAcct) + if err != nil { + return nil, fmt.Errorf("error converting legacy content into proposal message: %w", err) + } + + proposal, err := govv1.NewMsgSubmitProposal( + []sdk.Msg{contentMsg}, + msg.InitialDeposit, + msg.Proposer, + "", + msg.GetContent().GetTitle(), + msg.GetContent().GetDescription(), + ) + if err != nil { + return nil, err + } + + resp, err := k.server.SubmitProposal(goCtx, proposal) + if err != nil { + return nil, err + } + + return &govv1beta1.MsgSubmitProposalResponse{ProposalId: resp.ProposalId}, nil +} + +func (k legacyMsgServer) Vote(goCtx context.Context, msg *govv1beta1.MsgVote) (*govv1beta1.MsgVoteResponse, error) { + _, err := k.server.Vote(goCtx, &govv1.MsgVote{ + ProposalId: msg.ProposalId, + Voter: msg.Voter, + Option: govv1.VoteOption(msg.Option), + }) + if err != nil { + return nil, err + } + return &govv1beta1.MsgVoteResponse{}, nil +} + +func (k legacyMsgServer) VoteWeighted(goCtx context.Context, msg *govv1beta1.MsgVoteWeighted) (*govv1beta1.MsgVoteWeightedResponse, error) { + opts := make([]*govv1.WeightedVoteOption, len(msg.Options)) + for idx, opt := range msg.Options { + opts[idx] = &govv1.WeightedVoteOption{ + Option: govv1.VoteOption(opt.Option), + Weight: opt.Weight.String(), + } + } + + _, err := k.server.VoteWeighted(goCtx, &govv1.MsgVoteWeighted{ + ProposalId: msg.ProposalId, + Voter: msg.Voter, + Options: opts, + }) + if err != nil { + return nil, err + } + return &govv1beta1.MsgVoteWeightedResponse{}, nil +} + +func (k legacyMsgServer) Deposit(goCtx context.Context, msg *govv1beta1.MsgDeposit) (*govv1beta1.MsgDepositResponse, error) { + _, err := k.server.Deposit(goCtx, &govv1.MsgDeposit{ + ProposalId: msg.ProposalId, + Depositor: msg.Depositor, + Amount: msg.Amount, + }) + if err != nil { + return nil, err + } + return &govv1beta1.MsgDepositResponse{}, nil } diff --git a/custom/gov/keeper/proposal.go b/custom/gov/keeper/proposal.go index fd427e01..9983670b 100644 --- a/custom/gov/keeper/proposal.go +++ b/custom/gov/keeper/proposal.go @@ -97,7 +97,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat keeper.InsertInactiveProposalQueue(ctx, proposalID, *proposal.DepositEndTime) keeper.SetProposalID(ctx, proposalID+1) - err, totalLuncDeposit := keeper.GetMinimumDepositBaseUusd(ctx) + totalLuncDeposit, err := keeper.GetMinimumDepositBaseUusd(ctx) if err != nil { return v1.Proposal{}, sdkerrors.Wrap(v2lunc1types.ErrQueryExchangeRateUusdFail, err.Error()) } @@ -134,18 +134,18 @@ func (keeper Keeper) SetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64, } // GetDepositLimitBaseUusd: calculate the minimum LUNC amount to deposit base on Uusd for the proposal -func (keeper Keeper) GetMinimumDepositBaseUusd(ctx sdk.Context) (error, math.Int) { +func (keeper Keeper) GetMinimumDepositBaseUusd(ctx sdk.Context) (math.Int, error) { // Get exchange rate betweent Lunc/uusd from oracle // save it to store price, err := keeper.oracleKeeper.GetLunaExchangeRate(ctx, core.MicroUSDDenom) if err != nil && price.LTE(sdk.ZeroDec()) { - return err, sdk.ZeroInt() + return sdk.ZeroInt(), err } minUusdDeposit := keeper.GetParams(ctx).MinUusdDeposit totalLuncDeposit := sdk.NewDecFromInt(minUusdDeposit.Amount).Quo(price).TruncateInt() if err != nil { - return err, sdk.ZeroInt() + return sdk.ZeroInt(), err } - return nil, totalLuncDeposit + return totalLuncDeposit, nil } diff --git a/custom/gov/migrations/v5/store.go b/custom/gov/migrations/v5/store.go new file mode 100644 index 00000000..9101045f --- /dev/null +++ b/custom/gov/migrations/v5/store.go @@ -0,0 +1,50 @@ +package v5 + +import ( + "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + "github.com/cosmos/cosmos-sdk/codec" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" +) + +var ParamsKey = []byte{0x30} + +func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) error { + return migrateParams(ctx, storeKey, cdc) +} + +func migrateParams(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) error { + store := ctx.KVStore(storeKey) + + bz := store.Get(ParamsKey) + var params govv1.Params + err := cdc.Unmarshal(bz, ¶ms) + if err != nil { + return err + } + + defaultParams := v2lunc1.DefaultParams() + newParams := v2lunc1.NewParams( + params.MinDeposit, + *params.MaxDepositPeriod, + *params.VotingPeriod, + params.Quorum, + params.Threshold, + params.VetoThreshold, + params.MinInitialDepositRatio, + params.BurnProposalDepositPrevote, + params.BurnVoteQuorum, + params.BurnVoteVeto, + defaultParams.MinUusdDeposit, + ) + + bz, err = cdc.Marshal(&newParams) + if err != nil { + return err + } + + store.Set(ParamsKey, bz) + + return nil +} diff --git a/custom/gov/module.go b/custom/gov/module.go index e0c3da8a..3f85297d 100644 --- a/custom/gov/module.go +++ b/custom/gov/module.go @@ -1,31 +1,120 @@ package gov import ( + "context" "encoding/json" + "fmt" + "github.com/spf13/cobra" + + abci "github.com/cometbft/cometbft/abci/types" + gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" + + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/gov" - "github.com/cosmos/cosmos-sdk/x/gov/keeper" - v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - "github.com/spf13/cobra" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" - v2lunc1 "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + "github.com/cosmos/cosmos-sdk/x/gov" govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" + "github.com/cosmos/cosmos-sdk/x/gov/client/cli" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + "github.com/cosmos/cosmos-sdk/x/gov/simulation" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" customcli "github.com/classic-terra/core/v3/custom/gov/client/cli" - customtypes "github.com/classic-terra/core/v3/custom/gov/types" + "github.com/classic-terra/core/v3/custom/gov/keeper" + "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" core "github.com/classic-terra/core/v3/types" markettypes "github.com/classic-terra/core/v3/x/market/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) +const ConsensusVersion = 4 + var _ module.AppModuleBasic = AppModuleBasic{} // AppModuleBasic defines the basic application module used by the gov module. type AppModuleBasic struct { gov.AppModuleBasic + legacyProposalHandlers []govclient.ProposalHandler +} + +// Name returns the gov module's name. +func (AppModuleBasic) Name() string { + return govtypes.ModuleName +} + +// NewAppModuleBasic creates a new AppModuleBasic object +func NewAppModuleBasic(proposalHandlers []govclient.ProposalHandler) AppModuleBasic { + return AppModuleBasic{ + AppModuleBasic: gov.NewAppModuleBasic(proposalHandlers), + legacyProposalHandlers: proposalHandlers, + } +} + +// GetTxCmd returns the root tx command for the bank module. +func (a AppModuleBasic) GetTxCmd() *cobra.Command { + legacyProposalCLIHandlers := getProposalCLIHandlers(a.legacyProposalHandlers) + return cli.NewTxCmd(legacyProposalCLIHandlers) +} + +func getProposalCLIHandlers(handlers []govclient.ProposalHandler) []*cobra.Command { + proposalCLIHandlers := make([]*cobra.Command, 0, len(handlers)) + for _, proposalHandler := range handlers { + proposalCLIHandlers = append(proposalCLIHandlers, proposalHandler.CLIHandler()) + } + return proposalCLIHandlers +} + +// GetQueryCmd returns no root query command for the oracle module. +func (AppModuleBasic) GetQueryCmd() *cobra.Command { + return customcli.GetQueryCmd() +} + +// RegisterLegacyAminoCodec registers the gov module's types for the given codec. +func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + v1beta1.RegisterLegacyAminoCodec(cdc) + v2lunc1.RegisterLegacyAminoCodec(cdc) +} + +// RegisterInterfaces implements InterfaceModule.RegisterInterfaces +func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { + v1beta1.RegisterInterfaces(registry) + v2lunc1.RegisterInterfaces(registry) +} + +// DefaultGenesis returns default genesis state as raw bytes for the gov +// module. +func (am AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { + // customize to set default genesis state deposit denom to uluna + defaultGenesisState := v1.DefaultGenesisState() + defaultGenesisState.Params.MinDeposit[0].Denom = core.MicroLunaDenom + + return cdc.MustMarshalJSON(defaultGenesisState) +} + +// ValidateGenesis performs genesis state validation for the gov module. +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { + var data v2lunc1.GenesisState + if err := cdc.UnmarshalJSON(bz, &data); err != nil { + return fmt.Errorf("failed to unmarshal %s genesis state: %w", govtypes.ModuleName, err) + } + + return v2lunc1.ValidateGenesis(&data) +} + +// RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the gov module. +func (a AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *gwruntime.ServeMux) { + if err := v1.RegisterQueryHandlerClient(context.Background(), mux, v1.NewQueryClient(clientCtx)); err != nil { + panic(err) + } + if err := v1beta1.RegisterQueryHandlerClient(context.Background(), mux, v1beta1.NewQueryClient(clientCtx)); err != nil { + panic(err) + } } // AppModule implements an application module for the gov module. @@ -34,50 +123,117 @@ type AppModule struct { accountKeeper govtypes.AccountKeeper bankKeeper govtypes.BankKeeper oracleKeeper markettypes.OracleKeeper + keeper keeper.Keeper // legacySubspace is used solely for migration of x/params managed parameters legacySubspace govtypes.ParamSubspace } // NewAppModule creates a new AppModule object -func NewAppModule(cdc codec.Codec, keeper *keeper.Keeper, accountKeeper govtypes.AccountKeeper, bankKeeper govtypes.BankKeeper, oracleKeeper markettypes.OracleKeeper, legacySubspace govtypes.ParamSubspace) AppModule { +func NewAppModule(cdc codec.Codec, keeper keeper.Keeper, accountKeeper govtypes.AccountKeeper, bankKeeper govtypes.BankKeeper, oracleKeeper markettypes.OracleKeeper, legacySubspace govtypes.ParamSubspace) AppModule { return AppModule{ - AppModule: gov.NewAppModule(cdc, keeper, accountKeeper, bankKeeper, legacySubspace), + AppModule: gov.NewAppModule(cdc, keeper.Keeper, accountKeeper, bankKeeper, legacySubspace), accountKeeper: accountKeeper, bankKeeper: bankKeeper, oracleKeeper: oracleKeeper, + keeper: keeper, legacySubspace: legacySubspace, } } -// NewAppModuleBasic creates a new AppModuleBasic object -func NewAppModuleBasic(proposalHandlers []govclient.ProposalHandler) AppModuleBasic { - return AppModuleBasic{gov.NewAppModuleBasic(proposalHandlers)} +// Name returns the gov module's name. +func (AppModule) Name() string { + return govtypes.ModuleName } -// GetTxCmd returns the root tx command for the bank module. -func (AppModuleBasic) GetTxCmd() *cobra.Command { - return customcli.GetTxCmd() +// RegisterInvariants registers module invariants +func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { + am.AppModule.RegisterInvariants(ir) } -// GetQueryCmd returns no root query command for the oracle module. -func (AppModuleBasic) GetQueryCmd() *cobra.Command { - return customcli.GetQueryCmd() +// RegisterServices registers module services. +func (am AppModule) RegisterServices(cfg module.Configurator) { + msgServer := keeper.NewMsgServerImpl(&am.keeper) + v1beta1.RegisterMsgServer(cfg.MsgServer(), keeper.NewLegacyMsgServerImpl(am.accountKeeper.GetModuleAddress(govtypes.ModuleName).String(), msgServer)) + v2lunc1.RegisterMsgServer(cfg.MsgServer(), msgServer) + + legacyQueryServer := govkeeper.NewLegacyQueryServer(am.keeper.Keeper) + v1beta1.RegisterQueryServer(cfg.QueryServer(), legacyQueryServer) + // TODO: handle query + // v2lunc1.RegisterQueryServer(cfg.QueryServer(), am.keeper) + + // TODO: migrator + m := keeper.NewMigrator(&am.keeper, am.legacySubspace) + err := cfg.RegisterMigration(govtypes.ModuleName, 1, m.Migrate1to2) + if err != nil { + panic(fmt.Sprintf("failed to migrate x/gov from version 1 to 2: %v", err)) + } + err = cfg.RegisterMigration(govtypes.ModuleName, 2, m.Migrate2to3) + if err != nil { + panic(fmt.Sprintf("failed to migrate x/gov from version 2 to 3: %v", err)) + } + err = cfg.RegisterMigration(govtypes.ModuleName, 3, m.Migrate3to4) + if err != nil { + panic(fmt.Sprintf("failed to migrate x/gov from version 3 to 4: %v", err)) + } + err = cfg.RegisterMigration(govtypes.ModuleName, 4, m.Migrate4to5) + if err != nil { + panic(fmt.Sprintf("failed to migrate x/gov from version 4 to 5: %v", err)) + } } -// RegisterLegacyAminoCodec registers the gov module's types for the given codec. -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - customtypes.RegisterLegacyAminoCodec(cdc) - *govcodec.ModuleCdc = *customtypes.ModuleCdc - v1.RegisterLegacyAminoCodec(cdc) +// InitGenesis performs genesis initialization for the gov module. It returns +// no validator updates. +func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { + var genesisState v2lunc1.GenesisState + cdc.MustUnmarshalJSON(data, &genesisState) + InitGenesis(ctx, am.accountKeeper, am.bankKeeper, &am.keeper, &genesisState) + return []abci.ValidatorUpdate{} } -// DefaultGenesis returns default genesis state as raw bytes for the gov +// ExportGenesis returns the exported genesis state as raw bytes for the gov // module. -func (am AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - // customize to set default genesis state deposit denom to uluna - defaultGenesisState := v2lunc1.DefaultGenesisState() - defaultGenesisState.Params.MinDeposit[0].Denom = core.MicroLunaDenom +func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { + return am.AppModule.ExportGenesis(ctx, cdc) +} - return cdc.MustMarshalJSON(defaultGenesisState) +// ConsensusVersion implements AppModule/ConsensusVersion. +func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } + +// EndBlock returns the end blocker for the gov module. It returns no validator +// updates. +func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate { + return am.AppModule.EndBlock(ctx, req) +} + +// AppModuleSimulation functions + +// GenerateGenesisState creates a randomized GenState of the gov module. +func (AppModule) GenerateGenesisState(simState *module.SimulationState) { + simulation.RandomizedGenState(simState) +} + +// ProposalContents returns all the gov content functions used to +// simulate governance proposals. +func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { //nolint:staticcheck + return simulation.ProposalContents() +} + +// ProposalMsgs returns all the gov msgs used to simulate governance proposals. +func (AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { + return simulation.ProposalMsgs() +} + +// RegisterStoreDecoder registers a decoder for gov module's types +func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { + am.AppModule.RegisterStoreDecoder(sdr) +} + +// WeightedOperations returns the all the gov module operations with their respective weights. +func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { + return simulation.WeightedOperations( + simState.AppParams, simState.Cdc, + am.accountKeeper, am.bankKeeper, am.keeper.Keeper, + simState.ProposalMsgs, simState.LegacyProposalContents, + ) } diff --git a/custom/gov/types/v2lunc1/codec.go b/custom/gov/types/v2lunc1/codec.go new file mode 100644 index 00000000..48ecb589 --- /dev/null +++ b/custom/gov/types/v2lunc1/codec.go @@ -0,0 +1,58 @@ +package v2lunc1 + +import ( + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/legacy" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" + authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" + govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" +) + +// RegisterLegacyAminoCodec registers all the necessary types and interfaces for the +// governance module. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + legacy.RegisterAminoMsg(cdc, &govv1.MsgSubmitProposal{}, "cosmos-sdk/v1/MsgSubmitProposal") + legacy.RegisterAminoMsg(cdc, &govv1.MsgDeposit{}, "cosmos-sdk/v1/MsgDeposit") + legacy.RegisterAminoMsg(cdc, &govv1.MsgVote{}, "cosmos-sdk/v1/MsgVote") + legacy.RegisterAminoMsg(cdc, &govv1.MsgVoteWeighted{}, "cosmos-sdk/v1/MsgVoteWeighted") + legacy.RegisterAminoMsg(cdc, &govv1.MsgExecLegacyContent{}, "cosmos-sdk/v1/MsgExecLegacyContent") + legacy.RegisterAminoMsg(cdc, &MsgUpdateParams{}, "cosmos-sdk/x/gov/v1/MsgUpdateParams") +} + +// RegisterInterfaces registers the interfaces types with the Interface Registry. +func RegisterInterfaces(registry codectypes.InterfaceRegistry) { + registry.RegisterImplementations((*sdk.Msg)(nil), + &govv1.MsgSubmitProposal{}, + &govv1.MsgVote{}, + &govv1.MsgVoteWeighted{}, + &govv1.MsgDeposit{}, + &govv1.MsgExecLegacyContent{}, + &MsgUpdateParams{}, + ) + + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) +} + +var ( + amino = codec.NewLegacyAmino() + + // ModuleCdc references the global x/gov module codec. Note, the codec should + // ONLY be used in certain instances of tests and for JSON encoding as Amino is + // still used for that purpose. + // + // The actual codec used for serialization should be provided to x/gov and + // defined at the application level. + ModuleCdc = codec.NewAminoCodec(amino) +) + +func init() { + // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be + // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances + RegisterLegacyAminoCodec(authzcodec.Amino) + RegisterLegacyAminoCodec(govcodec.Amino) + RegisterLegacyAminoCodec(groupcodec.Amino) +} diff --git a/custom/gov/types/v2lunc1/genesis.go b/custom/gov/types/v2lunc1/genesis.go index c26d3a87..006ae2fb 100644 --- a/custom/gov/types/v2lunc1/genesis.go +++ b/custom/gov/types/v2lunc1/genesis.go @@ -1,7 +1,13 @@ package v2lunc1 import ( - v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + "errors" + "fmt" + + "golang.org/x/sync/errgroup" + + "github.com/cosmos/cosmos-sdk/codec/types" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) // NewGenesisState creates a new genesis state for the governance module @@ -15,7 +21,100 @@ func NewGenesisState(startingProposalID uint64, params Params) *GenesisState { // DefaultGenesisState defines the default governance genesis state func DefaultGenesisState() *GenesisState { return NewGenesisState( - v1.DefaultStartingProposalID, + govv1.DefaultStartingProposalID, DefaultParams(), ) } + +// Empty returns true if a GenesisState is empty +func (data GenesisState) Empty() bool { + return data.StartingProposalId == 0 || data.Params == nil +} + +// ValidateGenesis checks if gov genesis state is valid ranges +// It checks if params are in valid ranges +// It also makes sure that the provided proposal IDs are unique and +// that there are no duplicate deposit or vote records and no vote or deposits for non-existent proposals +func ValidateGenesis(data *GenesisState) error { + if data.StartingProposalId == 0 { + return errors.New("starting proposal id must be greater than 0") + } + + var errGroup errgroup.Group + + // weed out duplicate proposals + proposalIds := make(map[uint64]struct{}) + for _, p := range data.Proposals { + if _, ok := proposalIds[p.Id]; ok { + return fmt.Errorf("duplicate proposal id: %d", p.Id) + } + + proposalIds[p.Id] = struct{}{} + } + + // weed out duplicate deposits + errGroup.Go(func() error { + type depositKey struct { + ProposalId uint64 + Depositor string + } + depositIds := make(map[depositKey]struct{}) + for _, d := range data.Deposits { + if _, ok := proposalIds[d.ProposalId]; !ok { + return fmt.Errorf("deposit %v has non-existent proposal id: %d", d, d.ProposalId) + } + + dk := depositKey{d.ProposalId, d.Depositor} + if _, ok := depositIds[dk]; ok { + return fmt.Errorf("duplicate deposit: %v", d) + } + + depositIds[dk] = struct{}{} + } + + return nil + }) + + // weed out duplicate votes + errGroup.Go(func() error { + type voteKey struct { + ProposalId uint64 + Voter string + } + voteIds := make(map[voteKey]struct{}) + for _, v := range data.Votes { + if _, ok := proposalIds[v.ProposalId]; !ok { + return fmt.Errorf("vote %v has non-existent proposal id: %d", v, v.ProposalId) + } + + vk := voteKey{v.ProposalId, v.Voter} + if _, ok := voteIds[vk]; ok { + return fmt.Errorf("duplicate vote: %v", v) + } + + voteIds[vk] = struct{}{} + } + + return nil + }) + + // verify params + errGroup.Go(func() error { + return data.Params.ValidateBasic() + }) + + return errGroup.Wait() +} + +var _ types.UnpackInterfacesMessage = GenesisState{} + +// UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces +func (data GenesisState) UnpackInterfaces(unpacker types.AnyUnpacker) error { + for _, p := range data.Proposals { + err := p.UnpackInterfaces(unpacker) + if err != nil { + return err + } + } + return nil +} diff --git a/custom/gov/types/v2lunc1/genesis.pb.go b/custom/gov/types/v2lunc1/genesis.pb.go index 1c0c9095..abd53cc3 100644 --- a/custom/gov/types/v2lunc1/genesis.pb.go +++ b/custom/gov/types/v2lunc1/genesis.pb.go @@ -5,7 +5,12 @@ package v2lunc1 import ( fmt "fmt" + _ "github.com/cosmos/cosmos-proto" + _ "github.com/cosmos/cosmos-sdk/types" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" + _ "github.com/gogo/protobuf/types" io "io" math "math" math_bits "math/bits" @@ -27,20 +32,20 @@ type GenesisState struct { // starting_proposal_id is the ID of the starting proposal. StartingProposalId uint64 `protobuf:"varint,1,opt,name=starting_proposal_id,json=startingProposalId,proto3" json:"starting_proposal_id,omitempty"` // deposits defines all the deposits present at genesis. - Deposits []*Deposit `protobuf:"bytes,2,rep,name=deposits,proto3" json:"deposits,omitempty"` + Deposits []*v1.Deposit `protobuf:"bytes,2,rep,name=deposits,proto3" json:"deposits,omitempty"` // votes defines all the votes present at genesis. - Votes []*Vote `protobuf:"bytes,3,rep,name=votes,proto3" json:"votes,omitempty"` + Votes []*v1.Vote `protobuf:"bytes,3,rep,name=votes,proto3" json:"votes,omitempty"` // proposals defines all the proposals present at genesis. - Proposals []*Proposal `protobuf:"bytes,4,rep,name=proposals,proto3" json:"proposals,omitempty"` + Proposals []*v1.Proposal `protobuf:"bytes,4,rep,name=proposals,proto3" json:"proposals,omitempty"` // Deprecated: Prefer to use `params` instead. // deposit_params defines all the paramaters of related to deposit. - DepositParams *DepositParams `protobuf:"bytes,5,opt,name=deposit_params,json=depositParams,proto3" json:"deposit_params,omitempty"` // Deprecated: Do not use. + DepositParams *v1.DepositParams `protobuf:"bytes,5,opt,name=deposit_params,json=depositParams,proto3" json:"deposit_params,omitempty"` // Deprecated: Do not use. // Deprecated: Prefer to use `params` instead. // voting_params defines all the paramaters of related to voting. - VotingParams *VotingParams `protobuf:"bytes,6,opt,name=voting_params,json=votingParams,proto3" json:"voting_params,omitempty"` // Deprecated: Do not use. + VotingParams *v1.VotingParams `protobuf:"bytes,6,opt,name=voting_params,json=votingParams,proto3" json:"voting_params,omitempty"` // Deprecated: Do not use. // Deprecated: Prefer to use `params` instead. // tally_params defines all the paramaters of related to tally. - TallyParams *TallyParams `protobuf:"bytes,7,opt,name=tally_params,json=tallyParams,proto3" json:"tally_params,omitempty"` // Deprecated: Do not use. + TallyParams *v1.TallyParams `protobuf:"bytes,7,opt,name=tally_params,json=tallyParams,proto3" json:"tally_params,omitempty"` // Deprecated: Do not use. // params defines all the paramaters of x/gov module. // // Since: cosmos-sdk 0.47 @@ -87,21 +92,21 @@ func (m *GenesisState) GetStartingProposalId() uint64 { return 0 } -func (m *GenesisState) GetDeposits() []*Deposit { +func (m *GenesisState) GetDeposits() []*v1.Deposit { if m != nil { return m.Deposits } return nil } -func (m *GenesisState) GetVotes() []*Vote { +func (m *GenesisState) GetVotes() []*v1.Vote { if m != nil { return m.Votes } return nil } -func (m *GenesisState) GetProposals() []*Proposal { +func (m *GenesisState) GetProposals() []*v1.Proposal { if m != nil { return m.Proposals } @@ -109,7 +114,7 @@ func (m *GenesisState) GetProposals() []*Proposal { } // Deprecated: Do not use. -func (m *GenesisState) GetDepositParams() *DepositParams { +func (m *GenesisState) GetDepositParams() *v1.DepositParams { if m != nil { return m.DepositParams } @@ -117,7 +122,7 @@ func (m *GenesisState) GetDepositParams() *DepositParams { } // Deprecated: Do not use. -func (m *GenesisState) GetVotingParams() *VotingParams { +func (m *GenesisState) GetVotingParams() *v1.VotingParams { if m != nil { return m.VotingParams } @@ -125,7 +130,7 @@ func (m *GenesisState) GetVotingParams() *VotingParams { } // Deprecated: Do not use. -func (m *GenesisState) GetTallyParams() *TallyParams { +func (m *GenesisState) GetTallyParams() *v1.TallyParams { if m != nil { return m.TallyParams } @@ -146,31 +151,35 @@ func init() { func init() { proto.RegisterFile("terra/gov/v2lunc1/genesis.proto", fileDescriptor_a6436cbb1ac17fc7) } var fileDescriptor_a6436cbb1ac17fc7 = []byte{ - // 372 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xcd, 0x6a, 0xf2, 0x40, - 0x14, 0x86, 0x8d, 0x7f, 0x9f, 0xdf, 0xa8, 0x85, 0x0e, 0x85, 0xa6, 0x0a, 0x31, 0x74, 0xe5, 0xc6, - 0xa4, 0x2a, 0x14, 0xdc, 0x4a, 0x4b, 0x5b, 0xba, 0x91, 0x58, 0xba, 0xe8, 0x46, 0xc6, 0x64, 0x48, - 0x03, 0xd1, 0x13, 0x32, 0xc7, 0x01, 0xef, 0xa2, 0x97, 0xd5, 0xa5, 0xcb, 0x2e, 0x8b, 0x5e, 0x42, - 0x6f, 0xa0, 0x38, 0x49, 0xaa, 0xd0, 0x74, 0x7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, 0xea, - 0xa0, 0x6a, 0xc8, 0xa3, 0x09, 0xbd, 0x25, 0x0d, 0x64, 0x61, 0xb8, 0xce, 0x44, 0xff, 0x94, 0xc8, - 0xc8, 0x11, 0x3d, 0xed, 0xb1, 0x23, 0x4f, 0x1d, 0x0f, 0x03, 0xda, 0x27, 0xd5, 0x54, 0x50, 0x53, - 0x82, 0x8b, 0xbc, 0xad, 0x28, 0xc0, 0x49, 0xc1, 0xf1, 0xf4, 0x7d, 0x6b, 0x68, 0x9b, 0xad, 0xa1, - 0x7d, 0x6e, 0x0d, 0xed, 0x6d, 0x67, 0x14, 0x36, 0x3b, 0xa3, 0xf0, 0xb1, 0x33, 0x0a, 0x2f, 0x23, - 0x3f, 0xc0, 0xd7, 0xd5, 0xdc, 0x72, 0x61, 0x61, 0xbb, 0x21, 0x13, 0x22, 0x70, 0x7b, 0xc9, 0xfd, - 0xb8, 0x10, 0x73, 0x5b, 0x0e, 0x6d, 0x77, 0x25, 0x10, 0x16, 0xea, 0x9c, 0x70, 0x1d, 0x71, 0x91, - 0x1d, 0xd5, 0xbc, 0xaa, 0x2e, 0x6a, 0xf8, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x56, 0x65, 0x1d, 0xfd, - 0xa4, 0x02, 0x00, 0x00, + // 440 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xc1, 0x6f, 0xd3, 0x30, + 0x14, 0xc6, 0x9b, 0x75, 0x2b, 0xc3, 0xed, 0x90, 0x30, 0x13, 0xcb, 0x3a, 0x14, 0x2a, 0x4e, 0xe5, + 0x40, 0x4c, 0x3a, 0x71, 0xe0, 0xc8, 0x34, 0x69, 0xe2, 0x36, 0x65, 0x88, 0x03, 0x97, 0xca, 0x49, + 0x8c, 0xb1, 0x94, 0xf6, 0x45, 0xf1, 0x8b, 0xa5, 0xfd, 0x17, 0xfc, 0x59, 0x1c, 0x77, 0x44, 0xe2, + 0x82, 0xda, 0x7f, 0x04, 0xd5, 0x76, 0x68, 0xd4, 0xf5, 0x16, 0xbf, 0xef, 0xf7, 0x7d, 0xfe, 0x62, + 0x3d, 0xf2, 0x1a, 0x45, 0x5d, 0x73, 0x26, 0xc1, 0x30, 0x33, 0x2b, 0x9b, 0x65, 0x9e, 0x30, 0x29, + 0x96, 0x42, 0x2b, 0x1d, 0x57, 0x35, 0x20, 0xd0, 0xe7, 0x16, 0x88, 0x25, 0x98, 0xd8, 0x03, 0xe3, + 0x28, 0x07, 0xbd, 0x00, 0xcd, 0x32, 0xae, 0x05, 0x33, 0x49, 0x26, 0x90, 0x27, 0x2c, 0x07, 0xb5, + 0x74, 0x96, 0xf1, 0xa9, 0x04, 0x09, 0xf6, 0x93, 0x6d, 0xbe, 0xfc, 0x34, 0x92, 0x00, 0xb2, 0x14, + 0xcc, 0x9e, 0xb2, 0xe6, 0x3b, 0x2b, 0x9a, 0x9a, 0xa3, 0x82, 0xd6, 0x75, 0xee, 0x52, 0xe7, 0xce, + 0xe8, 0x0e, 0x5e, 0xba, 0xd8, 0x53, 0x12, 0x8c, 0x17, 0xcf, 0x7c, 0x1b, 0xab, 0x76, 0x84, 0x37, + 0x7f, 0xfa, 0x64, 0x74, 0xe3, 0xfe, 0xe5, 0x0e, 0x39, 0x0a, 0xfa, 0x9e, 0x9c, 0x6a, 0xe4, 0x35, + 0xaa, 0xa5, 0xdc, 0xdc, 0x52, 0x81, 0xe6, 0xe5, 0x5c, 0x15, 0x61, 0x30, 0x09, 0xa6, 0x87, 0x29, + 0x6d, 0xb5, 0x5b, 0x2f, 0x7d, 0x2e, 0xe8, 0x8c, 0x1c, 0x17, 0xa2, 0x02, 0xad, 0x50, 0x87, 0x07, + 0x93, 0xfe, 0x74, 0x38, 0x7b, 0x19, 0xfb, 0x66, 0xf6, 0x41, 0x92, 0xf8, 0xda, 0xc9, 0xe9, 0x7f, + 0x8e, 0xbe, 0x25, 0x47, 0x06, 0x50, 0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 0x00, 0x00, 0xff, 0xff, + 0x70, 0x07, 0xb4, 0x0f, 0x16, 0x03, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -431,7 +440,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Deposits = append(m.Deposits, &Deposit{}) + m.Deposits = append(m.Deposits, &v1.Deposit{}) if err := m.Deposits[len(m.Deposits)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -465,7 +474,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Votes = append(m.Votes, &Vote{}) + m.Votes = append(m.Votes, &v1.Vote{}) if err := m.Votes[len(m.Votes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -499,7 +508,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Proposals = append(m.Proposals, &Proposal{}) + m.Proposals = append(m.Proposals, &v1.Proposal{}) if err := m.Proposals[len(m.Proposals)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -534,7 +543,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.DepositParams == nil { - m.DepositParams = &DepositParams{} + m.DepositParams = &v1.DepositParams{} } if err := m.DepositParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -570,7 +579,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.VotingParams == nil { - m.VotingParams = &VotingParams{} + m.VotingParams = &v1.VotingParams{} } if err := m.VotingParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -606,7 +615,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.TallyParams == nil { - m.TallyParams = &TallyParams{} + m.TallyParams = &v1.TallyParams{} } if err := m.TallyParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/custom/gov/types/v2lunc1/gov.pb.go b/custom/gov/types/v2lunc1/gov.pb.go index 7d60395b..39c5dcd0 100644 --- a/custom/gov/types/v2lunc1/gov.pb.go +++ b/custom/gov/types/v2lunc1/gov.pb.go @@ -6,7 +6,6 @@ package v2lunc1 import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" - types2 "github.com/cosmos/cosmos-sdk/codec/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" @@ -31,95 +30,6 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// VoteOption enumerates the valid vote options for a given governance proposal. -type VoteOption int32 - -const ( - // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. - VoteOption_VOTE_OPTION_UNSPECIFIED VoteOption = 0 - // VOTE_OPTION_YES defines a yes vote option. - VoteOption_VOTE_OPTION_YES VoteOption = 1 - // VOTE_OPTION_ABSTAIN defines an abstain vote option. - VoteOption_VOTE_OPTION_ABSTAIN VoteOption = 2 - // VOTE_OPTION_NO defines a no vote option. - VoteOption_VOTE_OPTION_NO VoteOption = 3 - // VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. - VoteOption_VOTE_OPTION_NO_WITH_VETO VoteOption = 4 -) - -var VoteOption_name = map[int32]string{ - 0: "VOTE_OPTION_UNSPECIFIED", - 1: "VOTE_OPTION_YES", - 2: "VOTE_OPTION_ABSTAIN", - 3: "VOTE_OPTION_NO", - 4: "VOTE_OPTION_NO_WITH_VETO", -} - -var VoteOption_value = map[string]int32{ - "VOTE_OPTION_UNSPECIFIED": 0, - "VOTE_OPTION_YES": 1, - "VOTE_OPTION_ABSTAIN": 2, - "VOTE_OPTION_NO": 3, - "VOTE_OPTION_NO_WITH_VETO": 4, -} - -func (x VoteOption) String() string { - return proto.EnumName(VoteOption_name, int32(x)) -} - -func (VoteOption) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{0} -} - -// ProposalStatus enumerates the valid statuses of a proposal. -type ProposalStatus int32 - -const ( - // PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. - ProposalStatus_PROPOSAL_STATUS_UNSPECIFIED ProposalStatus = 0 - // PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit - // period. - ProposalStatus_PROPOSAL_STATUS_DEPOSIT_PERIOD ProposalStatus = 1 - // PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting - // period. - ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD ProposalStatus = 2 - // PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has - // passed. - ProposalStatus_PROPOSAL_STATUS_PASSED ProposalStatus = 3 - // PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has - // been rejected. - ProposalStatus_PROPOSAL_STATUS_REJECTED ProposalStatus = 4 - // PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has - // failed. - ProposalStatus_PROPOSAL_STATUS_FAILED ProposalStatus = 5 -) - -var ProposalStatus_name = map[int32]string{ - 0: "PROPOSAL_STATUS_UNSPECIFIED", - 1: "PROPOSAL_STATUS_DEPOSIT_PERIOD", - 2: "PROPOSAL_STATUS_VOTING_PERIOD", - 3: "PROPOSAL_STATUS_PASSED", - 4: "PROPOSAL_STATUS_REJECTED", - 5: "PROPOSAL_STATUS_FAILED", -} - -var ProposalStatus_value = map[string]int32{ - "PROPOSAL_STATUS_UNSPECIFIED": 0, - "PROPOSAL_STATUS_DEPOSIT_PERIOD": 1, - "PROPOSAL_STATUS_VOTING_PERIOD": 2, - "PROPOSAL_STATUS_PASSED": 3, - "PROPOSAL_STATUS_REJECTED": 4, - "PROPOSAL_STATUS_FAILED": 5, -} - -func (x ProposalStatus) String() string { - return proto.EnumName(ProposalStatus_name, int32(x)) -} - -func (ProposalStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{1} -} - // Params defines the parameters for the x/gov module. // // Since: cosmos-sdk 0.47 @@ -262,3094 +172,245 @@ func (m *Params) GetMinUusdDeposit() types.Coin { return types.Coin{} } -// WeightedVoteOption defines a unit of vote for vote split. -type WeightedVoteOption struct { - // option defines the valid vote options, it must not contain duplicate vote options. - Option VoteOption `protobuf:"varint,1,opt,name=option,proto3,enum=terra.gov.v2lunc1.VoteOption" json:"option,omitempty"` - // weight is the vote weight associated with the vote option. - Weight string `protobuf:"bytes,2,opt,name=weight,proto3" json:"weight,omitempty"` -} - -func (m *WeightedVoteOption) Reset() { *m = WeightedVoteOption{} } -func (m *WeightedVoteOption) String() string { return proto.CompactTextString(m) } -func (*WeightedVoteOption) ProtoMessage() {} -func (*WeightedVoteOption) Descriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{1} -} -func (m *WeightedVoteOption) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *WeightedVoteOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_WeightedVoteOption.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *WeightedVoteOption) XXX_Merge(src proto.Message) { - xxx_messageInfo_WeightedVoteOption.Merge(m, src) -} -func (m *WeightedVoteOption) XXX_Size() int { - return m.Size() -} -func (m *WeightedVoteOption) XXX_DiscardUnknown() { - xxx_messageInfo_WeightedVoteOption.DiscardUnknown(m) +func init() { + proto.RegisterType((*Params)(nil), "terra.gov.v2lunc1.Params") } -var xxx_messageInfo_WeightedVoteOption proto.InternalMessageInfo +func init() { proto.RegisterFile("terra/gov/v2lunc1/gov.proto", fileDescriptor_ec6805a6cb6c4923) } -func (m *WeightedVoteOption) GetOption() VoteOption { - if m != nil { - return m.Option - } - return VoteOption_VOTE_OPTION_UNSPECIFIED +var fileDescriptor_ec6805a6cb6c4923 = []byte{ + // 540 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xbf, 0x6f, 0xd3, 0x40, + 0x14, 0xc7, 0x63, 0xda, 0x06, 0x7a, 0x6d, 0x4d, 0x6a, 0x21, 0xe4, 0x06, 0xe1, 0x46, 0x08, 0xa1, + 0x08, 0x51, 0x9f, 0xd2, 0x8a, 0x81, 0x91, 0x10, 0x86, 0x0e, 0xa0, 0x10, 0xa0, 0x03, 0x8b, 0xe5, + 0x1f, 0x87, 0x73, 0x52, 0xce, 0xcf, 0xdc, 0x9d, 0xad, 0xf2, 0x5f, 0x30, 0xb2, 0xb1, 0x32, 0x32, + 0xf0, 0x47, 0x74, 0xac, 0x98, 0x98, 0x00, 0x25, 0x03, 0xff, 0x06, 0xba, 0x1f, 0x4e, 0x18, 0x32, + 0x74, 0xb1, 0xce, 0xef, 0x7d, 0x3f, 0xdf, 0xf7, 0xde, 0xfd, 0x40, 0x77, 0x24, 0xe1, 0x3c, 0xc6, + 0x39, 0xd4, 0xb8, 0x3e, 0x9e, 0x55, 0x45, 0x3a, 0x50, 0xeb, 0xb0, 0xe4, 0x20, 0xc1, 0xdb, 0xd7, + 0xc9, 0x50, 0x05, 0x6c, 0xb2, 0x1b, 0xa4, 0x20, 0x18, 0x08, 0x9c, 0xc4, 0x82, 0xe0, 0x7a, 0x90, + 0x10, 0x19, 0x0f, 0x70, 0x0a, 0xb4, 0x30, 0x48, 0xf7, 0x56, 0x0e, 0x39, 0xe8, 0x25, 0x56, 0x2b, + 0x1b, 0x0d, 0x72, 0x80, 0x7c, 0x46, 0xb0, 0xfe, 0x4b, 0xaa, 0xf7, 0x38, 0xab, 0x78, 0x2c, 0x29, + 0x34, 0xd4, 0x81, 0x71, 0x8d, 0x0c, 0x68, 0x7e, 0x6c, 0x6a, 0x3f, 0x66, 0xb4, 0x00, 0xac, 0x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, 0xe9, 0xf6, 0xfd, 0xeb, 0x6b, 0x1d, 0x6e, 0x33, 0x5a, 0x9c, 0x1a, 0xbd, 0xdd, + 0x9e, 0x89, 0x52, 0x7b, 0x7d, 0xd4, 0x49, 0x2a, 0x5e, 0x44, 0x35, 0x48, 0x12, 0xd9, 0x09, 0xf7, + 0x7a, 0x4e, 0xff, 0xc6, 0xc4, 0x55, 0xf1, 0x33, 0x90, 0xe4, 0x95, 0x99, 0xec, 0x29, 0xba, 0xab, + 0x95, 0x25, 0x87, 0x12, 0xc4, 0x7f, 0x65, 0x4b, 0x4e, 0x14, 0xed, 0xbb, 0x1a, 0xeb, 0x2a, 0xd1, + 0xd8, 0x6a, 0x9a, 0x93, 0x30, 0x0a, 0xef, 0x3e, 0x72, 0x57, 0xc5, 0xd4, 0x48, 0xfe, 0x4d, 0xcd, + 0xec, 0x36, 0xa5, 0xce, 0x88, 0x04, 0xef, 0x25, 0xea, 0xa8, 0xe9, 0xaa, 0x4a, 0x64, 0xcb, 0xbb, + 0xd4, 0xb1, 0x67, 0x76, 0x95, 0xbb, 0xe4, 0x32, 0x5a, 0xbc, 0xad, 0x44, 0x66, 0x8b, 0x0f, 0x5f, + 0x5f, 0xcc, 0x03, 0xe7, 0x72, 0x1e, 0x38, 0x7f, 0xe6, 0x81, 0xf3, 0x69, 0x11, 0xb4, 0x2e, 0x17, + 0x41, 0xeb, 0xe7, 0x22, 0x68, 0xbd, 0x7b, 0x92, 0x53, 0x39, 0xad, 0x92, 0x30, 0x05, 0x86, 0xd3, + 0x59, 0x2c, 0x04, 0x4d, 0x8f, 0xcc, 0x13, 0x4c, 0x81, 0x13, 0x5c, 0x9f, 0xe0, 0xb4, 0x12, 0x12, + 0x98, 0x7e, 0x91, 0xf2, 0x63, 0x49, 0x44, 0xf3, 0x2e, 0x93, 0xb6, 0xbe, 0x36, 0x27, 0xff, 0x02, + 0x00, 0x00, 0xff, 0xff, 0x30, 0xde, 0xf4, 0x37, 0xb3, 0x03, 0x00, 0x00, } -func (m *WeightedVoteOption) GetWeight() string { - if m != nil { - return m.Weight +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - return "" + return dAtA[:n], nil } -// Deposit defines an amount deposited by an account address to an active -// proposal. -type Deposit struct { - // proposal_id defines the unique id of the proposal. - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - // depositor defines the deposit addresses from the proposals. - Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` - // amount to be deposited by depositor. - Amount []types.Coin `protobuf:"bytes,3,rep,name=amount,proto3" json:"amount"` +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Deposit) Reset() { *m = Deposit{} } -func (m *Deposit) String() string { return proto.CompactTextString(m) } -func (*Deposit) ProtoMessage() {} -func (*Deposit) Descriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{2} -} -func (m *Deposit) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Deposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Deposit.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.MinUusdDeposit.MarshalToSizedBuffer(dAtA[:i]) if err != nil { - return nil, err + return 0, err } - return b[:n], nil - } -} -func (m *Deposit) XXX_Merge(src proto.Message) { - xxx_messageInfo_Deposit.Merge(m, src) -} -func (m *Deposit) XXX_Size() int { - return m.Size() -} -func (m *Deposit) XXX_DiscardUnknown() { - xxx_messageInfo_Deposit.DiscardUnknown(m) -} - -var xxx_messageInfo_Deposit proto.InternalMessageInfo - -func (m *Deposit) GetProposalId() uint64 { - if m != nil { - return m.ProposalId + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) } - return 0 -} - -func (m *Deposit) GetDepositor() string { - if m != nil { - return m.Depositor + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + if m.BurnVoteVeto { + i-- + if m.BurnVoteVeto { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x78 } - return "" -} - -func (m *Deposit) GetAmount() []types.Coin { - if m != nil { - return m.Amount + if m.BurnProposalDepositPrevote { + i-- + if m.BurnProposalDepositPrevote { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x70 } - return nil -} - -// Proposal defines the core field members of a governance proposal. -type Proposal struct { - // id defines the unique id of the proposal. - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` - // messages are the arbitrary messages to be executed if the proposal passes. - Messages []*types2.Any `protobuf:"bytes,2,rep,name=messages,proto3" json:"messages,omitempty"` - // status defines the proposal status. - Status ProposalStatus `protobuf:"varint,3,opt,name=status,proto3,enum=terra.gov.v2lunc1.ProposalStatus" json:"status,omitempty"` - // final_tally_result is the final tally result of the proposal. When - // querying a proposal via gRPC, this field is not populated until the - // proposal's voting period has ended. - FinalTallyResult *TallyResult `protobuf:"bytes,4,opt,name=final_tally_result,json=finalTallyResult,proto3" json:"final_tally_result,omitempty"` - // submit_time is the time of proposal submission. - SubmitTime *time.Time `protobuf:"bytes,5,opt,name=submit_time,json=submitTime,proto3,stdtime" json:"submit_time,omitempty"` - // deposit_end_time is the end time for deposition. - DepositEndTime *time.Time `protobuf:"bytes,6,opt,name=deposit_end_time,json=depositEndTime,proto3,stdtime" json:"deposit_end_time,omitempty"` - // total_deposit is the total deposit on the proposal. - TotalDeposit []types.Coin `protobuf:"bytes,7,rep,name=total_deposit,json=totalDeposit,proto3" json:"total_deposit"` - // voting_start_time is the starting time to vote on a proposal. - VotingStartTime *time.Time `protobuf:"bytes,8,opt,name=voting_start_time,json=votingStartTime,proto3,stdtime" json:"voting_start_time,omitempty"` - // voting_end_time is the end time of voting on a proposal. - VotingEndTime *time.Time `protobuf:"bytes,9,opt,name=voting_end_time,json=votingEndTime,proto3,stdtime" json:"voting_end_time,omitempty"` - // metadata is any arbitrary metadata attached to the proposal. - // the recommended format of the metadata is to be found here: - // https://docs.cosmos.network/v0.47/modules/gov#proposal-3 - Metadata string `protobuf:"bytes,10,opt,name=metadata,proto3" json:"metadata,omitempty"` - // title is the title of the proposal - // - // Since: cosmos-sdk 0.47 - Title string `protobuf:"bytes,11,opt,name=title,proto3" json:"title,omitempty"` - // summary is a short summary of the proposal - // - // Since: cosmos-sdk 0.47 - Summary string `protobuf:"bytes,12,opt,name=summary,proto3" json:"summary,omitempty"` - // proposer is the address of the proposal sumbitter - // - // Since: cosmos-sdk 0.47 - Proposer string `protobuf:"bytes,13,opt,name=proposer,proto3" json:"proposer,omitempty"` - // expedited defines if the proposal is expedited - // - // Since: cosmos-sdk 0.50 - Expedited bool `protobuf:"varint,14,opt,name=expedited,proto3" json:"expedited,omitempty"` - // failed_reason defines the reason why the proposal failed - // - // Since: cosmos-sdk 0.50 - FailedReason string `protobuf:"bytes,15,opt,name=failed_reason,json=failedReason,proto3" json:"failed_reason,omitempty"` -} - -func (m *Proposal) Reset() { *m = Proposal{} } -func (m *Proposal) String() string { return proto.CompactTextString(m) } -func (*Proposal) ProtoMessage() {} -func (*Proposal) Descriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{3} -} -func (m *Proposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Proposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Proposal.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err + if m.BurnVoteQuorum { + i-- + if m.BurnVoteQuorum { + dAtA[i] = 1 + } else { + dAtA[i] = 0 } - return b[:n], nil + i-- + dAtA[i] = 0x68 } -} -func (m *Proposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_Proposal.Merge(m, src) -} -func (m *Proposal) XXX_Size() int { - return m.Size() -} -func (m *Proposal) XXX_DiscardUnknown() { - xxx_messageInfo_Proposal.DiscardUnknown(m) -} - -var xxx_messageInfo_Proposal proto.InternalMessageInfo - -func (m *Proposal) GetId() uint64 { - if m != nil { - return m.Id + if len(m.MinInitialDepositRatio) > 0 { + i -= len(m.MinInitialDepositRatio) + copy(dAtA[i:], m.MinInitialDepositRatio) + i = encodeVarintGov(dAtA, i, uint64(len(m.MinInitialDepositRatio))) + i-- + dAtA[i] = 0x3a } - return 0 -} - -func (m *Proposal) GetMessages() []*types2.Any { - if m != nil { - return m.Messages + if len(m.VetoThreshold) > 0 { + i -= len(m.VetoThreshold) + copy(dAtA[i:], m.VetoThreshold) + i = encodeVarintGov(dAtA, i, uint64(len(m.VetoThreshold))) + i-- + dAtA[i] = 0x32 } - return nil -} - -func (m *Proposal) GetStatus() ProposalStatus { - if m != nil { - return m.Status + if len(m.Threshold) > 0 { + i -= len(m.Threshold) + copy(dAtA[i:], m.Threshold) + i = encodeVarintGov(dAtA, i, uint64(len(m.Threshold))) + i-- + dAtA[i] = 0x2a } - return ProposalStatus_PROPOSAL_STATUS_UNSPECIFIED -} - -func (m *Proposal) GetFinalTallyResult() *TallyResult { - if m != nil { - return m.FinalTallyResult + if len(m.Quorum) > 0 { + i -= len(m.Quorum) + copy(dAtA[i:], m.Quorum) + i = encodeVarintGov(dAtA, i, uint64(len(m.Quorum))) + i-- + dAtA[i] = 0x22 } - return nil -} - -func (m *Proposal) GetSubmitTime() *time.Time { - if m != nil { - return m.SubmitTime + if m.VotingPeriod != nil { + n2, err2 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintGov(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x1a } - return nil -} - -func (m *Proposal) GetDepositEndTime() *time.Time { - if m != nil { - return m.DepositEndTime + if m.MaxDepositPeriod != nil { + n3, err3 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintGov(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x12 } - return nil -} - -func (m *Proposal) GetTotalDeposit() []types.Coin { - if m != nil { - return m.TotalDeposit + if len(m.MinDeposit) > 0 { + for iNdEx := len(m.MinDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MinDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } } - return nil + return len(dAtA) - i, nil } -func (m *Proposal) GetVotingStartTime() *time.Time { - if m != nil { - return m.VotingStartTime +func encodeVarintGov(dAtA []byte, offset int, v uint64) int { + offset -= sovGov(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ } - return nil + dAtA[offset] = uint8(v) + return base } - -func (m *Proposal) GetVotingEndTime() *time.Time { - if m != nil { - return m.VotingEndTime +func (m *Params) Size() (n int) { + if m == nil { + return 0 } - return nil -} - -func (m *Proposal) GetMetadata() string { - if m != nil { - return m.Metadata + var l int + _ = l + if len(m.MinDeposit) > 0 { + for _, e := range m.MinDeposit { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } } - return "" -} - -func (m *Proposal) GetTitle() string { - if m != nil { - return m.Title - } - return "" -} - -func (m *Proposal) GetSummary() string { - if m != nil { - return m.Summary - } - return "" -} - -func (m *Proposal) GetProposer() string { - if m != nil { - return m.Proposer - } - return "" -} - -func (m *Proposal) GetExpedited() bool { - if m != nil { - return m.Expedited - } - return false -} - -func (m *Proposal) GetFailedReason() string { - if m != nil { - return m.FailedReason - } - return "" -} - -// TallyResult defines a standard tally for a governance proposal. -type TallyResult struct { - // yes_count is the number of yes votes on a proposal. - YesCount string `protobuf:"bytes,1,opt,name=yes_count,json=yesCount,proto3" json:"yes_count,omitempty"` - // abstain_count is the number of abstain votes on a proposal. - AbstainCount string `protobuf:"bytes,2,opt,name=abstain_count,json=abstainCount,proto3" json:"abstain_count,omitempty"` - // no_count is the number of no votes on a proposal. - NoCount string `protobuf:"bytes,3,opt,name=no_count,json=noCount,proto3" json:"no_count,omitempty"` - // no_with_veto_count is the number of no with veto votes on a proposal. - NoWithVetoCount string `protobuf:"bytes,4,opt,name=no_with_veto_count,json=noWithVetoCount,proto3" json:"no_with_veto_count,omitempty"` -} - -func (m *TallyResult) Reset() { *m = TallyResult{} } -func (m *TallyResult) String() string { return proto.CompactTextString(m) } -func (*TallyResult) ProtoMessage() {} -func (*TallyResult) Descriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{4} -} -func (m *TallyResult) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TallyResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TallyResult.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *TallyResult) XXX_Merge(src proto.Message) { - xxx_messageInfo_TallyResult.Merge(m, src) -} -func (m *TallyResult) XXX_Size() int { - return m.Size() -} -func (m *TallyResult) XXX_DiscardUnknown() { - xxx_messageInfo_TallyResult.DiscardUnknown(m) -} - -var xxx_messageInfo_TallyResult proto.InternalMessageInfo - -func (m *TallyResult) GetYesCount() string { - if m != nil { - return m.YesCount - } - return "" -} - -func (m *TallyResult) GetAbstainCount() string { - if m != nil { - return m.AbstainCount - } - return "" -} - -func (m *TallyResult) GetNoCount() string { - if m != nil { - return m.NoCount - } - return "" -} - -func (m *TallyResult) GetNoWithVetoCount() string { - if m != nil { - return m.NoWithVetoCount - } - return "" -} - -// Vote defines a vote on a governance proposal. -// A Vote consists of a proposal ID, the voter, and the vote option. -type Vote struct { - // proposal_id defines the unique id of the proposal. - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` - // voter is the voter address of the proposal. - Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` - // options is the weighted vote options. - Options []*WeightedVoteOption `protobuf:"bytes,4,rep,name=options,proto3" json:"options,omitempty"` - // metadata is any arbitrary metadata attached to the vote. - // the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/gov#vote-5 - Metadata string `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"` -} - -func (m *Vote) Reset() { *m = Vote{} } -func (m *Vote) String() string { return proto.CompactTextString(m) } -func (*Vote) ProtoMessage() {} -func (*Vote) Descriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{5} -} -func (m *Vote) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Vote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Vote.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Vote) XXX_Merge(src proto.Message) { - xxx_messageInfo_Vote.Merge(m, src) -} -func (m *Vote) XXX_Size() int { - return m.Size() -} -func (m *Vote) XXX_DiscardUnknown() { - xxx_messageInfo_Vote.DiscardUnknown(m) -} - -var xxx_messageInfo_Vote proto.InternalMessageInfo - -func (m *Vote) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -func (m *Vote) GetVoter() string { - if m != nil { - return m.Voter - } - return "" -} - -func (m *Vote) GetOptions() []*WeightedVoteOption { - if m != nil { - return m.Options - } - return nil -} - -func (m *Vote) GetMetadata() string { - if m != nil { - return m.Metadata - } - return "" -} - -// DepositParams defines the params for deposits on governance proposals. -// -// Deprecated: Do not use. -type DepositParams struct { - // Minimum deposit for a proposal to enter voting period. - MinDeposit []types.Coin `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3" json:"min_deposit,omitempty"` - // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 - // months. - MaxDepositPeriod *time.Duration `protobuf:"bytes,2,opt,name=max_deposit_period,json=maxDepositPeriod,proto3,stdduration" json:"max_deposit_period,omitempty"` -} - -func (m *DepositParams) Reset() { *m = DepositParams{} } -func (m *DepositParams) String() string { return proto.CompactTextString(m) } -func (*DepositParams) ProtoMessage() {} -func (*DepositParams) Descriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{6} -} -func (m *DepositParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DepositParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DepositParams.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *DepositParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_DepositParams.Merge(m, src) -} -func (m *DepositParams) XXX_Size() int { - return m.Size() -} -func (m *DepositParams) XXX_DiscardUnknown() { - xxx_messageInfo_DepositParams.DiscardUnknown(m) -} - -var xxx_messageInfo_DepositParams proto.InternalMessageInfo - -func (m *DepositParams) GetMinDeposit() []types.Coin { - if m != nil { - return m.MinDeposit - } - return nil -} - -func (m *DepositParams) GetMaxDepositPeriod() *time.Duration { - if m != nil { - return m.MaxDepositPeriod - } - return nil -} - -// VotingParams defines the params for voting on governance proposals. -// -// Deprecated: Do not use. -type VotingParams struct { - // Duration of the voting period. - VotingPeriod *time.Duration `protobuf:"bytes,1,opt,name=voting_period,json=votingPeriod,proto3,stdduration" json:"voting_period,omitempty"` -} - -func (m *VotingParams) Reset() { *m = VotingParams{} } -func (m *VotingParams) String() string { return proto.CompactTextString(m) } -func (*VotingParams) ProtoMessage() {} -func (*VotingParams) Descriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{7} -} -func (m *VotingParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *VotingParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_VotingParams.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *VotingParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_VotingParams.Merge(m, src) -} -func (m *VotingParams) XXX_Size() int { - return m.Size() -} -func (m *VotingParams) XXX_DiscardUnknown() { - xxx_messageInfo_VotingParams.DiscardUnknown(m) -} - -var xxx_messageInfo_VotingParams proto.InternalMessageInfo - -func (m *VotingParams) GetVotingPeriod() *time.Duration { - if m != nil { - return m.VotingPeriod - } - return nil -} - -// TallyParams defines the params for tallying votes on governance proposals. -// -// Deprecated: Do not use. -type TallyParams struct { - // Minimum percentage of total stake needed to vote for a result to be - // considered valid. - Quorum string `protobuf:"bytes,1,opt,name=quorum,proto3" json:"quorum,omitempty"` - // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. - Threshold string `protobuf:"bytes,2,opt,name=threshold,proto3" json:"threshold,omitempty"` - // Minimum value of Veto votes to Total votes ratio for proposal to be - // vetoed. Default value: 1/3. - VetoThreshold string `protobuf:"bytes,3,opt,name=veto_threshold,json=vetoThreshold,proto3" json:"veto_threshold,omitempty"` -} - -func (m *TallyParams) Reset() { *m = TallyParams{} } -func (m *TallyParams) String() string { return proto.CompactTextString(m) } -func (*TallyParams) ProtoMessage() {} -func (*TallyParams) Descriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{8} -} -func (m *TallyParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *TallyParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TallyParams.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *TallyParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_TallyParams.Merge(m, src) -} -func (m *TallyParams) XXX_Size() int { - return m.Size() -} -func (m *TallyParams) XXX_DiscardUnknown() { - xxx_messageInfo_TallyParams.DiscardUnknown(m) -} - -var xxx_messageInfo_TallyParams proto.InternalMessageInfo - -func (m *TallyParams) GetQuorum() string { - if m != nil { - return m.Quorum + if m.MaxDepositPeriod != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod) + n += 1 + l + sovGov(uint64(l)) } - return "" -} - -func (m *TallyParams) GetThreshold() string { - if m != nil { - return m.Threshold + if m.VotingPeriod != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod) + n += 1 + l + sovGov(uint64(l)) } - return "" -} - -func (m *TallyParams) GetVetoThreshold() string { - if m != nil { - return m.VetoThreshold + l = len(m.Quorum) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) } - return "" -} - -func init() { - proto.RegisterEnum("terra.gov.v2lunc1.VoteOption", VoteOption_name, VoteOption_value) - proto.RegisterEnum("terra.gov.v2lunc1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) - proto.RegisterType((*Params)(nil), "terra.gov.v2lunc1.Params") - proto.RegisterType((*WeightedVoteOption)(nil), "terra.gov.v2lunc1.WeightedVoteOption") - proto.RegisterType((*Deposit)(nil), "terra.gov.v2lunc1.Deposit") - proto.RegisterType((*Proposal)(nil), "terra.gov.v2lunc1.Proposal") - proto.RegisterType((*TallyResult)(nil), "terra.gov.v2lunc1.TallyResult") - proto.RegisterType((*Vote)(nil), "terra.gov.v2lunc1.Vote") - proto.RegisterType((*DepositParams)(nil), "terra.gov.v2lunc1.DepositParams") - proto.RegisterType((*VotingParams)(nil), "terra.gov.v2lunc1.VotingParams") - proto.RegisterType((*TallyParams)(nil), "terra.gov.v2lunc1.TallyParams") -} - -func init() { proto.RegisterFile("terra/gov/v2lunc1/gov.proto", fileDescriptor_ec6805a6cb6c4923) } - -var fileDescriptor_ec6805a6cb6c4923 = []byte{ - // 1371 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0x4f, 0x6f, 0xdb, 0xc6, - 0x12, 0x37, 0x65, 0x59, 0x96, 0x46, 0xb6, 0xcc, 0x6c, 0xfc, 0x12, 0xda, 0x89, 0x65, 0x47, 0x2f, - 0xef, 0xc1, 0x2f, 0x2f, 0x91, 0x1a, 0xa7, 0x29, 0x90, 0xb6, 0x40, 0x21, 0x5b, 0x4c, 0xc3, 0xc0, - 0xb5, 0x54, 0x4a, 0x71, 0x9a, 0x5e, 0x08, 0x4a, 0xdc, 0xc8, 0x0b, 0x88, 0x5c, 0x95, 0xbb, 0x74, - 0xa2, 0x8f, 0x50, 0xa0, 0x87, 0x1c, 0x7b, 0x6a, 0x7b, 0xec, 0xb1, 0x87, 0x9c, 0xfa, 0x09, 0x72, - 0x2a, 0x82, 0x5c, 0xda, 0x4b, 0xd3, 0x22, 0x39, 0x14, 0xc8, 0xa7, 0x28, 0x76, 0xb9, 0x94, 0x64, - 0x5b, 0x68, 0xe4, 0x5c, 0x04, 0x72, 0xe6, 0xf7, 0x9b, 0x3f, 0xbb, 0x33, 0xa3, 0x21, 0x5c, 0xe0, - 0x38, 0x0c, 0xdd, 0x4a, 0x97, 0x1e, 0x56, 0x0e, 0xb7, 0x7a, 0x51, 0xd0, 0xb9, 0x2e, 0x9e, 0xcb, - 0xfd, 0x90, 0x72, 0x8a, 0xce, 0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b1, 0x32, 0xd4, 0x90, - 0x44, 0x54, 0x83, 0xc5, 0x43, 0xca, 0x49, 0xd0, 0x4d, 0x2c, 0xcd, 0x4e, 0x67, 0x69, 0x21, 0x66, - 0x29, 0x2b, 0xff, 0x85, 0xcc, 0x57, 0x11, 0x0d, 0x23, 0xdf, 0x48, 0x6f, 0x68, 0x9b, 0xb9, 0xed, - 0xc2, 0x8b, 0xa7, 0xd7, 0x40, 0x65, 0x56, 0xc3, 0x1d, 0x5b, 0x69, 0xd1, 0x55, 0xc8, 0xf1, 0x83, - 0x10, 0xb3, 0x03, 0xda, 0xf3, 0x8c, 0xb9, 0x89, 0xd0, 0x11, 0x00, 0xdd, 0x84, 0xc2, 0x21, 0xe6, - 0xd4, 0x19, 0x51, 0x32, 0x13, 0x29, 0x8b, 0x02, 0xd5, 0x1a, 0xd2, 0x2c, 0x58, 0x11, 0x07, 0x4d, - 0x02, 0xc2, 0x89, 0xdb, 0x1b, 0x9e, 0x94, 0x0c, 0xdf, 0x98, 0x9f, 0x68, 0xe1, 0x9c, 0x4f, 0x02, - 0x2b, 0xc6, 0xab, 0xe3, 0xb1, 0x05, 0x1a, 0x6d, 0x82, 0xde, 0x8e, 0xc2, 0xc0, 0x39, 0xa4, 0x1c, - 0x3b, 0x2a, 0xc3, 0xc5, 0x0d, 0x6d, 0x33, 0x6b, 0x17, 0x84, 0x7c, 0x9f, 0x72, 0xfc, 0x79, 0x9c, - 0x59, 0x15, 0xd6, 0x24, 0xb2, 0x1f, 0xd2, 0x3e, 0x65, 0x63, 0x6e, 0xfb, 0x21, 0x16, 0x6c, 0xa3, - 0x20, 0x69, 0xab, 0x02, 0xd4, 0x50, 0x98, 0xe4, 0x26, 0x62, 0x04, 0xba, 0x0c, 0x85, 0x91, 0x33, - 0x91, 0x92, 0xb1, 0x24, 0x39, 0x0b, 0x89, 0xab, 0x7d, 0xcc, 0x29, 0xda, 0x03, 0x5d, 0x64, 0x17, - 0x45, 0xcc, 0x1b, 0xd6, 0x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, 0xe7, 0x70, 0xb7, 0xd7, - 0x1b, 0x38, 0x21, 0x66, 0x51, 0x8f, 0xcb, 0x46, 0xcb, 0x6f, 0x15, 0x27, 0x98, 0x69, 0x09, 0x98, - 0x2d, 0x51, 0xb6, 0x2e, 0x99, 0x63, 0x12, 0x54, 0x85, 0x3c, 0x8b, 0xda, 0x3e, 0xe1, 0x8e, 0x18, - 0x8a, 0xb2, 0x09, 0xf3, 0x5b, 0xab, 0x27, 0xa2, 0x6f, 0x25, 0x13, 0x73, 0x3b, 0xfd, 0x44, 0xf4, - 0x3b, 0xc4, 0x24, 0x21, 0x46, 0x77, 0x41, 0x4f, 0xaa, 0x1b, 0x07, 0x5e, 0x6c, 0x27, 0x33, 0xa5, - 0x9d, 0x82, 0x62, 0x9a, 0x81, 0x27, 0x6d, 0x59, 0xb0, 0xc8, 0x29, 0x1f, 0xf5, 0x8b, 0x31, 0x7f, - 0x8a, 0xbb, 0x5a, 0x90, 0xd4, 0xa4, 0x90, 0x76, 0xe1, 0x8c, 0x1a, 0x65, 0x8c, 0xbb, 0xa1, 0xca, - 0x2f, 0x3b, 0x65, 0x5c, 0x4b, 0x31, 0xb5, 0x29, 0x98, 0x32, 0xb0, 0x3b, 0xa0, 0x44, 0xa3, 0x1c, - 0x73, 0x53, 0xda, 0x52, 0x13, 0x35, 0x49, 0x71, 0x55, 0x14, 0x0b, 0x77, 0x3d, 0x97, 0xbb, 0x06, - 0x88, 0xf2, 0xb5, 0x87, 0xef, 0x68, 0x19, 0xe6, 0x38, 0xe1, 0x3d, 0x6c, 0xe4, 0xa5, 0x22, 0x7e, - 0x41, 0x06, 0xcc, 0xb3, 0xc8, 0xf7, 0xdd, 0x70, 0x60, 0x2c, 0x48, 0x79, 0xf2, 0x8a, 0xde, 0x87, - 0x6c, 0xdc, 0x19, 0x38, 0x94, 0x83, 0xe8, 0x9f, 0x5a, 0x61, 0x88, 0x44, 0x17, 0x21, 0x87, 0x1f, - 0xf7, 0xb1, 0x47, 0x38,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0x2d, 0xa7, 0x61, 0xda, 0x56, 0xbd, 0xa6, 0x6b, 0xe8, 0x12, 0xac, 0x1d, 0xc7, 0xec, 0xd7, 0x5b, - 0xd6, 0xde, 0xa7, 0x09, 0x24, 0x85, 0x56, 0xe1, 0xdc, 0x71, 0x48, 0xa3, 0xda, 0x6c, 0x9a, 0xb5, - 0x38, 0xe8, 0xe3, 0x3a, 0xdb, 0xbc, 0x6b, 0xee, 0xb4, 0xcc, 0x9a, 0x9e, 0x9e, 0xc4, 0xbc, 0x5d, - 0xb5, 0x76, 0xcd, 0x9a, 0x3e, 0xb7, 0xdd, 0x7c, 0xf6, 0xaa, 0xa8, 0x3d, 0x7f, 0x55, 0xd4, 0xfe, - 0x7c, 0x55, 0xd4, 0x9e, 0xbc, 0x2e, 0xce, 0x3c, 0x7f, 0x5d, 0x9c, 0xf9, 0xed, 0x75, 0x71, 0xe6, - 0xcb, 0x5b, 0x5d, 0xc2, 0x0f, 0xa2, 0x76, 0xb9, 0x43, 0xfd, 0x4a, 0xa7, 0xe7, 0x32, 0x46, 0x3a, - 0xd7, 0xe2, 0x8f, 0x96, 0x0e, 0x0d, 0x71, 0xe5, 0xf0, 0x46, 0xa5, 0x13, 0x31, 0x4e, 0x7d, 0xf9, - 0x0d, 0xc3, 0x07, 0x7d, 0xcc, 0x92, 0x2f, 0x99, 0x76, 0x46, 0x56, 0xdf, 0x8d, 0xbf, 0x03, 0x00, - 0x00, 0xff, 0xff, 0xbf, 0x46, 0x38, 0x51, 0xe5, 0x0c, 0x00, 0x00, -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + l = len(m.Threshold) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.MinUusdDeposit.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x82 - if m.BurnVoteVeto { - i-- - if m.BurnVoteVeto { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x78 - } - if m.BurnProposalDepositPrevote { - i-- - if m.BurnProposalDepositPrevote { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x70 - } - if m.BurnVoteQuorum { - i-- - if m.BurnVoteQuorum { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x68 - } - if len(m.MinInitialDepositRatio) > 0 { - i -= len(m.MinInitialDepositRatio) - copy(dAtA[i:], m.MinInitialDepositRatio) - i = encodeVarintGov(dAtA, i, uint64(len(m.MinInitialDepositRatio))) - i-- - dAtA[i] = 0x3a - } - if len(m.VetoThreshold) > 0 { - i -= len(m.VetoThreshold) - copy(dAtA[i:], m.VetoThreshold) - i = encodeVarintGov(dAtA, i, uint64(len(m.VetoThreshold))) - i-- - dAtA[i] = 0x32 - } - if len(m.Threshold) > 0 { - i -= len(m.Threshold) - copy(dAtA[i:], m.Threshold) - i = encodeVarintGov(dAtA, i, uint64(len(m.Threshold))) - i-- - dAtA[i] = 0x2a - } - if len(m.Quorum) > 0 { - i -= len(m.Quorum) - copy(dAtA[i:], m.Quorum) - i = encodeVarintGov(dAtA, i, uint64(len(m.Quorum))) - i-- - dAtA[i] = 0x22 - } - if m.VotingPeriod != nil { - n2, err2 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) - if err2 != nil { - return 0, err2 - } - i -= n2 - i = encodeVarintGov(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x1a - } - if m.MaxDepositPeriod != nil { - n3, err3 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) - if err3 != nil { - return 0, err3 - } - i -= n3 - i = encodeVarintGov(dAtA, i, uint64(n3)) - i-- - dAtA[i] = 0x12 - } - if len(m.MinDeposit) > 0 { - for iNdEx := len(m.MinDeposit) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.MinDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *WeightedVoteOption) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *WeightedVoteOption) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Weight) > 0 { - i -= len(m.Weight) - copy(dAtA[i:], m.Weight) - i = encodeVarintGov(dAtA, i, uint64(len(m.Weight))) - i-- - dAtA[i] = 0x12 - } - if m.Option != 0 { - i = encodeVarintGov(dAtA, i, uint64(m.Option)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Deposit) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Deposit) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Deposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - } - if len(m.Depositor) > 0 { - i -= len(m.Depositor) - copy(dAtA[i:], m.Depositor) - i = encodeVarintGov(dAtA, i, uint64(len(m.Depositor))) - i-- - dAtA[i] = 0x12 - } - if m.ProposalId != 0 { - i = encodeVarintGov(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Proposal) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Proposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.FailedReason) > 0 { - i -= len(m.FailedReason) - copy(dAtA[i:], m.FailedReason) - i = encodeVarintGov(dAtA, i, uint64(len(m.FailedReason))) - i-- - dAtA[i] = 0x7a - } - if m.Expedited { - i-- - if m.Expedited { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x70 - } - if len(m.Proposer) > 0 { - i -= len(m.Proposer) - copy(dAtA[i:], m.Proposer) - i = encodeVarintGov(dAtA, i, uint64(len(m.Proposer))) - i-- - dAtA[i] = 0x6a - } - if len(m.Summary) > 0 { - i -= len(m.Summary) - copy(dAtA[i:], m.Summary) - i = encodeVarintGov(dAtA, i, uint64(len(m.Summary))) - i-- - dAtA[i] = 0x62 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintGov(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0x5a - } - if len(m.Metadata) > 0 { - i -= len(m.Metadata) - copy(dAtA[i:], m.Metadata) - i = encodeVarintGov(dAtA, i, uint64(len(m.Metadata))) - i-- - dAtA[i] = 0x52 - } - if m.VotingEndTime != nil { - n4, err4 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.VotingEndTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.VotingEndTime):]) - if err4 != nil { - return 0, err4 - } - i -= n4 - i = encodeVarintGov(dAtA, i, uint64(n4)) - i-- - dAtA[i] = 0x4a - } - if m.VotingStartTime != nil { - n5, err5 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.VotingStartTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.VotingStartTime):]) - if err5 != nil { - return 0, err5 - } - i -= n5 - i = encodeVarintGov(dAtA, i, uint64(n5)) - i-- - dAtA[i] = 0x42 - } - if len(m.TotalDeposit) > 0 { - for iNdEx := len(m.TotalDeposit) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.TotalDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - } - if m.DepositEndTime != nil { - n6, err6 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.DepositEndTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.DepositEndTime):]) - if err6 != nil { - return 0, err6 - } - i -= n6 - i = encodeVarintGov(dAtA, i, uint64(n6)) - i-- - dAtA[i] = 0x32 - } - if m.SubmitTime != nil { - n7, err7 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.SubmitTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.SubmitTime):]) - if err7 != nil { - return 0, err7 - } - i -= n7 - i = encodeVarintGov(dAtA, i, uint64(n7)) - i-- - dAtA[i] = 0x2a - } - if m.FinalTallyResult != nil { - { - size, err := m.FinalTallyResult.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - if m.Status != 0 { - i = encodeVarintGov(dAtA, i, uint64(m.Status)) - i-- - dAtA[i] = 0x18 - } - if len(m.Messages) > 0 { - for iNdEx := len(m.Messages) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Messages[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if m.Id != 0 { - i = encodeVarintGov(dAtA, i, uint64(m.Id)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *TallyResult) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TallyResult) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TallyResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.NoWithVetoCount) > 0 { - i -= len(m.NoWithVetoCount) - copy(dAtA[i:], m.NoWithVetoCount) - i = encodeVarintGov(dAtA, i, uint64(len(m.NoWithVetoCount))) - i-- - dAtA[i] = 0x22 - } - if len(m.NoCount) > 0 { - i -= len(m.NoCount) - copy(dAtA[i:], m.NoCount) - i = encodeVarintGov(dAtA, i, uint64(len(m.NoCount))) - i-- - dAtA[i] = 0x1a - } - if len(m.AbstainCount) > 0 { - i -= len(m.AbstainCount) - copy(dAtA[i:], m.AbstainCount) - i = encodeVarintGov(dAtA, i, uint64(len(m.AbstainCount))) - i-- - dAtA[i] = 0x12 - } - if len(m.YesCount) > 0 { - i -= len(m.YesCount) - copy(dAtA[i:], m.YesCount) - i = encodeVarintGov(dAtA, i, uint64(len(m.YesCount))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Vote) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Vote) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Metadata) > 0 { - i -= len(m.Metadata) - copy(dAtA[i:], m.Metadata) - i = encodeVarintGov(dAtA, i, uint64(len(m.Metadata))) - i-- - dAtA[i] = 0x2a - } - if len(m.Options) > 0 { - for iNdEx := len(m.Options) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Options[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 - } - } - if len(m.Voter) > 0 { - i -= len(m.Voter) - copy(dAtA[i:], m.Voter) - i = encodeVarintGov(dAtA, i, uint64(len(m.Voter))) - i-- - dAtA[i] = 0x12 - } - if m.ProposalId != 0 { - i = encodeVarintGov(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *DepositParams) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *DepositParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DepositParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.MaxDepositPeriod != nil { - n9, err9 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) - if err9 != nil { - return 0, err9 - } - i -= n9 - i = encodeVarintGov(dAtA, i, uint64(n9)) - i-- - dAtA[i] = 0x12 - } - if len(m.MinDeposit) > 0 { - for iNdEx := len(m.MinDeposit) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.MinDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *VotingParams) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *VotingParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *VotingParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.VotingPeriod != nil { - n10, err10 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) - if err10 != nil { - return 0, err10 - } - i -= n10 - i = encodeVarintGov(dAtA, i, uint64(n10)) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *TallyParams) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *TallyParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TallyParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.VetoThreshold) > 0 { - i -= len(m.VetoThreshold) - copy(dAtA[i:], m.VetoThreshold) - i = encodeVarintGov(dAtA, i, uint64(len(m.VetoThreshold))) - i-- - dAtA[i] = 0x1a - } - if len(m.Threshold) > 0 { - i -= len(m.Threshold) - copy(dAtA[i:], m.Threshold) - i = encodeVarintGov(dAtA, i, uint64(len(m.Threshold))) - i-- - dAtA[i] = 0x12 - } - if len(m.Quorum) > 0 { - i -= len(m.Quorum) - copy(dAtA[i:], m.Quorum) - i = encodeVarintGov(dAtA, i, uint64(len(m.Quorum))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintGov(dAtA []byte, offset int, v uint64) int { - offset -= sovGov(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.MinDeposit) > 0 { - for _, e := range m.MinDeposit { - l = e.Size() - n += 1 + l + sovGov(uint64(l)) - } - } - if m.MaxDepositPeriod != nil { - l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod) - n += 1 + l + sovGov(uint64(l)) - } - if m.VotingPeriod != nil { - l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod) - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.Quorum) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.Threshold) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.VetoThreshold) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.MinInitialDepositRatio) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - if m.BurnVoteQuorum { - n += 2 - } - if m.BurnProposalDepositPrevote { - n += 2 - } - if m.BurnVoteVeto { - n += 2 - } - l = m.MinUusdDeposit.Size() - n += 2 + l + sovGov(uint64(l)) - return n -} - -func (m *WeightedVoteOption) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Option != 0 { - n += 1 + sovGov(uint64(m.Option)) - } - l = len(m.Weight) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - return n -} - -func (m *Deposit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovGov(uint64(m.ProposalId)) - } - l = len(m.Depositor) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovGov(uint64(l)) - } - } - return n -} - -func (m *Proposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Id != 0 { - n += 1 + sovGov(uint64(m.Id)) - } - if len(m.Messages) > 0 { - for _, e := range m.Messages { - l = e.Size() - n += 1 + l + sovGov(uint64(l)) - } - } - if m.Status != 0 { - n += 1 + sovGov(uint64(m.Status)) - } - if m.FinalTallyResult != nil { - l = m.FinalTallyResult.Size() - n += 1 + l + sovGov(uint64(l)) - } - if m.SubmitTime != nil { - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.SubmitTime) - n += 1 + l + sovGov(uint64(l)) - } - if m.DepositEndTime != nil { - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.DepositEndTime) - n += 1 + l + sovGov(uint64(l)) - } - if len(m.TotalDeposit) > 0 { - for _, e := range m.TotalDeposit { - l = e.Size() - n += 1 + l + sovGov(uint64(l)) - } - } - if m.VotingStartTime != nil { - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.VotingStartTime) - n += 1 + l + sovGov(uint64(l)) - } - if m.VotingEndTime != nil { - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.VotingEndTime) - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.Metadata) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.Title) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.Summary) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.Proposer) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - if m.Expedited { - n += 2 - } - l = len(m.FailedReason) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - return n -} - -func (m *TallyResult) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.YesCount) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.AbstainCount) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.NoCount) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.NoWithVetoCount) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - return n -} - -func (m *Vote) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovGov(uint64(m.ProposalId)) - } - l = len(m.Voter) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - if len(m.Options) > 0 { - for _, e := range m.Options { - l = e.Size() - n += 1 + l + sovGov(uint64(l)) - } - } - l = len(m.Metadata) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - return n -} - -func (m *DepositParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.MinDeposit) > 0 { - for _, e := range m.MinDeposit { - l = e.Size() - n += 1 + l + sovGov(uint64(l)) - } - } - if m.MaxDepositPeriod != nil { - l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod) - n += 1 + l + sovGov(uint64(l)) - } - return n -} - -func (m *VotingParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.VotingPeriod != nil { - l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod) - n += 1 + l + sovGov(uint64(l)) - } - return n -} - -func (m *TallyParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Quorum) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.Threshold) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.VetoThreshold) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - return n -} - -func sovGov(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGov(x uint64) (n int) { - return sovGov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinDeposit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MinDeposit = append(m.MinDeposit, types.Coin{}) - if err := m.MinDeposit[len(m.MinDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxDepositPeriod", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.MaxDepositPeriod == nil { - m.MaxDepositPeriod = new(time.Duration) - } - if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.MaxDepositPeriod, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VotingPeriod", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VotingPeriod == nil { - m.VotingPeriod = new(time.Duration) - } - if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.VotingPeriod, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Quorum", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Quorum = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Threshold", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Threshold = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VetoThreshold", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.VetoThreshold = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinInitialDepositRatio", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MinInitialDepositRatio = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 13: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BurnVoteQuorum", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.BurnVoteQuorum = bool(v != 0) - case 14: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BurnProposalDepositPrevote", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.BurnProposalDepositPrevote = bool(v != 0) - case 15: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BurnVoteVeto", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.BurnVoteVeto = bool(v != 0) - case 16: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MinUusdDeposit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MinUusdDeposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *WeightedVoteOption) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: WeightedVoteOption: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: WeightedVoteOption: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) - } - m.Option = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Option |= VoteOption(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Weight", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Weight = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Deposit) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Deposit: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Deposit: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Depositor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Amount = append(m.Amount, types.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Proposal) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Proposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Proposal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Id |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Messages = append(m.Messages, &types2.Any{}) - if err := m.Messages[len(m.Messages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) - } - m.Status = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Status |= ProposalStatus(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FinalTallyResult", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.FinalTallyResult == nil { - m.FinalTallyResult = &TallyResult{} - } - if err := m.FinalTallyResult.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SubmitTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.SubmitTime == nil { - m.SubmitTime = new(time.Time) - } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.SubmitTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DepositEndTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.DepositEndTime == nil { - m.DepositEndTime = new(time.Time) - } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.DepositEndTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalDeposit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TotalDeposit = append(m.TotalDeposit, types.Coin{}) - if err := m.TotalDeposit[len(m.TotalDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VotingStartTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VotingStartTime == nil { - m.VotingStartTime = new(time.Time) - } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.VotingStartTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VotingEndTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.VotingEndTime == nil { - m.VotingEndTime = new(time.Time) - } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.VotingEndTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Metadata = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 12: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Summary", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Summary = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 13: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proposer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Proposer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 14: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Expedited", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Expedited = bool(v != 0) - case 15: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FailedReason", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.FailedReason = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TallyResult) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TallyResult: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TallyResult: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field YesCount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.YesCount = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AbstainCount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AbstainCount = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NoCount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NoCount = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NoWithVetoCount", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NoWithVetoCount = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Vote) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Vote: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Vote: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Voter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Options = append(m.Options, &WeightedVoteOption{}) - if err := m.Options[len(m.Options)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthGov - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthGov - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Metadata = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } + l = len(m.VetoThreshold) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) } - - if iNdEx > l { - return io.ErrUnexpectedEOF + l = len(m.MinInitialDepositRatio) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) } - return nil + if m.BurnVoteQuorum { + n += 2 + } + if m.BurnProposalDepositPrevote { + n += 2 + } + if m.BurnVoteVeto { + n += 2 + } + l = m.MinUusdDeposit.Size() + n += 2 + l + sovGov(uint64(l)) + return n +} + +func sovGov(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGov(x uint64) (n int) { + return sovGov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *DepositParams) Unmarshal(dAtA []byte) error { +func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3372,10 +433,10 @@ func (m *DepositParams) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DepositParams: wiretype end group for non-group") + return fmt.Errorf("proto: Params: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DepositParams: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -3448,57 +509,7 @@ func (m *DepositParams) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *VotingParams) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: VotingParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: VotingParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field VotingPeriod", wireType) } @@ -3534,57 +545,7 @@ func (m *VotingParams) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGov(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGov - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TallyParams) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGov - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: TallyParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TallyParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: + case 4: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Quorum", wireType) } @@ -3616,7 +577,7 @@ func (m *TallyParams) Unmarshal(dAtA []byte) error { } m.Quorum = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 2: + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Threshold", wireType) } @@ -3648,7 +609,7 @@ func (m *TallyParams) Unmarshal(dAtA []byte) error { } m.Threshold = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field VetoThreshold", wireType) } @@ -3680,6 +641,131 @@ func (m *TallyParams) Unmarshal(dAtA []byte) error { } m.VetoThreshold = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinInitialDepositRatio", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinInitialDepositRatio = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BurnVoteQuorum", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BurnVoteQuorum = bool(v != 0) + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BurnProposalDepositPrevote", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BurnProposalDepositPrevote = bool(v != 0) + case 15: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BurnVoteVeto", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.BurnVoteVeto = bool(v != 0) + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinUusdDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MinUusdDeposit.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGov(dAtA[iNdEx:]) diff --git a/custom/gov/types/v2lunc1/params.go b/custom/gov/types/v2lunc1/params.go index f265ec6a..1140dba6 100644 --- a/custom/gov/types/v2lunc1/params.go +++ b/custom/gov/types/v2lunc1/params.go @@ -2,37 +2,57 @@ package v2lunc1 import ( fmt "fmt" - "time" + time "time" "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" -) + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/cosmos/cosmos-sdk/x/gov/codec" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" -// Default period for deposits & voting -const ( - DefaultPeriod time.Duration = time.Hour * 24 * 2 // 2 days + "github.com/classic-terra/core/v3/types/assets" ) -// Default governance params - // Default governance params var ( - DefaultMinDepositTokens = sdk.NewInt(10000000) - DefaultQuorum = sdk.NewDecWithPrec(334, 3) - DefaultThreshold = sdk.NewDecWithPrec(5, 1) - DefaultVetoThreshold = sdk.NewDecWithPrec(334, 3) - DefaultMinInitialDepositRatio = sdk.ZeroDec() - DefaultBurnProposalPrevote = false // set to false to replicate behavior of when this change was made (0.47) - DefaultBurnVoteQuorom = false // set to false to replicate behavior of when this change was made (0.47) - DefaultBurnVoteVeto = true // set to true to replicate behavior of when this change was made (0.47) - DefaultMinUusdDepositTokens = sdk.NewInt(500) // Minimal uusd deposit for a proposal to enter voting period - + DefaultMinUusdDepositTokens = sdk.NewInt(500000000) // Minimal uusd deposit for a proposal to enter voting period ) +var _ sdk.Msg = &MsgUpdateParams{} + +// Route implements the sdk.Msg interface. +func (msg MsgUpdateParams) Route() string { return govtypes.RouterKey } + +// Type implements the sdk.Msg interface. +func (msg MsgUpdateParams) Type() string { return sdk.MsgTypeURL(&msg) } + +// ValidateBasic implements the sdk.Msg interface. +func (msg MsgUpdateParams) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Authority); err != nil { + return sdkerrors.ErrInvalidAddress.Wrapf("invalid authority address: %s", err) + } + + return msg.Params.ValidateBasic() +} + +// GetSignBytes returns the message bytes to sign over. +func (msg MsgUpdateParams) GetSignBytes() []byte { + bz := codec.ModuleCdc.MustMarshalJSON(&msg) + return sdk.MustSortJSON(bz) +} + +// GetSigners returns the expected signers for a MsgUpdateParams. +func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { + authority, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{authority} +} + // NewParams creates a new Params instance with given values. func NewParams( minDeposit sdk.Coins, maxDepositPeriod, votingPeriod time.Duration, - quorum, threshold, vetoThreshold, minInitialDepositRatio string, burnProposalDeposit, burnVoteQuorum, burnVoteVeto bool, minUusdDeposit sdk.Coin, + quorum, threshold, vetoThreshold, minInitialDepositRatio string, burnProposalDeposit, burnVoteQuorum, burnVoteVeto bool, + minUusdDeposit sdk.Coin, ) Params { return Params{ MinDeposit: minDeposit, @@ -52,17 +72,17 @@ func NewParams( // DefaultParams returns the default governance params func DefaultParams() Params { return NewParams( - sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, DefaultMinDepositTokens)), - DefaultPeriod, - DefaultPeriod, - DefaultQuorum.String(), - DefaultThreshold.String(), - DefaultVetoThreshold.String(), - DefaultMinInitialDepositRatio.String(), - DefaultBurnProposalPrevote, - DefaultBurnVoteQuorom, - DefaultBurnVoteVeto, - sdk.NewCoin(sdk.DefaultBondDenom, DefaultMinUusdDepositTokens), + sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, govv1.DefaultMinDepositTokens)), + govv1.DefaultPeriod, + govv1.DefaultPeriod, + govv1.DefaultQuorum.String(), + govv1.DefaultThreshold.String(), + govv1.DefaultVetoThreshold.String(), + govv1.DefaultMinInitialDepositRatio.String(), + govv1.DefaultBurnProposalPrevote, + govv1.DefaultBurnVoteQuorom, + govv1.DefaultBurnVoteVeto, + sdk.NewCoin(assets.MicroUSDDenom, DefaultMinUusdDepositTokens), // 1,000,000 microLuna ) } @@ -132,8 +152,8 @@ func (p Params) ValidateBasic() error { return fmt.Errorf("mininum initial deposit ratio of proposal is too large: %s", minInitialDepositRatio) } - if minUusdDeposit := p.MinUusdDeposit; !minUusdDeposit.IsValid() { - return fmt.Errorf("invalid minimum uusd deposit: %s", minUusdDeposit) + if p.MinUusdDeposit.IsZero() || !p.MinUusdDeposit.IsValid() { + return fmt.Errorf("invalid minimum uusd deposit: %s", p.MinUusdDeposit) } return nil diff --git a/custom/gov/types/v2lunc1/tx.pb.go b/custom/gov/types/v2lunc1/tx.pb.go index fa945b69..546963d6 100644 --- a/custom/gov/types/v2lunc1/tx.pb.go +++ b/custom/gov/types/v2lunc1/tx.pb.go @@ -7,14 +7,12 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" - types "github.com/cosmos/cosmos-sdk/codec/types" - types1 "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" - _ "github.com/gogo/protobuf/types" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -34,37 +32,30 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type MsgSubmitProposal struct { - // messages are the arbitrary messages to be executed if proposal passes. - Messages []*types.Any `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"` - // initial_deposit is the deposit value that must be paid at proposal submission. - InitialDeposit []types1.Coin `protobuf:"bytes,2,rep,name=initial_deposit,json=initialDeposit,proto3" json:"initial_deposit"` - // proposer is the account address of the proposer. - Proposer string `protobuf:"bytes,3,opt,name=proposer,proto3" json:"proposer,omitempty"` - // metadata is any arbitrary metadata attached to the proposal. - Metadata string `protobuf:"bytes,4,opt,name=metadata,proto3" json:"metadata,omitempty"` - // title is the title of the proposal. - // - // Since: cosmos-sdk 0.47 - Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"` - // summary is the summary of the proposal +// MsgUpdateParams is the Msg/UpdateParams request type. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateParams struct { + // authority is the address that controls the module (defaults to x/gov unless overwritten). + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // params defines the x/gov parameters to update. // - // Since: cosmos-sdk 0.47 - Summary string `protobuf:"bytes,6,opt,name=summary,proto3" json:"summary,omitempty"` + // NOTE: All parameters must be supplied. + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` } -func (m *MsgSubmitProposal) Reset() { *m = MsgSubmitProposal{} } -func (m *MsgSubmitProposal) String() string { return proto.CompactTextString(m) } -func (*MsgSubmitProposal) ProtoMessage() {} -func (*MsgSubmitProposal) Descriptor() ([]byte, []int) { +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { return fileDescriptor_9d64e87259bdff9f, []int{0} } -func (m *MsgSubmitProposal) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgSubmitProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgSubmitProposal.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -74,186 +65,51 @@ func (m *MsgSubmitProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *MsgSubmitProposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSubmitProposal.Merge(m, src) +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) } -func (m *MsgSubmitProposal) XXX_Size() int { +func (m *MsgUpdateParams) XXX_Size() int { return m.Size() } -func (m *MsgSubmitProposal) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSubmitProposal.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSubmitProposal proto.InternalMessageInfo - -func (m *MsgSubmitProposal) GetMessages() []*types.Any { - if m != nil { - return m.Messages - } - return nil -} - -func (m *MsgSubmitProposal) GetInitialDeposit() []types1.Coin { - if m != nil { - return m.InitialDeposit - } - return nil -} - -func (m *MsgSubmitProposal) GetProposer() string { - if m != nil { - return m.Proposer - } - return "" +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) } -func (m *MsgSubmitProposal) GetMetadata() string { - if m != nil { - return m.Metadata - } - return "" -} +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo -func (m *MsgSubmitProposal) GetTitle() string { +func (m *MsgUpdateParams) GetAuthority() string { if m != nil { - return m.Title + return m.Authority } return "" } -func (m *MsgSubmitProposal) GetSummary() string { +func (m *MsgUpdateParams) GetParams() Params { if m != nil { - return m.Summary + return m.Params } - return "" + return Params{} } -// MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. -type MsgSubmitProposalResponse struct { - // proposal_id defines the unique id of the proposal. - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: cosmos-sdk 0.47 +type MsgUpdateParamsResponse struct { } -func (m *MsgSubmitProposalResponse) Reset() { *m = MsgSubmitProposalResponse{} } -func (m *MsgSubmitProposalResponse) String() string { return proto.CompactTextString(m) } -func (*MsgSubmitProposalResponse) ProtoMessage() {} -func (*MsgSubmitProposalResponse) Descriptor() ([]byte, []int) { +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_9d64e87259bdff9f, []int{1} } -func (m *MsgSubmitProposalResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgSubmitProposalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgSubmitProposalResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgSubmitProposalResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgSubmitProposalResponse.Merge(m, src) -} -func (m *MsgSubmitProposalResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgSubmitProposalResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgSubmitProposalResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgSubmitProposalResponse proto.InternalMessageInfo - -func (m *MsgSubmitProposalResponse) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -// MsgDeposit defines a message to submit a deposit to an existing proposal. -type MsgDeposit struct { - // proposal_id defines the unique id of the proposal. - ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id"` - // depositor defines the deposit addresses from the proposals. - Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` - // amount to be deposited by depositor. - Amount []types1.Coin `protobuf:"bytes,3,rep,name=amount,proto3" json:"amount"` -} - -func (m *MsgDeposit) Reset() { *m = MsgDeposit{} } -func (m *MsgDeposit) String() string { return proto.CompactTextString(m) } -func (*MsgDeposit) ProtoMessage() {} -func (*MsgDeposit) Descriptor() ([]byte, []int) { - return fileDescriptor_9d64e87259bdff9f, []int{2} -} -func (m *MsgDeposit) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgDeposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgDeposit.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *MsgDeposit) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDeposit.Merge(m, src) -} -func (m *MsgDeposit) XXX_Size() int { - return m.Size() -} -func (m *MsgDeposit) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDeposit.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgDeposit proto.InternalMessageInfo - -func (m *MsgDeposit) GetProposalId() uint64 { - if m != nil { - return m.ProposalId - } - return 0 -} - -func (m *MsgDeposit) GetDepositor() string { - if m != nil { - return m.Depositor - } - return "" -} - -func (m *MsgDeposit) GetAmount() []types1.Coin { - if m != nil { - return m.Amount - } - return nil -} - -// MsgDepositResponse defines the Msg/Deposit response type. -type MsgDepositResponse struct { -} - -func (m *MsgDepositResponse) Reset() { *m = MsgDepositResponse{} } -func (m *MsgDepositResponse) String() string { return proto.CompactTextString(m) } -func (*MsgDepositResponse) ProtoMessage() {} -func (*MsgDepositResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9d64e87259bdff9f, []int{3} -} -func (m *MsgDepositResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgDepositResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgDepositResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -263,68 +119,59 @@ func (m *MsgDepositResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *MsgDepositResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDepositResponse.Merge(m, src) +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) } -func (m *MsgDepositResponse) XXX_Size() int { +func (m *MsgUpdateParamsResponse) XXX_Size() int { return m.Size() } -func (m *MsgDepositResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDepositResponse.DiscardUnknown(m) +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgDepositResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgSubmitProposal)(nil), "terra.gov.v2lunc1.MsgSubmitProposal") - proto.RegisterType((*MsgSubmitProposalResponse)(nil), "terra.gov.v2lunc1.MsgSubmitProposalResponse") - proto.RegisterType((*MsgDeposit)(nil), "terra.gov.v2lunc1.MsgDeposit") - proto.RegisterType((*MsgDepositResponse)(nil), "terra.gov.v2lunc1.MsgDepositResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "terra.gov.v2lunc1.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "terra.gov.v2lunc1.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("terra/gov/v2lunc1/tx.proto", fileDescriptor_9d64e87259bdff9f) } var fileDescriptor_9d64e87259bdff9f = []byte{ - // 614 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xcf, 0x6b, 0x14, 0x31, - 0x14, 0xc7, 0x77, 0xba, 0xfd, 0x99, 0x42, 0xa5, 0x61, 0xc1, 0xec, 0x80, 0xb3, 0x65, 0x51, 0x28, - 0xd5, 0x26, 0x6e, 0xab, 0x82, 0xa5, 0x97, 0xae, 0x5e, 0x3c, 0x2c, 0xca, 0xf4, 0xe6, 0xa5, 0x64, - 0x66, 0x62, 0x0c, 0x4e, 0x26, 0xc3, 0x24, 0x33, 0xb8, 0x37, 0xf1, 0xe8, 0xc9, 0x3f, 0xc3, 0x63, - 0x0f, 0xfe, 0x07, 0x5e, 0xea, 0xad, 0x78, 0xf2, 0x54, 0xa4, 0x05, 0x0b, 0xfe, 0x15, 0x32, 0x33, - 0x99, 0x6d, 0xe9, 0x16, 0x7f, 0x5c, 0x76, 0xf3, 0xde, 0xf7, 0xbd, 0x97, 0xef, 0x7e, 0xb2, 0x09, - 0x70, 0x0d, 0xcb, 0x32, 0x4a, 0xb8, 0x2a, 0x48, 0xb1, 0x15, 0xe7, 0x49, 0x38, 0x20, 0xe6, 0x2d, - 0x4e, 0x33, 0x65, 0x14, 0x5c, 0xad, 0x34, 0xcc, 0x55, 0x81, 0xad, 0xe6, 0x7a, 0xa1, 0xd2, 0x52, - 0x69, 0x12, 0x50, 0xcd, 0x48, 0x31, 0x08, 0x98, 0xa1, 0x03, 0x12, 0x2a, 0x91, 0xd4, 0x2d, 0x6e, - 0x87, 0x2b, 0xae, 0xaa, 0x25, 0x29, 0x57, 0x36, 0xdb, 0xe3, 0x4a, 0xf1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 0x7d, 0xeb, 0xfa, 0x46, 0x2b, 0xbb, 0x77, 0xfe, 0x28, - 0x37, 0x03, 0xdd, 0xb9, 0x77, 0x25, 0x90, 0xe1, 0xfe, 0xd1, 0xa9, 0xe7, 0x1c, 0x9f, 0x7a, 0xce, - 0x8f, 0x53, 0xcf, 0xf9, 0x78, 0xe6, 0xb5, 0x8e, 0xcf, 0xbc, 0xd6, 0xf7, 0x33, 0xaf, 0xf5, 0xf2, - 0x31, 0x17, 0xe6, 0x75, 0x1e, 0xe0, 0x50, 0x49, 0x12, 0xc6, 0x54, 0x6b, 0x11, 0x6e, 0xd6, 0x6f, - 0x50, 0xa8, 0x32, 0x46, 0x8a, 0x6d, 0x12, 0xe6, 0xda, 0x28, 0x59, 0x3d, 0x49, 0x66, 0x9c, 0x32, - 0xdd, 0x3c, 0x4c, 0xc1, 0x7c, 0x75, 0xe7, 0xb6, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x6d, 0xe8, - 0x36, 0x8b, 0xb4, 0x04, 0x00, 0x00, + // 505 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4f, 0x8b, 0xd3, 0x40, + 0x14, 0x6f, 0x74, 0x5d, 0xe9, 0xb8, 0x28, 0x1d, 0x96, 0xdd, 0x76, 0x84, 0x58, 0xbb, 0x20, 0xa5, + 0xd2, 0x84, 0xed, 0xc2, 0x82, 0x22, 0x82, 0x55, 0xf1, 0x62, 0x61, 0x69, 0x71, 0x05, 0x11, 0x25, + 0x4d, 0x86, 0x69, 0xb0, 0xc9, 0x0b, 0x79, 0x93, 0xd2, 0xde, 0xc4, 0xa3, 0x27, 0xf1, 0x53, 0x78, + 0xec, 0xc1, 0xbb, 0xd7, 0x3d, 0x2e, 0x9e, 0x3c, 0x89, 0xb4, 0x87, 0x7e, 0x0d, 0x49, 0x32, 0x69, + 0xd9, 0x66, 0xd7, 0xf5, 0x12, 0x66, 0xde, 0xef, 0xdf, 0x64, 0xe6, 0x3d, 0xc2, 0x24, 0x0f, 0x43, + 0xcb, 0x14, 0x30, 0x32, 0x47, 0xad, 0x61, 0xe4, 0xdb, 0xfb, 0xa6, 0x1c, 0x1b, 0x41, 0x08, 0x12, + 0x68, 0x29, 0xc1, 0x0c, 0x01, 0x23, 0x43, 0x61, 0x6c, 0xc7, 0x06, 0xf4, 0x00, 0x53, 0xfe, 0x8a, + 0xca, 0xb6, 0x05, 0x08, 0x48, 0x96, 0x66, 0xbc, 0x52, 0xd5, 0xdb, 0x79, 0xf3, 0xd8, 0x2c, 0x05, + 0x2b, 0xa9, 0xd5, 0xfb, 0x54, 0x95, 0x6e, 0x14, 0xb4, 0xab, 0x52, 0x3c, 0x14, 0x71, 0x8a, 0x87, + 0x42, 0x01, 0x25, 0xcb, 0x73, 0x7d, 0x30, 0x93, 0x6f, 0x5a, 0xaa, 0xfd, 0xd0, 0xc8, 0xad, 0x0e, + 0x8a, 0x57, 0x81, 0x63, 0x49, 0x7e, 0x64, 0x85, 0x96, 0x87, 0xf4, 0x90, 0x14, 0xad, 0x48, 0x0e, + 0x20, 0x74, 0xe5, 0xa4, 0xac, 0x55, 0xb5, 0x7a, 0xb1, 0x5d, 0xfe, 0xf9, 0xbd, 0xb9, 0xad, 0x42, + 0x9e, 0x38, 0x4e, 0xc8, 0x11, 0x7b, 0x32, 0x74, 0x7d, 0xd1, 0x5d, 0x51, 0xe9, 0x23, 0xb2, 0x19, + 0x24, 0x0e, 0xe5, 0x2b, 0x55, 0xad, 0x7e, 0xa3, 0x55, 0x31, 0x72, 0x37, 0x60, 0xa4, 0x11, 0xed, + 0xe2, 0xc9, 0xef, 0x3b, 0x85, 0x6f, 0x8b, 0x69, 0x43, 0xeb, 0x2a, 0xcd, 0xc3, 0xc3, 0x4f, 0x8b, + 0x69, 0x63, 0xe5, 0xf6, 0x79, 0x31, 0x6d, 0xec, 0xa5, 0x89, 0x4d, 0x74, 0x3e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0x07, 0xc2, 0x95, 0x83, 0xa8, 0x6f, 0xd8, 0xe0, 0x99, 0xf6, 0xd0, 0x42, 0x74, + 0xed, 0x66, 0x3a, 0x82, 0x36, 0x84, 0xdc, 0x1c, 0x1d, 0x98, 0x76, 0x84, 0x12, 0xbc, 0xa4, 0x13, + 0xe5, 0x24, 0xe0, 0x98, 0xcd, 0x65, 0x7f, 0x33, 0x99, 0xa6, 0x83, 0xbf, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x10, 0xdb, 0x9e, 0x6a, 0x10, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -340,9 +187,21 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { // SubmitProposal defines a method to create new proposal given the messages. - SubmitProposal(ctx context.Context, in *MsgSubmitProposal, opts ...grpc.CallOption) (*MsgSubmitProposalResponse, error) + SubmitProposal(ctx context.Context, in *v1.MsgSubmitProposal, opts ...grpc.CallOption) (*v1.MsgSubmitProposalResponse, error) + // ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + // to execute a legacy content-based proposal. + ExecLegacyContent(ctx context.Context, in *v1.MsgExecLegacyContent, opts ...grpc.CallOption) (*v1.MsgExecLegacyContentResponse, error) + // Vote defines a method to add a vote on a specific proposal. + Vote(ctx context.Context, in *v1.MsgVote, opts ...grpc.CallOption) (*v1.MsgVoteResponse, error) + // VoteWeighted defines a method to add a weighted vote on a specific proposal. + VoteWeighted(ctx context.Context, in *v1.MsgVoteWeighted, opts ...grpc.CallOption) (*v1.MsgVoteWeightedResponse, error) // Deposit defines a method to add deposit on a specific proposal. - Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) + Deposit(ctx context.Context, in *v1.MsgDeposit, opts ...grpc.CallOption) (*v1.MsgDepositResponse, error) + // UpdateParams defines a governance operation for updating the x/gov module + // parameters. The authority is defined in the keeper. + // + // Since: cosmos-sdk 0.47 + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -353,8 +212,8 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) SubmitProposal(ctx context.Context, in *MsgSubmitProposal, opts ...grpc.CallOption) (*MsgSubmitProposalResponse, error) { - out := new(MsgSubmitProposalResponse) +func (c *msgClient) SubmitProposal(ctx context.Context, in *v1.MsgSubmitProposal, opts ...grpc.CallOption) (*v1.MsgSubmitProposalResponse, error) { + out := new(v1.MsgSubmitProposalResponse) err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Msg/SubmitProposal", in, out, opts...) if err != nil { return nil, err @@ -362,8 +221,35 @@ func (c *msgClient) SubmitProposal(ctx context.Context, in *MsgSubmitProposal, o return out, nil } -func (c *msgClient) Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.CallOption) (*MsgDepositResponse, error) { - out := new(MsgDepositResponse) +func (c *msgClient) ExecLegacyContent(ctx context.Context, in *v1.MsgExecLegacyContent, opts ...grpc.CallOption) (*v1.MsgExecLegacyContentResponse, error) { + out := new(v1.MsgExecLegacyContentResponse) + err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Msg/ExecLegacyContent", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Vote(ctx context.Context, in *v1.MsgVote, opts ...grpc.CallOption) (*v1.MsgVoteResponse, error) { + out := new(v1.MsgVoteResponse) + err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Msg/Vote", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) VoteWeighted(ctx context.Context, in *v1.MsgVoteWeighted, opts ...grpc.CallOption) (*v1.MsgVoteWeightedResponse, error) { + out := new(v1.MsgVoteWeightedResponse) + err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Msg/VoteWeighted", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) Deposit(ctx context.Context, in *v1.MsgDeposit, opts ...grpc.CallOption) (*v1.MsgDepositResponse, error) { + out := new(v1.MsgDepositResponse) err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Msg/Deposit", in, out, opts...) if err != nil { return nil, err @@ -371,31 +257,64 @@ func (c *msgClient) Deposit(ctx context.Context, in *MsgDeposit, opts ...grpc.Ca return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { // SubmitProposal defines a method to create new proposal given the messages. - SubmitProposal(context.Context, *MsgSubmitProposal) (*MsgSubmitProposalResponse, error) + SubmitProposal(context.Context, *v1.MsgSubmitProposal) (*v1.MsgSubmitProposalResponse, error) + // ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + // to execute a legacy content-based proposal. + ExecLegacyContent(context.Context, *v1.MsgExecLegacyContent) (*v1.MsgExecLegacyContentResponse, error) + // Vote defines a method to add a vote on a specific proposal. + Vote(context.Context, *v1.MsgVote) (*v1.MsgVoteResponse, error) + // VoteWeighted defines a method to add a weighted vote on a specific proposal. + VoteWeighted(context.Context, *v1.MsgVoteWeighted) (*v1.MsgVoteWeightedResponse, error) // Deposit defines a method to add deposit on a specific proposal. - Deposit(context.Context, *MsgDeposit) (*MsgDepositResponse, error) + Deposit(context.Context, *v1.MsgDeposit) (*v1.MsgDepositResponse, error) + // UpdateParams defines a governance operation for updating the x/gov module + // parameters. The authority is defined in the keeper. + // + // Since: cosmos-sdk 0.47 + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) SubmitProposal(ctx context.Context, req *MsgSubmitProposal) (*MsgSubmitProposalResponse, error) { +func (*UnimplementedMsgServer) SubmitProposal(ctx context.Context, req *v1.MsgSubmitProposal) (*v1.MsgSubmitProposalResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SubmitProposal not implemented") } -func (*UnimplementedMsgServer) Deposit(ctx context.Context, req *MsgDeposit) (*MsgDepositResponse, error) { +func (*UnimplementedMsgServer) ExecLegacyContent(ctx context.Context, req *v1.MsgExecLegacyContent) (*v1.MsgExecLegacyContentResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ExecLegacyContent not implemented") +} +func (*UnimplementedMsgServer) Vote(ctx context.Context, req *v1.MsgVote) (*v1.MsgVoteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Vote not implemented") +} +func (*UnimplementedMsgServer) VoteWeighted(ctx context.Context, req *v1.MsgVoteWeighted) (*v1.MsgVoteWeightedResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method VoteWeighted not implemented") +} +func (*UnimplementedMsgServer) Deposit(ctx context.Context, req *v1.MsgDeposit) (*v1.MsgDepositResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Deposit not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } func _Msg_SubmitProposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgSubmitProposal) + in := new(v1.MsgSubmitProposal) if err := dec(in); err != nil { return nil, err } @@ -407,13 +326,67 @@ func _Msg_SubmitProposal_Handler(srv interface{}, ctx context.Context, dec func( FullMethod: "/terra.gov.v2lunc1.Msg/SubmitProposal", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).SubmitProposal(ctx, req.(*MsgSubmitProposal)) + return srv.(MsgServer).SubmitProposal(ctx, req.(*v1.MsgSubmitProposal)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_ExecLegacyContent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(v1.MsgExecLegacyContent) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).ExecLegacyContent(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terra.gov.v2lunc1.Msg/ExecLegacyContent", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).ExecLegacyContent(ctx, req.(*v1.MsgExecLegacyContent)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(v1.MsgVote) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).Vote(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terra.gov.v2lunc1.Msg/Vote", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).Vote(ctx, req.(*v1.MsgVote)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_VoteWeighted_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(v1.MsgVoteWeighted) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).VoteWeighted(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terra.gov.v2lunc1.Msg/VoteWeighted", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).VoteWeighted(ctx, req.(*v1.MsgVoteWeighted)) } return interceptor(ctx, in, info, handler) } func _Msg_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDeposit) + in := new(v1.MsgDeposit) if err := dec(in); err != nil { return nil, err } @@ -425,7 +398,25 @@ func _Msg_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interfa FullMethod: "/terra.gov.v2lunc1.Msg/Deposit", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Deposit(ctx, req.(*MsgDeposit)) + return srv.(MsgServer).Deposit(ctx, req.(*v1.MsgDeposit)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terra.gov.v2lunc1.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) } return interceptor(ctx, in, info, handler) } @@ -438,123 +429,32 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "SubmitProposal", Handler: _Msg_SubmitProposal_Handler, }, + { + MethodName: "ExecLegacyContent", + Handler: _Msg_ExecLegacyContent_Handler, + }, + { + MethodName: "Vote", + Handler: _Msg_Vote_Handler, + }, + { + MethodName: "VoteWeighted", + Handler: _Msg_VoteWeighted_Handler, + }, { MethodName: "Deposit", Handler: _Msg_Deposit_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "terra/gov/v2lunc1/tx.proto", } -func (m *MsgSubmitProposal) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgSubmitProposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSubmitProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Summary) > 0 { - i -= len(m.Summary) - copy(dAtA[i:], m.Summary) - i = encodeVarintTx(dAtA, i, uint64(len(m.Summary))) - i-- - dAtA[i] = 0x32 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintTx(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0x2a - } - if len(m.Metadata) > 0 { - i -= len(m.Metadata) - copy(dAtA[i:], m.Metadata) - i = encodeVarintTx(dAtA, i, uint64(len(m.Metadata))) - i-- - dAtA[i] = 0x22 - } - if len(m.Proposer) > 0 { - i -= len(m.Proposer) - copy(dAtA[i:], m.Proposer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Proposer))) - i-- - dAtA[i] = 0x1a - } - if len(m.InitialDeposit) > 0 { - for iNdEx := len(m.InitialDeposit) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.InitialDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Messages) > 0 { - for iNdEx := len(m.Messages) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Messages[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *MsgSubmitProposalResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *MsgSubmitProposalResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgSubmitProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ProposalId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *MsgDeposit) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -564,46 +464,37 @@ func (m *MsgDeposit) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgDeposit) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgDeposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Amount) > 0 { - for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - } - if len(m.Depositor) > 0 { - i -= len(m.Depositor) - copy(dAtA[i:], m.Depositor) - i = encodeVarintTx(dAtA, i, uint64(len(m.Depositor))) + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) i-- - dAtA[i] = 0x12 - } - if m.ProposalId != 0 { - i = encodeVarintTx(dAtA, i, uint64(m.ProposalId)) - i-- - dAtA[i] = 0x8 + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *MsgDepositResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -613,12 +504,12 @@ func (m *MsgDepositResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgDepositResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgDepositResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -637,78 +528,22 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgSubmitProposal) Size() (n int) { +func (m *MsgUpdateParams) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Messages) > 0 { - for _, e := range m.Messages { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - if len(m.InitialDeposit) > 0 { - for _, e := range m.InitialDeposit { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - l = len(m.Proposer) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Metadata) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Title) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Summary) + l = len(m.Authority) if l > 0 { n += 1 + l + sovTx(uint64(l)) } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) return n } -func (m *MsgSubmitProposalResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovTx(uint64(m.ProposalId)) - } - return n -} - -func (m *MsgDeposit) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ProposalId != 0 { - n += 1 + sovTx(uint64(m.ProposalId)) - } - l = len(m.Depositor) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.Amount) > 0 { - for _, e := range m.Amount { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgDepositResponse) Size() (n int) { +func (m *MsgUpdateParamsResponse) Size() (n int) { if m == nil { return 0 } @@ -723,7 +558,7 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -746,147 +581,15 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgSubmitProposal: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSubmitProposal: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Messages = append(m.Messages, &types.Any{}) - if err := m.Messages[len(m.Messages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field InitialDeposit", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.InitialDeposit = append(m.InitialDeposit, types1.Coin{}) - if err := m.InitialDeposit[len(m.InitialDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proposer", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Proposer = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Metadata = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -914,213 +617,11 @@ func (m *MsgSubmitProposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Title = string(dAtA[iNdEx:postIndex]) + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Summary", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Summary = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgSubmitProposalResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgSubmitProposalResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgSubmitProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgDeposit) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MsgDeposit: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDeposit: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) - } - m.ProposalId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProposalId |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Depositor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1147,8 +648,7 @@ func (m *MsgDeposit) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Amount = append(m.Amount, types1.Coin{}) - if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1173,7 +673,7 @@ func (m *MsgDeposit) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDepositResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1196,10 +696,10 @@ func (m *MsgDepositResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDepositResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDepositResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/custom/params/types/codec.go b/custom/params/types/codec.go index 8548a0b6..1309a83c 100644 --- a/custom/params/types/codec.go +++ b/custom/params/types/codec.go @@ -3,15 +3,9 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - - govtypes "github.com/classic-terra/core/v3/custom/gov/types" ) // RegisterLegacyAminoCodec registers all necessary param module types with a given LegacyAmino codec. func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&proposal.ParameterChangeProposal{}, "params/ParameterChangeProposal", nil) } - -func init() { - govtypes.RegisterProposalTypeCodec(&proposal.ParameterChangeProposal{}, "params/ParameterChangeProposal") -} diff --git a/custom/upgrade/types/codec.go b/custom/upgrade/types/codec.go index bc63758e..8bb324a3 100644 --- a/custom/upgrade/types/codec.go +++ b/custom/upgrade/types/codec.go @@ -3,8 +3,6 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/upgrade/types" - - govtypes "github.com/classic-terra/core/v3/custom/gov/types" ) // RegisterLegacyAminoCodec registers concrete types on the LegacyAmino codec @@ -13,8 +11,3 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&types.SoftwareUpgradeProposal{}, "upgrade/SoftwareUpgradeProposal", nil) cdc.RegisterConcrete(&types.CancelSoftwareUpgradeProposal{}, "upgrade/CancelSoftwareUpgradeProposal", nil) } - -func init() { - govtypes.RegisterProposalTypeCodec(&types.SoftwareUpgradeProposal{}, "upgrade/SoftwareUpgradeProposal") - govtypes.RegisterProposalTypeCodec(&types.CancelSoftwareUpgradeProposal{}, "upgrade/CancelSoftwareUpgradeProposal") -} diff --git a/proto/terra/gov/v2lunc1/genesis.proto b/proto/terra/gov/v2lunc1/genesis.proto index 4de9326b..9091aa59 100644 --- a/proto/terra/gov/v2lunc1/genesis.proto +++ b/proto/terra/gov/v2lunc1/genesis.proto @@ -1,7 +1,12 @@ syntax = "proto3"; package terra.gov.v2lunc1; +import "cosmos/base/v1beta1/coin.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/duration.proto"; +import "cosmos_proto/cosmos.proto"; import "terra/gov/v2lunc1/gov.proto"; +import "cosmos/gov/v1/gov.proto"; option go_package = "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1"; @@ -10,23 +15,22 @@ message GenesisState { // starting_proposal_id is the ID of the starting proposal. uint64 starting_proposal_id = 1; // deposits defines all the deposits present at genesis. - repeated Deposit deposits = 2; + repeated cosmos.gov.v1.Deposit deposits = 2; // votes defines all the votes present at genesis. - repeated Vote votes = 3; + repeated cosmos.gov.v1.Vote votes = 3; // proposals defines all the proposals present at genesis. - repeated Proposal proposals = 4; + repeated cosmos.gov.v1.Proposal proposals = 4; // Deprecated: Prefer to use `params` instead. // deposit_params defines all the paramaters of related to deposit. - DepositParams deposit_params = 5 [deprecated = true]; + cosmos.gov.v1.DepositParams deposit_params = 5 [deprecated = true]; // Deprecated: Prefer to use `params` instead. // voting_params defines all the paramaters of related to voting. - VotingParams voting_params = 6 [deprecated = true]; + cosmos.gov.v1.VotingParams voting_params = 6 [deprecated = true]; // Deprecated: Prefer to use `params` instead. // tally_params defines all the paramaters of related to tally. - TallyParams tally_params = 7 [deprecated = true]; + cosmos.gov.v1.TallyParams tally_params = 7 [deprecated = true]; // params defines all the paramaters of x/gov module. // // Since: cosmos-sdk 0.47 - Params params = 8; - + terra.gov.v2lunc1.Params params = 8; } diff --git a/proto/terra/gov/v2lunc1/gov.proto b/proto/terra/gov/v2lunc1/gov.proto index 7d20af9d..95b0acdf 100644 --- a/proto/terra/gov/v2lunc1/gov.proto +++ b/proto/terra/gov/v2lunc1/gov.proto @@ -3,8 +3,6 @@ package terra.gov.v2lunc1; import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/any.proto"; import "google/protobuf/duration.proto"; import "cosmos_proto/cosmos.proto"; import "amino/amino.proto"; @@ -199,7 +197,7 @@ message Params { // burn deposits if the proposal does not enter voting period bool burn_proposal_deposit_prevote = 14; - + // burn deposits if quorum with vote type no_veto is met bool burn_vote_veto = 15; diff --git a/proto/terra/gov/v2lunc1/tx.proto b/proto/terra/gov/v2lunc1/tx.proto index bed1a16d..264eea92 100644 --- a/proto/terra/gov/v2lunc1/tx.proto +++ b/proto/terra/gov/v2lunc1/tx.proto @@ -1,11 +1,9 @@ syntax = "proto3"; package terra.gov.v2lunc1; -import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/gov/v1/tx.proto"; import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/duration.proto"; +import "terra/gov/v2lunc1/gov.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; import "amino/amino.proto"; @@ -17,59 +15,46 @@ service Msg { option (cosmos.msg.v1.service) = true; // SubmitProposal defines a method to create new proposal given the messages. - rpc SubmitProposal(MsgSubmitProposal) returns (MsgSubmitProposalResponse); + rpc SubmitProposal(cosmos.gov.v1.MsgSubmitProposal) returns (cosmos.gov.v1.MsgSubmitProposalResponse); - // Deposit defines a method to add deposit on a specific proposal. - rpc Deposit(MsgDeposit) returns (MsgDepositResponse); -} - -message MsgSubmitProposal { - option (cosmos.msg.v1.signer) = "proposer"; - option (amino.name) = "cosmos-sdk/v1/MsgSubmitProposal"; + // ExecLegacyContent defines a Msg to be in included in a MsgSubmitProposal + // to execute a legacy content-based proposal. + rpc ExecLegacyContent(cosmos.gov.v1.MsgExecLegacyContent) returns (cosmos.gov.v1.MsgExecLegacyContentResponse); - // messages are the arbitrary messages to be executed if proposal passes. - repeated google.protobuf.Any messages = 1; + // Vote defines a method to add a vote on a specific proposal. + rpc Vote(cosmos.gov.v1.MsgVote) returns (cosmos.gov.v1.MsgVoteResponse); - // initial_deposit is the deposit value that must be paid at proposal submission. - repeated cosmos.base.v1beta1.Coin initial_deposit = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; - - // proposer is the account address of the proposer. - string proposer = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // metadata is any arbitrary metadata attached to the proposal. - string metadata = 4; + // VoteWeighted defines a method to add a weighted vote on a specific proposal. + rpc VoteWeighted(cosmos.gov.v1.MsgVoteWeighted) returns (cosmos.gov.v1.MsgVoteWeightedResponse); - // title is the title of the proposal. - // - // Since: cosmos-sdk 0.47 - string title = 5; + // Deposit defines a method to add deposit on a specific proposal. + rpc Deposit(cosmos.gov.v1.MsgDeposit) returns (cosmos.gov.v1.MsgDepositResponse); - // summary is the summary of the proposal + // UpdateParams defines a governance operation for updating the x/gov module + // parameters. The authority is defined in the keeper. // // Since: cosmos-sdk 0.47 - string summary = 6; + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } -// MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. -message MsgSubmitProposalResponse { - // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1; -} +// MsgUpdateParams is the Msg/UpdateParams request type. +// +// Since: cosmos-sdk 0.47 +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "cosmos-sdk/x/gov/v1/MsgUpdateParams"; -// MsgDeposit defines a message to submit a deposit to an existing proposal. -message MsgDeposit { - option (cosmos.msg.v1.signer) = "depositor"; - option (amino.name) = "cosmos-sdk/v1/MsgDeposit"; + // authority is the address that controls the module (defaults to x/gov unless overwritten). + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - // proposal_id defines the unique id of the proposal. - uint64 proposal_id = 1 [(gogoproto.jsontag) = "proposal_id", (amino.dont_omitempty) = true]; - - // depositor defines the deposit addresses from the proposals. - string depositor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; - - // amount to be deposited by depositor. - repeated cosmos.base.v1beta1.Coin amount = 3 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + // params defines the x/gov parameters to update. + // + // NOTE: All parameters must be supplied. + terra.gov.v2lunc1.Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } -// MsgDepositResponse defines the Msg/Deposit response type. -message MsgDepositResponse {} \ No newline at end of file +// MsgUpdateParamsResponse defines the response structure for executing a +// MsgUpdateParams message. +// +// Since: cosmos-sdk 0.47 +message MsgUpdateParamsResponse {} From 5bf6106052afb8c5bf83b6fda1362f559c08d301 Mon Sep 17 00:00:00 2001 From: tusoict Date: Sat, 12 Oct 2024 16:01:40 +0700 Subject: [PATCH 23/60] added missing file --- custom/gov/client/cli/tx.go | 103 ------------------------------------ custom/gov/types/codec.go | 46 ---------------- 2 files changed, 149 deletions(-) delete mode 100644 custom/gov/client/cli/tx.go delete mode 100644 custom/gov/types/codec.go diff --git a/custom/gov/client/cli/tx.go b/custom/gov/client/cli/tx.go deleted file mode 100644 index 9ddb3334..00000000 --- a/custom/gov/client/cli/tx.go +++ /dev/null @@ -1,103 +0,0 @@ -package cli - -import ( - "fmt" - "strings" - - "github.com/spf13/cobra" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/cosmos/cosmos-sdk/version" - "github.com/cosmos/cosmos-sdk/x/bank/types" - v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" -) - -var FlagSplit = "split" - -// GetTxCmd returns the transaction commands for this module -func GetTxCmd() *cobra.Command { - txCmd := &cobra.Command{ - Use: types.ModuleName, - Short: "Governance transaction subcommands", - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - txCmd.AddCommand(NewCmdSubmitProposal()) - - return txCmd -} - -// NewCmdSubmitProposal implements submitting a proposal transaction command. -func NewCmdSubmitProposal() *cobra.Command { - cmd := &cobra.Command{ - Use: "submit-proposal [path/to/proposal.json]", - Short: "Submit a proposal along with some messages, metadata and deposit", - Args: cobra.ExactArgs(1), - Long: strings.TrimSpace( - fmt.Sprintf(`Submit a proposal along with some messages, metadata and deposit. -They should be defined in a JSON file. - -Example: -$ %s tx gov submit-proposal path/to/proposal.json - -Where proposal.json contains: - -{ - // array of proto-JSON-encoded sdk.Msgs - "messages": [ - { - "@type": "/cosmos.bank.v1beta1.MsgSend", - "from_address": "cosmos1...", - "to_address": "cosmos1...", - "amount":[{"denom": "stake","amount": "10"}] - } - ], - // metadata can be any of base64 encoded, raw text, stringified json, IPFS link to json - // see below for example metadata - "metadata": "4pIMOgIGx1vZGU=", - "deposit": "10stake", - "title": "My proposal", - "summary": "A short summary of my proposal" -} - -metadata example: -{ - "title": "", - "authors": [""], - "summary": "", - "details": "", - "proposal_forum_url": "", - "vote_option_context": "", -} -`, - version.AppName, - ), - ), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - msgs, metadata, title, summary, deposit, err := parseSubmitProposal(clientCtx.Codec, args[0]) - if err != nil { - return err - } - - msg, err := v1.NewMsgSubmitProposal(msgs, deposit, clientCtx.GetFromAddress().String(), metadata, title, summary) - if err != nil { - return fmt.Errorf("invalid message: %w", err) - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/custom/gov/types/codec.go b/custom/gov/types/codec.go deleted file mode 100644 index d0008cab..00000000 --- a/custom/gov/types/codec.go +++ /dev/null @@ -1,46 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/legacy" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" -) - -// RegisterLegacyAminoCodec registers all the necessary types and interfaces for the -// governance module. -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterInterface((*govv1beta1.Content)(nil), nil) - legacy.RegisterAminoMsg(cdc, &govv1beta1.MsgSubmitProposal{}, "gov/MsgSubmitProposal") - legacy.RegisterAminoMsg(cdc, &govv1beta1.MsgDeposit{}, "gov/MsgDeposit") - legacy.RegisterAminoMsg(cdc, &govv1beta1.MsgVote{}, "gov/MsgVote") - legacy.RegisterAminoMsg(cdc, &govv1beta1.MsgVoteWeighted{}, "gov/MsgVoteWeighted") - cdc.RegisterConcrete(&govv1beta1.TextProposal{}, "gov/TextProposal", nil) -} - -// RegisterProposalTypeCodec registers an external proposal content type defined -// in another module for the internal ModuleCdc. This allows the MsgSubmitProposal -// to be correctly Amino encoded and decoded. -// -// NOTE: This should only be used for applications that are still using a concrete -// Amino codec for serialization. -func RegisterProposalTypeCodec(o interface{}, name string) { - amino.RegisterConcrete(o, name, nil) -} - -var ( - amino = codec.NewLegacyAmino() - - // ModuleCdc references the global x/gov module codec. Note, the codec should - // ONLY be used in certain instances of tests and for JSON encoding as Amino is - // still used for that purpose. - // - // The actual codec used for serialization should be provided to x/gov and - // defined at the application level. - ModuleCdc = codec.NewAminoCodec(amino) -) - -func init() { - RegisterLegacyAminoCodec(amino) - cryptocodec.RegisterCrypto(amino) -} From fb0f953ae643719abf0fdbb1316f672542b45555 Mon Sep 17 00:00:00 2001 From: tusoict Date: Sun, 13 Oct 2024 12:23:44 +0700 Subject: [PATCH 24/60] Update codec & fix config test --- custom/gov/keeper/test_utils.go | 303 ++++++++++++++++++++++++++++++ custom/gov/types/v2lunc1/codec.go | 11 -- 2 files changed, 303 insertions(+), 11 deletions(-) create mode 100644 custom/gov/keeper/test_utils.go diff --git a/custom/gov/keeper/test_utils.go b/custom/gov/keeper/test_utils.go new file mode 100644 index 00000000..125b6c38 --- /dev/null +++ b/custom/gov/keeper/test_utils.go @@ -0,0 +1,303 @@ +package keeper + +//nolint +//DONTCOVER + +import ( + "fmt" + "testing" + "time" + + "github.com/stretchr/testify/require" + + customauth "github.com/classic-terra/core/v3/custom/auth" + custombank "github.com/classic-terra/core/v3/custom/bank" + customdistr "github.com/classic-terra/core/v3/custom/distribution" + "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + customparams "github.com/classic-terra/core/v3/custom/params" + customstaking "github.com/classic-terra/core/v3/custom/staking" + core "github.com/classic-terra/core/v3/types" + "github.com/classic-terra/core/v3/x/market/types" + "github.com/classic-terra/core/v3/x/oracle" + oraclekeeper "github.com/classic-terra/core/v3/x/oracle/keeper" + oracletypes "github.com/classic-terra/core/v3/x/oracle/types" + + dbm "github.com/cometbft/cometbft-db" + "github.com/cometbft/cometbft/crypto" + "github.com/cometbft/cometbft/crypto/secp256k1" + "github.com/cometbft/cometbft/libs/log" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + + simparams "cosmossdk.io/simapp/params" + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/std" + "github.com/cosmos/cosmos-sdk/store" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + "github.com/cosmos/cosmos-sdk/x/auth/tx" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" +) + +const faucetAccountName = "faucet" + +var ModuleBasics = module.NewBasicManager( + customauth.AppModuleBasic{}, + custombank.AppModuleBasic{}, + customstaking.AppModuleBasic{}, + customdistr.AppModuleBasic{}, + customparams.AppModuleBasic{}, + oracle.AppModuleBasic{}, +) + +// MakeTestCodec +func MakeTestCodec(t *testing.T) codec.Codec { + return MakeEncodingConfig(t).Codec +} + +// MakeEncodingConfig +func MakeEncodingConfig(_ *testing.T) simparams.EncodingConfig { + amino := codec.NewLegacyAmino() + interfaceRegistry := codectypes.NewInterfaceRegistry() + codec := codec.NewProtoCodec(interfaceRegistry) + txCfg := tx.NewTxConfig(codec, tx.DefaultSignModes) + + std.RegisterInterfaces(interfaceRegistry) + std.RegisterLegacyAminoCodec(amino) + + ModuleBasics.RegisterLegacyAminoCodec(amino) + ModuleBasics.RegisterInterfaces(interfaceRegistry) + v1beta1.RegisterLegacyAminoCodec(amino) + v1beta1.RegisterInterfaces(interfaceRegistry) + v2lunc1.RegisterLegacyAminoCodec(amino) + v2lunc1.RegisterInterfaces(interfaceRegistry) + types.RegisterLegacyAminoCodec(amino) + types.RegisterInterfaces(interfaceRegistry) + + return simparams.EncodingConfig{ + InterfaceRegistry: interfaceRegistry, + Codec: codec, + TxConfig: txCfg, + Amino: amino, + } +} + +// Test Account +var ( + PubKeys = []crypto.PubKey{ + secp256k1.GenPrivKey().PubKey(), + secp256k1.GenPrivKey().PubKey(), + secp256k1.GenPrivKey().PubKey(), + } + + Addrs = []sdk.AccAddress{ + sdk.AccAddress(PubKeys[0].Address()), + sdk.AccAddress(PubKeys[1].Address()), + sdk.AccAddress(PubKeys[2].Address()), + } + + ValAddrs = []sdk.ValAddress{ + sdk.ValAddress(PubKeys[0].Address()), + sdk.ValAddress(PubKeys[1].Address()), + sdk.ValAddress(PubKeys[2].Address()), + } + + InitTokens = sdk.TokensFromConsensusPower(200, sdk.DefaultPowerReduction) + InitCoins = sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, InitTokens)) +) + +type TestInput struct { + Ctx sdk.Context + Cdc *codec.LegacyAmino + AccountKeeper authkeeper.AccountKeeper + BankKeeper bankkeeper.Keeper + OracleKeeper types.OracleKeeper + GovKeeper *Keeper +} + +func CreateTestInput(t *testing.T) TestInput { + keyAcc := sdk.NewKVStoreKey(authtypes.StoreKey) + keyBank := sdk.NewKVStoreKey(banktypes.StoreKey) + keyParams := sdk.NewKVStoreKey(paramstypes.StoreKey) + tKeyParams := sdk.NewTransientStoreKey(paramstypes.TStoreKey) + keyOracle := sdk.NewKVStoreKey(oracletypes.StoreKey) + keyStaking := sdk.NewKVStoreKey(stakingtypes.StoreKey) + keyDistr := sdk.NewKVStoreKey(distrtypes.StoreKey) + keyMarket := sdk.NewKVStoreKey(types.StoreKey) + keyGov := sdk.NewKVStoreKey(govtypes.StoreKey) + + db := dbm.NewMemDB() + ms := store.NewCommitMultiStore(db) + ctx := sdk.NewContext(ms, tmproto.Header{Time: time.Now().UTC()}, false, log.NewNopLogger()) + encodingConfig := MakeEncodingConfig(t) + appCodec, legacyAmino := encodingConfig.Codec, encodingConfig.Amino + + ms.MountStoreWithDB(keyAcc, storetypes.StoreTypeIAVL, db) + ms.MountStoreWithDB(keyBank, storetypes.StoreTypeIAVL, db) + ms.MountStoreWithDB(tKeyParams, storetypes.StoreTypeTransient, db) + ms.MountStoreWithDB(keyParams, storetypes.StoreTypeIAVL, db) + ms.MountStoreWithDB(keyOracle, storetypes.StoreTypeIAVL, db) + ms.MountStoreWithDB(keyStaking, storetypes.StoreTypeIAVL, db) + ms.MountStoreWithDB(keyDistr, storetypes.StoreTypeIAVL, db) + ms.MountStoreWithDB(keyMarket, storetypes.StoreTypeIAVL, db) + ms.MountStoreWithDB(keyGov, storetypes.StoreTypeIAVL, db) + + require.NoError(t, ms.LoadLatestVersion()) + + blackListAddrs := map[string]bool{ + faucetAccountName: true, + authtypes.FeeCollectorName: true, + stakingtypes.NotBondedPoolName: true, + stakingtypes.BondedPoolName: true, + distrtypes.ModuleName: true, + } + + maccPerms := map[string][]string{ + faucetAccountName: {authtypes.Minter}, + authtypes.FeeCollectorName: nil, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + distrtypes.ModuleName: nil, + oracletypes.ModuleName: nil, + types.ModuleName: {authtypes.Burner, authtypes.Minter}, + govtypes.ModuleName: nil, + } + + paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, keyParams, tKeyParams) + accountKeeper := authkeeper.NewAccountKeeper(appCodec, keyAcc, authtypes.ProtoBaseAccount, maccPerms, sdk.GetConfig().GetBech32AccountAddrPrefix(), authtypes.NewModuleAddress(govtypes.ModuleName).String()) + bankKeeper := bankkeeper.NewBaseKeeper(appCodec, keyBank, accountKeeper, blackListAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + + totalSupply := sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, InitTokens.MulRaw(int64(len(Addrs)*10)))) + err := bankKeeper.MintCoins(ctx, faucetAccountName, totalSupply) + require.NoError(t, err) + + stakingKeeper := stakingkeeper.NewKeeper( + appCodec, + keyStaking, + accountKeeper, + bankKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + stakingParams := stakingtypes.DefaultParams() + stakingParams.BondDenom = core.MicroLunaDenom + stakingKeeper.SetParams(ctx, stakingParams) + + distrKeeper := distrkeeper.NewKeeper( + appCodec, keyDistr, + accountKeeper, bankKeeper, stakingKeeper, + authtypes.FeeCollectorName, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + distrKeeper.SetFeePool(ctx, distrtypes.InitialFeePool()) + distrParams := distrtypes.DefaultParams() + distrParams.CommunityTax = sdk.NewDecWithPrec(2, 2) + distrParams.BaseProposerReward = sdk.NewDecWithPrec(1, 2) + distrParams.BonusProposerReward = sdk.NewDecWithPrec(4, 2) + distrKeeper.SetParams(ctx, distrParams) + stakingKeeper.SetHooks(stakingtypes.NewMultiStakingHooks(distrKeeper.Hooks())) + + feeCollectorAcc := authtypes.NewEmptyModuleAccount(authtypes.FeeCollectorName) + notBondedPool := authtypes.NewEmptyModuleAccount(stakingtypes.NotBondedPoolName, authtypes.Burner, authtypes.Staking) + bondPool := authtypes.NewEmptyModuleAccount(stakingtypes.BondedPoolName, authtypes.Burner, authtypes.Staking) + distrAcc := authtypes.NewEmptyModuleAccount(distrtypes.ModuleName) + oracleAcc := authtypes.NewEmptyModuleAccount(oracletypes.ModuleName) + marketAcc := authtypes.NewEmptyModuleAccount(types.ModuleName, authtypes.Burner, authtypes.Minter) + govAcc := authtypes.NewEmptyModuleAccount(govtypes.ModuleName, authtypes.Burner, authtypes.Minter, authtypes.Staking) + + err = bankKeeper.SendCoinsFromModuleToModule(ctx, faucetAccountName, stakingtypes.NotBondedPoolName, sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, InitTokens.MulRaw(int64(len(Addrs)))))) + require.NoError(t, err) + + accountKeeper.SetModuleAccount(ctx, feeCollectorAcc) + accountKeeper.SetModuleAccount(ctx, bondPool) + accountKeeper.SetModuleAccount(ctx, notBondedPool) + accountKeeper.SetModuleAccount(ctx, distrAcc) + accountKeeper.SetModuleAccount(ctx, oracleAcc) + accountKeeper.SetModuleAccount(ctx, marketAcc) + accountKeeper.SetModuleAccount(ctx, govAcc) + + addr := accountKeeper.GetModuleAddress(govtypes.ModuleName) + if addr == nil { + fmt.Println("addr is nil") + } + fmt.Println("address: ", addr.String()) + + for _, addr := range Addrs { + accountKeeper.SetAccount(ctx, authtypes.NewBaseAccountWithAddress(addr)) + err := bankKeeper.SendCoinsFromModuleToAccount(ctx, faucetAccountName, addr, InitCoins) + require.NoError(t, err) + require.Equal(t, bankKeeper.GetAllBalances(ctx, addr), InitCoins) + } + + oracleKeeper := oraclekeeper.NewKeeper( + appCodec, + keyOracle, + paramsKeeper.Subspace(oracletypes.ModuleName), + accountKeeper, + bankKeeper, + distrKeeper, + stakingKeeper, + distrtypes.ModuleName, + ) + oracleDefaultParams := oracletypes.DefaultParams() + oracleKeeper.SetParams(ctx, oracleDefaultParams) + + for _, denom := range oracleDefaultParams.Whitelist { + oracleKeeper.SetTobinTax(ctx, denom.Name, denom.TobinTax) + } + + // Create MsgServiceRouter, but don't populate it before creating the gov + // keeper. + msr := baseapp.NewMsgServiceRouter() + + govKeeper := NewKeeper( + appCodec, + keyGov, + accountKeeper, + bankKeeper, + stakingKeeper, + oracleKeeper, + msr, + govtypes.DefaultConfig(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + govKeeper.SetProposalID(ctx, 1) + govRouter := v1beta1.NewRouter() // Also register legacy gov handlers to test them too. + govRouter.AddRoute(govtypes.RouterKey, v1beta1.ProposalHandler) + govKeeper.SetLegacyRouter(govRouter) + govKeeper.SetParams(ctx, v2lunc1.DefaultParams()) + + // Register all handlers for the MegServiceRouter. + msr.SetInterfaceRegistry(encodingConfig.InterfaceRegistry) + msgServer := NewMsgServerImpl(govKeeper) + v1beta1.RegisterMsgServer(msr, NewLegacyMsgServerImpl(accountKeeper.GetModuleAddress(govtypes.ModuleName).String(), msgServer)) + v2lunc1.RegisterMsgServer(msr, msgServer) + banktypes.RegisterMsgServer(msr, nil) // + + return TestInput{ctx, legacyAmino, accountKeeper, bankKeeper, oracleKeeper, govKeeper} +} + +// FundAccount is a utility function that funds an account by minting and +// sending the coins to the address. This should be used for testing purposes +// only! +func FundAccount(input TestInput, addr sdk.AccAddress, amounts sdk.Coins) error { + if err := input.BankKeeper.MintCoins(input.Ctx, faucetAccountName, amounts); err != nil { + return err + } + + return input.BankKeeper.SendCoinsFromModuleToAccount(input.Ctx, faucetAccountName, addr, amounts) +} diff --git a/custom/gov/types/v2lunc1/codec.go b/custom/gov/types/v2lunc1/codec.go index 48ecb589..872580b8 100644 --- a/custom/gov/types/v2lunc1/codec.go +++ b/custom/gov/types/v2lunc1/codec.go @@ -6,10 +6,7 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/msgservice" - authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec" - govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec" ) // RegisterLegacyAminoCodec registers all the necessary types and interfaces for the @@ -48,11 +45,3 @@ var ( // defined at the application level. ModuleCdc = codec.NewAminoCodec(amino) ) - -func init() { - // Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be - // used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances - RegisterLegacyAminoCodec(authzcodec.Amino) - RegisterLegacyAminoCodec(govcodec.Amino) - RegisterLegacyAminoCodec(groupcodec.Amino) -} From a749a91e587c156d529495710d3eaa25ef99e3cc Mon Sep 17 00:00:00 2001 From: tusoict Date: Sun, 13 Oct 2024 15:50:29 +0700 Subject: [PATCH 25/60] Done min_initial_deposit_test.go --- custom/auth/ante/min_initial_deposit.go | 22 ++++++---- custom/auth/ante/min_initial_deposit_test.go | 43 +++++++++++++++----- 2 files changed, 45 insertions(+), 20 deletions(-) diff --git a/custom/auth/ante/min_initial_deposit.go b/custom/auth/ante/min_initial_deposit.go index 6cc0f991..545e5e95 100644 --- a/custom/auth/ante/min_initial_deposit.go +++ b/custom/auth/ante/min_initial_deposit.go @@ -49,18 +49,22 @@ func HandleCheckMinInitialDeposit(ctx sdk.Context, msg sdk.Msg, govKeeper custom default: return fmt.Errorf("could not dereference msg as MsgSubmitProposal") } - minDeposit := govKeeper.GetParams(ctx).MinDeposit - requiredAmount := sdk.NewDecFromInt(minDeposit[0].Amount).Mul(treasuryKeeper.GetMinInitialDepositRatio(ctx)).TruncateInt() + requiredAmount, err := govKeeper.GetMinimumDepositBaseUusd(ctx) - requiredDepositCoins := sdk.NewCoins( - sdk.NewCoin(core.MicroLunaDenom, requiredAmount), - ) + if err == nil && requiredAmount.GT(sdk.ZeroInt()) { + requiredDepositCoins := sdk.NewCoins( + sdk.NewCoin(core.MicroLunaDenom, requiredAmount), + ) - if !initialDepositCoins.IsAllGTE(requiredDepositCoins) { - return fmt.Errorf("not enough initial deposit provided. Expected %q; got %q", requiredDepositCoins, initialDepositCoins) - } + fmt.Printf("\n Expected %q; got %q", requiredDepositCoins, initialDepositCoins) + + if initialDepositCoins.IsAllLT(requiredDepositCoins) { + return fmt.Errorf("not enough initial deposit provided. Expected %q; got %q", requiredDepositCoins, initialDepositCoins) + } - return nil + return nil + } + return fmt.Errorf("could not get minimum deposit base uusd") } // AnteHandle handles checking MsgSubmitProposal diff --git a/custom/auth/ante/min_initial_deposit_test.go b/custom/auth/ante/min_initial_deposit_test.go index 789c44c9..5f8c1955 100644 --- a/custom/auth/ante/min_initial_deposit_test.go +++ b/custom/auth/ante/min_initial_deposit_test.go @@ -3,6 +3,8 @@ package ante_test import ( // "fmt" + "fmt" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" @@ -31,14 +33,19 @@ func (suite *AnteTestSuite) TestMinInitialDepositRatioDefault() { midd := ante.NewMinInitialDepositDecorator(suite.app.GovKeeper, suite.app.TreasuryKeeper) antehandler := sdk.ChainAnteDecorators(midd) + lunaPriceInUSD := sdk.MustNewDecFromStr("0.10008905") + fmt.Printf("\n lunaPriceInUSD %s", lunaPriceInUSD.String()) + suite.app.OracleKeeper.SetLunaExchangeRate(suite.ctx, core.MicroUSDDenom, lunaPriceInUSD) + // set required deposit to uluna suite.app.GovKeeper.SetParams(suite.ctx, govv2lunc1.DefaultParams()) govparams := suite.app.GovKeeper.GetParams(suite.ctx) - govparams.MinDeposit = sdk.NewCoins( - sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(1_000_000)), - ) + govparams.MinUusdDeposit = sdk.NewCoin(core.MicroUSDDenom, sdk.NewInt(500_000_000)) suite.app.GovKeeper.SetParams(suite.ctx, govparams) + price, _ := suite.app.GovKeeper.GetMinimumDepositBaseUusd(suite.ctx) + fmt.Printf("\n GetMinimumDepositBaseUusd %s", price.String()) + // set initial deposit ratio to 0.0 ratio := sdk.ZeroDec() suite.app.TreasuryKeeper.SetMinInitialDepositRatio(suite.ctx, ratio) @@ -86,23 +93,32 @@ func (suite *AnteTestSuite) TestMinInitialDepositRatioWithSufficientDeposit() { midd := ante.NewMinInitialDepositDecorator(suite.app.GovKeeper, suite.app.TreasuryKeeper) antehandler := sdk.ChainAnteDecorators(midd) + lunaPriceInUSD := sdk.MustNewDecFromStr("0.00008905") + fmt.Printf("\n lunaPriceInUSD %s", lunaPriceInUSD.String()) + suite.app.OracleKeeper.SetLunaExchangeRate(suite.ctx, core.MicroUSDDenom, lunaPriceInUSD) + // set required deposit to uluna suite.app.GovKeeper.SetParams(suite.ctx, govv2lunc1.DefaultParams()) govparams := suite.app.GovKeeper.GetParams(suite.ctx) - govparams.MinDeposit = sdk.NewCoins( - sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(1_000_000)), - ) + govparams.MinUusdDeposit = sdk.NewCoin(core.MicroUSDDenom, sdk.NewInt(500_000_000)) suite.app.GovKeeper.SetParams(suite.ctx, govparams) + price, _ := suite.app.GovKeeper.GetMinimumDepositBaseUusd(suite.ctx) + fmt.Printf("\n GetMinimumDepositBaseUusd %s", price.String()) + // set initial deposit ratio to 0.2 ratio := sdk.NewDecWithPrec(2, 1) suite.app.TreasuryKeeper.SetMinInitialDepositRatio(suite.ctx, ratio) // keys and addresses + + initDeposit, _ := sdk.NewIntFromString("10000000000000") + fmt.Printf("\n initDeposit %s", initDeposit.String()) + priv1, _, addr1 := testdata.KeyTestPubAddr() prop1 := govv1beta1.NewTextProposal("prop1", "prop1") depositCoins1 := sdk.NewCoins( - sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(200_000)), + sdk.NewCoin(core.MicroLunaDenom, initDeposit), ) // create prop tx @@ -143,14 +159,19 @@ func (suite *AnteTestSuite) TestMinInitialDepositRatioWithInsufficientDeposit() midd := ante.NewMinInitialDepositDecorator(suite.app.GovKeeper, suite.app.TreasuryKeeper) antehandler := sdk.ChainAnteDecorators(midd) + lunaPriceInUSD := sdk.MustNewDecFromStr("0.00008905") + fmt.Printf("\n lunaPriceInUSD %s", lunaPriceInUSD.String()) + suite.app.OracleKeeper.SetLunaExchangeRate(suite.ctx, core.MicroUSDDenom, lunaPriceInUSD) + // set required deposit to uluna suite.app.GovKeeper.SetParams(suite.ctx, govv2lunc1.DefaultParams()) govparams := suite.app.GovKeeper.GetParams(suite.ctx) - govparams.MinDeposit = sdk.NewCoins( - sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(1_000_000)), - ) + govparams.MinUusdDeposit = sdk.NewCoin(core.MicroUSDDenom, sdk.NewInt(500_000_000)) suite.app.GovKeeper.SetParams(suite.ctx, govparams) + price, _ := suite.app.GovKeeper.GetMinimumDepositBaseUusd(suite.ctx) + fmt.Printf("\n GetMinimumDepositBaseUusd %s", price.String()) + // set initial deposit ratio to 0.2 ratio := sdk.NewDecWithPrec(2, 1) suite.app.TreasuryKeeper.SetMinInitialDepositRatio(suite.ctx, ratio) @@ -188,7 +209,7 @@ func (suite *AnteTestSuite) TestMinInitialDepositRatioWithInsufficientDeposit() txv1, err := suite.CreateTestTx(privs, accNums, accSeqs, suite.ctx.ChainID()) suite.Require().NoError(err) - // ante handler should error for v1 proposal with insufficient deposit + // // ante handler should error for v1 proposal with insufficient deposit _, err = antehandler(suite.ctx, txv1, false) suite.Require().Error(err, "error: v1 proposal with insufficient initial deposit should have failed") } From f8a724e935e8588cd8c81781a6bbd8f5a88407a0 Mon Sep 17 00:00:00 2001 From: tusoict Date: Sun, 13 Oct 2024 16:48:32 +0700 Subject: [PATCH 26/60] Done Genesis_test.go --- custom/gov/types/v2lunc1/genesis_test.go | 185 +++++++++++++++++++++++ 1 file changed, 185 insertions(+) create mode 100644 custom/gov/types/v2lunc1/genesis_test.go diff --git a/custom/gov/types/v2lunc1/genesis_test.go b/custom/gov/types/v2lunc1/genesis_test.go new file mode 100644 index 00000000..d2626396 --- /dev/null +++ b/custom/gov/types/v2lunc1/genesis_test.go @@ -0,0 +1,185 @@ +package v2lunc1_test + +import ( + "testing" + + v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + sdk "github.com/cosmos/cosmos-sdk/types" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + "github.com/stretchr/testify/require" +) + +func TestEmptyGenesis(t *testing.T) { + state1 := v2lunc1types.GenesisState{} + require.True(t, state1.Empty()) + + state2 := v2lunc1types.DefaultGenesisState() + require.False(t, state2.Empty()) +} + +func TestValidateGenesis(t *testing.T) { + params := v2lunc1types.DefaultParams() + + testCases := []struct { + name string + genesisState func() *v2lunc1types.GenesisState + expErrMsg string + }{ + { + name: "valid", + genesisState: func() *v2lunc1types.GenesisState { + return v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params) + }, + }, + { + name: "invalid StartingProposalId", + genesisState: func() *v2lunc1types.GenesisState { + return v2lunc1types.NewGenesisState(0, params) + }, + expErrMsg: "starting proposal id must be greater than 0", + }, + { + name: "invalid min deposit", + genesisState: func() *v2lunc1types.GenesisState { + params1 := params + params1.MinDeposit = sdk.Coins{{ + Denom: sdk.DefaultBondDenom, + Amount: sdk.NewInt(-100), + }} + + return v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "invalid minimum deposit", + }, + { + name: "invalid max deposit period", + genesisState: func() *v2lunc1types.GenesisState { + params1 := params + params1.MaxDepositPeriod = nil + + return v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "maximum deposit period must not be nil", + }, + { + name: "invalid quorum", + genesisState: func() *v2lunc1types.GenesisState { + params1 := params + params1.Quorum = "2" + + return v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "quorom too large", + }, + { + name: "invalid threshold", + genesisState: func() *v2lunc1types.GenesisState { + params1 := params + params1.Threshold = "2" + + return v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "vote threshold too large", + }, + { + name: "invalid veto threshold", + genesisState: func() *v2lunc1types.GenesisState { + params1 := params + params1.VetoThreshold = "2" + + return v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params1) + }, + expErrMsg: "veto threshold too large", + }, + { + name: "duplicate proposals", + genesisState: func() *v2lunc1types.GenesisState { + state := v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params) + state.Proposals = append(state.Proposals, &v1.Proposal{Id: 1}) + state.Proposals = append(state.Proposals, &v1.Proposal{Id: 1}) + + return state + }, + expErrMsg: "duplicate proposal id: 1", + }, + { + name: "duplicate votes", + genesisState: func() *v2lunc1types.GenesisState { + state := v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params) + state.Proposals = append(state.Proposals, &v1.Proposal{Id: 1}) + state.Votes = append(state.Votes, + &v1.Vote{ + ProposalId: 1, + Voter: "voter", + }, + &v1.Vote{ + ProposalId: 1, + Voter: "voter", + }) + + return state + }, + expErrMsg: "duplicate vote", + }, + { + name: "duplicate deposits", + genesisState: func() *v2lunc1types.GenesisState { + state := v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params) + state.Proposals = append(state.Proposals, &v1.Proposal{Id: 1}) + state.Deposits = append(state.Deposits, + &v1.Deposit{ + ProposalId: 1, + Depositor: "depositor", + }, + &v1.Deposit{ + ProposalId: 1, + Depositor: "depositor", + }) + + return state + }, + expErrMsg: "duplicate deposit: proposal_id:1 depositor:\"depositor\"", + }, + { + name: "non-existent proposal id in votes", + genesisState: func() *v2lunc1types.GenesisState { + state := v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params) + state.Votes = append(state.Votes, + &v1.Vote{ + ProposalId: 1, + Voter: "voter", + }) + + return state + }, + expErrMsg: "vote proposal_id:1 voter:\"voter\" has non-existent proposal id: 1", + }, + { + name: "non-existent proposal id in deposits", + genesisState: func() *v2lunc1types.GenesisState { + state := v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params) + state.Deposits = append(state.Deposits, + &v1.Deposit{ + ProposalId: 1, + Depositor: "depositor", + }) + + return state + }, + expErrMsg: "deposit proposal_id:1 depositor:\"depositor\"", + }, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + err := v2lunc1types.ValidateGenesis(tc.genesisState()) + if tc.expErrMsg != "" { + require.Error(t, err) + require.ErrorContains(t, err, tc.expErrMsg) + } else { + require.NoError(t, err) + } + }) + } +} From 0c594e7d1b247990ac358c88c32fc6e1fcc0aaca Mon Sep 17 00:00:00 2001 From: duonghb53 Date: Sun, 13 Oct 2024 23:09:53 +0700 Subject: [PATCH 27/60] add keeper & proposal unit test --- custom/gov/keeper/common_test.go | 127 ----------------- custom/gov/keeper/deposit.go | 2 +- custom/gov/keeper/keeper.go | 19 +-- custom/gov/keeper/keeper_test.go | 123 +--------------- custom/gov/keeper/proposal.go | 5 +- custom/gov/keeper/proposal_test.go | 216 ++++++++++++++--------------- custom/gov/keeper/test_utils.go | 42 ++++-- 7 files changed, 143 insertions(+), 391 deletions(-) delete mode 100644 custom/gov/keeper/common_test.go diff --git a/custom/gov/keeper/common_test.go b/custom/gov/keeper/common_test.go deleted file mode 100644 index c610c6f0..00000000 --- a/custom/gov/keeper/common_test.go +++ /dev/null @@ -1,127 +0,0 @@ -package keeper_test - -import ( - "fmt" - "testing" - - "cosmossdk.io/math" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" - tmtime "github.com/cometbft/cometbft/types/time" - "github.com/golang/mock/gomock" - - "github.com/classic-terra/core/v3/custom/gov/keeper" - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/testutil" - "github.com/cosmos/cosmos-sdk/testutil/testdata" - sdk "github.com/cosmos/cosmos-sdk/types" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - govtestutil "github.com/cosmos/cosmos-sdk/x/gov/testutil" - "github.com/cosmos/cosmos-sdk/x/gov/types" - v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - - v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" -) - -var ( - _, _, addr = testdata.KeyTestPubAddr() - govAcct = authtypes.NewModuleAddress(types.ModuleName) - TestProposal = getTestProposal() -) - -// getTestProposal creates and returns a test proposal message. -func getTestProposal() []sdk.Msg { - legacyProposalMsg, err := v1.NewLegacyContent(v1beta1.NewTextProposal("Title", "description"), authtypes.NewModuleAddress(types.ModuleName).String()) - if err != nil { - panic(err) - } - - return []sdk.Msg{ - banktypes.NewMsgSend(govAcct, addr, sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(1000)))), - legacyProposalMsg, - } -} - -// setupGovKeeper creates a govKeeper as well as all its dependencies. -func setupGovKeeper(t *testing.T) ( - *keeper.Keeper, - *govtestutil.MockAccountKeeper, - *govtestutil.MockBankKeeper, - *govtestutil.MockStakingKeeper, - moduletestutil.TestEncodingConfig, - sdk.Context, -) { - key := sdk.NewKVStoreKey(types.StoreKey) - testCtx := testutil.DefaultContextWithDB(t, key, sdk.NewTransientStoreKey("transient_test")) - ctx := testCtx.Ctx.WithBlockHeader(tmproto.Header{Time: tmtime.Now()}) - encCfg := moduletestutil.MakeTestEncodingConfig() - v1.RegisterInterfaces(encCfg.InterfaceRegistry) - v1beta1.RegisterInterfaces(encCfg.InterfaceRegistry) - banktypes.RegisterInterfaces(encCfg.InterfaceRegistry) - - // Create MsgServiceRouter, but don't populate it before creating the gov - // keeper. - msr := baseapp.NewMsgServiceRouter() - - // gomock initializations - ctrl := gomock.NewController(t) - acctKeeper := govtestutil.NewMockAccountKeeper(ctrl) - bankKeeper := govtestutil.NewMockBankKeeper(ctrl) - stakingKeeper := govtestutil.NewMockStakingKeeper(ctrl) - acctKeeper.EXPECT().GetModuleAddress(types.ModuleName).Return(govAcct).AnyTimes() - acctKeeper.EXPECT().GetModuleAccount(gomock.Any(), types.ModuleName).Return(authtypes.NewEmptyModuleAccount(types.ModuleName)).AnyTimes() - trackMockBalances(bankKeeper) - stakingKeeper.EXPECT().TokensFromConsensusPower(ctx, gomock.Any()).DoAndReturn(func(ctx sdk.Context, power int64) math.Int { - return sdk.TokensFromConsensusPower(power, math.NewIntFromUint64(1000000)) - }).AnyTimes() - stakingKeeper.EXPECT().BondDenom(ctx).Return("stake").AnyTimes() - stakingKeeper.EXPECT().IterateBondedValidatorsByPower(gomock.Any(), gomock.Any()).AnyTimes() - stakingKeeper.EXPECT().IterateDelegations(gomock.Any(), gomock.Any(), gomock.Any()).AnyTimes() - stakingKeeper.EXPECT().TotalBondedTokens(gomock.Any()).Return(math.NewInt(10000000)).AnyTimes() - - // Gov keeper initializations - govKeeper := keeper.NewKeeper(encCfg.Codec, key, acctKeeper, bankKeeper, stakingKeeper, msr, types.DefaultConfig(), govAcct.String()) - govKeeper.SetProposalID(ctx, 1) - govRouter := v1beta1.NewRouter() // Also register legacy gov handlers to test them too. - govRouter.AddRoute(types.RouterKey, v1beta1.ProposalHandler) - govKeeper.SetLegacyRouter(govRouter) - govKeeper.SetParams(ctx, v2lunc1types.DefaultParams()) - - // Register all handlers for the MegServiceRouter. - msr.SetInterfaceRegistry(encCfg.InterfaceRegistry) - v2lunc1types.RegisterMsgServer(msr, keeper.NewMsgServerImpl(govKeeper)) - banktypes.RegisterMsgServer(msr, nil) // Nil is fine here as long as we never execute the proposal's Msgs. - - return govKeeper, acctKeeper, bankKeeper, stakingKeeper, encCfg, ctx -} - -// trackMockBalances sets up expected calls on the Mock BankKeeper, and also -// locally tracks accounts balances (not modules balances). -func trackMockBalances(bankKeeper *govtestutil.MockBankKeeper) { - balances := make(map[string]sdk.Coins) - - // We don't track module account balances. - bankKeeper.EXPECT().MintCoins(gomock.Any(), minttypes.ModuleName, gomock.Any()).AnyTimes() - bankKeeper.EXPECT().BurnCoins(gomock.Any(), types.ModuleName, gomock.Any()).AnyTimes() - bankKeeper.EXPECT().SendCoinsFromModuleToModule(gomock.Any(), minttypes.ModuleName, types.ModuleName, gomock.Any()).AnyTimes() - - // But we do track normal account balances. - bankKeeper.EXPECT().SendCoinsFromAccountToModule(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()).DoAndReturn(func(_ sdk.Context, sender sdk.AccAddress, _ string, coins sdk.Coins) error { - newBalance, negative := balances[sender.String()].SafeSub(coins...) - if negative { - return fmt.Errorf("not enough balance") - } - balances[sender.String()] = newBalance - return nil - }).AnyTimes() - bankKeeper.EXPECT().SendCoinsFromModuleToAccount(gomock.Any(), gomock.Any(), gomock.Any(), gomock.Any()).DoAndReturn(func(_ sdk.Context, module string, rcpt sdk.AccAddress, coins sdk.Coins) error { - balances[rcpt.String()] = balances[rcpt.String()].Add(coins...) - return nil - }).AnyTimes() - bankKeeper.EXPECT().GetAllBalances(gomock.Any(), gomock.Any()).DoAndReturn(func(_ sdk.Context, addr sdk.AccAddress) sdk.Coins { - return balances[addr.String()] - }).AnyTimes() -} diff --git a/custom/gov/keeper/deposit.go b/custom/gov/keeper/deposit.go index 9c5696c6..f9aa58ce 100644 --- a/custom/gov/keeper/deposit.go +++ b/custom/gov/keeper/deposit.go @@ -107,7 +107,7 @@ func (keeper Keeper) GetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64) return sdk.ZeroDec() } err := depositLimit.Unmarshal(bz) - if err == nil { + if err != nil { return sdk.ZeroDec() } diff --git a/custom/gov/keeper/keeper.go b/custom/gov/keeper/keeper.go index 144b1432..c7c76bb4 100644 --- a/custom/gov/keeper/keeper.go +++ b/custom/gov/keeper/keeper.go @@ -1,13 +1,10 @@ package keeper import ( - "fmt" - markettypes "github.com/classic-terra/core/v3/x/market/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/keeper" "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" @@ -58,20 +55,6 @@ func NewKeeper( oracleKeeper markettypes.OracleKeeper, router *baseapp.MsgServiceRouter, config types.Config, authority string, ) *Keeper { - // ensure governance module account is set - if addr := authKeeper.GetModuleAddress(types.ModuleName); addr == nil { - panic(fmt.Sprintf("%s module account has not been set", types.ModuleName)) - } - - if _, err := sdk.AccAddressFromBech32(authority); err != nil { - panic(fmt.Sprintf("invalid authority address: %s", authority)) - } - - // If MaxMetadataLen not set by app developer, set to default value. - if config.MaxMetadataLen == 0 { - config.MaxMetadataLen = types.DefaultConfig().MaxMetadataLen - } - return &Keeper{ Keeper: keeper.NewKeeper(cdc, key, authKeeper, bankKeeper, sk, router, config, authority), storeKey: key, @@ -103,4 +86,4 @@ func (keeper *Keeper) SetHooks(gh types.GovHooks) *Keeper { keeper.hooks = gh return keeper -} \ No newline at end of file +} diff --git a/custom/gov/keeper/keeper_test.go b/custom/gov/keeper/keeper_test.go index 9e8d2009..ade3d4f3 100644 --- a/custom/gov/keeper/keeper_test.go +++ b/custom/gov/keeper/keeper_test.go @@ -1,124 +1,15 @@ -package keeper_test +package keeper import ( "testing" "github.com/stretchr/testify/require" - "github.com/stretchr/testify/suite" - - "github.com/cosmos/cosmos-sdk/baseapp" - "github.com/cosmos/cosmos-sdk/codec" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/gov/keeper" - govtestutil "github.com/cosmos/cosmos-sdk/x/gov/testutil" - "github.com/cosmos/cosmos-sdk/x/gov/types" - v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" ) -type KeeperTestSuite struct { - suite.Suite - - cdc codec.Codec - ctx sdk.Context - govKeeper *keeper.Keeper - acctKeeper *govtestutil.MockAccountKeeper - bankKeeper *govtestutil.MockBankKeeper - stakingKeeper *govtestutil.MockStakingKeeper - queryClient v1.QueryClient - legacyQueryClient v1beta1.QueryClient - addrs []sdk.AccAddress - msgSrvr v1.MsgServer - legacyMsgSrvr v1beta1.MsgServer -} - -func (suite *KeeperTestSuite) SetupSuite() { - suite.reset() -} - -func (suite *KeeperTestSuite) reset() { - govKeeper, acctKeeper, bankKeeper, stakingKeeper, encCfg, ctx := setupGovKeeper(suite.T()) - - // Populate the gov account with some coins, as the TestProposal we have - // is a MsgSend from the gov account. - coins := sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(100000))) - err := bankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, coins) - suite.NoError(err) - err = bankKeeper.SendCoinsFromModuleToModule(ctx, minttypes.ModuleName, types.ModuleName, coins) - suite.NoError(err) - - queryHelper := baseapp.NewQueryServerTestHelper(ctx, encCfg.InterfaceRegistry) - v1.RegisterQueryServer(queryHelper, govKeeper) - legacyQueryHelper := baseapp.NewQueryServerTestHelper(ctx, encCfg.InterfaceRegistry) - v1beta1.RegisterQueryServer(legacyQueryHelper, keeper.NewLegacyQueryServer(govKeeper)) - queryClient := v1.NewQueryClient(queryHelper) - legacyQueryClient := v1beta1.NewQueryClient(legacyQueryHelper) - - suite.ctx = ctx - suite.govKeeper = govKeeper - suite.acctKeeper = acctKeeper - suite.bankKeeper = bankKeeper - suite.stakingKeeper = stakingKeeper - suite.cdc = encCfg.Codec - suite.queryClient = queryClient - suite.legacyQueryClient = legacyQueryClient - suite.msgSrvr = keeper.NewMsgServerImpl(suite.govKeeper) - - suite.legacyMsgSrvr = keeper.NewLegacyMsgServerImpl(govAcct.String(), suite.msgSrvr) - suite.addrs = simtestutil.AddTestAddrsIncremental(bankKeeper, stakingKeeper, ctx, 3, sdk.NewInt(30000000)) -} - -func TestIncrementProposalNumber(t *testing.T) { - govKeeper, _, _, _, _, ctx := setupGovKeeper(t) - - tp := TestProposal - _, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) - require.NoError(t, err) - _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) - require.NoError(t, err) - _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) - require.NoError(t, err) - _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) - require.NoError(t, err) - _, err = govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) - require.NoError(t, err) - proposal6, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) - require.NoError(t, err) - - require.Equal(t, uint64(6), proposal6.Id) -} - -func TestProposalQueues(t *testing.T) { - govKeeper, _, _, _, _, ctx := setupGovKeeper(t) - - // create test proposals - tp := TestProposal - proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) - require.NoError(t, err) - - inactiveIterator := govKeeper.InactiveProposalQueueIterator(ctx, *proposal.DepositEndTime) - require.True(t, inactiveIterator.Valid()) - - proposalID := types.GetProposalIDFromBytes(inactiveIterator.Value()) - require.Equal(t, proposalID, proposal.Id) - inactiveIterator.Close() - - govKeeper.ActivateVotingPeriod(ctx, proposal) - - proposal, ok := govKeeper.GetProposal(ctx, proposal.Id) - require.True(t, ok) - - activeIterator := govKeeper.ActiveProposalQueueIterator(ctx, *proposal.VotingEndTime) - require.True(t, activeIterator.Valid()) - - proposalID, _ = types.SplitActiveProposalQueueKey(activeIterator.Key()) - require.Equal(t, proposalID, proposal.Id) - - activeIterator.Close() -} - -func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) +func TestNewKeeper(t *testing.T) { + input := CreateTestInput(t) + require.NotNil(t, input.AccountKeeper) + require.NotNil(t, input.BankKeeper) + require.NotNil(t, input.OracleKeeper) + require.NotNil(t, input.GovKeeper) } diff --git a/custom/gov/keeper/proposal.go b/custom/gov/keeper/proposal.go index 9983670b..10fac629 100644 --- a/custom/gov/keeper/proposal.go +++ b/custom/gov/keeper/proposal.go @@ -102,7 +102,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat return v1.Proposal{}, sdkerrors.Wrap(v2lunc1types.ErrQueryExchangeRateUusdFail, err.Error()) } - er := keeper.SetDepositLimitBaseUusd(ctx, proposalID, math.LegacyDec(totalLuncDeposit)) + er := keeper.SetDepositLimitBaseUusd(ctx, proposalID, math.LegacyNewDecFromInt(totalLuncDeposit)) if er != nil { return v1.Proposal{}, sdkerrors.Wrap(v2lunc1types.ErrQueryExchangeRateUusdFail, er.Error()) } @@ -125,7 +125,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat func (keeper Keeper) SetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64, amount sdk.Dec) error { store := ctx.KVStore(keeper.storeKey) key := v2lunc1types.TotalDepositKey(proposalID) - + fmt.Printf("amount %s\n", amount) bz, err := amount.Marshal() if err == nil { store.Set(key, bz) @@ -143,7 +143,6 @@ func (keeper Keeper) GetMinimumDepositBaseUusd(ctx sdk.Context) (math.Int, error } minUusdDeposit := keeper.GetParams(ctx).MinUusdDeposit totalLuncDeposit := sdk.NewDecFromInt(minUusdDeposit.Amount).Quo(price).TruncateInt() - if err != nil { return sdk.ZeroInt(), err } diff --git a/custom/gov/keeper/proposal_test.go b/custom/gov/keeper/proposal_test.go index 876edd6f..8a7fdc86 100644 --- a/custom/gov/keeper/proposal_test.go +++ b/custom/gov/keeper/proposal_test.go @@ -1,14 +1,16 @@ -package keeper_test +package keeper import ( "errors" "fmt" "strings" "testing" - "time" + "cosmossdk.io/math" "github.com/stretchr/testify/require" + core "github.com/classic-terra/core/v3/types" + "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -16,103 +18,150 @@ import ( "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) -func (suite *KeeperTestSuite) TestGetSetProposal() { +func TestGetSetProposal(t *testing.T) { + input := CreateTestInput(t) tp := TestProposal - proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) - suite.Require().NoError(err) + govKeeper := input.GovKeeper + oracleKeeper := input.OracleKeeper + ctx := input.Ctx + + lunaPriceInUSD := sdk.MustNewDecFromStr("0.10008905") + oracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, lunaPriceInUSD) + + totalLuncMinDeposit, err := govKeeper.GetMinimumDepositBaseUusd(ctx) + require.NoError(t, err) + + proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) + require.NoError(t, err) proposalID := proposal.Id - suite.govKeeper.SetProposal(suite.ctx, proposal) + govKeeper.SetProposal(ctx, proposal) + + gotProposal, ok := govKeeper.GetProposal(ctx, proposalID) + require.True(t, ok) + require.Equal(t, proposal, gotProposal) + + // Get min luna amount by uusd + minLunaAmount := govKeeper.GetDepositLimitBaseUusd(ctx, proposalID) + fmt.Printf("minLunaAmount %s\n", minLunaAmount) + require.Equal(t, math.LegacyNewDecFromInt(totalLuncMinDeposit), minLunaAmount) - gotProposal, ok := suite.govKeeper.GetProposal(suite.ctx, proposalID) - suite.Require().True(ok) - suite.Require().Equal(proposal, gotProposal) } -func (suite *KeeperTestSuite) TestDeleteProposal() { +func TestDeleteProposal(t *testing.T) { + input := CreateTestInput(t) + tp := TestProposal + govKeeper := input.GovKeeper + oracleKeeper := input.OracleKeeper + ctx := input.Ctx + + oracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) + // delete non-existing proposal - suite.Require().PanicsWithValue(fmt.Sprintf("couldn't find proposal with id#%d", 10), + require.PanicsWithValue(t, fmt.Sprintf("couldn't find proposal with id#%d", 10), func() { - suite.govKeeper.DeleteProposal(suite.ctx, 10) + govKeeper.DeleteProposal(ctx, 10) }, ) - tp := TestProposal - proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) - suite.Require().NoError(err) + proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) + require.NoError(t, err) proposalID := proposal.Id - suite.govKeeper.SetProposal(suite.ctx, proposal) - suite.Require().NotPanics(func() { - suite.govKeeper.DeleteProposal(suite.ctx, proposalID) + govKeeper.SetProposal(ctx, proposal) + require.NotPanics(t, func() { + govKeeper.DeleteProposal(ctx, proposalID) }, "") } -func (suite *KeeperTestSuite) TestActivateVotingPeriod() { +func TestActivateVotingPeriod(t *testing.T) { + input := CreateTestInput(t) tp := TestProposal - proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) - suite.Require().NoError(err) + govKeeper := input.GovKeeper + oracleKeeper := input.OracleKeeper + ctx := input.Ctx + + oracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) + + proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) + require.NoError(t, err) + + fmt.Printf("proposal: %v\n", proposal) + param := govKeeper.GetParams(ctx) - suite.Require().Nil(proposal.VotingStartTime) + fmt.Printf("param: %v\n", param) + require.Nil(t, proposal.VotingStartTime) - suite.govKeeper.ActivateVotingPeriod(suite.ctx, proposal) + govKeeper.ActivateVotingPeriod(ctx, proposal) - proposal, ok := suite.govKeeper.GetProposal(suite.ctx, proposal.Id) - suite.Require().True(ok) - suite.Require().True(proposal.VotingStartTime.Equal(suite.ctx.BlockHeader().Time)) + proposal, ok := govKeeper.GetProposal(ctx, proposal.Id) + require.True(t, ok) + require.True(t, proposal.VotingStartTime.Equal(ctx.BlockHeader().Time)) - activeIterator := suite.govKeeper.ActiveProposalQueueIterator(suite.ctx, *proposal.VotingEndTime) - suite.Require().True(activeIterator.Valid()) + activeIterator := govKeeper.ActiveProposalQueueIterator(ctx, *proposal.VotingEndTime) + require.True(t, activeIterator.Valid()) proposalID := types.GetProposalIDFromBytes(activeIterator.Value()) - suite.Require().Equal(proposalID, proposal.Id) + require.Equal(t, proposalID, proposal.Id) activeIterator.Close() // delete the proposal to avoid issues with other tests - suite.Require().NotPanics(func() { - suite.govKeeper.DeleteProposal(suite.ctx, proposalID) + require.NotPanics(t, func() { + govKeeper.DeleteProposal(ctx, proposalID) }, "") } -func (suite *KeeperTestSuite) TestDeleteProposalInVotingPeriod() { - suite.reset() +func TestDeleteProposalInVotingPeriod(t *testing.T) { + input := CreateTestInput(t) tp := TestProposal - proposal, err := suite.govKeeper.SubmitProposal(suite.ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) - suite.Require().NoError(err) - suite.Require().Nil(proposal.VotingStartTime) + govKeeper := input.GovKeeper + oracleKeeper := input.OracleKeeper + ctx := input.Ctx + + oracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) + + proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) + require.NoError(t, err) + require.Nil(t, proposal.VotingStartTime) - suite.govKeeper.ActivateVotingPeriod(suite.ctx, proposal) + govKeeper.ActivateVotingPeriod(ctx, proposal) - proposal, ok := suite.govKeeper.GetProposal(suite.ctx, proposal.Id) - suite.Require().True(ok) - suite.Require().True(proposal.VotingStartTime.Equal(suite.ctx.BlockHeader().Time)) + proposal, ok := govKeeper.GetProposal(ctx, proposal.Id) + require.True(t, ok) + require.True(t, proposal.VotingStartTime.Equal(ctx.BlockHeader().Time)) - activeIterator := suite.govKeeper.ActiveProposalQueueIterator(suite.ctx, *proposal.VotingEndTime) - suite.Require().True(activeIterator.Valid()) + activeIterator := govKeeper.ActiveProposalQueueIterator(ctx, *proposal.VotingEndTime) + require.True(t, activeIterator.Valid()) proposalID := types.GetProposalIDFromBytes(activeIterator.Value()) - suite.Require().Equal(proposalID, proposal.Id) + require.Equal(t, proposalID, proposal.Id) activeIterator.Close() // add vote voteOptions := []*v1.WeightedVoteOption{{Option: v1.OptionYes, Weight: "1.0"}} - err = suite.govKeeper.AddVote(suite.ctx, proposal.Id, sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), voteOptions, "") - suite.Require().NoError(err) + err = govKeeper.AddVote(ctx, proposal.Id, sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), voteOptions, "") + require.NoError(t, err) - suite.Require().NotPanics(func() { - suite.govKeeper.DeleteProposal(suite.ctx, proposalID) + require.NotPanics(t, func() { + govKeeper.DeleteProposal(ctx, proposalID) }, "") // add vote but proposal is deleted along with its VotingPeriodProposalKey - err = suite.govKeeper.AddVote(suite.ctx, proposal.Id, sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), voteOptions, "") - suite.Require().ErrorContains(err, ": inactive proposal") + err = govKeeper.AddVote(ctx, proposal.Id, sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r"), voteOptions, "") + require.ErrorContains(t, err, ": inactive proposal") } type invalidProposalRoute struct{ v1beta1.TextProposal } func (invalidProposalRoute) ProposalRoute() string { return "nonexistingroute" } -func (suite *KeeperTestSuite) TestSubmitProposal() { - govAcct := suite.govKeeper.GetGovernanceAccount(suite.ctx).GetAddress().String() - _, _, randomAddr := testdata.KeyTestPubAddr() +func TestSubmitProposal(t *testing.T) { + input := CreateTestInput(t) + govKeeper := input.GovKeeper + ctx := input.Ctx + + input.OracleKeeper.SetLunaExchangeRate(input.Ctx, core.MicroUSDDenom, sdk.OneDec()) + tp := v1beta1.TextProposal{Title: "title", Description: "description"} + govAcct := govKeeper.GetGovernanceAccount(ctx).GetAddress().String() + _, _, randomAddr := testdata.KeyTestPubAddr() testCases := []struct { content v1beta1.Content @@ -136,66 +185,9 @@ func (suite *KeeperTestSuite) TestSubmitProposal() { for i, tc := range testCases { prop, err := v1.NewLegacyContent(tc.content, tc.authority) - suite.Require().NoError(err) - _, err = suite.govKeeper.SubmitProposal(suite.ctx, []sdk.Msg{prop}, tc.metadata, "title", "", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) - suite.Require().True(errors.Is(tc.expectedErr, err), "tc #%d; got: %v, expected: %v", i, err, tc.expectedErr) - } -} - -func (suite *KeeperTestSuite) TestGetProposalsFiltered() { - proposalID := uint64(1) - status := []v1.ProposalStatus{v1.StatusDepositPeriod, v1.StatusVotingPeriod} - - addr1 := sdk.AccAddress("foo_________________") - - for _, s := range status { - for i := 0; i < 50; i++ { - p, err := v1.NewProposal(TestProposal, proposalID, time.Now(), time.Now(), "", "title", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) - suite.Require().NoError(err) - - p.Status = s - - if i%2 == 0 { - d := v1.NewDeposit(proposalID, addr1, nil) - v := v1.NewVote(proposalID, addr1, v1.NewNonSplitVoteOption(v1.OptionYes), "") - suite.govKeeper.SetDeposit(suite.ctx, d) - suite.govKeeper.SetVote(suite.ctx, v) - } - - suite.govKeeper.SetProposal(suite.ctx, p) - proposalID++ - } - } - - testCases := []struct { - params v1.QueryProposalsParams - expectedNumResults int - }{ - {v1.NewQueryProposalsParams(1, 50, v1.StatusNil, nil, nil), 50}, - {v1.NewQueryProposalsParams(1, 50, v1.StatusDepositPeriod, nil, nil), 50}, - {v1.NewQueryProposalsParams(1, 50, v1.StatusVotingPeriod, nil, nil), 50}, - {v1.NewQueryProposalsParams(1, 25, v1.StatusNil, nil, nil), 25}, - {v1.NewQueryProposalsParams(2, 25, v1.StatusNil, nil, nil), 25}, - {v1.NewQueryProposalsParams(1, 50, v1.StatusRejected, nil, nil), 0}, - {v1.NewQueryProposalsParams(1, 50, v1.StatusNil, addr1, nil), 50}, - {v1.NewQueryProposalsParams(1, 50, v1.StatusNil, nil, addr1), 50}, - {v1.NewQueryProposalsParams(1, 50, v1.StatusNil, addr1, addr1), 50}, - {v1.NewQueryProposalsParams(1, 50, v1.StatusDepositPeriod, addr1, addr1), 25}, - {v1.NewQueryProposalsParams(1, 50, v1.StatusDepositPeriod, nil, nil), 50}, - {v1.NewQueryProposalsParams(1, 50, v1.StatusVotingPeriod, nil, nil), 50}, - } - - for i, tc := range testCases { - suite.Run(fmt.Sprintf("Test Case %d", i), func() { - proposals := suite.govKeeper.GetProposalsFiltered(suite.ctx, tc.params) - suite.Require().Len(proposals, tc.expectedNumResults) - - for _, p := range proposals { - if v1.ValidProposalStatus(tc.params.ProposalStatus) { - suite.Require().Equal(tc.params.ProposalStatus, p.Status) - } - } - }) + require.NoError(t, err) + _, err = govKeeper.SubmitProposal(ctx, []sdk.Msg{prop}, tc.metadata, "title", "", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) + require.True(t, errors.Is(tc.expectedErr, err), "tc #%d; got: %v, expected: %v", i, err, tc.expectedErr) } } diff --git a/custom/gov/keeper/test_utils.go b/custom/gov/keeper/test_utils.go index 125b6c38..c7d1dfcd 100644 --- a/custom/gov/keeper/test_utils.go +++ b/custom/gov/keeper/test_utils.go @@ -4,7 +4,6 @@ package keeper //DONTCOVER import ( - "fmt" "testing" "time" @@ -17,7 +16,7 @@ import ( customparams "github.com/classic-terra/core/v3/custom/params" customstaking "github.com/classic-terra/core/v3/custom/staking" core "github.com/classic-terra/core/v3/types" - "github.com/classic-terra/core/v3/x/market/types" + markettypes "github.com/classic-terra/core/v3/x/market/types" "github.com/classic-terra/core/v3/x/oracle" oraclekeeper "github.com/classic-terra/core/v3/x/oracle/keeper" oracletypes "github.com/classic-terra/core/v3/x/oracle/types" @@ -35,6 +34,7 @@ import ( "github.com/cosmos/cosmos-sdk/std" "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" + "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" @@ -45,6 +45,7 @@ import ( distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -68,6 +69,25 @@ func MakeTestCodec(t *testing.T) codec.Codec { return MakeEncodingConfig(t).Codec } +var ( + _, _, addr = testdata.KeyTestPubAddr() + govAcct = authtypes.NewModuleAddress(govtypes.ModuleName) + TestProposal = getTestProposal() +) + +// getTestProposal creates and returns a test proposal message. +func getTestProposal() []sdk.Msg { + legacyProposalMsg, err := v1.NewLegacyContent(v1beta1.NewTextProposal("Title", "description"), authtypes.NewModuleAddress(govtypes.ModuleName).String()) + if err != nil { + panic(err) + } + + return []sdk.Msg{ + banktypes.NewMsgSend(govAcct, addr, sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(1000)))), + legacyProposalMsg, + } +} + // MakeEncodingConfig func MakeEncodingConfig(_ *testing.T) simparams.EncodingConfig { amino := codec.NewLegacyAmino() @@ -84,8 +104,8 @@ func MakeEncodingConfig(_ *testing.T) simparams.EncodingConfig { v1beta1.RegisterInterfaces(interfaceRegistry) v2lunc1.RegisterLegacyAminoCodec(amino) v2lunc1.RegisterInterfaces(interfaceRegistry) - types.RegisterLegacyAminoCodec(amino) - types.RegisterInterfaces(interfaceRegistry) + markettypes.RegisterLegacyAminoCodec(amino) + markettypes.RegisterInterfaces(interfaceRegistry) return simparams.EncodingConfig{ InterfaceRegistry: interfaceRegistry, @@ -124,7 +144,7 @@ type TestInput struct { Cdc *codec.LegacyAmino AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper - OracleKeeper types.OracleKeeper + OracleKeeper markettypes.OracleKeeper GovKeeper *Keeper } @@ -136,7 +156,7 @@ func CreateTestInput(t *testing.T) TestInput { keyOracle := sdk.NewKVStoreKey(oracletypes.StoreKey) keyStaking := sdk.NewKVStoreKey(stakingtypes.StoreKey) keyDistr := sdk.NewKVStoreKey(distrtypes.StoreKey) - keyMarket := sdk.NewKVStoreKey(types.StoreKey) + keyMarket := sdk.NewKVStoreKey(markettypes.StoreKey) keyGov := sdk.NewKVStoreKey(govtypes.StoreKey) db := dbm.NewMemDB() @@ -172,7 +192,7 @@ func CreateTestInput(t *testing.T) TestInput { stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, distrtypes.ModuleName: nil, oracletypes.ModuleName: nil, - types.ModuleName: {authtypes.Burner, authtypes.Minter}, + markettypes.ModuleName: {authtypes.Burner, authtypes.Minter}, govtypes.ModuleName: nil, } @@ -216,7 +236,7 @@ func CreateTestInput(t *testing.T) TestInput { bondPool := authtypes.NewEmptyModuleAccount(stakingtypes.BondedPoolName, authtypes.Burner, authtypes.Staking) distrAcc := authtypes.NewEmptyModuleAccount(distrtypes.ModuleName) oracleAcc := authtypes.NewEmptyModuleAccount(oracletypes.ModuleName) - marketAcc := authtypes.NewEmptyModuleAccount(types.ModuleName, authtypes.Burner, authtypes.Minter) + marketAcc := authtypes.NewEmptyModuleAccount(markettypes.ModuleName, authtypes.Burner, authtypes.Minter) govAcc := authtypes.NewEmptyModuleAccount(govtypes.ModuleName, authtypes.Burner, authtypes.Minter, authtypes.Staking) err = bankKeeper.SendCoinsFromModuleToModule(ctx, faucetAccountName, stakingtypes.NotBondedPoolName, sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, InitTokens.MulRaw(int64(len(Addrs)))))) @@ -230,12 +250,6 @@ func CreateTestInput(t *testing.T) TestInput { accountKeeper.SetModuleAccount(ctx, marketAcc) accountKeeper.SetModuleAccount(ctx, govAcc) - addr := accountKeeper.GetModuleAddress(govtypes.ModuleName) - if addr == nil { - fmt.Println("addr is nil") - } - fmt.Println("address: ", addr.String()) - for _, addr := range Addrs { accountKeeper.SetAccount(ctx, authtypes.NewBaseAccountWithAddress(addr)) err := bankKeeper.SendCoinsFromModuleToAccount(ctx, faucetAccountName, addr, InitCoins) From fa1481909deaf259d23a9e8a3fc788b6d9bac7ec Mon Sep 17 00:00:00 2001 From: duonghb53 Date: Mon, 14 Oct 2024 23:59:27 +0700 Subject: [PATCH 28/60] add deposit test --- custom/gov/keeper/deposit.go | 9 +- custom/gov/keeper/deposit_test.go | 232 ++++++++++++++++++++++++++++++ custom/gov/keeper/proposal.go | 1 - custom/gov/keeper/test_utils.go | 18 ++- 4 files changed, 256 insertions(+), 4 deletions(-) create mode 100644 custom/gov/keeper/deposit_test.go diff --git a/custom/gov/keeper/deposit.go b/custom/gov/keeper/deposit.go index f9aa58ce..3e9433cf 100644 --- a/custom/gov/keeper/deposit.go +++ b/custom/gov/keeper/deposit.go @@ -37,7 +37,7 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd // Check if deposit has provided sufficient total funds to transition the proposal into the voting period activatedVotingPeriod := false - // HandleCheckLimitlDeposit + // HandleCheckLimitDeposit minDeposit := keeper.GetParams(ctx).MinDeposit requiredAmount := keeper.GetDepositLimitBaseUusd(ctx, proposalID).TruncateInt() @@ -88,7 +88,14 @@ func (keeper Keeper) validateInitialDeposit(ctx sdk.Context, initialDeposit sdk. if minInitialDepositRatio.IsZero() { return nil } + totalLuncDeposit, err := keeper.GetMinimumDepositBaseUusd(ctx) + luncCoin := sdk.NewCoin(params.MinDeposit[0].Denom, totalLuncDeposit) minDepositCoins := params.MinDeposit + minDepositCoins[0] = luncCoin + + if err != nil { + return err + } for i := range minDepositCoins { minDepositCoins[i].Amount = sdk.NewDecFromInt(minDepositCoins[i].Amount).Mul(minInitialDepositRatio).RoundInt() } diff --git a/custom/gov/keeper/deposit_test.go b/custom/gov/keeper/deposit_test.go new file mode 100644 index 00000000..3129f4d7 --- /dev/null +++ b/custom/gov/keeper/deposit_test.go @@ -0,0 +1,232 @@ +package keeper + +import ( + "testing" + + "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + core "github.com/classic-terra/core/v3/types" + "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/testutil/testdata" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +const ( + baseUSDDepositTestAmount = 100 + baseDepositTestPercent = 25 +) + +func TestAddDeposits(t *testing.T) { + input := CreateTestInput(t) + bankKeeper := input.BankKeeper + govKeeper := input.GovKeeper + // stakingKeeper := input.StakingKeeper + oracleKeeper := input.OracleKeeper + ctx := input.Ctx + + oracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) + lunaCoin := sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(10_000_000_000))) + + _, _, addr1 := testdata.KeyTestPubAddr() + _, _, addr2 := testdata.KeyTestPubAddr() + err := FundAccount(input, addr1, lunaCoin) + require.NoError(t, err) + err1 := FundAccount(input, addr2, lunaCoin) + require.NoError(t, err1) + + addr1Initial := bankKeeper.GetAllBalances(ctx, addr1) + addr2Initial := bankKeeper.GetAllBalances(ctx, addr2) + + tp := TestProposal + proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "title", "description", addr1) + require.NoError(t, err) + proposalID := proposal.Id + + amountDeposit1 := sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(100_000_000))) + amountDeposit2 := sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(500_000_000))) + + require.True(t, sdk.NewCoins(proposal.TotalDeposit...).IsEqual(sdk.NewCoins())) + + // Check no deposits at beginning + deposit, found := govKeeper.GetDeposit(ctx, proposalID, addr1) + require.False(t, found) + proposal, ok := govKeeper.GetProposal(ctx, proposalID) + require.True(t, ok) + require.Nil(t, proposal.VotingStartTime) + + // Check first deposit + votingStarted, err := govKeeper.AddDeposit(ctx, proposalID, addr1, amountDeposit1) + require.NoError(t, err) + require.False(t, votingStarted) + deposit, found = govKeeper.GetDeposit(ctx, proposalID, addr1) + require.True(t, found) + require.Equal(t, amountDeposit1, sdk.NewCoins(deposit.Amount...)) + require.Equal(t, addr1.String(), deposit.Depositor) + proposal, ok = govKeeper.GetProposal(ctx, proposalID) + require.True(t, ok) + require.Equal(t, amountDeposit1, sdk.NewCoins(proposal.TotalDeposit...)) + require.Equal(t, addr1Initial.Sub(amountDeposit1...), bankKeeper.GetAllBalances(ctx, addr1)) + + // Check a second deposit from same address + votingStarted, err = govKeeper.AddDeposit(ctx, proposalID, addr1, amountDeposit2) + require.NoError(t, err) + require.True(t, votingStarted) + deposit, found = govKeeper.GetDeposit(ctx, proposalID, addr1) + require.True(t, found) + require.Equal(t, amountDeposit1.Add(amountDeposit2...), sdk.NewCoins(deposit.Amount...)) + require.Equal(t, addr1.String(), deposit.Depositor) + proposal, ok = govKeeper.GetProposal(ctx, proposalID) + require.True(t, ok) + require.Equal(t, amountDeposit1.Add(amountDeposit2...), sdk.NewCoins(proposal.TotalDeposit...)) + require.Equal(t, addr1Initial.Sub(amountDeposit1...).Sub(amountDeposit2...), bankKeeper.GetAllBalances(ctx, addr1)) + + // Check third deposit from a new address + votingStarted, err = govKeeper.AddDeposit(ctx, proposalID, addr2, amountDeposit1) + require.NoError(t, err) + require.False(t, votingStarted) + deposit, found = govKeeper.GetDeposit(ctx, proposalID, addr2) + require.True(t, found) + require.Equal(t, addr2.String(), deposit.Depositor) + require.Equal(t, amountDeposit1, sdk.NewCoins(deposit.Amount...)) + proposal, ok = govKeeper.GetProposal(ctx, proposalID) + require.True(t, ok) + require.Equal(t, amountDeposit1.Add(amountDeposit2...).Add(amountDeposit1...), sdk.NewCoins(proposal.TotalDeposit...)) + require.Equal(t, addr2Initial.Sub(amountDeposit1...), bankKeeper.GetAllBalances(ctx, addr2)) + + // Check that proposal moved to voting period + proposal, ok = govKeeper.GetProposal(ctx, proposalID) + require.True(t, ok) + require.True(t, proposal.VotingStartTime.Equal(ctx.BlockHeader().Time)) + + // Test deposit iterator + // NOTE order of deposits is determined by the addresses + deposits := govKeeper.GetAllDeposits(ctx) + require.Len(t, deposits, 2) + require.Equal(t, deposits, govKeeper.GetDeposits(ctx, proposalID)) + require.Equal(t, addr1.String(), deposits[0].Depositor) + require.Equal(t, amountDeposit1.Add(amountDeposit2...), sdk.NewCoins(deposits[0].Amount...)) + require.Equal(t, addr2.String(), deposits[1].Depositor) + require.Equal(t, amountDeposit1, sdk.NewCoins(deposits[1].Amount...)) + + // Test Refund Deposits + deposit, found = govKeeper.GetDeposit(ctx, proposalID, addr2) + require.True(t, found) + require.Equal(t, amountDeposit1, sdk.NewCoins(deposit.Amount...)) + govKeeper.RefundAndDeleteDeposits(ctx, proposalID) + deposit, found = govKeeper.GetDeposit(ctx, proposalID, addr2) + require.False(t, found) + require.Equal(t, addr1Initial, bankKeeper.GetAllBalances(ctx, addr1)) + require.Equal(t, addr2Initial, bankKeeper.GetAllBalances(ctx, addr2)) + + // Test delete and burn deposits + proposal, err = govKeeper.SubmitProposal(ctx, tp, "", "title", "description", addr1) + require.NoError(t, err) + proposalID = proposal.Id + _, err = govKeeper.AddDeposit(ctx, proposalID, addr1, amountDeposit1) + require.NoError(t, err) + govKeeper.DeleteAndBurnDeposits(ctx, proposalID) + deposits = govKeeper.GetDeposits(ctx, proposalID) + require.Len(t, deposits, 0) + require.Equal(t, addr1Initial.Sub(amountDeposit1...), bankKeeper.GetAllBalances(ctx, addr1)) +} + +func TestValidateInitialDeposit(t *testing.T) { + testcases := map[string]struct { + minDeposit sdk.Coins + minInitialDepositPercent int64 + initialDeposit sdk.Coins + + expectError bool + }{ + "min deposit * initial percent == initial deposit: success": { + minDeposit: sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount))), + minInitialDepositPercent: baseDepositTestPercent, + initialDeposit: sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount*baseDepositTestPercent/100))), + }, + "min deposit * initial percent < initial deposit: success": { + minDeposit: sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount))), + minInitialDepositPercent: baseDepositTestPercent, + initialDeposit: sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount*baseDepositTestPercent/100+1))), + }, + "min deposit * initial percent > initial deposit: error": { + minDeposit: sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount))), + minInitialDepositPercent: baseDepositTestPercent, + initialDeposit: sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount*baseDepositTestPercent/100-1))), + + expectError: true, + }, + "min deposit * initial percent == initial deposit (non-base values and denom): success": { + minDeposit: sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(56912))), + minInitialDepositPercent: 50, + initialDeposit: sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(56912/2+10))), + }, + "min deposit * initial percent == initial deposit but different denoms: error": { + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseUSDDepositTestAmount))), + minInitialDepositPercent: baseDepositTestPercent, + initialDeposit: sdk.NewCoins(sdk.NewCoin("uosmo", sdk.NewInt(baseUSDDepositTestAmount*baseDepositTestPercent/100))), + + expectError: true, + }, + "min deposit * initial percent == initial deposit (multiple coins): success": { + minDeposit: sdk.NewCoins( + sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount)), + sdk.NewCoin("uosmo", sdk.NewInt(baseUSDDepositTestAmount*2))), + minInitialDepositPercent: baseDepositTestPercent, + initialDeposit: sdk.NewCoins( + sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount*baseDepositTestPercent/100)), + sdk.NewCoin("uosmo", sdk.NewInt(baseUSDDepositTestAmount*2*baseDepositTestPercent/100)), + ), + }, + "min deposit * initial percent > initial deposit (multiple coins): error": { + minDeposit: sdk.NewCoins( + sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount)), + sdk.NewCoin("uosmo", sdk.NewInt(baseUSDDepositTestAmount*2))), + minInitialDepositPercent: baseDepositTestPercent, + initialDeposit: sdk.NewCoins( + sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount*baseDepositTestPercent/100)), + sdk.NewCoin("uosmo", sdk.NewInt(baseUSDDepositTestAmount*2*baseDepositTestPercent/100-1)), + ), + + expectError: true, + }, + "min deposit * initial percent < initial deposit (multiple coins - coin not required by min deposit): success": { + minDeposit: sdk.NewCoins( + sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount))), + minInitialDepositPercent: baseDepositTestPercent, + initialDeposit: sdk.NewCoins( + sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount*baseDepositTestPercent/100)), + sdk.NewCoin("uosmo", sdk.NewInt(baseUSDDepositTestAmount*baseDepositTestPercent/100-1)), + ), + }, + "0 initial percent: success": { + minDeposit: sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount))), + minInitialDepositPercent: 0, + initialDeposit: sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount*baseDepositTestPercent/100))), + }, + } + + for name, tc := range testcases { + t.Run(name, func(t *testing.T) { + input := CreateTestInput(t) + govKeeper := input.GovKeeper + ctx := input.Ctx + input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.NewDec(1)) + + params := v2lunc1.DefaultParams() + params.MinDeposit = tc.minDeposit + params.MinUusdDeposit = tc.minDeposit[0] + params.MinDeposit[0].Denom = core.MicroLunaDenom + params.MinInitialDepositRatio = sdk.NewDec(tc.minInitialDepositPercent).Quo(sdk.NewDec(100)).String() + + govKeeper.SetParams(ctx, params) + + err := govKeeper.validateInitialDeposit(ctx, tc.initialDeposit) + + if tc.expectError { + require.Error(t, err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/custom/gov/keeper/proposal.go b/custom/gov/keeper/proposal.go index 10fac629..b4dccb1a 100644 --- a/custom/gov/keeper/proposal.go +++ b/custom/gov/keeper/proposal.go @@ -125,7 +125,6 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat func (keeper Keeper) SetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64, amount sdk.Dec) error { store := ctx.KVStore(keeper.storeKey) key := v2lunc1types.TotalDepositKey(proposalID) - fmt.Printf("amount %s\n", amount) bz, err := amount.Marshal() if err == nil { store.Set(key, bz) diff --git a/custom/gov/keeper/test_utils.go b/custom/gov/keeper/test_utils.go index c7d1dfcd..9fea5d15 100644 --- a/custom/gov/keeper/test_utils.go +++ b/custom/gov/keeper/test_utils.go @@ -145,6 +145,7 @@ type TestInput struct { AccountKeeper authkeeper.AccountKeeper BankKeeper bankkeeper.Keeper OracleKeeper markettypes.OracleKeeper + StakingKeeper *stakingkeeper.Keeper GovKeeper *Keeper } @@ -193,7 +194,7 @@ func CreateTestInput(t *testing.T) TestInput { distrtypes.ModuleName: nil, oracletypes.ModuleName: nil, markettypes.ModuleName: {authtypes.Burner, authtypes.Minter}, - govtypes.ModuleName: nil, + govtypes.ModuleName: {authtypes.Burner, authtypes.Minter}, } paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, keyParams, tKeyParams) @@ -294,6 +295,19 @@ func CreateTestInput(t *testing.T) TestInput { govRouter.AddRoute(govtypes.RouterKey, v1beta1.ProposalHandler) govKeeper.SetLegacyRouter(govRouter) govKeeper.SetParams(ctx, v2lunc1.DefaultParams()) + govKeeper.Keeper.SetParams(ctx, v1.DefaultParams()) + + govparamsv2 := govKeeper.GetParams(ctx) + govparamsv2.MinDeposit = sdk.NewCoins( + sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(1_000_000)), + ) + govKeeper.SetParams(ctx, govparamsv2) + + govparamsv1 := govKeeper.Keeper.GetParams(ctx) + govparamsv1.MinDeposit = sdk.NewCoins( + sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(1_000_000)), + ) + govKeeper.Keeper.SetParams(ctx, govparamsv1) // Register all handlers for the MegServiceRouter. msr.SetInterfaceRegistry(encodingConfig.InterfaceRegistry) @@ -302,7 +316,7 @@ func CreateTestInput(t *testing.T) TestInput { v2lunc1.RegisterMsgServer(msr, msgServer) banktypes.RegisterMsgServer(msr, nil) // - return TestInput{ctx, legacyAmino, accountKeeper, bankKeeper, oracleKeeper, govKeeper} + return TestInput{ctx, legacyAmino, accountKeeper, bankKeeper, oracleKeeper, stakingKeeper, govKeeper} } // FundAccount is a utility function that funds an account by minting and From 61ea499d58f5e7def3dc56c4352ee2a74ab4e87c Mon Sep 17 00:00:00 2001 From: duonghb53 Date: Tue, 15 Oct 2024 00:02:42 +0700 Subject: [PATCH 29/60] remove debug --- custom/gov/keeper/proposal_test.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/custom/gov/keeper/proposal_test.go b/custom/gov/keeper/proposal_test.go index 8a7fdc86..c14da62d 100644 --- a/custom/gov/keeper/proposal_test.go +++ b/custom/gov/keeper/proposal_test.go @@ -83,10 +83,6 @@ func TestActivateVotingPeriod(t *testing.T) { proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) require.NoError(t, err) - fmt.Printf("proposal: %v\n", proposal) - param := govKeeper.GetParams(ctx) - - fmt.Printf("param: %v\n", param) require.Nil(t, proposal.VotingStartTime) govKeeper.ActivateVotingPeriod(ctx, proposal) From 6e9ed9bcb7365f41bf243aa09e5b430ae6ffde2f Mon Sep 17 00:00:00 2001 From: tusoict Date: Tue, 15 Oct 2024 11:06:30 +0700 Subject: [PATCH 30/60] added files for unitest: init_test.go query_test.go grpc_query.go grpc_query_test.go store_test.go --- custom/gov/client/cli/init_test.go | 42 ++++++++++++ custom/gov/client/cli/query_test.go | 40 +++++++++++ custom/gov/keeper/grpc_query.go | 39 +++++++++++ custom/gov/keeper/grpc_query_test.go | 55 ++++++++++++++++ custom/gov/migrations/v5/store_test.go | 91 ++++++++++++++++++++++++++ 5 files changed, 267 insertions(+) create mode 100644 custom/gov/client/cli/init_test.go create mode 100644 custom/gov/client/cli/query_test.go create mode 100644 custom/gov/keeper/grpc_query.go create mode 100644 custom/gov/keeper/grpc_query_test.go create mode 100644 custom/gov/migrations/v5/store_test.go diff --git a/custom/gov/client/cli/init_test.go b/custom/gov/client/cli/init_test.go new file mode 100644 index 00000000..a2a906b2 --- /dev/null +++ b/custom/gov/client/cli/init_test.go @@ -0,0 +1,42 @@ +package cli_test + +import ( + + "io" + "testing" + "github.com/stretchr/testify/suite" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + testutilmod "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/gov" + // "github.com/cosmos/cosmos-sdk/x/gov/client/cli" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + rpcclientmock "github.com/cometbft/cometbft/rpc/client/mock" +) + +type CLITestSuite struct { + suite.Suite + + kr keyring.Keyring + encCfg testutilmod.TestEncodingConfig //This holds the encoding configuration, which is crucial for marshaling and unmarshaling data for transactions and messages. + baseCtx client.Context //This is a base context used for all operations in the test suite. +} + +func TestCLITestSuite(t *testing.T) { + suite.Run(t, new(CLITestSuite)) +} +//run once before any tests in the suite +func (s *CLITestSuite) SetupSuite() { + //It initializes the necessary components, such as the codec, which is used for marshaling and unmarshaling data. + s.encCfg = testutilmod.MakeTestEncodingConfig(gov.AppModuleBasic{}) + s.kr = keyring.NewInMemory(s.encCfg.Codec) + s.baseCtx = client.Context{}. + WithKeyring(s.kr). + WithTxConfig(s.encCfg.TxConfig). + WithCodec(s.encCfg.Codec). + WithClient(clitestutil.MockTendermintRPC{Client: rpcclientmock.Client{}}). + WithAccountRetriever(client.MockAccountRetriever{}). + WithOutput(io.Discard). + WithChainID("test-chain") + +} \ No newline at end of file diff --git a/custom/gov/client/cli/query_test.go b/custom/gov/client/cli/query_test.go new file mode 100644 index 00000000..91dd66e0 --- /dev/null +++ b/custom/gov/client/cli/query_test.go @@ -0,0 +1,40 @@ +package cli_test + +import ( + "fmt" + "strings" + v2lunc1cli "github.com/classic-terra/core/v3/custom/gov/client/cli" +) + +func (s *CLITestSuite) TestGetCmdQueryMinimalDeposit() { + testCases := []struct { + name string + args []string + expCmdOutput string + }{ + { + "proposal with id", + []string{ + "1", + }, + "1", + }, + { + "proposal with no id", + []string{ + "", + }, + "", + }, + } + + for _, tc := range testCases { + tc := tc + + s.Run(tc.name, func() { + cmd := v2lunc1cli.GetCmdQueryMinimalDeposit() + cmd.SetArgs(tc.args) + s.Require().Contains(fmt.Sprint(cmd), strings.TrimSpace(tc.expCmdOutput)) + }) + } +} \ No newline at end of file diff --git a/custom/gov/keeper/grpc_query.go b/custom/gov/keeper/grpc_query.go new file mode 100644 index 00000000..d2a83144 --- /dev/null +++ b/custom/gov/keeper/grpc_query.go @@ -0,0 +1,39 @@ +package keeper + +import ( + "context" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + sdk "github.com/cosmos/cosmos-sdk/types" + v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + +) +var ( + _ v2lunc1types.QueryServer = queryServer{} +) +type queryServer struct{ k *Keeper } + +func NewQueryServer(k *Keeper) v2lunc1types.QueryServer { + return queryServer{k: k} +} + +func (q queryServer) ProposalMinimalLUNCByUusd(ctx context.Context, req *v2lunc1types.QueryProposalRequest) (*v2lunc1types.QueryMinimalDepositProposalResponse, error) { + // Fetch the proposal using the proposal ID + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + +if req.ProposalId == 0 { + return nil, status.Error(codes.InvalidArgument, "proposal id can not be 0") +} +_, found := q.k.GetProposal(ctx.(sdk.Context), req.ProposalId) +if !found { + return nil, status.Error(codes.NotFound, "proposal not found") +} +depositLimit := q.k.GetDepositLimitBaseUusd(ctx.(sdk.Context), req.ProposalId) +minimalDeposits := sdk.NewCoins(sdk.NewCoin("uusd", depositLimit.TruncateInt())) // Convert depositLimit to Int +return &v2lunc1types.QueryMinimalDepositProposalResponse{ + MinimalDeposit: minimalDeposits[0], +}, nil + +} \ No newline at end of file diff --git a/custom/gov/keeper/grpc_query_test.go b/custom/gov/keeper/grpc_query_test.go new file mode 100644 index 00000000..54a3f1da --- /dev/null +++ b/custom/gov/keeper/grpc_query_test.go @@ -0,0 +1,55 @@ +package keeper_test + + + +import ( + "context" + "testing" + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" // Adjust the import path as necessary + "github.com/stretchr/testify/require" +) + +// MockQueryServer is a mock implementation of the v2lunc1.QueryServer interface +type MockQueryServer struct { + // You can store any state needed for the mock here + ProposalResponse *v2lunc1.QueryMinimalDepositProposalResponse + Err error +} + +// ProposalMinimalLUNCByUusd implements the v2lunc1.QueryServer interface +func (m *MockQueryServer) ProposalMinimalLUNCByUusd(ctx context.Context, req *v2lunc1.QueryProposalRequest) (*v2lunc1.QueryMinimalDepositProposalResponse, error) { + if m.Err != nil { + return nil, m.Err + } + return m.ProposalResponse, nil +} + +// Test your keeper logic with the mock +func TestKeeperWithMockQueryServer(t *testing.T) { +mockQueryServer := &MockQueryServer{ + ProposalResponse: &v2lunc1.QueryMinimalDepositProposalResponse{ + //MinimalDeposit: sdk.Coin{sdk.NewCoin("uusd", sdk.NewInt(1000))}, + MinimalDeposit: sdk.NewCoin("uusd", sdk.NewInt(1000)), + }, +} + + // Create your context and other setup logic as needed + + t.Run("successful query", func(t *testing.T) { + req := &v2lunc1.QueryProposalRequest{ProposalId: 1} + res, err := mockQueryServer.ProposalMinimalLUNCByUusd(context.Background(), req) + require.NoError(t, err) + require.NotNil(t, res) + require.Equal(t, sdk.NewInt(1000), res.MinimalDeposit.Amount) + }) + + t.Run("error when querying proposal", func(t *testing.T) { + mockQueryServer.Err = fmt.Errorf("proposal not found") + req := &v2lunc1.QueryProposalRequest{ProposalId: 1} + _, err := mockQueryServer.ProposalMinimalLUNCByUusd(context.Background(), req) + require.Error(t, err) + require.Equal(t, "proposal not found", err.Error()) + }) +} diff --git a/custom/gov/migrations/v5/store_test.go b/custom/gov/migrations/v5/store_test.go new file mode 100644 index 00000000..372ebb4a --- /dev/null +++ b/custom/gov/migrations/v5/store_test.go @@ -0,0 +1,91 @@ +package v5_test + +import ( + "testing" + "time" + + v5 "github.com/classic-terra/core/v3/custom/gov/migrations/v5" + "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/x/bank" + "github.com/cosmos/cosmos-sdk/x/gov" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + "github.com/stretchr/testify/require" + + "github.com/cosmos/cosmos-sdk/testutil" + moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" +) + +func TestMigrateStore(t *testing.T) { + // Initialize codec and store keys + cdc := moduletestutil.MakeTestEncodingConfig(gov.AppModuleBasic{}, bank.AppModuleBasic{}).Codec + + // Create KV store keys + govKey := storetypes.NewKVStoreKey("gov") + transientKey := storetypes.NewTransientStoreKey("transient_test") + + // Create context and KV store + ctx := testutil.DefaultContext(govKey, transientKey) + + store := ctx.KVStore(govKey) + + storeService := storetypes.StoreKey(govKey) + + maxDepositPeriod := time.Duration(time.Hour * 24 * 2) + votingPeriod := time.Duration(time.Hour * 24 * 3) + + // Setup initial governance params in the store (old params before migration) + oldParams := v1.Params{ + MinDeposit: sdk.Coins{sdk.NewCoin("uluna", sdk.NewInt(100))}, + MaxDepositPeriod: &maxDepositPeriod, + VotingPeriod: &votingPeriod, + Quorum: sdk.NewDecWithPrec(334, 3).String(), // 33.4% + Threshold: sdk.NewDecWithPrec(500, 3).String(), // 50% + VetoThreshold: sdk.NewDecWithPrec(334, 3).String(), // 33.4% + MinInitialDepositRatio: sdk.NewDecWithPrec(100, 3).String(), // 10% + BurnProposalDepositPrevote: true, + BurnVoteQuorum: true, + BurnVoteVeto: false, + } + + // Marshal and set the old params into the KV store + bz, err := cdc.Marshal(&oldParams) + require.NoError(t, err) + store.Set(v5.ParamsKey, bz) + + // Ensure the params are correctly stored before migration + var params v1.Params + bz = store.Get(v5.ParamsKey) + require.NoError(t, cdc.Unmarshal(bz, ¶ms)) + t.Logf("params: %v", params) + require.Equal(t, sdk.NewDecWithPrec(500, 3).String(), params.Threshold) + // require.Equal(t, (*time.Duration(time.Hour * 2)), params.VotingPeriod) // Expecting nil before migration + + // Run the migration function + err = v5.MigrateStore(ctx, storeService, cdc) + require.NoError(t, err) + + // Fetch the params after migration + bz = store.Get(v5.ParamsKey) + + var newParams v2lunc1.Params + require.NoError(t, cdc.Unmarshal(bz, &newParams)) + + t.Logf("params2: %v", newParams) + + require.Equal(t, oldParams.MinDeposit, newParams.MinDeposit) + require.Equal(t, oldParams.MaxDepositPeriod, newParams.MaxDepositPeriod) + require.Equal(t, oldParams.VotingPeriod, newParams.VotingPeriod) + require.Equal(t, oldParams.Quorum, newParams.Quorum) + require.Equal(t, oldParams.Threshold, newParams.Threshold) + require.Equal(t, oldParams.VetoThreshold, newParams.VetoThreshold) + require.Equal(t, oldParams.MinInitialDepositRatio, newParams.MinInitialDepositRatio) + require.Equal(t, oldParams.BurnProposalDepositPrevote, newParams.BurnProposalDepositPrevote) + require.Equal(t, oldParams.BurnVoteQuorum, newParams.BurnVoteQuorum) + require.Equal(t, oldParams.BurnVoteVeto, newParams.BurnVoteVeto) + + // Check any new fields from the `v2lunc1.Params` + require.Equal(t, v2lunc1.DefaultParams().MinUusdDeposit, newParams.MinUusdDeposit) + +} From 6265c9d8164c001a00e134758f63753d7a7b02ed Mon Sep 17 00:00:00 2001 From: tusoict Date: Tue, 15 Oct 2024 11:18:08 +0700 Subject: [PATCH 31/60] added migrator_test.go --- custom/gov/keeper/migrator_test.go | 40 ++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 custom/gov/keeper/migrator_test.go diff --git a/custom/gov/keeper/migrator_test.go b/custom/gov/keeper/migrator_test.go new file mode 100644 index 00000000..a3cfda3b --- /dev/null +++ b/custom/gov/keeper/migrator_test.go @@ -0,0 +1,40 @@ +package keeper_test + +import ( + "testing" + + //"github.com/cosmos/cosmos-sdk/x/gov/exported" + sdk "github.com/cosmos/cosmos-sdk/types" + //"github.com/cosmos/cosmos-sdk/x/gov/keeper" + "github.com/classic-terra/core/v3/custom/gov/keeper" + + "github.com/stretchr/testify/require" + +) + +// MockParamSubspace is a mock implementation of ParamSubspace for testing. +type MockParamSubspace struct{} + + +// Satisfy the ParamSubspace interface by adding dummy methods. +func (m MockParamSubspace) Get(ctx sdk.Context, key []byte, ptr interface{}) {} + + +// TestNewMigrator tests the NewMigrator constructor +func TestNewMigrator(t *testing.T) { + + + // Create a keeper + mockKeeper := &keeper.Keeper{} + // mockKeeper := &keeper.Keeper{} + t.Logf("mockKeeper: %v", mockKeeper) + + // Use the mock ParamSubspace + mockSubspace := MockParamSubspace{} + t.Logf("mockSubspace: %v", mockSubspace) + + migrator := keeper.NewMigrator(mockKeeper, mockSubspace) + require.NotNil(t, migrator) + } + + From 03ec02bcbd33449660fd3806e401893b6814b999 Mon Sep 17 00:00:00 2001 From: duonghb53 Date: Wed, 16 Oct 2024 23:02:04 +0700 Subject: [PATCH 32/60] add msg server test --- custom/gov/keeper/msg_server_test.go | 1272 ++++++++++++++++++++++++++ 1 file changed, 1272 insertions(+) create mode 100644 custom/gov/keeper/msg_server_test.go diff --git a/custom/gov/keeper/msg_server_test.go b/custom/gov/keeper/msg_server_test.go new file mode 100644 index 00000000..62e90ac1 --- /dev/null +++ b/custom/gov/keeper/msg_server_test.go @@ -0,0 +1,1272 @@ +package keeper + +import ( + "time" + + "github.com/cosmos/cosmos-sdk/testutil/testdata" + "github.com/stretchr/testify/require" + + "strings" + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + + v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + core "github.com/classic-terra/core/v3/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/cosmos-sdk/x/gov/types" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + v1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" +) + +const ( + baseDepositTestAmount = 100 +) + +var () + +func TestSubmitProposalReq(t *testing.T) { + // Set up the necessary dependencies and context + input := CreateTestInput(t) + ctx := input.Ctx + govAcct := authtypes.NewModuleAddress(types.ModuleName) + _, _, addr = testdata.KeyTestPubAddr() + proposer := addr + govMsgSvr := NewMsgServerImpl(input.GovKeeper) + coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 Default Bond Denom + initialDeposit := coins + input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) + + bankMsg := &banktypes.MsgSend{ + FromAddress: govAcct.String(), + ToAddress: proposer.String(), + Amount: coins, + } + + cases := map[string]struct { + preRun func() (*v1.MsgSubmitProposal, error) + expErr bool + expErrMsg string + }{ + "metadata too long": { + preRun: func() (*v1.MsgSubmitProposal, error) { + return v1.NewMsgSubmitProposal( + []sdk.Msg{bankMsg}, + initialDeposit, + proposer.String(), + strings.Repeat("1", 300), + "Proposal", + "description of proposal", + ) + }, + expErr: true, + expErrMsg: "metadata too long", + }, + "many signers": { + preRun: func() (*v1.MsgSubmitProposal, error) { + return v1.NewMsgSubmitProposal( + []sdk.Msg{testdata.NewTestMsg(govAcct, addr)}, + initialDeposit, + proposer.String(), + "", + "Proposal", + "description of proposal", + ) + }, + expErr: true, + expErrMsg: "expected gov account as only signer for proposal message", + }, + "signer isn't gov account": { + preRun: func() (*v1.MsgSubmitProposal, error) { + return v1.NewMsgSubmitProposal( + []sdk.Msg{testdata.NewTestMsg(addr)}, + initialDeposit, + proposer.String(), + "", + "Proposal", + "description of proposal", + ) + }, + expErr: true, + expErrMsg: "expected gov account as only signer for proposal message", + }, + "invalid msg handler": { + preRun: func() (*v1.MsgSubmitProposal, error) { + return v1.NewMsgSubmitProposal( + []sdk.Msg{testdata.NewTestMsg(govAcct)}, + initialDeposit, + proposer.String(), + "", + "Proposal", + "description of proposal", + ) + }, + expErr: true, + expErrMsg: "proposal message not recognized by router", + }, + "all good": { + preRun: func() (*v1.MsgSubmitProposal, error) { + return v1.NewMsgSubmitProposal( + []sdk.Msg{bankMsg}, + initialDeposit, + proposer.String(), + "", + "Proposal", + "description of proposal", + ) + }, + expErr: false, + }, + "all good with min deposit": { + preRun: func() (*v1.MsgSubmitProposal, error) { + return v1.NewMsgSubmitProposal( + []sdk.Msg{bankMsg}, + coins, + proposer.String(), + "", + "Proposal", + "description of proposal", + ) + }, + expErr: false, + }, + } + + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + // Fund the account + FundAccount(input, addr, coins) + msg, err := tc.preRun() + if err != nil { + t.Fatalf("preRun error: %v", err) + } + res, err := govMsgSvr.SubmitProposal(ctx, msg) + if tc.expErr { + if err == nil { + t.Errorf("expected error but got none") + } else if !strings.Contains(err.Error(), tc.expErrMsg) { + t.Errorf("expected error message to contain %q but got %q", tc.expErrMsg, err.Error()) + } + } else { + if err != nil { + t.Fatalf("SubmitProposal error: %v", err) + } + if res.ProposalId == 0 { + t.Errorf("expected non-nil ProposalId but got %v", res.ProposalId) + } + } + }) + } +} + +func TestVoteReq(t *testing.T) { + // Set up the necessary dependencies and context + input := CreateTestInput(t) + govKeeper := input.GovKeeper + ctx := input.Ctx + govAcct := authtypes.NewModuleAddress(types.ModuleName) + _, _, addr = testdata.KeyTestPubAddr() + proposer := addr + govMsgSvr := NewMsgServerImpl(input.GovKeeper) + coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 Default Bond Denom + input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) + + bankMsg := &banktypes.MsgSend{ + FromAddress: govAcct.String(), + ToAddress: proposer.String(), + Amount: coins, + } + + msg, err := v1.NewMsgSubmitProposal( + []sdk.Msg{bankMsg}, + coins, + proposer.String(), + "", + "Proposal", + "description of proposal", + ) + require.NoError(t, err) + // Fund the account + FundAccount(input, addr, coins) + require.NoError(t, err) + res, err := govMsgSvr.SubmitProposal(ctx, msg) + require.NoError(t, err) + require.NotNil(t, res.ProposalId) + proposalId := res.ProposalId + requiredAmount := govKeeper.GetDepositLimitBaseUusd(ctx, proposalId).TruncateInt() + + cases := map[string]struct { + preRun func() uint64 + expErr bool + expErrMsg string + option v1.VoteOption + metadata string + voter sdk.AccAddress + }{ + "inactive proposal": { + preRun: func() uint64 { + msg, err := v1.NewMsgSubmitProposal( + []sdk.Msg{bankMsg}, + coins, + proposer.String(), + "", + "Proposal", + "description of proposal", + ) + require.NoError(t, err) + FundAccount(input, addr, coins) + res, err := govMsgSvr.SubmitProposal(ctx, msg) + require.NoError(t, err) + require.NotNil(t, res.ProposalId) + return res.ProposalId + }, + option: v1.VoteOption_VOTE_OPTION_YES, + voter: proposer, + metadata: "", + expErr: true, + expErrMsg: "inactive proposal", + }, + "metadata too long": { + preRun: func() uint64 { + // set proposal to status activedVoting + proposal, ok := govKeeper.GetProposal(ctx, proposalId) + require.True(t, ok) + proposal.Status = v1.StatusVotingPeriod + govKeeper.SetProposal(ctx, proposal) + return proposalId + }, + option: v1.VoteOption_VOTE_OPTION_YES, + voter: proposer, + metadata: strings.Repeat("a", 300), + expErr: true, + expErrMsg: "metadata too long", + }, + "voter error": { + preRun: func() uint64 { + return proposalId + }, + option: v1.VoteOption_VOTE_OPTION_YES, + voter: sdk.AccAddress(strings.Repeat("a", 300)), + metadata: "", + expErr: true, + expErrMsg: "address max length is 255", + }, + "all good": { + preRun: func() uint64 { + msg, err := v1.NewMsgSubmitProposal( + []sdk.Msg{bankMsg}, + sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, requiredAmount)), + proposer.String(), + "", + "Proposal", + "description of proposal", + ) + require.NoError(t, err) + FundAccount(input, addr, coins) + res, err := govMsgSvr.SubmitProposal(ctx, msg) + require.NoError(t, err) + require.NotNil(t, res.ProposalId) + + // set proposal to status activedVoting + proposal, ok := govKeeper.GetProposal(ctx, res.ProposalId) + require.True(t, ok) + proposal.Status = v1.StatusVotingPeriod + govKeeper.SetProposal(ctx, proposal) + return res.ProposalId + }, + option: v1.VoteOption_VOTE_OPTION_YES, + voter: proposer, + metadata: "", + expErr: false, + }, + } + + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + + pId := tc.preRun() + FundAccount(input, addr, coins) + voteReq := v1.NewMsgVote(tc.voter, pId, tc.option, tc.metadata) + _, err := govMsgSvr.Vote(ctx, voteReq) + if tc.expErr { + if err == nil { + t.Errorf("expected error but got none") + } else if !strings.Contains(err.Error(), tc.expErrMsg) { + t.Errorf("expected error message to contain %q but got %q", tc.expErrMsg, err.Error()) + } + } else { + if err != nil { + t.Fatalf("SubmitProposal error: %v", err) + } + if res.ProposalId == 0 { + t.Errorf("expected non-nil ProposalId but got %v", res.ProposalId) + } + } + }) + } +} + +func TestVoteWeightedReq(t *testing.T) { + // Set up the necessary dependencies and context + input := CreateTestInput(t) + govKeeper := input.GovKeeper + ctx := input.Ctx + govAcct := authtypes.NewModuleAddress(types.ModuleName) + _, _, addr = testdata.KeyTestPubAddr() + proposer := addr + govMsgSvr := NewMsgServerImpl(input.GovKeeper) + coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 Default Bond Denom + input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) + + bankMsg := &banktypes.MsgSend{ + FromAddress: govAcct.String(), + ToAddress: proposer.String(), + Amount: coins, + } + + msg, err := v1.NewMsgSubmitProposal( + []sdk.Msg{bankMsg}, + coins, + proposer.String(), + "", + "Proposal", + "description of proposal", + ) + require.NoError(t, err) + FundAccount(input, addr, coins) + res, err := govMsgSvr.SubmitProposal(ctx, msg) + require.NoError(t, err) + require.NotNil(t, res.ProposalId) + proposalId := res.ProposalId + // requiredAmount := suite.govKeeper.GetDepositLimitBaseUusd(suite.ctx, proposalId).TruncateInt() + + cases := map[string]struct { + preRun func() uint64 + vote *v1.MsgVote + expErr bool + expErrMsg string + option v1.VoteOption + metadata string + voter sdk.AccAddress + }{ + "vote on inactive proposal": { + preRun: func() uint64 { + msg, err := v1.NewMsgSubmitProposal( + []sdk.Msg{bankMsg}, + coins, + proposer.String(), + "", + "Proposal", + "description of proposal", + ) + require.NoError(t, err) + FundAccount(input, addr, coins) + res, err := govMsgSvr.SubmitProposal(ctx, msg) + require.NoError(t, err) + require.NotNil(t, res.ProposalId) + return res.ProposalId + }, + option: v1.VoteOption_VOTE_OPTION_YES, + voter: proposer, + metadata: "", + expErr: true, + expErrMsg: "inactive proposal", + }, + "metadata too long": { + preRun: func() uint64 { + // set proposal to status activedVoting + proposal, ok := govKeeper.GetProposal(ctx, proposalId) + require.True(t, ok) + proposal.Status = v1.StatusVotingPeriod + govKeeper.SetProposal(ctx, proposal) + return proposalId + }, + option: v1.VoteOption_VOTE_OPTION_YES, + voter: proposer, + metadata: strings.Repeat("a", 300), + expErr: true, + expErrMsg: "metadata too long", + }, + "voter error": { + preRun: func() uint64 { + return proposalId + }, + option: v1.VoteOption_VOTE_OPTION_YES, + voter: sdk.AccAddress(strings.Repeat("a", 300)), + metadata: "", + expErr: true, + expErrMsg: "address max length is 255", + }, + "all good": { + preRun: func() uint64 { + msg, err := v1.NewMsgSubmitProposal( + []sdk.Msg{bankMsg}, + coins, + proposer.String(), + "", + "Proposal", + "description of proposal", + ) + require.NoError(t, err) + FundAccount(input, addr, coins) + res, err := govMsgSvr.SubmitProposal(ctx, msg) + require.NoError(t, err) + require.NotNil(t, res.ProposalId) + // set proposal to status activedVoting + proposal, ok := govKeeper.GetProposal(ctx, res.ProposalId) + require.True(t, ok) + proposal.Status = v1.StatusVotingPeriod + govKeeper.SetProposal(ctx, proposal) + return res.ProposalId + }, + option: v1.VoteOption_VOTE_OPTION_YES, + voter: proposer, + metadata: "", + expErr: false, + }, + } + + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + + pId := tc.preRun() + voteReq := v1.NewMsgVoteWeighted(tc.voter, pId, v1.NewNonSplitVoteOption(tc.option), tc.metadata) + _, err := govMsgSvr.VoteWeighted(ctx, voteReq) + if tc.expErr { + if err == nil { + t.Errorf("expected error but got none") + } else if !strings.Contains(err.Error(), tc.expErrMsg) { + t.Errorf("expected error message to contain %q but got %q", tc.expErrMsg, err.Error()) + } + } else { + if err != nil { + t.Fatalf("SubmitProposal error: %v", err) + } + if res.ProposalId == 0 { + t.Errorf("expected non-nil ProposalId but got %v", res.ProposalId) + } + } + }) + } +} + +func TestDepositReq(t *testing.T) { + // Set up the necessary dependencies and context + input := CreateTestInput(t) + ctx := input.Ctx + govAcct := authtypes.NewModuleAddress(types.ModuleName) + _, _, addr = testdata.KeyTestPubAddr() + proposer := addr + + coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 Default Bond Denom + input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) + govMsgSvr := NewMsgServerImpl(input.GovKeeper) + + bankMsg := &banktypes.MsgSend{ + FromAddress: govAcct.String(), + ToAddress: proposer.String(), + Amount: coins, + } + + msg, err := v1.NewMsgSubmitProposal( + []sdk.Msg{bankMsg}, + coins, + proposer.String(), + "", + "Proposal", + "description of proposal", + ) + require.NoError(t, err) + FundAccount(input, addr, coins) + res, err := govMsgSvr.SubmitProposal(ctx, msg) + require.NoError(t, err) + require.NotNil(t, res.ProposalId) + pId := res.ProposalId + + cases := map[string]struct { + preRun func() uint64 + expErr bool + proposalId uint64 + depositor sdk.AccAddress + deposit sdk.Coins + options v1.WeightedVoteOptions + }{ + "wrong proposal id": { + preRun: func() uint64 { + return 0 + }, + depositor: proposer, + deposit: coins, + expErr: true, + options: v1.NewNonSplitVoteOption(v1.OptionYes), + }, + "all good": { + preRun: func() uint64 { + return pId + }, + depositor: proposer, + deposit: coins, + expErr: false, + options: v1.NewNonSplitVoteOption(v1.OptionYes), + }, + } + + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + proposalId := tc.preRun() + FundAccount(input, addr, coins) + depositReq := v1.NewMsgDeposit(tc.depositor, proposalId, tc.deposit) + _, err := govMsgSvr.Deposit(ctx, depositReq) + if tc.expErr { + if err == nil { + t.Errorf("expected error but got none") + } + } else { + if err != nil { + t.Fatalf("SubmitProposal error: %v", err) + } + if res.ProposalId == 0 { + t.Errorf("expected non-nil ProposalId but got %v", res.ProposalId) + } + } + }) + } +} + +func TestMsgUpdateParams(t *testing.T) { + input := CreateTestInput(t) + ctx := input.Ctx + govKeeper := input.GovKeeper + authority := govKeeper.GetAuthority() + params := v2lunc1types.DefaultParams() + govMsgSvr := NewMsgServerImpl(input.GovKeeper) + testCases := []struct { + name string + input func() *v2lunc1types.MsgUpdateParams + expErr bool + expErrMsg string + }{ + { + name: "valid", + input: func() *v2lunc1types.MsgUpdateParams { + return &v2lunc1types.MsgUpdateParams{ + Authority: authority, + Params: params, + } + }, + expErr: false, + }, + { + name: "invalid authority", + input: func() *v2lunc1types.MsgUpdateParams { + return &v2lunc1types.MsgUpdateParams{ + Authority: "authority", + Params: params, + } + }, + expErr: true, + expErrMsg: "invalid authority address", + }, + { + name: "invalid min deposit", + input: func() *v2lunc1types.MsgUpdateParams { + params1 := params + params1.MinDeposit = nil + + return &v2lunc1types.MsgUpdateParams{ + Authority: authority, + Params: params1, + } + }, + expErr: true, + expErrMsg: "invalid minimum deposit", + }, + { + name: "negative deposit", + input: func() *v2lunc1types.MsgUpdateParams { + params1 := params + params1.MinDeposit = sdk.Coins{{ + Denom: sdk.DefaultBondDenom, + Amount: sdk.NewInt(-100), + }} + + return &v2lunc1types.MsgUpdateParams{ + Authority: authority, + Params: params1, + } + }, + expErr: true, + expErrMsg: "invalid minimum deposit", + }, + { + name: "invalid max deposit period", + input: func() *v2lunc1types.MsgUpdateParams { + params1 := params + params1.MaxDepositPeriod = nil + + return &v2lunc1types.MsgUpdateParams{ + Authority: authority, + Params: params1, + } + }, + expErr: true, + expErrMsg: "maximum deposit period must not be nil", + }, + { + name: "zero max deposit period", + input: func() *v2lunc1types.MsgUpdateParams { + params1 := params + duration := time.Duration(0) + params1.MaxDepositPeriod = &duration + + return &v2lunc1types.MsgUpdateParams{ + Authority: authority, + Params: params1, + } + }, + expErr: true, + expErrMsg: "maximum deposit period must be positive", + }, + { + name: "invalid quorum", + input: func() *v2lunc1types.MsgUpdateParams { + params1 := params + params1.Quorum = "abc" + + return &v2lunc1types.MsgUpdateParams{ + Authority: authority, + Params: params1, + } + }, + expErr: true, + expErrMsg: "invalid quorum string", + }, + { + name: "negative quorum", + input: func() *v2lunc1types.MsgUpdateParams { + params1 := params + params1.Quorum = "-0.1" + + return &v2lunc1types.MsgUpdateParams{ + Authority: authority, + Params: params1, + } + }, + expErr: true, + expErrMsg: "quorom cannot be negative", + }, + { + name: "quorum > 1", + input: func() *v2lunc1types.MsgUpdateParams { + params1 := params + params1.Quorum = "2" + + return &v2lunc1types.MsgUpdateParams{ + Authority: authority, + Params: params1, + } + }, + expErr: true, + expErrMsg: "quorom too large", + }, + { + name: "invalid threshold", + input: func() *v2lunc1types.MsgUpdateParams { + params1 := params + params1.Threshold = "abc" + + return &v2lunc1types.MsgUpdateParams{ + Authority: authority, + Params: params1, + } + }, + expErr: true, + expErrMsg: "invalid threshold string", + }, + { + name: "negative threshold", + input: func() *v2lunc1types.MsgUpdateParams { + params1 := params + params1.Threshold = "-0.1" + + return &v2lunc1types.MsgUpdateParams{ + Authority: authority, + Params: params1, + } + }, + expErr: true, + expErrMsg: "vote threshold must be positive", + }, + { + name: "threshold > 1", + input: func() *v2lunc1types.MsgUpdateParams { + params1 := params + params1.Threshold = "2" + + return &v2lunc1types.MsgUpdateParams{ + Authority: authority, + Params: params1, + } + }, + expErr: true, + expErrMsg: "vote threshold too large", + }, + { + name: "invalid veto threshold", + input: func() *v2lunc1types.MsgUpdateParams { + params1 := params + params1.VetoThreshold = "abc" + + return &v2lunc1types.MsgUpdateParams{ + Authority: authority, + Params: params1, + } + }, + expErr: true, + expErrMsg: "invalid vetoThreshold string", + }, + { + name: "negative veto threshold", + input: func() *v2lunc1types.MsgUpdateParams { + params1 := params + params1.VetoThreshold = "-0.1" + + return &v2lunc1types.MsgUpdateParams{ + Authority: authority, + Params: params1, + } + }, + expErr: true, + expErrMsg: "veto threshold must be positive", + }, + { + name: "veto threshold > 1", + input: func() *v2lunc1types.MsgUpdateParams { + params1 := params + params1.VetoThreshold = "2" + + return &v2lunc1types.MsgUpdateParams{ + Authority: authority, + Params: params1, + } + }, + expErr: true, + expErrMsg: "veto threshold too large", + }, + { + name: "invalid voting period", + input: func() *v2lunc1types.MsgUpdateParams { + params1 := params + params1.VotingPeriod = nil + + return &v2lunc1types.MsgUpdateParams{ + Authority: authority, + Params: params1, + } + }, + expErr: true, + expErrMsg: "voting period must not be nil", + }, + { + name: "zero voting period", + input: func() *v2lunc1types.MsgUpdateParams { + params1 := params + duration := time.Duration(0) + params1.VotingPeriod = &duration + + return &v2lunc1types.MsgUpdateParams{ + Authority: authority, + Params: params1, + } + }, + expErr: true, + expErrMsg: "voting period must be positive", + }, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + msg := tc.input() + exec := func(updateParams *v2lunc1types.MsgUpdateParams) error { + if err := msg.ValidateBasic(); err != nil { + return err + } + + if _, err := govMsgSvr.UpdateParams(ctx, updateParams); err != nil { + return err + } + return nil + } + + err := exec(msg) + if tc.expErr { + if err == nil { + t.Errorf("expected error but got none") + } else if !strings.Contains(err.Error(), tc.expErrMsg) { + t.Errorf("expected error message to contain %q but got %q", tc.expErrMsg, err.Error()) + } + } else { + if err != nil { + t.Fatalf("SubmitProposal error: %v", err) + } + } + }) + } +} + +func TestSubmitProposal_InitialDeposit(t *testing.T) { + // Set up the necessary dependencies and context + input := CreateTestInput(t) + ctx := input.Ctx + govKeeper := input.GovKeeper + input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.NewDecWithPrec(2, 1)) + _, _, address := testdata.KeyTestPubAddr() + + // setup desposit value when test + const meetsDepositValue = baseDepositTestAmount * baseDepositTestPercent / 100 + baseDepositRatioDec := sdk.NewDec(baseDepositTestPercent).Quo(sdk.NewDec(100)) + + testcases := map[string]struct { + minDeposit sdk.Coins + minInitialDepositRatio sdk.Dec + initialDeposit sdk.Coins + accountBalance sdk.Coins + + expectError bool + }{ + "meets initial deposit, enough balance - success": { + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount))), + minInitialDepositRatio: baseDepositRatioDec, + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue))), + accountBalance: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue))), + }, + "does not meet initial deposit, enough balance - error": { + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount))), + minInitialDepositRatio: baseDepositRatioDec, + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue-1))), + accountBalance: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue))), + + expectError: true, + }, + "meets initial deposit, not enough balance - error": { + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount))), + minInitialDepositRatio: baseDepositRatioDec, + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue))), + accountBalance: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue-1))), + + expectError: true, + }, + "does not meet initial deposit and not enough balance - error": { + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount))), + minInitialDepositRatio: baseDepositRatioDec, + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue-1))), + accountBalance: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue-1))), + + expectError: true, + }, + } + + for name, tc := range testcases { + t.Run(name, func(t *testing.T) { + // Fund the proposer's account + FundAccount(input, address, tc.minDeposit) + govMsgSvr := NewMsgServerImpl(input.GovKeeper) + + params := v2lunc1types.DefaultParams() + params.MinUusdDeposit = tc.minDeposit[0] + params.MinInitialDepositRatio = tc.minInitialDepositRatio.String() + govKeeper.SetParams(ctx, params) + + msg, err := v1.NewMsgSubmitProposal(TestProposal, tc.initialDeposit, address.String(), "test", "Proposal", "description of proposal") + require.NoError(t, err) + + // System under test + _, err = govMsgSvr.SubmitProposal(sdk.WrapSDKContext(ctx), msg) + + // Assertions + if tc.expectError { + require.NoError(t, err) + return + } + require.NoError(t, err) + }) + } +} + +// legacy msg server tests +func TestLegacyMsgSubmitProposal(t *testing.T) { + // Set up the necessary dependencies and context + input := CreateTestInput(t) + ctx := input.Ctx + govAcct := authtypes.NewModuleAddress(types.ModuleName) + _, _, addr = testdata.KeyTestPubAddr() + proposer := addr + + coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 UUSD + input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) + initialDeposit := coins + + cases := map[string]struct { + preRun func() (*v1beta1.MsgSubmitProposal, error) + expErr bool + }{ + "all good": { + preRun: func() (*v1beta1.MsgSubmitProposal, error) { + return v1beta1.NewMsgSubmitProposal( + v1beta1.NewTextProposal("test", "I am test"), + initialDeposit, + proposer, + ) + }, + expErr: false, + }, + "all good with min deposit": { + preRun: func() (*v1beta1.MsgSubmitProposal, error) { + return v1beta1.NewMsgSubmitProposal( + v1beta1.NewTextProposal("test", "I am test"), + coins, + proposer, + ) + }, + expErr: false, + }, + } + + legacyMsgSrvr := NewLegacyMsgServerImpl(govAcct.String(), NewMsgServerImpl(input.GovKeeper)) + + for name, c := range cases { + + t.Run(name, func(t *testing.T) { + msg, err := c.preRun() + + if err != nil { + t.Fatalf("preRun error: %v", err) + } + + FundAccount(input, addr, coins) + res, err := legacyMsgSrvr.SubmitProposal(ctx, msg) + + if c.expErr { + if err == nil { + t.Errorf("expected error but got none") + } + } else { + if err != nil { + t.Fatalf("SubmitProposal error: %v", err) + } + if res.ProposalId == 0 { + t.Errorf("expected non-nil ProposalId but got %v", res.ProposalId) + } + } + }) + } +} + +func TestLegacyMsgVote(t *testing.T) { + // Set up the necessary dependencies and context + input := CreateTestInput(t) + ctx := input.Ctx + govKeeper := input.GovKeeper + govAcct := authtypes.NewModuleAddress(types.ModuleName) + _, _, addr := testdata.KeyTestPubAddr() + proposer := addr + + coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 UUSD + input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) + FundAccount(input, addr, coins) + + // Create a proposal first + proposal, err := input.GovKeeper.SubmitProposal(ctx, []sdk.Msg{}, "", "Test Proposal", "This is a test proposal", proposer) + require.NoError(t, err) + + if err != nil { + t.Fatalf("preRun error: %v", err) + } + proposalID := proposal.Id + + proposal, ok := input.GovKeeper.GetProposal(ctx, proposal.Id) + require.True(t, ok) + + bankMsg := &banktypes.MsgSend{ + FromAddress: govAcct.String(), + ToAddress: proposer.String(), + Amount: coins, + } + + govMsgSvr := NewMsgServerImpl(input.GovKeeper) + + cases := map[string]struct { + preRun func() uint64 + expErr bool + expErrMsg string + option v1beta1.VoteOption + metadata string + voter sdk.AccAddress + }{ + "vote on inactive proposal": { + preRun: func() uint64 { + msg, err := v1.NewMsgSubmitProposal( + []sdk.Msg{bankMsg}, + coins, + proposer.String(), + "", + "Proposal", + "description of proposal", + ) + require.NoError(t, err) + + res, err := govMsgSvr.SubmitProposal(ctx, msg) + require.NoError(t, err) + require.NotNil(t, res.ProposalId) + return res.ProposalId + }, + option: v1beta1.OptionYes, + voter: proposer, + metadata: "", + expErr: true, + expErrMsg: "inactive proposal", + }, + "voter error": { + preRun: func() uint64 { + return proposalID + }, + option: v1beta1.OptionYes, + voter: sdk.AccAddress(strings.Repeat("a", 300)), + metadata: "", + expErr: true, + expErrMsg: "address max length is 255", + }, + "all good": { + preRun: func() uint64 { + msg, err := v1.NewMsgSubmitProposal( + []sdk.Msg{bankMsg}, + coins, + proposer.String(), + "", + "Proposal", + "description of proposal", + ) + require.NoError(t, err) + FundAccount(input, addr, coins) + res, err := govMsgSvr.SubmitProposal(ctx, msg) + require.NoError(t, err) + require.NotNil(t, res.ProposalId) + // set proposal to status activedVoting + proposal, ok := govKeeper.GetProposal(ctx, res.ProposalId) + require.True(t, ok) + proposal.Status = v1.StatusVotingPeriod + govKeeper.SetProposal(ctx, proposal) + return res.ProposalId + }, + option: v1beta1.OptionYes, + voter: proposer, + metadata: "", + expErr: false, + }, + } + + legacyMsgSrvr := NewLegacyMsgServerImpl(govAcct.String(), govMsgSvr) + + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + pId := tc.preRun() + voteReq := v1beta1.NewMsgVote(tc.voter, pId, tc.option) + _, err := legacyMsgSrvr.Vote(ctx, voteReq) + proposal.Status = v1.StatusVotingPeriod + input.GovKeeper.SetProposal(ctx, proposal) + + if tc.expErr { + require.Error(t, err) + require.Contains(t, err.Error(), tc.expErrMsg) + } else { + require.NoError(t, err) + } + }) + } +} + +func TestLegacyVoteWeighted(t *testing.T) { + // Set up the necessary dependencies and context + input := CreateTestInput(t) + govKeeper := input.GovKeeper + ctx := input.Ctx + govAcct := authtypes.NewModuleAddress(types.ModuleName) + _, _, addr := testdata.KeyTestPubAddr() + proposer := addr + + coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 Default Bond Denom + input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) + FundAccount(input, addr, coins) + + proposal, err := input.GovKeeper.SubmitProposal(ctx, []sdk.Msg{}, "", "Test Proposal", "This is a test proposal", proposer) + + if err != nil { + t.Fatalf("preRun error: %v", err) + } + proposalID := proposal.Id + + proposal, ok := input.GovKeeper.GetProposal(ctx, proposal.Id) + require.True(t, ok) + + bankMsg := &banktypes.MsgSend{ + FromAddress: govAcct.String(), + ToAddress: proposer.String(), + Amount: coins, + } + + govMsgSvr := NewMsgServerImpl(input.GovKeeper) + + cases := map[string]struct { + preRun func() uint64 + vote *v1beta1.MsgVote + expErr bool + expErrMsg string + option v1beta1.VoteOption + metadata string + voter sdk.AccAddress + }{ + "vote on inactive proposal": { + preRun: func() uint64 { + msg, err := v1.NewMsgSubmitProposal( + []sdk.Msg{bankMsg}, + coins, + proposer.String(), + "", + "Proposal", + "description of proposal", + ) + require.NoError(t, err) + + res, err := govMsgSvr.SubmitProposal(ctx, msg) + require.NoError(t, err) + require.NotNil(t, res.ProposalId) + return res.ProposalId + }, + option: v1beta1.OptionYes, + voter: proposer, + metadata: "", + expErr: true, + expErrMsg: "inactive proposal", + }, + "voter error": { + preRun: func() uint64 { + return proposalID + }, + option: v1beta1.OptionYes, + voter: sdk.AccAddress(strings.Repeat("a", 300)), + metadata: "", + expErr: true, + expErrMsg: "address max length is 255", + }, + "all good": { + preRun: func() uint64 { + msg, err := v1.NewMsgSubmitProposal( + []sdk.Msg{bankMsg}, + coins, + proposer.String(), + "", + "Proposal", + "description of proposal", + ) + require.NoError(t, err) + + res, err := govMsgSvr.SubmitProposal(ctx, msg) + require.NoError(t, err) + require.NotNil(t, res.ProposalId) + // set proposal to status activedVoting + proposal, ok := govKeeper.GetProposal(ctx, res.ProposalId) + require.True(t, ok) + proposal.Status = v1.StatusVotingPeriod + govKeeper.SetProposal(ctx, proposal) + return res.ProposalId + }, + option: v1beta1.OptionYes, + voter: proposer, + metadata: "", + expErr: false, + }, + } + + legacyMsgSrvr := NewLegacyMsgServerImpl(govAcct.String(), govMsgSvr) + + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + pId := tc.preRun() + + voteReq := v1beta1.NewMsgVoteWeighted(tc.voter, pId, v1beta1.NewNonSplitVoteOption(v1beta1.VoteOption(tc.option))) + proposal.Status = v1.StatusVotingPeriod + input.GovKeeper.SetProposal(ctx, proposal) + _, err := legacyMsgSrvr.VoteWeighted(ctx, voteReq) + FundAccount(input, addr, coins) + + if tc.expErr { + require.Error(t, err) + require.Contains(t, err.Error(), tc.expErrMsg) + } else { + require.NoError(t, err) + } + }) + } +} + +func TestLegacyMsgDeposit(t *testing.T) { + // Set up the necessary dependencies and context + input := CreateTestInput(t) + ctx := input.Ctx + govAcct := authtypes.NewModuleAddress(types.ModuleName) + _, _, addr := testdata.KeyTestPubAddr() + proposer := addr + coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 Default Bond Denom + input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) + FundAccount(input, addr, coins) + + govMsgSvr := NewMsgServerImpl(input.GovKeeper) + proposal, err := input.GovKeeper.SubmitProposal(ctx, []sdk.Msg{}, "", "Test Proposal", "This is a test proposal", proposer) + require.NoError(t, err) + proposalID := proposal.Id + + cases := map[string]struct { + preRun func() uint64 + expErr bool + proposalId uint64 + depositor sdk.AccAddress + deposit sdk.Coins + options v1beta1.WeightedVoteOptions + }{ + "wrong proposal id": { + preRun: func() uint64 { + return 0 + }, + depositor: proposer, + deposit: coins, + expErr: true, + options: v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes), + }, + "all good": { + preRun: func() uint64 { + return proposalID + }, + depositor: proposer, + deposit: coins, + expErr: false, + options: v1beta1.NewNonSplitVoteOption(v1beta1.OptionYes), + }, + } + + legacyMsgSrvr := NewLegacyMsgServerImpl(govAcct.String(), govMsgSvr) + + for name, tc := range cases { + t.Run(name, func(t *testing.T) { + proposalId := tc.preRun() + depositReq := v1beta1.NewMsgDeposit(tc.depositor, proposalId, tc.deposit) + _, err := legacyMsgSrvr.Deposit(ctx, depositReq) + if tc.expErr { + require.Error(t, err) + } else { + require.NoError(t, err) + } + }) + } +} From fa06f7e556ac801580c9c6c404cc56189e5d8e38 Mon Sep 17 00:00:00 2001 From: duonghb53 Date: Sat, 19 Oct 2024 16:07:22 +0700 Subject: [PATCH 33/60] add min uusd to genesis and debug error --- app/keepers/keepers.go | 3 +++ custom/gov/genesis.go | 2 ++ custom/gov/keeper/test_utils.go | 2 ++ scripts/run-node.sh | 1 + 4 files changed, 8 insertions(+) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 2155df89..40b7aa9a 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -1,6 +1,7 @@ package keepers import ( + "fmt" "path/filepath" ibchooks "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7" @@ -204,6 +205,8 @@ func NewAppKeepers( sdk.GetConfig().GetBech32AccountAddrPrefix(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) + fmt.Printf("sdk.GetConfig().GetBech32AccountAddrPrefix(): %v\n", sdk.GetConfig()) + fmt.Printf("authtypes.NewModuleAddress(govtypes.ModuleName).String(): %v\n", authtypes.NewModuleAddress(govtypes.ModuleName).String()) appKeepers.BankKeeper = bankkeeper.NewBaseKeeper( appCodec, appKeepers.keys[banktypes.StoreKey], diff --git a/custom/gov/genesis.go b/custom/gov/genesis.go index e0f5d1ca..4fd36be3 100644 --- a/custom/gov/genesis.go +++ b/custom/gov/genesis.go @@ -22,6 +22,8 @@ func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, k panic(fmt.Sprintf("%s module account has not been set", types.ModuleName)) } + fmt.Printf("module account: %v\n", moduleAcc) + var totalDeposits sdk.Coins for _, deposit := range data.Deposits { k.SetDeposit(ctx, *deposit) diff --git a/custom/gov/keeper/test_utils.go b/custom/gov/keeper/test_utils.go index 9fea5d15..88238da6 100644 --- a/custom/gov/keeper/test_utils.go +++ b/custom/gov/keeper/test_utils.go @@ -4,6 +4,7 @@ package keeper //DONTCOVER import ( + "fmt" "testing" "time" @@ -197,6 +198,7 @@ func CreateTestInput(t *testing.T) TestInput { govtypes.ModuleName: {authtypes.Burner, authtypes.Minter}, } + fmt.Printf("sdk.GetConfig().GetBech32AccountAddrPrefix(): %v\n", sdk.GetConfig()) paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, keyParams, tKeyParams) accountKeeper := authkeeper.NewAccountKeeper(appCodec, keyAcc, authtypes.ProtoBaseAccount, maccPerms, sdk.GetConfig().GetBech32AccountAddrPrefix(), authtypes.NewModuleAddress(govtypes.ModuleName).String()) bankKeeper := bankkeeper.NewBaseKeeper(appCodec, keyBank, accountKeeper, blackListAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) diff --git a/scripts/run-node.sh b/scripts/run-node.sh index 30243cac..6a4106c9 100755 --- a/scripts/run-node.sh +++ b/scripts/run-node.sh @@ -63,6 +63,7 @@ $BINARY add-genesis-account $KEY2 "1000000000000${DENOM}" --keyring-backend $KEY update_test_genesis '.app_state["mint"]["params"]["mint_denom"]="'$DENOM'"' update_test_genesis '.app_state["gov"]["deposit_params"]["min_deposit"]=[{"denom":"'$DENOM'","amount": "1000000"}]' +update_test_genesis '.app_state["gov"]["params"]["min_uusd_deposit"]=[{"denom":"uusd","amount": "500000000"}]' update_test_genesis '.app_state["crisis"]["constant_fee"]={"denom":"'$DENOM'","amount":"1000"}' update_test_genesis '.app_state["staking"]["params"]["bond_denom"]="'$DENOM'"' From 5240f63dc14a0aa95ce4ff0cfa0ddee70266bf9d Mon Sep 17 00:00:00 2001 From: duonghb53 Date: Sun, 20 Oct 2024 10:25:31 +0700 Subject: [PATCH 34/60] fix bug and run chain ok --- custom/gov/client/cli/query.go | 6 +-- custom/gov/keeper/deposit_test.go | 18 ++++++++- custom/gov/keeper/msg_server_test.go | 26 +++++++++---- custom/gov/keeper/proposal_test.go | 57 ++++++++++++++++++++++++++-- custom/gov/keeper/test_utils.go | 20 ---------- custom/gov/module.go | 2 +- scripts/run-node.sh | 1 - 7 files changed, 92 insertions(+), 38 deletions(-) diff --git a/custom/gov/client/cli/query.go b/custom/gov/client/cli/query.go index fc5aaccd..fe2619f8 100644 --- a/custom/gov/client/cli/query.go +++ b/custom/gov/client/cli/query.go @@ -46,15 +46,15 @@ func GetQueryCmd() *cobra.Command { // GetCmdQueryMinimalDeposit implements the query proposal command. func GetCmdQueryMinimalDeposit() *cobra.Command { cmd := &cobra.Command{ - Use: "proposal [proposal-id] get-minimal-deposit", + Use: "get-minimal-deposit [proposal-id]", Args: cobra.ExactArgs(1), - Short: "Query minimal deposit of a single proposal", + Short: "Query minimal deposit by min uusd of a single proposal", Long: strings.TrimSpace( fmt.Sprintf(`Query minimal deposit for a proposal. You can find the proposal-id by running "%s query gov proposals". Example: -$ %s query gov proposal 1 +$ %s query gov get-minimal-deposit 1 `, version.AppName, version.AppName, ), diff --git a/custom/gov/keeper/deposit_test.go b/custom/gov/keeper/deposit_test.go index 3129f4d7..d072d724 100644 --- a/custom/gov/keeper/deposit_test.go +++ b/custom/gov/keeper/deposit_test.go @@ -9,6 +9,11 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/cosmos-sdk/x/gov/types" + v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) const ( @@ -37,7 +42,18 @@ func TestAddDeposits(t *testing.T) { addr1Initial := bankKeeper.GetAllBalances(ctx, addr1) addr2Initial := bankKeeper.GetAllBalances(ctx, addr2) - tp := TestProposal + govAcct := authtypes.NewModuleAddress(types.ModuleName) + _, _, addr := testdata.KeyTestPubAddr() + + legacyProposalMsg, err := v1.NewLegacyContent(v1beta1.NewTextProposal("Title", "description"), authtypes.NewModuleAddress(types.ModuleName).String()) + if err != nil { + panic(err) + } + + tp := []sdk.Msg{ + banktypes.NewMsgSend(govAcct, addr, sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(1000)))), + legacyProposalMsg, + } proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "title", "description", addr1) require.NoError(t, err) proposalID := proposal.Id diff --git a/custom/gov/keeper/msg_server_test.go b/custom/gov/keeper/msg_server_test.go index 62e90ac1..f032f6b6 100644 --- a/custom/gov/keeper/msg_server_test.go +++ b/custom/gov/keeper/msg_server_test.go @@ -31,7 +31,7 @@ func TestSubmitProposalReq(t *testing.T) { input := CreateTestInput(t) ctx := input.Ctx govAcct := authtypes.NewModuleAddress(types.ModuleName) - _, _, addr = testdata.KeyTestPubAddr() + _, _, addr := testdata.KeyTestPubAddr() proposer := addr govMsgSvr := NewMsgServerImpl(input.GovKeeper) coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 Default Bond Denom @@ -166,7 +166,7 @@ func TestVoteReq(t *testing.T) { govKeeper := input.GovKeeper ctx := input.Ctx govAcct := authtypes.NewModuleAddress(types.ModuleName) - _, _, addr = testdata.KeyTestPubAddr() + _, _, addr := testdata.KeyTestPubAddr() proposer := addr govMsgSvr := NewMsgServerImpl(input.GovKeeper) coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 Default Bond Denom @@ -313,7 +313,7 @@ func TestVoteWeightedReq(t *testing.T) { govKeeper := input.GovKeeper ctx := input.Ctx govAcct := authtypes.NewModuleAddress(types.ModuleName) - _, _, addr = testdata.KeyTestPubAddr() + _, _, addr := testdata.KeyTestPubAddr() proposer := addr govMsgSvr := NewMsgServerImpl(input.GovKeeper) coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 Default Bond Denom @@ -456,7 +456,7 @@ func TestDepositReq(t *testing.T) { input := CreateTestInput(t) ctx := input.Ctx govAcct := authtypes.NewModuleAddress(types.ModuleName) - _, _, addr = testdata.KeyTestPubAddr() + _, _, addr := testdata.KeyTestPubAddr() proposer := addr coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 Default Bond Denom @@ -822,7 +822,7 @@ func TestSubmitProposal_InitialDeposit(t *testing.T) { ctx := input.Ctx govKeeper := input.GovKeeper input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.NewDecWithPrec(2, 1)) - _, _, address := testdata.KeyTestPubAddr() + _, _, addr := testdata.KeyTestPubAddr() // setup desposit value when test const meetsDepositValue = baseDepositTestAmount * baseDepositTestPercent / 100 @@ -868,10 +868,20 @@ func TestSubmitProposal_InitialDeposit(t *testing.T) { }, } + govAcct := authtypes.NewModuleAddress(types.ModuleName) + legacyProposalMsg, err := v1.NewLegacyContent(v1beta1.NewTextProposal("Title", "description"), authtypes.NewModuleAddress(types.ModuleName).String()) + if err != nil { + panic(err) + } + + msgs := []sdk.Msg{ + banktypes.NewMsgSend(govAcct, addr, sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(1000)))), + legacyProposalMsg, + } for name, tc := range testcases { t.Run(name, func(t *testing.T) { // Fund the proposer's account - FundAccount(input, address, tc.minDeposit) + FundAccount(input, addr, tc.minDeposit) govMsgSvr := NewMsgServerImpl(input.GovKeeper) params := v2lunc1types.DefaultParams() @@ -879,7 +889,7 @@ func TestSubmitProposal_InitialDeposit(t *testing.T) { params.MinInitialDepositRatio = tc.minInitialDepositRatio.String() govKeeper.SetParams(ctx, params) - msg, err := v1.NewMsgSubmitProposal(TestProposal, tc.initialDeposit, address.String(), "test", "Proposal", "description of proposal") + msg, err := v1.NewMsgSubmitProposal(msgs, tc.initialDeposit, addr.String(), "test", "Proposal", "description of proposal") require.NoError(t, err) // System under test @@ -901,7 +911,7 @@ func TestLegacyMsgSubmitProposal(t *testing.T) { input := CreateTestInput(t) ctx := input.Ctx govAcct := authtypes.NewModuleAddress(types.ModuleName) - _, _, addr = testdata.KeyTestPubAddr() + _, _, addr := testdata.KeyTestPubAddr() proposer := addr coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 UUSD diff --git a/custom/gov/keeper/proposal_test.go b/custom/gov/keeper/proposal_test.go index 8a7fdc86..1bddb99f 100644 --- a/custom/gov/keeper/proposal_test.go +++ b/custom/gov/keeper/proposal_test.go @@ -13,6 +13,8 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/gov/types" v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" @@ -20,7 +22,18 @@ import ( func TestGetSetProposal(t *testing.T) { input := CreateTestInput(t) - tp := TestProposal + govAcct := authtypes.NewModuleAddress(types.ModuleName) + _, _, addr := testdata.KeyTestPubAddr() + + legacyProposalMsg, err := v1.NewLegacyContent(v1beta1.NewTextProposal("Title", "description"), authtypes.NewModuleAddress(types.ModuleName).String()) + if err != nil { + panic(err) + } + + tp := []sdk.Msg{ + banktypes.NewMsgSend(govAcct, addr, sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(1000)))), + legacyProposalMsg, + } govKeeper := input.GovKeeper oracleKeeper := input.OracleKeeper ctx := input.Ctx @@ -49,7 +62,19 @@ func TestGetSetProposal(t *testing.T) { func TestDeleteProposal(t *testing.T) { input := CreateTestInput(t) - tp := TestProposal + govAcct := authtypes.NewModuleAddress(types.ModuleName) + _, _, addr := testdata.KeyTestPubAddr() + + legacyProposalMsg, err := v1.NewLegacyContent(v1beta1.NewTextProposal("Title", "description"), authtypes.NewModuleAddress(types.ModuleName).String()) + if err != nil { + panic(err) + } + + tp := []sdk.Msg{ + banktypes.NewMsgSend(govAcct, addr, sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(1000)))), + legacyProposalMsg, + } + govKeeper := input.GovKeeper oracleKeeper := input.OracleKeeper ctx := input.Ctx @@ -73,7 +98,19 @@ func TestDeleteProposal(t *testing.T) { func TestActivateVotingPeriod(t *testing.T) { input := CreateTestInput(t) - tp := TestProposal + govAcct := authtypes.NewModuleAddress(types.ModuleName) + _, _, addr := testdata.KeyTestPubAddr() + + legacyProposalMsg, err := v1.NewLegacyContent(v1beta1.NewTextProposal("Title", "description"), authtypes.NewModuleAddress(types.ModuleName).String()) + if err != nil { + panic(err) + } + + tp := []sdk.Msg{ + banktypes.NewMsgSend(govAcct, addr, sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(1000)))), + legacyProposalMsg, + } + govKeeper := input.GovKeeper oracleKeeper := input.OracleKeeper ctx := input.Ctx @@ -110,7 +147,19 @@ func TestActivateVotingPeriod(t *testing.T) { func TestDeleteProposalInVotingPeriod(t *testing.T) { input := CreateTestInput(t) - tp := TestProposal + govAcct := authtypes.NewModuleAddress(types.ModuleName) + _, _, addr := testdata.KeyTestPubAddr() + + legacyProposalMsg, err := v1.NewLegacyContent(v1beta1.NewTextProposal("Title", "description"), authtypes.NewModuleAddress(types.ModuleName).String()) + if err != nil { + panic(err) + } + + tp := []sdk.Msg{ + banktypes.NewMsgSend(govAcct, addr, sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(1000)))), + legacyProposalMsg, + } + govKeeper := input.GovKeeper oracleKeeper := input.OracleKeeper ctx := input.Ctx diff --git a/custom/gov/keeper/test_utils.go b/custom/gov/keeper/test_utils.go index 88238da6..47147478 100644 --- a/custom/gov/keeper/test_utils.go +++ b/custom/gov/keeper/test_utils.go @@ -35,7 +35,6 @@ import ( "github.com/cosmos/cosmos-sdk/std" "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" - "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" @@ -70,25 +69,6 @@ func MakeTestCodec(t *testing.T) codec.Codec { return MakeEncodingConfig(t).Codec } -var ( - _, _, addr = testdata.KeyTestPubAddr() - govAcct = authtypes.NewModuleAddress(govtypes.ModuleName) - TestProposal = getTestProposal() -) - -// getTestProposal creates and returns a test proposal message. -func getTestProposal() []sdk.Msg { - legacyProposalMsg, err := v1.NewLegacyContent(v1beta1.NewTextProposal("Title", "description"), authtypes.NewModuleAddress(govtypes.ModuleName).String()) - if err != nil { - panic(err) - } - - return []sdk.Msg{ - banktypes.NewMsgSend(govAcct, addr, sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(1000)))), - legacyProposalMsg, - } -} - // MakeEncodingConfig func MakeEncodingConfig(_ *testing.T) simparams.EncodingConfig { amino := codec.NewLegacyAmino() diff --git a/custom/gov/module.go b/custom/gov/module.go index 3f85297d..0cd3c84b 100644 --- a/custom/gov/module.go +++ b/custom/gov/module.go @@ -91,7 +91,7 @@ func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) // module. func (am AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { // customize to set default genesis state deposit denom to uluna - defaultGenesisState := v1.DefaultGenesisState() + defaultGenesisState := v2lunc1.DefaultGenesisState() defaultGenesisState.Params.MinDeposit[0].Denom = core.MicroLunaDenom return cdc.MustMarshalJSON(defaultGenesisState) diff --git a/scripts/run-node.sh b/scripts/run-node.sh index 6a4106c9..30243cac 100755 --- a/scripts/run-node.sh +++ b/scripts/run-node.sh @@ -63,7 +63,6 @@ $BINARY add-genesis-account $KEY2 "1000000000000${DENOM}" --keyring-backend $KEY update_test_genesis '.app_state["mint"]["params"]["mint_denom"]="'$DENOM'"' update_test_genesis '.app_state["gov"]["deposit_params"]["min_deposit"]=[{"denom":"'$DENOM'","amount": "1000000"}]' -update_test_genesis '.app_state["gov"]["params"]["min_uusd_deposit"]=[{"denom":"uusd","amount": "500000000"}]' update_test_genesis '.app_state["crisis"]["constant_fee"]={"denom":"'$DENOM'","amount":"1000"}' update_test_genesis '.app_state["staking"]["params"]["bond_denom"]="'$DENOM'"' From 10bcfdc90918fbf28239d95f8844f91511258938 Mon Sep 17 00:00:00 2001 From: duonghb53 Date: Mon, 21 Oct 2024 09:17:30 +0700 Subject: [PATCH 35/60] remove log --- app/keepers/keepers.go | 3 --- custom/gov/keeper/test_utils.go | 2 -- 2 files changed, 5 deletions(-) diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index 40b7aa9a..2155df89 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -1,7 +1,6 @@ package keepers import ( - "fmt" "path/filepath" ibchooks "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7" @@ -205,8 +204,6 @@ func NewAppKeepers( sdk.GetConfig().GetBech32AccountAddrPrefix(), authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - fmt.Printf("sdk.GetConfig().GetBech32AccountAddrPrefix(): %v\n", sdk.GetConfig()) - fmt.Printf("authtypes.NewModuleAddress(govtypes.ModuleName).String(): %v\n", authtypes.NewModuleAddress(govtypes.ModuleName).String()) appKeepers.BankKeeper = bankkeeper.NewBaseKeeper( appCodec, appKeepers.keys[banktypes.StoreKey], diff --git a/custom/gov/keeper/test_utils.go b/custom/gov/keeper/test_utils.go index 47147478..d2b36596 100644 --- a/custom/gov/keeper/test_utils.go +++ b/custom/gov/keeper/test_utils.go @@ -4,7 +4,6 @@ package keeper //DONTCOVER import ( - "fmt" "testing" "time" @@ -178,7 +177,6 @@ func CreateTestInput(t *testing.T) TestInput { govtypes.ModuleName: {authtypes.Burner, authtypes.Minter}, } - fmt.Printf("sdk.GetConfig().GetBech32AccountAddrPrefix(): %v\n", sdk.GetConfig()) paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, keyParams, tKeyParams) accountKeeper := authkeeper.NewAccountKeeper(appCodec, keyAcc, authtypes.ProtoBaseAccount, maccPerms, sdk.GetConfig().GetBech32AccountAddrPrefix(), authtypes.NewModuleAddress(govtypes.ModuleName).String()) bankKeeper := bankkeeper.NewBaseKeeper(appCodec, keyBank, accountKeeper, blackListAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) From 3fa6092be7b288d7d2e6e9e992053113441cf898 Mon Sep 17 00:00:00 2001 From: duonghb53 Date: Fri, 25 Oct 2024 11:03:26 +0700 Subject: [PATCH 36/60] fix msg query server and test --- custom/auth/ante/min_initial_deposit.go | 9 +- custom/gov/client/cli/query.go | 36 +- custom/gov/genesis.go | 2 - custom/gov/keeper/deposit.go | 10 +- custom/gov/keeper/grpc_query.go | 59 +- custom/gov/keeper/msg_server_test.go | 2 +- custom/gov/keeper/proposal.go | 8 +- custom/gov/module.go | 9 +- custom/gov/types/v2lunc1/gov.pb.go | 3462 ++++++++++++++++++++-- custom/gov/types/v2lunc1/query.pb.go | 399 ++- custom/gov/types/v2lunc1/query.pb.gw.go | 67 +- proto/terra/gov/v2lunc1/gov.proto | 2 + proto/terra/gov/v2lunc1/query.proto | 17 +- scripts/gov_test/proposal.json | 13 + scripts/gov_test/test-submit-proposal.sh | 27 + scripts/set-uusd-price.sh | 14 + x/oracle/keeper/msg_server.go | 8 +- 17 files changed, 3780 insertions(+), 364 deletions(-) create mode 100644 scripts/gov_test/proposal.json create mode 100755 scripts/gov_test/test-submit-proposal.sh create mode 100755 scripts/set-uusd-price.sh diff --git a/custom/auth/ante/min_initial_deposit.go b/custom/auth/ante/min_initial_deposit.go index 545e5e95..9a97fb04 100644 --- a/custom/auth/ante/min_initial_deposit.go +++ b/custom/auth/ante/min_initial_deposit.go @@ -49,15 +49,14 @@ func HandleCheckMinInitialDeposit(ctx sdk.Context, msg sdk.Msg, govKeeper custom default: return fmt.Errorf("could not dereference msg as MsgSubmitProposal") } - requiredAmount, err := govKeeper.GetMinimumDepositBaseUusd(ctx) + minLuncAmount, err := govKeeper.GetMinimumDepositBaseUusd(ctx) - if err == nil && requiredAmount.GT(sdk.ZeroInt()) { + if err == nil && minLuncAmount.GT(sdk.ZeroInt()) { + minLuncAmount = minLuncAmount.Mul(treasuryKeeper.GetMinInitialDepositRatio(ctx).TruncateInt()) requiredDepositCoins := sdk.NewCoins( - sdk.NewCoin(core.MicroLunaDenom, requiredAmount), + sdk.NewCoin(core.MicroLunaDenom, minLuncAmount), ) - fmt.Printf("\n Expected %q; got %q", requiredDepositCoins, initialDepositCoins) - if initialDepositCoins.IsAllLT(requiredDepositCoins) { return fmt.Errorf("not enough initial deposit provided. Expected %q; got %q", requiredDepositCoins, initialDepositCoins) } diff --git a/custom/gov/client/cli/query.go b/custom/gov/client/cli/query.go index fe2619f8..08bc60f5 100644 --- a/custom/gov/client/cli/query.go +++ b/custom/gov/client/cli/query.go @@ -28,6 +28,7 @@ func GetQueryCmd() *cobra.Command { govQueryCmd.AddCommand( GetCmdQueryMinimalDeposit(), + GetCmdQueryCustomParams(), govcli.GetCmdQueryProposal(), govcli.GetCmdQueryProposals(), govcli.GetCmdQueryVote(), @@ -43,18 +44,18 @@ func GetQueryCmd() *cobra.Command { return govQueryCmd } -// GetCmdQueryMinimalDeposit implements the query proposal command. +// GetCmdQueryMinimalDeposit implements the query proposal's min uluna deposit command. func GetCmdQueryMinimalDeposit() *cobra.Command { cmd := &cobra.Command{ - Use: "get-minimal-deposit [proposal-id]", + Use: "min-deposit [proposal-id]", Args: cobra.ExactArgs(1), Short: "Query minimal deposit by min uusd of a single proposal", Long: strings.TrimSpace( fmt.Sprintf(`Query minimal deposit for a proposal. You can find the -proposal-id by running "%s query gov proposals". +proposal-id by running "%s query gov min-deposit [proposal-id]". Example: -$ %s query gov get-minimal-deposit 1 +$ %s query gov min-deposit 1 `, version.AppName, version.AppName, ), @@ -89,3 +90,30 @@ $ %s query gov get-minimal-deposit 1 return cmd } + +// GetCmdQueryCustomParams implements the query custom params command. +func GetCmdQueryCustomParams() *cobra.Command { + cmd := &cobra.Command{ + Use: "custom-params", + Args: cobra.NoArgs, + Short: "Query custom params of module", + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + queryClient := v2lunc1types.NewQueryClient(clientCtx) + // Query the proposal + res, err := queryClient.Params( + cmd.Context(), + &v2lunc1types.QueryParamsRequest{}, + ) + if err != nil { + return err + } + return clientCtx.PrintProto(&res.Params) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/custom/gov/genesis.go b/custom/gov/genesis.go index 4fd36be3..e0f5d1ca 100644 --- a/custom/gov/genesis.go +++ b/custom/gov/genesis.go @@ -22,8 +22,6 @@ func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, k panic(fmt.Sprintf("%s module account has not been set", types.ModuleName)) } - fmt.Printf("module account: %v\n", moduleAcc) - var totalDeposits sdk.Coins for _, deposit := range data.Deposits { k.SetDeposit(ctx, *deposit) diff --git a/custom/gov/keeper/deposit.go b/custom/gov/keeper/deposit.go index 3e9433cf..3a920fd3 100644 --- a/custom/gov/keeper/deposit.go +++ b/custom/gov/keeper/deposit.go @@ -3,6 +3,7 @@ package keeper import ( "fmt" + "cosmossdk.io/math" v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -39,8 +40,9 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd // HandleCheckLimitDeposit minDeposit := keeper.GetParams(ctx).MinDeposit - requiredAmount := keeper.GetDepositLimitBaseUusd(ctx, proposalID).TruncateInt() + requiredAmount := keeper.GetDepositLimitBaseUusd(ctx, proposalID) + // Should not set like this requiredDepositCoins := sdk.NewCoins( sdk.NewCoin(minDeposit[0].Denom, requiredAmount), ) @@ -106,16 +108,16 @@ func (keeper Keeper) validateInitialDeposit(ctx sdk.Context, initialDeposit sdk. } // GetDepositLimitBaseUUSD gets the deposit limit (Lunc) for a specific proposal -func (keeper Keeper) GetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64) (depositLimit sdk.Dec) { +func (keeper Keeper) GetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64) (depositLimit math.Int) { store := ctx.KVStore(keeper.storeKey) key := v2lunc1types.TotalDepositKey(proposalID) bz := store.Get(key) if bz == nil { - return sdk.ZeroDec() + return sdk.ZeroInt() } err := depositLimit.Unmarshal(bz) if err != nil { - return sdk.ZeroDec() + return sdk.ZeroInt() } return depositLimit diff --git a/custom/gov/keeper/grpc_query.go b/custom/gov/keeper/grpc_query.go index d2a83144..7597ca1b 100644 --- a/custom/gov/keeper/grpc_query.go +++ b/custom/gov/keeper/grpc_query.go @@ -1,39 +1,40 @@ package keeper import ( - "context" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" - sdk "github.com/cosmos/cosmos-sdk/types" - v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" - -) -var ( - _ v2lunc1types.QueryServer = queryServer{} + "context" + + v2lunc1 "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + core "github.com/classic-terra/core/v3/types" + sdk "github.com/cosmos/cosmos-sdk/types" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) -type queryServer struct{ k *Keeper } -func NewQueryServer(k *Keeper) v2lunc1types.QueryServer { - return queryServer{k: k} -} +var _ v2lunc1.QueryServer = queryServer{} -func (q queryServer) ProposalMinimalLUNCByUusd(ctx context.Context, req *v2lunc1types.QueryProposalRequest) (*v2lunc1types.QueryMinimalDepositProposalResponse, error) { - // Fetch the proposal using the proposal ID - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } +func NewQueryServerImpl(k Keeper) v2lunc1.QueryServer { + return queryServer{ + k: k, + govQueryServer: govkeeper.NewLegacyQueryServer(k.Keeper)} +} -if req.ProposalId == 0 { - return nil, status.Error(codes.InvalidArgument, "proposal id can not be 0") +type queryServer struct { + k Keeper + govQueryServer v1beta1.QueryServer } -_, found := q.k.GetProposal(ctx.(sdk.Context), req.ProposalId) -if !found { - return nil, status.Error(codes.NotFound, "proposal not found") + +// Params returns params of the mint module. +func (q queryServer) Params(ctx context.Context, _ *v2lunc1.QueryParamsRequest) (*v2lunc1.QueryParamsResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + params := q.k.GetParams(sdkCtx) + + return &v2lunc1.QueryParamsResponse{Params: params}, nil } -depositLimit := q.k.GetDepositLimitBaseUusd(ctx.(sdk.Context), req.ProposalId) -minimalDeposits := sdk.NewCoins(sdk.NewCoin("uusd", depositLimit.TruncateInt())) // Convert depositLimit to Int -return &v2lunc1types.QueryMinimalDepositProposalResponse{ - MinimalDeposit: minimalDeposits[0], -}, nil -} \ No newline at end of file +// ProposalMinimalLUNCByUusd returns min Usd amount proposal needs to deposit +func (q queryServer) ProposalMinimalLUNCByUusd(ctx context.Context, req *v2lunc1.QueryProposalRequest) (*v2lunc1.QueryMinimalDepositProposalResponse, error) { + sdkCtx := sdk.UnwrapSDKContext(ctx) + depositAmount := q.k.GetDepositLimitBaseUusd(sdkCtx, req.ProposalId) + + return &v2lunc1.QueryMinimalDepositProposalResponse{MinimalDeposit: sdk.NewCoin(core.MicroLunaDenom, depositAmount)}, nil +} diff --git a/custom/gov/keeper/msg_server_test.go b/custom/gov/keeper/msg_server_test.go index f032f6b6..638ef22a 100644 --- a/custom/gov/keeper/msg_server_test.go +++ b/custom/gov/keeper/msg_server_test.go @@ -194,7 +194,7 @@ func TestVoteReq(t *testing.T) { require.NoError(t, err) require.NotNil(t, res.ProposalId) proposalId := res.ProposalId - requiredAmount := govKeeper.GetDepositLimitBaseUusd(ctx, proposalId).TruncateInt() + requiredAmount := govKeeper.GetDepositLimitBaseUusd(ctx, proposalId) cases := map[string]struct { preRun func() uint64 diff --git a/custom/gov/keeper/proposal.go b/custom/gov/keeper/proposal.go index b4dccb1a..f88f2fb6 100644 --- a/custom/gov/keeper/proposal.go +++ b/custom/gov/keeper/proposal.go @@ -102,9 +102,9 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat return v1.Proposal{}, sdkerrors.Wrap(v2lunc1types.ErrQueryExchangeRateUusdFail, err.Error()) } - er := keeper.SetDepositLimitBaseUusd(ctx, proposalID, math.LegacyNewDecFromInt(totalLuncDeposit)) - if er != nil { - return v1.Proposal{}, sdkerrors.Wrap(v2lunc1types.ErrQueryExchangeRateUusdFail, er.Error()) + err = keeper.SetDepositLimitBaseUusd(ctx, proposalID, totalLuncDeposit) + if err != nil { + return v1.Proposal{}, sdkerrors.Wrap(v2lunc1types.ErrQueryExchangeRateUusdFail, err.Error()) } // called right after a proposal is submitted @@ -122,7 +122,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat } // SetDepositLimitBaseUusd sets a limit deposit(Lunc) base on Uusd to store. -func (keeper Keeper) SetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64, amount sdk.Dec) error { +func (keeper Keeper) SetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64, amount math.Int) error { store := ctx.KVStore(keeper.storeKey) key := v2lunc1types.TotalDepositKey(proposalID) bz, err := amount.Marshal() diff --git a/custom/gov/module.go b/custom/gov/module.go index 0cd3c84b..a0960124 100644 --- a/custom/gov/module.go +++ b/custom/gov/module.go @@ -33,7 +33,7 @@ import ( markettypes "github.com/classic-terra/core/v3/x/market/types" ) -const ConsensusVersion = 4 +const ConsensusVersion = 5 var _ module.AppModuleBasic = AppModuleBasic{} @@ -157,12 +157,13 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { v1beta1.RegisterMsgServer(cfg.MsgServer(), keeper.NewLegacyMsgServerImpl(am.accountKeeper.GetModuleAddress(govtypes.ModuleName).String(), msgServer)) v2lunc1.RegisterMsgServer(cfg.MsgServer(), msgServer) + queryServer := keeper.NewQueryServerImpl(am.keeper) + v2lunc1.RegisterQueryServer(cfg.QueryServer(), queryServer) + legacyQueryServer := govkeeper.NewLegacyQueryServer(am.keeper.Keeper) v1beta1.RegisterQueryServer(cfg.QueryServer(), legacyQueryServer) - // TODO: handle query - // v2lunc1.RegisterQueryServer(cfg.QueryServer(), am.keeper) + v1.RegisterQueryServer(cfg.QueryServer(), am.keeper.Keeper) - // TODO: migrator m := keeper.NewMigrator(&am.keeper, am.legacySubspace) err := cfg.RegisterMigration(govtypes.ModuleName, 1, m.Migrate1to2) if err != nil { diff --git a/custom/gov/types/v2lunc1/gov.pb.go b/custom/gov/types/v2lunc1/gov.pb.go index 39c5dcd0..3e30c841 100644 --- a/custom/gov/types/v2lunc1/gov.pb.go +++ b/custom/gov/types/v2lunc1/gov.pb.go @@ -6,6 +6,7 @@ package v2lunc1 import ( fmt "fmt" _ "github.com/cosmos/cosmos-proto" + types1 "github.com/cosmos/cosmos-sdk/codec/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" @@ -30,50 +31,115 @@ var _ = time.Kitchen // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// Params defines the parameters for the x/gov module. -// -// Since: cosmos-sdk 0.47 -type Params struct { - // Deprecated: min_deposit is deprecated and replaced by the min_uusd_deposit - // Minimum deposit for a proposal to enter voting period. - MinDeposit []types.Coin `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3" json:"min_deposit"` - // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 - // months. - MaxDepositPeriod *time.Duration `protobuf:"bytes,2,opt,name=max_deposit_period,json=maxDepositPeriod,proto3,stdduration" json:"max_deposit_period,omitempty"` - // Duration of the voting period. - VotingPeriod *time.Duration `protobuf:"bytes,3,opt,name=voting_period,json=votingPeriod,proto3,stdduration" json:"voting_period,omitempty"` - // Minimum percentage of total stake needed to vote for a result to be - // considered valid. - Quorum string `protobuf:"bytes,4,opt,name=quorum,proto3" json:"quorum,omitempty"` - // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. - Threshold string `protobuf:"bytes,5,opt,name=threshold,proto3" json:"threshold,omitempty"` - // Minimum value of Veto votes to Total votes ratio for proposal to be - // vetoed. Default value: 1/3. - VetoThreshold string `protobuf:"bytes,6,opt,name=veto_threshold,json=vetoThreshold,proto3" json:"veto_threshold,omitempty"` - // The ratio representing the proportion of the deposit value that must be paid at proposal submission. - MinInitialDepositRatio string `protobuf:"bytes,7,opt,name=min_initial_deposit_ratio,json=minInitialDepositRatio,proto3" json:"min_initial_deposit_ratio,omitempty"` - // burn deposits if a proposal does not meet quorum - BurnVoteQuorum bool `protobuf:"varint,13,opt,name=burn_vote_quorum,json=burnVoteQuorum,proto3" json:"burn_vote_quorum,omitempty"` - // burn deposits if the proposal does not enter voting period - BurnProposalDepositPrevote bool `protobuf:"varint,14,opt,name=burn_proposal_deposit_prevote,json=burnProposalDepositPrevote,proto3" json:"burn_proposal_deposit_prevote,omitempty"` - // burn deposits if quorum with vote type no_veto is met - BurnVoteVeto bool `protobuf:"varint,15,opt,name=burn_vote_veto,json=burnVoteVeto,proto3" json:"burn_vote_veto,omitempty"` - // Minimal uusd deposit for a proposal to enter voting period - MinUusdDeposit types.Coin `protobuf:"bytes,16,opt,name=min_uusd_deposit,json=minUusdDeposit,proto3" json:"min_uusd_deposit"` +// VoteOption enumerates the valid vote options for a given governance proposal. +type VoteOption int32 + +const ( + // VOTE_OPTION_UNSPECIFIED defines a no-op vote option. + VoteOption_VOTE_OPTION_UNSPECIFIED VoteOption = 0 + // VOTE_OPTION_YES defines a yes vote option. + VoteOption_VOTE_OPTION_YES VoteOption = 1 + // VOTE_OPTION_ABSTAIN defines an abstain vote option. + VoteOption_VOTE_OPTION_ABSTAIN VoteOption = 2 + // VOTE_OPTION_NO defines a no vote option. + VoteOption_VOTE_OPTION_NO VoteOption = 3 + // VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. + VoteOption_VOTE_OPTION_NO_WITH_VETO VoteOption = 4 +) + +var VoteOption_name = map[int32]string{ + 0: "VOTE_OPTION_UNSPECIFIED", + 1: "VOTE_OPTION_YES", + 2: "VOTE_OPTION_ABSTAIN", + 3: "VOTE_OPTION_NO", + 4: "VOTE_OPTION_NO_WITH_VETO", } -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { +var VoteOption_value = map[string]int32{ + "VOTE_OPTION_UNSPECIFIED": 0, + "VOTE_OPTION_YES": 1, + "VOTE_OPTION_ABSTAIN": 2, + "VOTE_OPTION_NO": 3, + "VOTE_OPTION_NO_WITH_VETO": 4, +} + +func (x VoteOption) String() string { + return proto.EnumName(VoteOption_name, int32(x)) +} + +func (VoteOption) EnumDescriptor() ([]byte, []int) { return fileDescriptor_ec6805a6cb6c4923, []int{0} } -func (m *Params) XXX_Unmarshal(b []byte) error { + +// ProposalStatus enumerates the valid statuses of a proposal. +type ProposalStatus int32 + +const ( + // PROPOSAL_STATUS_UNSPECIFIED defines the default proposal status. + ProposalStatus_PROPOSAL_STATUS_UNSPECIFIED ProposalStatus = 0 + // PROPOSAL_STATUS_DEPOSIT_PERIOD defines a proposal status during the deposit + // period. + ProposalStatus_PROPOSAL_STATUS_DEPOSIT_PERIOD ProposalStatus = 1 + // PROPOSAL_STATUS_VOTING_PERIOD defines a proposal status during the voting + // period. + ProposalStatus_PROPOSAL_STATUS_VOTING_PERIOD ProposalStatus = 2 + // PROPOSAL_STATUS_PASSED defines a proposal status of a proposal that has + // passed. + ProposalStatus_PROPOSAL_STATUS_PASSED ProposalStatus = 3 + // PROPOSAL_STATUS_REJECTED defines a proposal status of a proposal that has + // been rejected. + ProposalStatus_PROPOSAL_STATUS_REJECTED ProposalStatus = 4 + // PROPOSAL_STATUS_FAILED defines a proposal status of a proposal that has + // failed. + ProposalStatus_PROPOSAL_STATUS_FAILED ProposalStatus = 5 +) + +var ProposalStatus_name = map[int32]string{ + 0: "PROPOSAL_STATUS_UNSPECIFIED", + 1: "PROPOSAL_STATUS_DEPOSIT_PERIOD", + 2: "PROPOSAL_STATUS_VOTING_PERIOD", + 3: "PROPOSAL_STATUS_PASSED", + 4: "PROPOSAL_STATUS_REJECTED", + 5: "PROPOSAL_STATUS_FAILED", +} + +var ProposalStatus_value = map[string]int32{ + "PROPOSAL_STATUS_UNSPECIFIED": 0, + "PROPOSAL_STATUS_DEPOSIT_PERIOD": 1, + "PROPOSAL_STATUS_VOTING_PERIOD": 2, + "PROPOSAL_STATUS_PASSED": 3, + "PROPOSAL_STATUS_REJECTED": 4, + "PROPOSAL_STATUS_FAILED": 5, +} + +func (x ProposalStatus) String() string { + return proto.EnumName(ProposalStatus_name, int32(x)) +} + +func (ProposalStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{1} +} + +// WeightedVoteOption defines a unit of vote for vote split. +type WeightedVoteOption struct { + // option defines the valid vote options, it must not contain duplicate vote options. + Option VoteOption `protobuf:"varint,1,opt,name=option,proto3,enum=terra.gov.v2lunc1.VoteOption" json:"option,omitempty"` + // weight is the vote weight associated with the vote option. + Weight string `protobuf:"bytes,2,opt,name=weight,proto3" json:"weight,omitempty"` +} + +func (m *WeightedVoteOption) Reset() { *m = WeightedVoteOption{} } +func (m *WeightedVoteOption) String() string { return proto.CompactTextString(m) } +func (*WeightedVoteOption) ProtoMessage() {} +func (*WeightedVoteOption) Descriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{0} +} +func (m *WeightedVoteOption) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *WeightedVoteOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) + return xxx_messageInfo_WeightedVoteOption.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -83,332 +149,3180 @@ func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return b[:n], nil } } -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) +func (m *WeightedVoteOption) XXX_Merge(src proto.Message) { + xxx_messageInfo_WeightedVoteOption.Merge(m, src) } -func (m *Params) XXX_Size() int { +func (m *WeightedVoteOption) XXX_Size() int { return m.Size() } -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) +func (m *WeightedVoteOption) XXX_DiscardUnknown() { + xxx_messageInfo_WeightedVoteOption.DiscardUnknown(m) } -var xxx_messageInfo_Params proto.InternalMessageInfo +var xxx_messageInfo_WeightedVoteOption proto.InternalMessageInfo -func (m *Params) GetMinDeposit() []types.Coin { +func (m *WeightedVoteOption) GetOption() VoteOption { if m != nil { - return m.MinDeposit + return m.Option + } + return VoteOption_VOTE_OPTION_UNSPECIFIED +} + +func (m *WeightedVoteOption) GetWeight() string { + if m != nil { + return m.Weight + } + return "" +} + +// Deposit defines an amount deposited by an account address to an active +// proposal. +type Deposit struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + // depositor defines the deposit addresses from the proposals. + Depositor string `protobuf:"bytes,2,opt,name=depositor,proto3" json:"depositor,omitempty"` + // amount to be deposited by depositor. + Amount []types.Coin `protobuf:"bytes,3,rep,name=amount,proto3" json:"amount"` +} + +func (m *Deposit) Reset() { *m = Deposit{} } +func (m *Deposit) String() string { return proto.CompactTextString(m) } +func (*Deposit) ProtoMessage() {} +func (*Deposit) Descriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{1} +} +func (m *Deposit) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Deposit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Deposit.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Deposit) XXX_Merge(src proto.Message) { + xxx_messageInfo_Deposit.Merge(m, src) +} +func (m *Deposit) XXX_Size() int { + return m.Size() +} +func (m *Deposit) XXX_DiscardUnknown() { + xxx_messageInfo_Deposit.DiscardUnknown(m) +} + +var xxx_messageInfo_Deposit proto.InternalMessageInfo + +func (m *Deposit) GetProposalId() uint64 { + if m != nil { + return m.ProposalId + } + return 0 +} + +func (m *Deposit) GetDepositor() string { + if m != nil { + return m.Depositor + } + return "" +} + +func (m *Deposit) GetAmount() []types.Coin { + if m != nil { + return m.Amount } return nil } -func (m *Params) GetMaxDepositPeriod() *time.Duration { +// Proposal defines the core field members of a governance proposal. +type Proposal struct { + // id defines the unique id of the proposal. + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // messages are the arbitrary messages to be executed if the proposal passes. + Messages []*types1.Any `protobuf:"bytes,2,rep,name=messages,proto3" json:"messages,omitempty"` + // status defines the proposal status. + Status ProposalStatus `protobuf:"varint,3,opt,name=status,proto3,enum=terra.gov.v2lunc1.ProposalStatus" json:"status,omitempty"` + // final_tally_result is the final tally result of the proposal. When + // querying a proposal via gRPC, this field is not populated until the + // proposal's voting period has ended. + FinalTallyResult *TallyResult `protobuf:"bytes,4,opt,name=final_tally_result,json=finalTallyResult,proto3" json:"final_tally_result,omitempty"` + // submit_time is the time of proposal submission. + SubmitTime *time.Time `protobuf:"bytes,5,opt,name=submit_time,json=submitTime,proto3,stdtime" json:"submit_time,omitempty"` + // deposit_end_time is the end time for deposition. + DepositEndTime *time.Time `protobuf:"bytes,6,opt,name=deposit_end_time,json=depositEndTime,proto3,stdtime" json:"deposit_end_time,omitempty"` + // total_deposit is the total deposit on the proposal. + TotalDeposit []types.Coin `protobuf:"bytes,7,rep,name=total_deposit,json=totalDeposit,proto3" json:"total_deposit"` + // voting_start_time is the starting time to vote on a proposal. + VotingStartTime *time.Time `protobuf:"bytes,8,opt,name=voting_start_time,json=votingStartTime,proto3,stdtime" json:"voting_start_time,omitempty"` + // voting_end_time is the end time of voting on a proposal. + VotingEndTime *time.Time `protobuf:"bytes,9,opt,name=voting_end_time,json=votingEndTime,proto3,stdtime" json:"voting_end_time,omitempty"` + // metadata is any arbitrary metadata attached to the proposal. + // the recommended format of the metadata is to be found here: + // https://docs.cosmos.network/v0.47/modules/gov#proposal-3 + Metadata string `protobuf:"bytes,10,opt,name=metadata,proto3" json:"metadata,omitempty"` + // title is the title of the proposal + // + // Since: cosmos-sdk 0.47 + Title string `protobuf:"bytes,11,opt,name=title,proto3" json:"title,omitempty"` + // summary is a short summary of the proposal + // + // Since: cosmos-sdk 0.47 + Summary string `protobuf:"bytes,12,opt,name=summary,proto3" json:"summary,omitempty"` + // proposer is the address of the proposal sumbitter + // + // Since: cosmos-sdk 0.47 + Proposer string `protobuf:"bytes,13,opt,name=proposer,proto3" json:"proposer,omitempty"` + // expedited defines if the proposal is expedited + // + // Since: cosmos-sdk 0.50 + Expedited bool `protobuf:"varint,14,opt,name=expedited,proto3" json:"expedited,omitempty"` + // failed_reason defines the reason why the proposal failed + // + // Since: cosmos-sdk 0.50 + FailedReason string `protobuf:"bytes,15,opt,name=failed_reason,json=failedReason,proto3" json:"failed_reason,omitempty"` +} + +func (m *Proposal) Reset() { *m = Proposal{} } +func (m *Proposal) String() string { return proto.CompactTextString(m) } +func (*Proposal) ProtoMessage() {} +func (*Proposal) Descriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{2} +} +func (m *Proposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Proposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Proposal.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Proposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_Proposal.Merge(m, src) +} +func (m *Proposal) XXX_Size() int { + return m.Size() +} +func (m *Proposal) XXX_DiscardUnknown() { + xxx_messageInfo_Proposal.DiscardUnknown(m) +} + +var xxx_messageInfo_Proposal proto.InternalMessageInfo + +func (m *Proposal) GetId() uint64 { if m != nil { - return m.MaxDepositPeriod + return m.Id + } + return 0 +} + +func (m *Proposal) GetMessages() []*types1.Any { + if m != nil { + return m.Messages } return nil } -func (m *Params) GetVotingPeriod() *time.Duration { +func (m *Proposal) GetStatus() ProposalStatus { if m != nil { - return m.VotingPeriod + return m.Status + } + return ProposalStatus_PROPOSAL_STATUS_UNSPECIFIED +} + +func (m *Proposal) GetFinalTallyResult() *TallyResult { + if m != nil { + return m.FinalTallyResult } return nil } -func (m *Params) GetQuorum() string { +func (m *Proposal) GetSubmitTime() *time.Time { if m != nil { - return m.Quorum + return m.SubmitTime } - return "" + return nil } -func (m *Params) GetThreshold() string { +func (m *Proposal) GetDepositEndTime() *time.Time { if m != nil { - return m.Threshold + return m.DepositEndTime } - return "" + return nil } -func (m *Params) GetVetoThreshold() string { +func (m *Proposal) GetTotalDeposit() []types.Coin { if m != nil { - return m.VetoThreshold + return m.TotalDeposit + } + return nil +} + +func (m *Proposal) GetVotingStartTime() *time.Time { + if m != nil { + return m.VotingStartTime + } + return nil +} + +func (m *Proposal) GetVotingEndTime() *time.Time { + if m != nil { + return m.VotingEndTime + } + return nil +} + +func (m *Proposal) GetMetadata() string { + if m != nil { + return m.Metadata } return "" } -func (m *Params) GetMinInitialDepositRatio() string { +func (m *Proposal) GetTitle() string { if m != nil { - return m.MinInitialDepositRatio + return m.Title } return "" } -func (m *Params) GetBurnVoteQuorum() bool { +func (m *Proposal) GetSummary() string { if m != nil { - return m.BurnVoteQuorum + return m.Summary } - return false + return "" } -func (m *Params) GetBurnProposalDepositPrevote() bool { +func (m *Proposal) GetProposer() string { if m != nil { - return m.BurnProposalDepositPrevote + return m.Proposer } - return false + return "" } -func (m *Params) GetBurnVoteVeto() bool { +func (m *Proposal) GetExpedited() bool { if m != nil { - return m.BurnVoteVeto + return m.Expedited } return false } -func (m *Params) GetMinUusdDeposit() types.Coin { +func (m *Proposal) GetFailedReason() string { if m != nil { - return m.MinUusdDeposit + return m.FailedReason } - return types.Coin{} + return "" } -func init() { - proto.RegisterType((*Params)(nil), "terra.gov.v2lunc1.Params") +// TallyResult defines a standard tally for a governance proposal. +type TallyResult struct { + // yes_count is the number of yes votes on a proposal. + YesCount string `protobuf:"bytes,1,opt,name=yes_count,json=yesCount,proto3" json:"yes_count,omitempty"` + // abstain_count is the number of abstain votes on a proposal. + AbstainCount string `protobuf:"bytes,2,opt,name=abstain_count,json=abstainCount,proto3" json:"abstain_count,omitempty"` + // no_count is the number of no votes on a proposal. + NoCount string `protobuf:"bytes,3,opt,name=no_count,json=noCount,proto3" json:"no_count,omitempty"` + // no_with_veto_count is the number of no with veto votes on a proposal. + NoWithVetoCount string `protobuf:"bytes,4,opt,name=no_with_veto_count,json=noWithVetoCount,proto3" json:"no_with_veto_count,omitempty"` } -func init() { proto.RegisterFile("terra/gov/v2lunc1/gov.proto", fileDescriptor_ec6805a6cb6c4923) } +func (m *TallyResult) Reset() { *m = TallyResult{} } +func (m *TallyResult) String() string { return proto.CompactTextString(m) } +func (*TallyResult) ProtoMessage() {} +func (*TallyResult) Descriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{3} +} +func (m *TallyResult) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TallyResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TallyResult.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *TallyResult) XXX_Merge(src proto.Message) { + xxx_messageInfo_TallyResult.Merge(m, src) +} +func (m *TallyResult) XXX_Size() int { + return m.Size() +} +func (m *TallyResult) XXX_DiscardUnknown() { + xxx_messageInfo_TallyResult.DiscardUnknown(m) +} -var fileDescriptor_ec6805a6cb6c4923 = []byte{ - // 540 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0x63, 0xda, 0x06, 0x7a, 0x6d, 0x4d, 0x6a, 0x21, 0xe4, 0x06, 0xe1, 0x46, 0x08, 0xa1, - 0x08, 0x51, 0x9f, 0xd2, 0x8a, 0x81, 0x91, 0x10, 0x86, 0x0e, 0xa0, 0x10, 0xa0, 0x03, 0x8b, 0xe5, - 0x1f, 0x87, 0x73, 0x52, 0xce, 0xcf, 0xdc, 0x9d, 0xad, 0xf2, 0x5f, 0x30, 0xb2, 0xb1, 0x32, 0x32, - 0xf0, 0x47, 0x74, 0xac, 0x98, 0x98, 0x00, 0x25, 0x03, 0xff, 0x06, 0xba, 0x1f, 0x4e, 0x18, 0x32, - 0x74, 0xb1, 0xce, 0xef, 0x7d, 0x3f, 0xdf, 0xf7, 0xde, 0xfd, 0x40, 0x77, 0x24, 0xe1, 0x3c, 0xc6, - 0x39, 0xd4, 0xb8, 0x3e, 0x9e, 0x55, 0x45, 0x3a, 0x50, 0xeb, 0xb0, 0xe4, 0x20, 0xc1, 0xdb, 0xd7, - 0xc9, 0x50, 0x05, 0x6c, 0xb2, 0x1b, 0xa4, 0x20, 0x18, 0x08, 0x9c, 0xc4, 0x82, 0xe0, 0x7a, 0x90, - 0x10, 0x19, 0x0f, 0x70, 0x0a, 0xb4, 0x30, 0x48, 0xf7, 0x56, 0x0e, 0x39, 0xe8, 0x25, 0x56, 0x2b, - 0x1b, 0x0d, 0x72, 0x80, 0x7c, 0x46, 0xb0, 0xfe, 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91, 0xf2, 0x63, 0x49, 0x44, 0xf3, 0x2e, 0x93, 0xb6, 0xbe, 0x36, 0x27, 0xff, 0x02, - 0x00, 0x00, 0xff, 0xff, 0x30, 0xde, 0xf4, 0x37, 0xb3, 0x03, 0x00, 0x00, +var xxx_messageInfo_TallyResult proto.InternalMessageInfo + +func (m *TallyResult) GetYesCount() string { + if m != nil { + return m.YesCount + } + return "" } -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *TallyResult) GetAbstainCount() string { + if m != nil { + return m.AbstainCount } - return dAtA[:n], nil + return "" } -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *TallyResult) GetNoCount() string { + if m != nil { + return m.NoCount + } + return "" } -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.MinUusdDeposit.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) +func (m *TallyResult) GetNoWithVetoCount() string { + if m != nil { + return m.NoWithVetoCount } - i-- - dAtA[i] = 0x1 - i-- - dAtA[i] = 0x82 - if m.BurnVoteVeto { - i-- - if m.BurnVoteVeto { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + return "" +} + +// Vote defines a vote on a governance proposal. +// A Vote consists of a proposal ID, the voter, and the vote option. +type Vote struct { + // proposal_id defines the unique id of the proposal. + ProposalId uint64 `protobuf:"varint,1,opt,name=proposal_id,json=proposalId,proto3" json:"proposal_id,omitempty"` + // voter is the voter address of the proposal. + Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty"` + // options is the weighted vote options. + Options []*WeightedVoteOption `protobuf:"bytes,4,rep,name=options,proto3" json:"options,omitempty"` + // metadata is any arbitrary metadata attached to the vote. + // the recommended format of the metadata is to be found here: https://docs.cosmos.network/v0.47/modules/gov#vote-5 + Metadata string `protobuf:"bytes,5,opt,name=metadata,proto3" json:"metadata,omitempty"` +} + +func (m *Vote) Reset() { *m = Vote{} } +func (m *Vote) String() string { return proto.CompactTextString(m) } +func (*Vote) ProtoMessage() {} +func (*Vote) Descriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{4} +} +func (m *Vote) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Vote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Vote.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } - i-- - dAtA[i] = 0x78 + return b[:n], nil } - if m.BurnProposalDepositPrevote { - i-- - if m.BurnProposalDepositPrevote { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x70 - } - if m.BurnVoteQuorum { - i-- - if m.BurnVoteQuorum { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x68 - } - if len(m.MinInitialDepositRatio) > 0 { - i -= len(m.MinInitialDepositRatio) - copy(dAtA[i:], m.MinInitialDepositRatio) - i = encodeVarintGov(dAtA, i, uint64(len(m.MinInitialDepositRatio))) - i-- - dAtA[i] = 0x3a - } - if len(m.VetoThreshold) > 0 { - i -= len(m.VetoThreshold) - copy(dAtA[i:], m.VetoThreshold) - i = encodeVarintGov(dAtA, i, uint64(len(m.VetoThreshold))) - i-- - dAtA[i] = 0x32 - } - if len(m.Threshold) > 0 { - i -= len(m.Threshold) - copy(dAtA[i:], m.Threshold) - i = encodeVarintGov(dAtA, i, uint64(len(m.Threshold))) - i-- - dAtA[i] = 0x2a +} +func (m *Vote) XXX_Merge(src proto.Message) { + xxx_messageInfo_Vote.Merge(m, src) +} +func (m *Vote) XXX_Size() int { + return m.Size() +} +func (m *Vote) XXX_DiscardUnknown() { + xxx_messageInfo_Vote.DiscardUnknown(m) +} + +var xxx_messageInfo_Vote proto.InternalMessageInfo + +func (m *Vote) GetProposalId() uint64 { + if m != nil { + return m.ProposalId } - if len(m.Quorum) > 0 { - i -= len(m.Quorum) - copy(dAtA[i:], m.Quorum) - i = encodeVarintGov(dAtA, i, uint64(len(m.Quorum))) - i-- - dAtA[i] = 0x22 + return 0 +} + +func (m *Vote) GetVoter() string { + if m != nil { + return m.Voter } - if m.VotingPeriod != nil { - n2, err2 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) - if err2 != nil { - return 0, err2 - } - i -= n2 - i = encodeVarintGov(dAtA, i, uint64(n2)) - i-- - dAtA[i] = 0x1a + return "" +} + +func (m *Vote) GetOptions() []*WeightedVoteOption { + if m != nil { + return m.Options } - if m.MaxDepositPeriod != nil { - n3, err3 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) - if err3 != nil { - return 0, err3 - } - i -= n3 - i = encodeVarintGov(dAtA, i, uint64(n3)) - i-- - dAtA[i] = 0x12 + return nil +} + +func (m *Vote) GetMetadata() string { + if m != nil { + return m.Metadata } - if len(m.MinDeposit) > 0 { - for iNdEx := len(m.MinDeposit) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.MinDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGov(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + return "" +} + +// DepositParams defines the params for deposits on governance proposals. +// +// Deprecated: Do not use. +type DepositParams struct { + // Minimum deposit for a proposal to enter voting period. + MinDeposit []types.Coin `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3" json:"min_deposit,omitempty"` + // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + // months. + MaxDepositPeriod *time.Duration `protobuf:"bytes,2,opt,name=max_deposit_period,json=maxDepositPeriod,proto3,stdduration" json:"max_deposit_period,omitempty"` +} + +func (m *DepositParams) Reset() { *m = DepositParams{} } +func (m *DepositParams) String() string { return proto.CompactTextString(m) } +func (*DepositParams) ProtoMessage() {} +func (*DepositParams) Descriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{5} +} +func (m *DepositParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DepositParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_DepositParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - return len(dAtA) - i, nil +} +func (m *DepositParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_DepositParams.Merge(m, src) +} +func (m *DepositParams) XXX_Size() int { + return m.Size() +} +func (m *DepositParams) XXX_DiscardUnknown() { + xxx_messageInfo_DepositParams.DiscardUnknown(m) } -func encodeVarintGov(dAtA []byte, offset int, v uint64) int { - offset -= sovGov(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ +var xxx_messageInfo_DepositParams proto.InternalMessageInfo + +func (m *DepositParams) GetMinDeposit() []types.Coin { + if m != nil { + return m.MinDeposit } - dAtA[offset] = uint8(v) - return base + return nil } -func (m *Params) Size() (n int) { - if m == nil { - return 0 + +func (m *DepositParams) GetMaxDepositPeriod() *time.Duration { + if m != nil { + return m.MaxDepositPeriod } - var l int - _ = l - if len(m.MinDeposit) > 0 { - for _, e := range m.MinDeposit { - l = e.Size() - n += 1 + l + sovGov(uint64(l)) + return nil +} + +// VotingParams defines the params for voting on governance proposals. +// +// Deprecated: Do not use. +type VotingParams struct { + // Duration of the voting period. + VotingPeriod *time.Duration `protobuf:"bytes,1,opt,name=voting_period,json=votingPeriod,proto3,stdduration" json:"voting_period,omitempty"` +} + +func (m *VotingParams) Reset() { *m = VotingParams{} } +func (m *VotingParams) String() string { return proto.CompactTextString(m) } +func (*VotingParams) ProtoMessage() {} +func (*VotingParams) Descriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{6} +} +func (m *VotingParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *VotingParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_VotingParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err } + return b[:n], nil } - if m.MaxDepositPeriod != nil { - l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod) - n += 1 + l + sovGov(uint64(l)) - } - if m.VotingPeriod != nil { - l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod) - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.Quorum) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.Threshold) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.VetoThreshold) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) - } - l = len(m.MinInitialDepositRatio) - if l > 0 { - n += 1 + l + sovGov(uint64(l)) +} +func (m *VotingParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_VotingParams.Merge(m, src) +} +func (m *VotingParams) XXX_Size() int { + return m.Size() +} +func (m *VotingParams) XXX_DiscardUnknown() { + xxx_messageInfo_VotingParams.DiscardUnknown(m) +} + +var xxx_messageInfo_VotingParams proto.InternalMessageInfo + +func (m *VotingParams) GetVotingPeriod() *time.Duration { + if m != nil { + return m.VotingPeriod } - if m.BurnVoteQuorum { - n += 2 + return nil +} + +// TallyParams defines the params for tallying votes on governance proposals. +// +// Deprecated: Do not use. +type TallyParams struct { + // Minimum percentage of total stake needed to vote for a result to be + // considered valid. + Quorum string `protobuf:"bytes,1,opt,name=quorum,proto3" json:"quorum,omitempty"` + // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. + Threshold string `protobuf:"bytes,2,opt,name=threshold,proto3" json:"threshold,omitempty"` + // Minimum value of Veto votes to Total votes ratio for proposal to be + // vetoed. Default value: 1/3. + VetoThreshold string `protobuf:"bytes,3,opt,name=veto_threshold,json=vetoThreshold,proto3" json:"veto_threshold,omitempty"` +} + +func (m *TallyParams) Reset() { *m = TallyParams{} } +func (m *TallyParams) String() string { return proto.CompactTextString(m) } +func (*TallyParams) ProtoMessage() {} +func (*TallyParams) Descriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{7} +} +func (m *TallyParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *TallyParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_TallyParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - if m.BurnProposalDepositPrevote { - n += 2 +} +func (m *TallyParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_TallyParams.Merge(m, src) +} +func (m *TallyParams) XXX_Size() int { + return m.Size() +} +func (m *TallyParams) XXX_DiscardUnknown() { + xxx_messageInfo_TallyParams.DiscardUnknown(m) +} + +var xxx_messageInfo_TallyParams proto.InternalMessageInfo + +func (m *TallyParams) GetQuorum() string { + if m != nil { + return m.Quorum } - if m.BurnVoteVeto { - n += 2 + return "" +} + +func (m *TallyParams) GetThreshold() string { + if m != nil { + return m.Threshold } - l = m.MinUusdDeposit.Size() - n += 2 + l + sovGov(uint64(l)) - return n + return "" } -func sovGov(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 +func (m *TallyParams) GetVetoThreshold() string { + if m != nil { + return m.VetoThreshold + } + return "" } -func sozGov(x uint64) (n int) { - return sovGov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + +// Params defines the parameters for the x/gov module. +// +// Since: cosmos-sdk 0.47 +type Params struct { + // Deprecated: min_deposit is deprecated and replaced by the min_uusd_deposit + // Minimum deposit for a proposal to enter voting period. + MinDeposit []types.Coin `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3" json:"min_deposit"` + // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 + // months. + MaxDepositPeriod *time.Duration `protobuf:"bytes,2,opt,name=max_deposit_period,json=maxDepositPeriod,proto3,stdduration" json:"max_deposit_period,omitempty"` + // Duration of the voting period. + VotingPeriod *time.Duration `protobuf:"bytes,3,opt,name=voting_period,json=votingPeriod,proto3,stdduration" json:"voting_period,omitempty"` + // Minimum percentage of total stake needed to vote for a result to be + // considered valid. + Quorum string `protobuf:"bytes,4,opt,name=quorum,proto3" json:"quorum,omitempty"` + // Minimum proportion of Yes votes for proposal to pass. Default value: 0.5. + Threshold string `protobuf:"bytes,5,opt,name=threshold,proto3" json:"threshold,omitempty"` + // Minimum value of Veto votes to Total votes ratio for proposal to be + // vetoed. Default value: 1/3. + VetoThreshold string `protobuf:"bytes,6,opt,name=veto_threshold,json=vetoThreshold,proto3" json:"veto_threshold,omitempty"` + // The ratio representing the proportion of the deposit value that must be paid at proposal submission. + MinInitialDepositRatio string `protobuf:"bytes,7,opt,name=min_initial_deposit_ratio,json=minInitialDepositRatio,proto3" json:"min_initial_deposit_ratio,omitempty"` + // burn deposits if a proposal does not meet quorum + BurnVoteQuorum bool `protobuf:"varint,13,opt,name=burn_vote_quorum,json=burnVoteQuorum,proto3" json:"burn_vote_quorum,omitempty"` + // burn deposits if the proposal does not enter voting period + BurnProposalDepositPrevote bool `protobuf:"varint,14,opt,name=burn_proposal_deposit_prevote,json=burnProposalDepositPrevote,proto3" json:"burn_proposal_deposit_prevote,omitempty"` + // burn deposits if quorum with vote type no_veto is met + BurnVoteVeto bool `protobuf:"varint,15,opt,name=burn_vote_veto,json=burnVoteVeto,proto3" json:"burn_vote_veto,omitempty"` + // Minimal uusd deposit for a proposal to enter voting period + MinUusdDeposit types.Coin `protobuf:"bytes,16,opt,name=min_uusd_deposit,json=minUusdDeposit,proto3" json:"min_uusd_deposit"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_ec6805a6cb6c4923, []int{8} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetMinDeposit() []types.Coin { + if m != nil { + return m.MinDeposit + } + return nil +} + +func (m *Params) GetMaxDepositPeriod() *time.Duration { + if m != nil { + return m.MaxDepositPeriod + } + return nil +} + +func (m *Params) GetVotingPeriod() *time.Duration { + if m != nil { + return m.VotingPeriod + } + return nil +} + +func (m *Params) GetQuorum() string { + if m != nil { + return m.Quorum + } + return "" +} + +func (m *Params) GetThreshold() string { + if m != nil { + return m.Threshold + } + return "" +} + +func (m *Params) GetVetoThreshold() string { + if m != nil { + return m.VetoThreshold + } + return "" +} + +func (m *Params) GetMinInitialDepositRatio() string { + if m != nil { + return m.MinInitialDepositRatio + } + return "" +} + +func (m *Params) GetBurnVoteQuorum() bool { + if m != nil { + return m.BurnVoteQuorum + } + return false +} + +func (m *Params) GetBurnProposalDepositPrevote() bool { + if m != nil { + return m.BurnProposalDepositPrevote + } + return false +} + +func (m *Params) GetBurnVoteVeto() bool { + if m != nil { + return m.BurnVoteVeto + } + return false +} + +func (m *Params) GetMinUusdDeposit() types.Coin { + if m != nil { + return m.MinUusdDeposit + } + return types.Coin{} +} + +func init() { + proto.RegisterEnum("terra.gov.v2lunc1.VoteOption", VoteOption_name, VoteOption_value) + proto.RegisterEnum("terra.gov.v2lunc1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) + proto.RegisterType((*WeightedVoteOption)(nil), "terra.gov.v2lunc1.WeightedVoteOption") + proto.RegisterType((*Deposit)(nil), "terra.gov.v2lunc1.Deposit") + proto.RegisterType((*Proposal)(nil), "terra.gov.v2lunc1.Proposal") + proto.RegisterType((*TallyResult)(nil), "terra.gov.v2lunc1.TallyResult") + proto.RegisterType((*Vote)(nil), "terra.gov.v2lunc1.Vote") + proto.RegisterType((*DepositParams)(nil), "terra.gov.v2lunc1.DepositParams") + proto.RegisterType((*VotingParams)(nil), "terra.gov.v2lunc1.VotingParams") + proto.RegisterType((*TallyParams)(nil), "terra.gov.v2lunc1.TallyParams") + proto.RegisterType((*Params)(nil), "terra.gov.v2lunc1.Params") +} + +func init() { proto.RegisterFile("terra/gov/v2lunc1/gov.proto", fileDescriptor_ec6805a6cb6c4923) } + +var fileDescriptor_ec6805a6cb6c4923 = []byte{ + // 1369 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0x4f, 0x6f, 0x13, 0x47, + 0x1b, 0xcf, 0xda, 0x8e, 0xe3, 0x3c, 0x89, 0x9d, 0x65, 0xc8, 0x0b, 0x4b, 0x20, 0x4e, 0xf0, 0xcb, + 0x8b, 0xf2, 0x52, 0xb0, 0x4b, 0x28, 0x95, 0x68, 0x2b, 0x55, 0x4e, 0xbc, 0x94, 0x45, 0x69, 0xec, + 0xae, 0x4d, 0x28, 0xbd, 0xac, 0xc6, 0xde, 0xc1, 0x19, 0xc9, 0xbb, 0xe3, 0xee, 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x02, 0x52, 0x39, 0xb8, 0x51, 0xe9, 0x84, 0x5c, 0x30, 0x4f, 0x7e, 0xc3, 0x88, + 0x41, 0x9f, 0xf0, 0xe4, 0x4b, 0xa6, 0x9d, 0x95, 0x33, 0x79, 0xe3, 0x9f, 0x00, 0x00, 0x00, 0xff, + 0xff, 0x8f, 0x00, 0x63, 0xda, 0xe5, 0x0c, 0x00, 0x00, +} + +func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *WeightedVoteOption) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WeightedVoteOption) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Weight) > 0 { + i -= len(m.Weight) + copy(dAtA[i:], m.Weight) + i = encodeVarintGov(dAtA, i, uint64(len(m.Weight))) + i-- + dAtA[i] = 0x12 + } + if m.Option != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.Option)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Deposit) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Deposit) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Deposit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Amount) > 0 { + for iNdEx := len(m.Amount) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Amount[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + } + if len(m.Depositor) > 0 { + i -= len(m.Depositor) + copy(dAtA[i:], m.Depositor) + i = encodeVarintGov(dAtA, i, uint64(len(m.Depositor))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *Proposal) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Proposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FailedReason) > 0 { + i -= len(m.FailedReason) + copy(dAtA[i:], m.FailedReason) + i = encodeVarintGov(dAtA, i, uint64(len(m.FailedReason))) + i-- + dAtA[i] = 0x7a + } + if m.Expedited { + i-- + if m.Expedited { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x70 + } + if len(m.Proposer) > 0 { + i -= len(m.Proposer) + copy(dAtA[i:], m.Proposer) + i = encodeVarintGov(dAtA, i, uint64(len(m.Proposer))) + i-- + dAtA[i] = 0x6a + } + if len(m.Summary) > 0 { + i -= len(m.Summary) + copy(dAtA[i:], m.Summary) + i = encodeVarintGov(dAtA, i, uint64(len(m.Summary))) + i-- + dAtA[i] = 0x62 + } + if len(m.Title) > 0 { + i -= len(m.Title) + copy(dAtA[i:], m.Title) + i = encodeVarintGov(dAtA, i, uint64(len(m.Title))) + i-- + dAtA[i] = 0x5a + } + if len(m.Metadata) > 0 { + i -= len(m.Metadata) + copy(dAtA[i:], m.Metadata) + i = encodeVarintGov(dAtA, i, uint64(len(m.Metadata))) + i-- + dAtA[i] = 0x52 + } + if m.VotingEndTime != nil { + n1, err1 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.VotingEndTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.VotingEndTime):]) + if err1 != nil { + return 0, err1 + } + i -= n1 + i = encodeVarintGov(dAtA, i, uint64(n1)) + i-- + dAtA[i] = 0x4a + } + if m.VotingStartTime != nil { + n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.VotingStartTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.VotingStartTime):]) + if err2 != nil { + return 0, err2 + } + i -= n2 + i = encodeVarintGov(dAtA, i, uint64(n2)) + i-- + dAtA[i] = 0x42 + } + if len(m.TotalDeposit) > 0 { + for iNdEx := len(m.TotalDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.TotalDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + } + if m.DepositEndTime != nil { + n3, err3 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.DepositEndTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.DepositEndTime):]) + if err3 != nil { + return 0, err3 + } + i -= n3 + i = encodeVarintGov(dAtA, i, uint64(n3)) + i-- + dAtA[i] = 0x32 + } + if m.SubmitTime != nil { + n4, err4 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.SubmitTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.SubmitTime):]) + if err4 != nil { + return 0, err4 + } + i -= n4 + i = encodeVarintGov(dAtA, i, uint64(n4)) + i-- + dAtA[i] = 0x2a + } + if m.FinalTallyResult != nil { + { + size, err := m.FinalTallyResult.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + if m.Status != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x18 + } + if len(m.Messages) > 0 { + for iNdEx := len(m.Messages) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Messages[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Id != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *TallyResult) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TallyResult) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TallyResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.NoWithVetoCount) > 0 { + i -= len(m.NoWithVetoCount) + copy(dAtA[i:], m.NoWithVetoCount) + i = encodeVarintGov(dAtA, i, uint64(len(m.NoWithVetoCount))) + i-- + dAtA[i] = 0x22 + } + if len(m.NoCount) > 0 { + i -= len(m.NoCount) + copy(dAtA[i:], m.NoCount) + i = encodeVarintGov(dAtA, i, uint64(len(m.NoCount))) + i-- + dAtA[i] = 0x1a + } + if len(m.AbstainCount) > 0 { + i -= len(m.AbstainCount) + copy(dAtA[i:], m.AbstainCount) + i = encodeVarintGov(dAtA, i, uint64(len(m.AbstainCount))) + i-- + dAtA[i] = 0x12 + } + if len(m.YesCount) > 0 { + i -= len(m.YesCount) + copy(dAtA[i:], m.YesCount) + i = encodeVarintGov(dAtA, i, uint64(len(m.YesCount))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Vote) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Vote) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Metadata) > 0 { + i -= len(m.Metadata) + copy(dAtA[i:], m.Metadata) + i = encodeVarintGov(dAtA, i, uint64(len(m.Metadata))) + i-- + dAtA[i] = 0x2a + } + if len(m.Options) > 0 { + for iNdEx := len(m.Options) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Options[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } + } + if len(m.Voter) > 0 { + i -= len(m.Voter) + copy(dAtA[i:], m.Voter) + i = encodeVarintGov(dAtA, i, uint64(len(m.Voter))) + i-- + dAtA[i] = 0x12 + } + if m.ProposalId != 0 { + i = encodeVarintGov(dAtA, i, uint64(m.ProposalId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *DepositParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DepositParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DepositParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.MaxDepositPeriod != nil { + n6, err6 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) + if err6 != nil { + return 0, err6 + } + i -= n6 + i = encodeVarintGov(dAtA, i, uint64(n6)) + i-- + dAtA[i] = 0x12 + } + if len(m.MinDeposit) > 0 { + for iNdEx := len(m.MinDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MinDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *VotingParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *VotingParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VotingParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.VotingPeriod != nil { + n7, err7 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) + if err7 != nil { + return 0, err7 + } + i -= n7 + i = encodeVarintGov(dAtA, i, uint64(n7)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TallyParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TallyParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TallyParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.VetoThreshold) > 0 { + i -= len(m.VetoThreshold) + copy(dAtA[i:], m.VetoThreshold) + i = encodeVarintGov(dAtA, i, uint64(len(m.VetoThreshold))) + i-- + dAtA[i] = 0x1a + } + if len(m.Threshold) > 0 { + i -= len(m.Threshold) + copy(dAtA[i:], m.Threshold) + i = encodeVarintGov(dAtA, i, uint64(len(m.Threshold))) + i-- + dAtA[i] = 0x12 + } + if len(m.Quorum) > 0 { + i -= len(m.Quorum) + copy(dAtA[i:], m.Quorum) + i = encodeVarintGov(dAtA, i, uint64(len(m.Quorum))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.MinUusdDeposit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + if m.BurnVoteVeto { + i-- + if m.BurnVoteVeto { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x78 + } + if m.BurnProposalDepositPrevote { + i-- + if m.BurnProposalDepositPrevote { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x70 + } + if m.BurnVoteQuorum { + i-- + if m.BurnVoteQuorum { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x68 + } + if len(m.MinInitialDepositRatio) > 0 { + i -= len(m.MinInitialDepositRatio) + copy(dAtA[i:], m.MinInitialDepositRatio) + i = encodeVarintGov(dAtA, i, uint64(len(m.MinInitialDepositRatio))) + i-- + dAtA[i] = 0x3a + } + if len(m.VetoThreshold) > 0 { + i -= len(m.VetoThreshold) + copy(dAtA[i:], m.VetoThreshold) + i = encodeVarintGov(dAtA, i, uint64(len(m.VetoThreshold))) + i-- + dAtA[i] = 0x32 + } + if len(m.Threshold) > 0 { + i -= len(m.Threshold) + copy(dAtA[i:], m.Threshold) + i = encodeVarintGov(dAtA, i, uint64(len(m.Threshold))) + i-- + dAtA[i] = 0x2a + } + if len(m.Quorum) > 0 { + i -= len(m.Quorum) + copy(dAtA[i:], m.Quorum) + i = encodeVarintGov(dAtA, i, uint64(len(m.Quorum))) + i-- + dAtA[i] = 0x22 + } + if m.VotingPeriod != nil { + n9, err9 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VotingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod):]) + if err9 != nil { + return 0, err9 + } + i -= n9 + i = encodeVarintGov(dAtA, i, uint64(n9)) + i-- + dAtA[i] = 0x1a + } + if m.MaxDepositPeriod != nil { + n10, err10 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MaxDepositPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod):]) + if err10 != nil { + return 0, err10 + } + i -= n10 + i = encodeVarintGov(dAtA, i, uint64(n10)) + i-- + dAtA[i] = 0x12 + } + if len(m.MinDeposit) > 0 { + for iNdEx := len(m.MinDeposit) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.MinDeposit[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGov(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintGov(dAtA []byte, offset int, v uint64) int { + offset -= sovGov(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *WeightedVoteOption) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Option != 0 { + n += 1 + sovGov(uint64(m.Option)) + } + l = len(m.Weight) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *Deposit) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovGov(uint64(m.ProposalId)) + } + l = len(m.Depositor) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if len(m.Amount) > 0 { + for _, e := range m.Amount { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + return n +} + +func (m *Proposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovGov(uint64(m.Id)) + } + if len(m.Messages) > 0 { + for _, e := range m.Messages { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + if m.Status != 0 { + n += 1 + sovGov(uint64(m.Status)) + } + if m.FinalTallyResult != nil { + l = m.FinalTallyResult.Size() + n += 1 + l + sovGov(uint64(l)) + } + if m.SubmitTime != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.SubmitTime) + n += 1 + l + sovGov(uint64(l)) + } + if m.DepositEndTime != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.DepositEndTime) + n += 1 + l + sovGov(uint64(l)) + } + if len(m.TotalDeposit) > 0 { + for _, e := range m.TotalDeposit { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + if m.VotingStartTime != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.VotingStartTime) + n += 1 + l + sovGov(uint64(l)) + } + if m.VotingEndTime != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.VotingEndTime) + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Metadata) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Title) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Summary) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Proposer) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if m.Expedited { + n += 2 + } + l = len(m.FailedReason) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *TallyResult) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.YesCount) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.AbstainCount) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.NoCount) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.NoWithVetoCount) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *Vote) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ProposalId != 0 { + n += 1 + sovGov(uint64(m.ProposalId)) + } + l = len(m.Voter) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if len(m.Options) > 0 { + for _, e := range m.Options { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + l = len(m.Metadata) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *DepositParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.MinDeposit) > 0 { + for _, e := range m.MinDeposit { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + if m.MaxDepositPeriod != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod) + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *VotingParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.VotingPeriod != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod) + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *TallyParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Quorum) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Threshold) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.VetoThreshold) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + return n +} + +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.MinDeposit) > 0 { + for _, e := range m.MinDeposit { + l = e.Size() + n += 1 + l + sovGov(uint64(l)) + } + } + if m.MaxDepositPeriod != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MaxDepositPeriod) + n += 1 + l + sovGov(uint64(l)) + } + if m.VotingPeriod != nil { + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VotingPeriod) + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Quorum) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.Threshold) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.VetoThreshold) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + l = len(m.MinInitialDepositRatio) + if l > 0 { + n += 1 + l + sovGov(uint64(l)) + } + if m.BurnVoteQuorum { + n += 2 + } + if m.BurnProposalDepositPrevote { + n += 2 + } + if m.BurnVoteVeto { + n += 2 + } + l = m.MinUusdDeposit.Size() + n += 2 + l + sovGov(uint64(l)) + return n +} + +func sovGov(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGov(x uint64) (n int) { + return sovGov(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *WeightedVoteOption) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WeightedVoteOption: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WeightedVoteOption: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Option", wireType) + } + m.Option = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Option |= VoteOption(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Weight", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Weight = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Deposit) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Deposit: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Deposit: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Depositor", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Depositor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Amount = append(m.Amount, types.Coin{}) + if err := m.Amount[len(m.Amount)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Proposal) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Proposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Proposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Messages", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Messages = append(m.Messages, &types1.Any{}) + if err := m.Messages[len(m.Messages)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) + } + m.Status = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Status |= ProposalStatus(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FinalTallyResult", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.FinalTallyResult == nil { + m.FinalTallyResult = &TallyResult{} + } + if err := m.FinalTallyResult.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SubmitTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SubmitTime == nil { + m.SubmitTime = new(time.Time) + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.SubmitTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DepositEndTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.DepositEndTime == nil { + m.DepositEndTime = new(time.Time) + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.DepositEndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TotalDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.TotalDeposit = append(m.TotalDeposit, types.Coin{}) + if err := m.TotalDeposit[len(m.TotalDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingStartTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VotingStartTime == nil { + m.VotingStartTime = new(time.Time) + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.VotingStartTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingEndTime", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VotingEndTime == nil { + m.VotingEndTime = new(time.Time) + } + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.VotingEndTime, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 10: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Metadata = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Title = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Summary", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Summary = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 13: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Proposer", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Proposer = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Expedited", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Expedited = bool(v != 0) + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FailedReason", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FailedReason = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TallyResult) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TallyResult: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TallyResult: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field YesCount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.YesCount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AbstainCount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.AbstainCount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NoCount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NoCount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NoWithVetoCount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.NoWithVetoCount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Vote) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Vote: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Vote: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ProposalId", wireType) + } + m.ProposalId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ProposalId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Voter = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Options", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Options = append(m.Options, &WeightedVoteOption{}) + if err := m.Options[len(m.Options)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Metadata = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DepositParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DepositParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DepositParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MinDeposit", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.MinDeposit = append(m.MinDeposit, types.Coin{}) + if err := m.MinDeposit[len(m.MinDeposit)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MaxDepositPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.MaxDepositPeriod == nil { + m.MaxDepositPeriod = new(time.Duration) + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.MaxDepositPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *VotingParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: VotingParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: VotingParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingPeriod", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.VotingPeriod == nil { + m.VotingPeriod = new(time.Duration) + } + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.VotingPeriod, dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TallyParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TallyParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TallyParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Quorum", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Quorum = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Threshold", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Threshold = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field VetoThreshold", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGov + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGov + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGov + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.VetoThreshold = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGov(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGov + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil } func (m *Params) Unmarshal(dAtA []byte) error { l := len(dAtA) diff --git a/custom/gov/types/v2lunc1/query.pb.go b/custom/gov/types/v2lunc1/query.pb.go index aba94ff7..60fd6ba8 100644 --- a/custom/gov/types/v2lunc1/query.pb.go +++ b/custom/gov/types/v2lunc1/query.pb.go @@ -34,6 +34,89 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package +// QueryParams is the request type for the Query/Params RPC method. +type QueryParamsRequest struct { +} + +func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } +func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryParamsRequest) ProtoMessage() {} +func (*QueryParamsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_075d72aa1a1cda58, []int{0} +} +func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsRequest.Merge(m, src) +} +func (m *QueryParamsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo + +// QueryParamsResponse defines the response type for the Query/Params RPC method. +type QueryParamsResponse struct { + // params defines the parameters of the module. + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` +} + +func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } +func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryParamsResponse) ProtoMessage() {} +func (*QueryParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_075d72aa1a1cda58, []int{1} +} +func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryParamsResponse.Merge(m, src) +} +func (m *QueryParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo + +func (m *QueryParamsResponse) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + // QueryProposalRequest is the request type for the Query/Proposal RPC method. type QueryProposalRequest struct { // proposal_id defines the unique id of the proposal. @@ -44,7 +127,7 @@ func (m *QueryProposalRequest) Reset() { *m = QueryProposalRequest{} } func (m *QueryProposalRequest) String() string { return proto.CompactTextString(m) } func (*QueryProposalRequest) ProtoMessage() {} func (*QueryProposalRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_075d72aa1a1cda58, []int{0} + return fileDescriptor_075d72aa1a1cda58, []int{2} } func (m *QueryProposalRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -90,7 +173,7 @@ func (m *QueryMinimalDepositProposalResponse) Reset() { *m = QueryMinima func (m *QueryMinimalDepositProposalResponse) String() string { return proto.CompactTextString(m) } func (*QueryMinimalDepositProposalResponse) ProtoMessage() {} func (*QueryMinimalDepositProposalResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_075d72aa1a1cda58, []int{1} + return fileDescriptor_075d72aa1a1cda58, []int{3} } func (m *QueryMinimalDepositProposalResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -127,6 +210,8 @@ func (m *QueryMinimalDepositProposalResponse) GetMinimalDeposit() types.Coin { } func init() { + proto.RegisterType((*QueryParamsRequest)(nil), "terra.gov.v2lunc1.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "terra.gov.v2lunc1.QueryParamsResponse") proto.RegisterType((*QueryProposalRequest)(nil), "terra.gov.v2lunc1.QueryProposalRequest") proto.RegisterType((*QueryMinimalDepositProposalResponse)(nil), "terra.gov.v2lunc1.QueryMinimalDepositProposalResponse") } @@ -134,35 +219,40 @@ func init() { func init() { proto.RegisterFile("terra/gov/v2lunc1/query.proto", fileDescriptor_075d72aa1a1cda58) } var fileDescriptor_075d72aa1a1cda58 = []byte{ - // 447 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0xcd, 0x8a, 0x13, 0x41, - 0x10, 0xce, 0x88, 0x0a, 0xce, 0x82, 0xb2, 0xc3, 0x1e, 0x4c, 0xd0, 0x89, 0xc4, 0x83, 0x22, 0x6c, - 0x17, 0xc9, 0x82, 0xcb, 0x9e, 0x84, 0xac, 0x17, 0xc1, 0x15, 0x8d, 0xec, 0xc5, 0x4b, 0xe8, 0x99, - 0x69, 0xc7, 0x86, 0xe9, 0xae, 0xd9, 0xa9, 0xee, 0x81, 0x20, 0x5e, 0x7c, 0x02, 0xc1, 0x97, 0xf0, - 0xe8, 0x0b, 0x78, 0x76, 0x8f, 0x0b, 0x5e, 0x3c, 0x89, 0x24, 0x82, 0xaf, 0x21, 0xe9, 0xee, 0x41, - 0x8d, 0x3f, 0x97, 0xa6, 0xbb, 0xbe, 0xaf, 0xaa, 0xbe, 0xfa, 0xba, 0xe2, 0xeb, 0x46, 0x34, 0x0d, - 0x87, 0x12, 0x5b, 0x68, 0x27, 0x95, 0xd5, 0xf9, 0x18, 0x4e, 0xac, 0x68, 0x16, 0xac, 0x6e, 0xd0, - 0x60, 0xb2, 0xed, 0x60, 0x56, 0x62, 0xcb, 0x02, 0x3c, 0x48, 0x73, 0x24, 0x85, 0x04, 0x19, 0x27, - 0x01, 0xed, 0x38, 0x13, 0x86, 0x8f, 0x21, 0x47, 0xa9, 0x7d, 0xca, 0x60, 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0x38, 0x5d, 0x1c, 0x5b, 0x2a, 0x92, 0x5b, 0xec, 0x8f, 0x8f, 0x64, 0x7f, 0x9b, 0x73, - 0x70, 0xf7, 0x5f, 0xc4, 0xff, 0xcf, 0x35, 0xba, 0xf7, 0xfa, 0xd3, 0xb7, 0xb7, 0xe7, 0x0e, 0x92, - 0xfd, 0xe0, 0xb0, 0xdf, 0xa8, 0x31, 0x74, 0x0e, 0x11, 0x04, 0xe5, 0xbb, 0x61, 0x6c, 0x82, 0x97, - 0xbf, 0x18, 0xfa, 0x6a, 0xfa, 0xf4, 0x74, 0x99, 0x46, 0x67, 0xcb, 0x34, 0xfa, 0xba, 0x4c, 0xa3, - 0x37, 0xab, 0xb4, 0x77, 0xb6, 0x4a, 0x7b, 0x9f, 0x57, 0x69, 0xef, 0xd9, 0x41, 0x29, 0xcd, 0x0b, - 0x9b, 0xb1, 0x1c, 0x15, 0xe4, 0x15, 0x27, 0x92, 0xf9, 0xae, 0xdf, 0xda, 0x1c, 0x1b, 0x01, 0xed, - 0x1e, 0xe4, 0x96, 0x0c, 0x2a, 0xd7, 0xd2, 0x2c, 0x6a, 0x41, 0xdd, 0x2a, 0x67, 0x17, 0xdd, 0xa7, - 0xee, 0xfd, 0x08, 0x00, 0x00, 0xff, 0xff, 0x87, 0x87, 0x74, 0x01, 0xe6, 0x02, 0x00, 0x00, + // 518 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0x4f, 0x6b, 0x14, 0x31, + 0x14, 0xdf, 0x29, 0x75, 0xc1, 0x14, 0x94, 0xc6, 0x3d, 0xb8, 0x63, 0x9d, 0x95, 0x11, 0xff, 0x20, + 0x74, 0xc2, 0x6e, 0xc1, 0x22, 0x88, 0x87, 0x6d, 0x2f, 0x82, 0x2d, 0xba, 0xd2, 0x8b, 0x97, 0x25, + 0x33, 0x13, 0xc7, 0xc0, 0x24, 0x6f, 0x3a, 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, 0xa9, 0xe1, 0xae, 0x91, 0xf8, 0x04, 0x3f, 0x3e, 0x53, 0xa2, 0x63, 0x2b, 0xe2, 0xbc, + 0xdb, 0x74, 0xc6, 0x2b, 0x72, 0xf4, 0xcf, 0x4a, 0xdf, 0x0e, 0x5f, 0x1e, 0x4f, 0x03, 0xef, 0x64, + 0x1a, 0x78, 0x3f, 0xa6, 0x81, 0xf7, 0x7e, 0x16, 0xb4, 0x4e, 0x66, 0x41, 0xeb, 0xdb, 0x2c, 0x68, + 0xbd, 0x7a, 0x94, 0x71, 0xfd, 0xa6, 0x8a, 0xa3, 0x04, 0x04, 0x49, 0x72, 0xaa, 0x14, 0x4f, 0x36, + 0xed, 0xef, 0x4d, 0xa0, 0x64, 0xa4, 0xde, 0x22, 0x49, 0xa5, 0x34, 0x08, 0xd3, 0x57, 0x4f, 0x0a, + 0xa6, 0xe6, 0xdd, 0xe3, 0xb6, 0xf9, 0xbc, 0x5b, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x73, 0x01, + 0x93, 0xde, 0xeb, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -177,6 +267,8 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { + // Params queries the parameters for custom gov module + Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // Proposal queries proposal details based on ProposalID. ProposalMinimalLUNCByUusd(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryMinimalDepositProposalResponse, error) } @@ -189,6 +281,15 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Query/Params", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *queryClient) ProposalMinimalLUNCByUusd(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryMinimalDepositProposalResponse, error) { out := new(QueryMinimalDepositProposalResponse) err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Query/ProposalMinimalLUNCByUusd", in, out, opts...) @@ -200,6 +301,8 @@ func (c *queryClient) ProposalMinimalLUNCByUusd(ctx context.Context, in *QueryPr // QueryServer is the server API for Query service. type QueryServer interface { + // Params queries the parameters for custom gov module + Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // Proposal queries proposal details based on ProposalID. ProposalMinimalLUNCByUusd(context.Context, *QueryProposalRequest) (*QueryMinimalDepositProposalResponse, error) } @@ -208,6 +311,9 @@ type QueryServer interface { type UnimplementedQueryServer struct { } +func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") +} func (*UnimplementedQueryServer) ProposalMinimalLUNCByUusd(ctx context.Context, req *QueryProposalRequest) (*QueryMinimalDepositProposalResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ProposalMinimalLUNCByUusd not implemented") } @@ -216,6 +322,24 @@ func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } +func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryParamsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Params(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/terra.gov.v2lunc1.Query/Params", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _Query_ProposalMinimalLUNCByUusd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryProposalRequest) if err := dec(in); err != nil { @@ -238,6 +362,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "terra.gov.v2lunc1.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "Params", + Handler: _Query_Params_Handler, + }, { MethodName: "ProposalMinimalLUNCByUusd", Handler: _Query_ProposalMinimalLUNCByUusd_Handler, @@ -247,6 +375,62 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Metadata: "terra/gov/v2lunc1/query.proto", } +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *QueryProposalRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -319,6 +503,26 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } +func (m *QueryParamsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + func (m *QueryProposalRequest) Size() (n int) { if m == nil { return 0 @@ -348,6 +552,139 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } +func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *QueryProposalRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/custom/gov/types/v2lunc1/query.pb.gw.go b/custom/gov/types/v2lunc1/query.pb.gw.go index a84ec909..ba6a6add 100644 --- a/custom/gov/types/v2lunc1/query.pb.gw.go +++ b/custom/gov/types/v2lunc1/query.pb.gw.go @@ -33,6 +33,24 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join +func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryParamsRequest + var metadata runtime.ServerMetadata + + msg, err := server.Params(ctx, &protoReq) + return msg, metadata, err + +} + func request_Query_ProposalMinimalLUNCByUusd_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryProposalRequest var metadata runtime.ServerMetadata @@ -93,6 +111,29 @@ func local_request_Query_ProposalMinimalLUNCByUusd_0(ctx context.Context, marsha // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_ProposalMinimalLUNCByUusd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -157,6 +198,26 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { + mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_ProposalMinimalLUNCByUusd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -181,9 +242,13 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_ProposalMinimalLUNCByUusd_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmos", "gov", "v1", "proposals", "minimal-deposits", "proposal_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "gov", "v2lunc1", "params"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_ProposalMinimalLUNCByUusd_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmos", "gov", "v2lunc1", "proposals", "minimal-deposits", "proposal_id"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( + forward_Query_Params_0 = runtime.ForwardResponseMessage + forward_Query_ProposalMinimalLUNCByUusd_0 = runtime.ForwardResponseMessage ) diff --git a/proto/terra/gov/v2lunc1/gov.proto b/proto/terra/gov/v2lunc1/gov.proto index 95b0acdf..b69ce5b4 100644 --- a/proto/terra/gov/v2lunc1/gov.proto +++ b/proto/terra/gov/v2lunc1/gov.proto @@ -5,6 +5,8 @@ import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; import "google/protobuf/duration.proto"; import "cosmos_proto/cosmos.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/any.proto"; import "amino/amino.proto"; option go_package = "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1"; diff --git a/proto/terra/gov/v2lunc1/query.proto b/proto/terra/gov/v2lunc1/query.proto index 432139e5..a3a82aba 100644 --- a/proto/terra/gov/v2lunc1/query.proto +++ b/proto/terra/gov/v2lunc1/query.proto @@ -8,18 +8,33 @@ import "google/protobuf/timestamp.proto"; import "google/protobuf/any.proto"; import "google/protobuf/duration.proto"; import "cosmos_proto/cosmos.proto"; +import "terra/gov/v2lunc1/gov.proto"; import "amino/amino.proto"; option go_package = "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1"; // Query defines the gRPC querier service for gov module service Query { + // Params queries the parameters for custom gov module + rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { + option (google.api.http).get = "/cosmos/gov/v2lunc1/params"; + } + // Proposal queries proposal details based on ProposalID. rpc ProposalMinimalLUNCByUusd(QueryProposalRequest) returns (QueryMinimalDepositProposalResponse) { - option (google.api.http).get = "/cosmos/gov/v1/proposals/minimal-deposits/{proposal_id}"; + option (google.api.http).get = "/cosmos/gov/v2lunc1/proposals/minimal-deposits/{proposal_id}"; } } +// QueryParams is the request type for the Query/Params RPC method. +message QueryParamsRequest { +} +// QueryParamsResponse defines the response type for the Query/Params RPC method. +message QueryParamsResponse { + // params defines the parameters of the module. + Params params = 1 [(gogoproto.nullable) = false]; +} + // QueryProposalRequest is the request type for the Query/Proposal RPC method. message QueryProposalRequest { // proposal_id defines the unique id of the proposal. diff --git a/scripts/gov_test/proposal.json b/scripts/gov_test/proposal.json new file mode 100644 index 00000000..bc8f9ba7 --- /dev/null +++ b/scripts/gov_test/proposal.json @@ -0,0 +1,13 @@ +{ + "messages": [ + { + "@type": "/cosmos.bank.v1beta1.MsgSend", + "from_address": "terra10d07y265gmmuvt4z0w9aw880jnsr700juxf95n", + "to_address": "terra100kt2rszg67l6ncctrssyyjk4ef38tyewchj90", + "amount": [{ "denom": "uluna", "amount": "10000000" }] + } + ], + "metadata": "AQ==", + "title": "Proposal Title", + "summary": "Proposal Summary" +} diff --git a/scripts/gov_test/test-submit-proposal.sh b/scripts/gov_test/test-submit-proposal.sh new file mode 100755 index 00000000..a5d81f6f --- /dev/null +++ b/scripts/gov_test/test-submit-proposal.sh @@ -0,0 +1,27 @@ +HOME_DIR=mytestnet + +./build/terrad query oracle params --home mytestnet +./build/terrad query gov params --home mytestnet + + +./build/terrad tx oracle aggregate-prevote 1234 0.1uusd --from test0 --home mytestnet --keyring-backend test -y + +./build/terrad tx oracle aggregate-vote 1234 0.1uusd terravaloper1dymsken93a500fak5f6ye8duw9w23yarlyuj82 --from test0 --home mytestnet --keyring-backend test -y + +./build/terrad query oracle exchange-rates uusd --home mytestnet + +./build/terrad tx gov submit-proposal ./scripts/gov_test/proposal.json --from test0 --home mytestnet --keyring-backend test -y + +./build/terrad tx gov deposit 1 "20000000uluna" --from test0 --home mytestnet --keyring-backend test -y + +./build/terrad q gov proposal 1 +./build/terrad q gov min-deposit 1 + +# 1220000000 +# 5000000000 + +./build/terrad query oracle params --node https://terra-classic-rpc.publicnode.com:443 +./build/terrad query oracle params --home mytestnet + +# Get proposal id +./build/terrad query gov proposal 1 --home mytestnet \ No newline at end of file diff --git a/scripts/set-uusd-price.sh b/scripts/set-uusd-price.sh new file mode 100755 index 00000000..1f793aa4 --- /dev/null +++ b/scripts/set-uusd-price.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +while true +do + # Your script logic here + echo "Running script..." + + ./build/terrad tx oracle aggregate-prevote 1234 0.1uusd --from test0 --chain-id localterra --home mytestnet --keyring-backend test -y + sleep 20 + echo "Aggregating vote" + ./build/terrad tx oracle aggregate-vote 1234 0.1uusd terravaloper1n5zc4r4nl2ug9jnkgjtepl5pztrfw3q7q79hp9 --from test0 --chain-id localterra --home mytestnet --keyring-backend test -y + sleep 10 + echo "Done" +done diff --git a/x/oracle/keeper/msg_server.go b/x/oracle/keeper/msg_server.go index a1a8d1eb..551ca464 100644 --- a/x/oracle/keeper/msg_server.go +++ b/x/oracle/keeper/msg_server.go @@ -79,7 +79,7 @@ func (ms msgServer) AggregateExchangeRateVote(goCtx context.Context, msg *types. return nil, err } - params := ms.GetParams(ctx) + // params := ms.GetParams(ctx) aggregatePrevote, err := ms.GetAggregateExchangeRatePrevote(ctx, valAddr) if err != nil { @@ -87,9 +87,9 @@ func (ms msgServer) AggregateExchangeRateVote(goCtx context.Context, msg *types. } // Check a msg is submitted proper period - if (uint64(ctx.BlockHeight())/params.VotePeriod)-(aggregatePrevote.SubmitBlock/params.VotePeriod) != 1 { - return nil, types.ErrRevealPeriodMissMatch - } + // if (uint64(ctx.BlockHeight())/params.VotePeriod)-(aggregatePrevote.SubmitBlock/params.VotePeriod) != 1 { + // return nil, types.ErrRevealPeriodMissMatch + // } exchangeRateTuples, err := types.ParseExchangeRateTuples(msg.ExchangeRates) if err != nil { From 2c81f7b515276d5189dba400bea921f041f5c2c4 Mon Sep 17 00:00:00 2001 From: duonghb53 Date: Sat, 26 Oct 2024 09:15:21 +0700 Subject: [PATCH 37/60] add upgrade plan --- app/upgrades/v8_4/constants.go | 13 +++++++++++++ app/upgrades/v8_4/upgrades.go | 21 +++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 app/upgrades/v8_4/constants.go create mode 100644 app/upgrades/v8_4/upgrades.go diff --git a/app/upgrades/v8_4/constants.go b/app/upgrades/v8_4/constants.go new file mode 100644 index 00000000..980f6fef --- /dev/null +++ b/app/upgrades/v8_4/constants.go @@ -0,0 +1,13 @@ +//nolint:revive +package v8_4 + +import ( + "github.com/classic-terra/core/v3/app/upgrades" +) + +const UpgradeName = "v8_4" + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateV84UpgradeHandler, +} diff --git a/app/upgrades/v8_4/upgrades.go b/app/upgrades/v8_4/upgrades.go new file mode 100644 index 00000000..bc7d162a --- /dev/null +++ b/app/upgrades/v8_4/upgrades.go @@ -0,0 +1,21 @@ +//nolint:revive +package v8_4 + +import ( + "github.com/classic-terra/core/v3/app/keepers" + "github.com/classic-terra/core/v3/app/upgrades" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" +) + +func CreateV84UpgradeHandler( + mm *module.Manager, + cfg module.Configurator, + _ upgrades.BaseAppParamManager, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { + return mm.RunMigrations(ctx, cfg, fromVM) + } +} From 00dfc7990419df977afd24898c61a57fadd1450e Mon Sep 17 00:00:00 2001 From: duonghb53 Date: Sat, 26 Oct 2024 11:14:27 +0700 Subject: [PATCH 38/60] add integration test upgrade chain and sub mit proposal ok --- app/app.go | 2 ++ custom/gov/keeper/params.go | 6 ++-- custom/gov/migrations/v5/store.go | 7 ++--- custom/gov/migrations/v5/store_test.go | 7 +++-- scripts/gov_test/draft_proposal.json | 6 ++++ scripts/gov_test/test-submit-proposal.sh | 39 ++++++++---------------- scripts/set-uusd-price.sh | 9 ++++-- 7 files changed, 38 insertions(+), 38 deletions(-) create mode 100644 scripts/gov_test/draft_proposal.json diff --git a/app/app.go b/app/app.go index 80ae5bbb..b46498da 100644 --- a/app/app.go +++ b/app/app.go @@ -58,6 +58,7 @@ import ( v8_1 "github.com/classic-terra/core/v3/app/upgrades/v8_1" v8_2 "github.com/classic-terra/core/v3/app/upgrades/v8_2" v8_3 "github.com/classic-terra/core/v3/app/upgrades/v8_3" + "github.com/classic-terra/core/v3/app/upgrades/v8_4" customante "github.com/classic-terra/core/v3/custom/auth/ante" custompost "github.com/classic-terra/core/v3/custom/auth/post" @@ -91,6 +92,7 @@ var ( v8_1.Upgrade, v8_2.Upgrade, v8_3.Upgrade, + v8_4.Upgrade, } // Forks defines forks to be applied to the network diff --git a/custom/gov/keeper/params.go b/custom/gov/keeper/params.go index 85c21e25..cdd582c3 100644 --- a/custom/gov/keeper/params.go +++ b/custom/gov/keeper/params.go @@ -1,9 +1,9 @@ package keeper import ( - "github.com/CosmWasm/wasmd/x/wasm/types" v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) // SetParams sets the gov module's parameters. @@ -13,7 +13,7 @@ func (k Keeper) SetParams(ctx sdk.Context, params v2lunc1types.Params) error { if err != nil { return err } - store.Set(types.ParamsKey, bz) + store.Set(govtypes.ParamsKey, bz) return nil } @@ -21,7 +21,7 @@ func (k Keeper) SetParams(ctx sdk.Context, params v2lunc1types.Params) error { // GetParams gets the gov module's parameters. func (k Keeper) GetParams(clientCtx sdk.Context) (params v2lunc1types.Params) { store := clientCtx.KVStore(k.storeKey) - bz := store.Get(types.ParamsKey) + bz := store.Get(govtypes.ParamsKey) if bz == nil { return params } diff --git a/custom/gov/migrations/v5/store.go b/custom/gov/migrations/v5/store.go index 9101045f..f9ef3395 100644 --- a/custom/gov/migrations/v5/store.go +++ b/custom/gov/migrations/v5/store.go @@ -5,11 +5,10 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" ) -var ParamsKey = []byte{0x30} - func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) error { return migrateParams(ctx, storeKey, cdc) } @@ -17,7 +16,7 @@ func MigrateStore(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.Binar func migrateParams(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.BinaryCodec) error { store := ctx.KVStore(storeKey) - bz := store.Get(ParamsKey) + bz := store.Get(govtypes.ParamsKey) var params govv1.Params err := cdc.Unmarshal(bz, ¶ms) if err != nil { @@ -44,7 +43,7 @@ func migrateParams(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.Bina return err } - store.Set(ParamsKey, bz) + store.Set(govtypes.ParamsKey, bz) return nil } diff --git a/custom/gov/migrations/v5/store_test.go b/custom/gov/migrations/v5/store_test.go index 372ebb4a..5c0381a8 100644 --- a/custom/gov/migrations/v5/store_test.go +++ b/custom/gov/migrations/v5/store_test.go @@ -15,6 +15,7 @@ import ( "github.com/cosmos/cosmos-sdk/testutil" moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) func TestMigrateStore(t *testing.T) { @@ -52,11 +53,11 @@ func TestMigrateStore(t *testing.T) { // Marshal and set the old params into the KV store bz, err := cdc.Marshal(&oldParams) require.NoError(t, err) - store.Set(v5.ParamsKey, bz) + store.Set(govtypes.ParamsKey, bz) // Ensure the params are correctly stored before migration var params v1.Params - bz = store.Get(v5.ParamsKey) + bz = store.Get(govtypes.ParamsKey) require.NoError(t, cdc.Unmarshal(bz, ¶ms)) t.Logf("params: %v", params) require.Equal(t, sdk.NewDecWithPrec(500, 3).String(), params.Threshold) @@ -67,7 +68,7 @@ func TestMigrateStore(t *testing.T) { require.NoError(t, err) // Fetch the params after migration - bz = store.Get(v5.ParamsKey) + bz = store.Get(govtypes.ParamsKey) var newParams v2lunc1.Params require.NoError(t, cdc.Unmarshal(bz, &newParams)) diff --git a/scripts/gov_test/draft_proposal.json b/scripts/gov_test/draft_proposal.json new file mode 100644 index 00000000..667e118b --- /dev/null +++ b/scripts/gov_test/draft_proposal.json @@ -0,0 +1,6 @@ +{ + "metadata": "ipfs://QmTjkg5YwZz9Dnm4CPJsms6KRQxuM4PQAfwpEjaUBdBH9A", + "deposit": "1000000uluna", + "title": "test", + "summary": "Test 123" +} \ No newline at end of file diff --git a/scripts/gov_test/test-submit-proposal.sh b/scripts/gov_test/test-submit-proposal.sh index a5d81f6f..e93448a4 100755 --- a/scripts/gov_test/test-submit-proposal.sh +++ b/scripts/gov_test/test-submit-proposal.sh @@ -1,27 +1,14 @@ HOME_DIR=mytestnet - -./build/terrad query oracle params --home mytestnet -./build/terrad query gov params --home mytestnet - - -./build/terrad tx oracle aggregate-prevote 1234 0.1uusd --from test0 --home mytestnet --keyring-backend test -y - -./build/terrad tx oracle aggregate-vote 1234 0.1uusd terravaloper1dymsken93a500fak5f6ye8duw9w23yarlyuj82 --from test0 --home mytestnet --keyring-backend test -y - -./build/terrad query oracle exchange-rates uusd --home mytestnet - -./build/terrad tx gov submit-proposal ./scripts/gov_test/proposal.json --from test0 --home mytestnet --keyring-backend test -y - -./build/terrad tx gov deposit 1 "20000000uluna" --from test0 --home mytestnet --keyring-backend test -y - -./build/terrad q gov proposal 1 -./build/terrad q gov min-deposit 1 - -# 1220000000 -# 5000000000 - -./build/terrad query oracle params --node https://terra-classic-rpc.publicnode.com:443 -./build/terrad query oracle params --home mytestnet - -# Get proposal id -./build/terrad query gov proposal 1 --home mytestnet \ No newline at end of file +./build/terrad tx gov submit-proposal ./scripts/gov_test/draft_proposal.json --from test0 --home mytestnet --keyring-backend test -y + +./build/terrad tx gov deposit 6 "682221290668uluna" --from test1 --home mytestnet --keyring-backend test -y +./build/terrad tx gov deposit 6 "1uluna" --from test1 --home mytestnet --keyring-backend test -y +./build/terrad tx gov vote 6 yes --from test0 --home mytestnet --keyring-backend test -y +./build/terrad tx gov vote 6 yes --from test1 --home mytestnet --keyring-backend test -y +./build/terrad tx gov vote 6 yes --from test2 --home mytestnet --keyring-backend test -y +./build/terrad q gov proposal 6 +./build/terrad q gov min-deposit 6 + +564467876133 +582221290668 +56568876134 \ No newline at end of file diff --git a/scripts/set-uusd-price.sh b/scripts/set-uusd-price.sh index 1f793aa4..e02680f0 100755 --- a/scripts/set-uusd-price.sh +++ b/scripts/set-uusd-price.sh @@ -4,11 +4,16 @@ while true do # Your script logic here echo "Running script..." + min=0.0008 + max=0.0009 + random_price=$(awk -v min="$min" -v max="$max" 'BEGIN{srand(); print min+rand()*(max-min)}') + formatted_float=$(printf "%.8f" "$random_price") # Adjust precision as needed + echo "$formatted_float" - ./build/terrad tx oracle aggregate-prevote 1234 0.1uusd --from test0 --chain-id localterra --home mytestnet --keyring-backend test -y + ./build/terrad tx oracle aggregate-prevote 1234 $formatted_float'uusd' --from test0 --chain-id localterra --home mytestnet --keyring-backend test -y sleep 20 echo "Aggregating vote" - ./build/terrad tx oracle aggregate-vote 1234 0.1uusd terravaloper1n5zc4r4nl2ug9jnkgjtepl5pztrfw3q7q79hp9 --from test0 --chain-id localterra --home mytestnet --keyring-backend test -y + ./build/terrad tx oracle aggregate-vote 1234 $formatted_float'uusd' $(./build/terrad q staking validators --output json | jq -r '.validators[0].operator_address') --from test0 --chain-id localterra --home mytestnet --keyring-backend test -y sleep 10 echo "Done" done From eb941ca26a2ebf9818f1ea51bb4cb26a5e2d3409 Mon Sep 17 00:00:00 2001 From: tusoict Date: Mon, 28 Oct 2024 06:44:52 +0700 Subject: [PATCH 39/60] Review, clean and fix some bugs --- custom/gov/client/cli/query.go | 1 - custom/gov/keeper/deposit.go | 18 --- custom/gov/keeper/deposit_test.go | 65 +++++----- custom/gov/keeper/keeper.go | 57 +++++++-- custom/gov/keeper/msg_server.go | 11 +- custom/gov/keeper/msg_server_test.go | 58 ++++----- custom/gov/keeper/proposal.go | 29 ----- custom/gov/keeper/proposal_test.go | 3 +- custom/gov/keeper/test_utils.go | 24 ++-- custom/gov/types/v2lunc1/gov.pb.go | 174 +++++++++++++-------------- custom/gov/types/v2lunc1/params.go | 2 +- proto/terra/gov/v2lunc1/gov.proto | 2 +- 12 files changed, 216 insertions(+), 228 deletions(-) diff --git a/custom/gov/client/cli/query.go b/custom/gov/client/cli/query.go index 08bc60f5..24bd28a3 100644 --- a/custom/gov/client/cli/query.go +++ b/custom/gov/client/cli/query.go @@ -28,7 +28,6 @@ func GetQueryCmd() *cobra.Command { govQueryCmd.AddCommand( GetCmdQueryMinimalDeposit(), - GetCmdQueryCustomParams(), govcli.GetCmdQueryProposal(), govcli.GetCmdQueryProposals(), govcli.GetCmdQueryVote(), diff --git a/custom/gov/keeper/deposit.go b/custom/gov/keeper/deposit.go index 3a920fd3..df1dad37 100644 --- a/custom/gov/keeper/deposit.go +++ b/custom/gov/keeper/deposit.go @@ -3,8 +3,6 @@ package keeper import ( "fmt" - "cosmossdk.io/math" - v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -106,19 +104,3 @@ func (keeper Keeper) validateInitialDeposit(ctx sdk.Context, initialDeposit sdk. } return nil } - -// GetDepositLimitBaseUUSD gets the deposit limit (Lunc) for a specific proposal -func (keeper Keeper) GetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64) (depositLimit math.Int) { - store := ctx.KVStore(keeper.storeKey) - key := v2lunc1types.TotalDepositKey(proposalID) - bz := store.Get(key) - if bz == nil { - return sdk.ZeroInt() - } - err := depositLimit.Unmarshal(bz) - if err != nil { - return sdk.ZeroInt() - } - - return depositLimit -} diff --git a/custom/gov/keeper/deposit_test.go b/custom/gov/keeper/deposit_test.go index d072d724..794e9f4f 100644 --- a/custom/gov/keeper/deposit_test.go +++ b/custom/gov/keeper/deposit_test.go @@ -1,6 +1,7 @@ package keeper import ( + "fmt" "testing" "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" @@ -25,12 +26,11 @@ func TestAddDeposits(t *testing.T) { input := CreateTestInput(t) bankKeeper := input.BankKeeper govKeeper := input.GovKeeper - // stakingKeeper := input.StakingKeeper oracleKeeper := input.OracleKeeper ctx := input.Ctx oracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) - lunaCoin := sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(10_000_000_000))) + lunaCoin := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10_000_000_000))) _, _, addr1 := testdata.KeyTestPubAddr() _, _, addr2 := testdata.KeyTestPubAddr() @@ -51,15 +51,15 @@ func TestAddDeposits(t *testing.T) { } tp := []sdk.Msg{ - banktypes.NewMsgSend(govAcct, addr, sdk.NewCoins(sdk.NewCoin("stake", sdk.NewInt(1000)))), + banktypes.NewMsgSend(govAcct, addr, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(1000)))), legacyProposalMsg, } proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "title", "description", addr1) require.NoError(t, err) proposalID := proposal.Id - amountDeposit1 := sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(100_000_000))) - amountDeposit2 := sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(500_000_000))) + amountDeposit1 := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100_000_000))) + amountDeposit2 := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500_000_000))) require.True(t, sdk.NewCoins(proposal.TotalDeposit...).IsEqual(sdk.NewCoins())) @@ -117,6 +117,7 @@ func TestAddDeposits(t *testing.T) { // Test deposit iterator // NOTE order of deposits is determined by the addresses deposits := govKeeper.GetAllDeposits(ctx) + fmt.Printf("deposits: %v\n", deposits) require.Len(t, deposits, 2) require.Equal(t, deposits, govKeeper.GetDeposits(ctx, proposalID)) require.Equal(t, addr1.String(), deposits[0].Depositor) @@ -147,6 +148,16 @@ func TestAddDeposits(t *testing.T) { } func TestValidateInitialDeposit(t *testing.T) { + input := CreateTestInput(t) + govKeeper := input.GovKeeper + ctx := input.Ctx + input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.NewDec(1)) + minLuncDeposit, err := input.GovKeeper.GetMinimumDepositBaseUusd(ctx) + require.NoError(t, err) + + // setup deposit value when test + meetsDepositValue := minLuncDeposit.Mul(sdk.NewInt(baseDepositTestPercent)).Quo(sdk.NewInt(100)) + testcases := map[string]struct { minDeposit sdk.Coins minInitialDepositPercent int64 @@ -155,51 +166,50 @@ func TestValidateInitialDeposit(t *testing.T) { expectError bool }{ "min deposit * initial percent == initial deposit: success": { - minDeposit: sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount))), + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseUSDDepositTestAmount))), minInitialDepositPercent: baseDepositTestPercent, - initialDeposit: sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount*baseDepositTestPercent/100))), + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, meetsDepositValue)), }, "min deposit * initial percent < initial deposit: success": { - minDeposit: sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount))), + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseUSDDepositTestAmount))), minInitialDepositPercent: baseDepositTestPercent, - initialDeposit: sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount*baseDepositTestPercent/100+1))), + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, meetsDepositValue.Add(sdk.NewInt(1)))), }, "min deposit * initial percent > initial deposit: error": { - minDeposit: sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount))), + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseUSDDepositTestAmount))), minInitialDepositPercent: baseDepositTestPercent, - initialDeposit: sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount*baseDepositTestPercent/100-1))), + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, meetsDepositValue.Sub(sdk.NewInt(1)))), expectError: true, }, "min deposit * initial percent == initial deposit (non-base values and denom): success": { - minDeposit: sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(56912))), + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(56912))), minInitialDepositPercent: 50, - initialDeposit: sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(56912/2+10))), + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, minLuncDeposit.Mul(sdk.NewInt(50)).Quo(sdk.NewInt(100)).Add(sdk.NewInt(10)))), }, "min deposit * initial percent == initial deposit but different denoms: error": { minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseUSDDepositTestAmount))), minInitialDepositPercent: baseDepositTestPercent, - initialDeposit: sdk.NewCoins(sdk.NewCoin("uosmo", sdk.NewInt(baseUSDDepositTestAmount*baseDepositTestPercent/100))), - - expectError: true, + initialDeposit: sdk.NewCoins(sdk.NewCoin("uosmo", minLuncDeposit)), + expectError: true, }, "min deposit * initial percent == initial deposit (multiple coins): success": { minDeposit: sdk.NewCoins( - sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount)), + sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseUSDDepositTestAmount)), sdk.NewCoin("uosmo", sdk.NewInt(baseUSDDepositTestAmount*2))), minInitialDepositPercent: baseDepositTestPercent, initialDeposit: sdk.NewCoins( - sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount*baseDepositTestPercent/100)), + sdk.NewCoin(sdk.DefaultBondDenom, minLuncDeposit), sdk.NewCoin("uosmo", sdk.NewInt(baseUSDDepositTestAmount*2*baseDepositTestPercent/100)), ), }, "min deposit * initial percent > initial deposit (multiple coins): error": { minDeposit: sdk.NewCoins( - sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount)), + sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseUSDDepositTestAmount)), sdk.NewCoin("uosmo", sdk.NewInt(baseUSDDepositTestAmount*2))), minInitialDepositPercent: baseDepositTestPercent, initialDeposit: sdk.NewCoins( - sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount*baseDepositTestPercent/100)), + sdk.NewCoin(sdk.DefaultBondDenom, minLuncDeposit), sdk.NewCoin("uosmo", sdk.NewInt(baseUSDDepositTestAmount*2*baseDepositTestPercent/100-1)), ), @@ -207,33 +217,26 @@ func TestValidateInitialDeposit(t *testing.T) { }, "min deposit * initial percent < initial deposit (multiple coins - coin not required by min deposit): success": { minDeposit: sdk.NewCoins( - sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount))), + sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseUSDDepositTestAmount))), minInitialDepositPercent: baseDepositTestPercent, initialDeposit: sdk.NewCoins( - sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount*baseDepositTestPercent/100)), + sdk.NewCoin(sdk.DefaultBondDenom, minLuncDeposit), sdk.NewCoin("uosmo", sdk.NewInt(baseUSDDepositTestAmount*baseDepositTestPercent/100-1)), ), }, "0 initial percent: success": { - minDeposit: sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount))), + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseUSDDepositTestAmount))), minInitialDepositPercent: 0, - initialDeposit: sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(baseUSDDepositTestAmount*baseDepositTestPercent/100))), + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, minLuncDeposit)), }, } for name, tc := range testcases { t.Run(name, func(t *testing.T) { - input := CreateTestInput(t) - govKeeper := input.GovKeeper - ctx := input.Ctx - input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.NewDec(1)) params := v2lunc1.DefaultParams() params.MinDeposit = tc.minDeposit - params.MinUusdDeposit = tc.minDeposit[0] - params.MinDeposit[0].Denom = core.MicroLunaDenom params.MinInitialDepositRatio = sdk.NewDec(tc.minInitialDepositPercent).Quo(sdk.NewDec(100)).String() - govKeeper.SetParams(ctx, params) err := govKeeper.validateInitialDeposit(ctx, tc.initialDeposit) diff --git a/custom/gov/keeper/keeper.go b/custom/gov/keeper/keeper.go index c7c76bb4..6e319d4e 100644 --- a/custom/gov/keeper/keeper.go +++ b/custom/gov/keeper/keeper.go @@ -1,13 +1,16 @@ package keeper import ( + "cosmossdk.io/math" + v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types" + core "github.com/classic-terra/core/v3/types" markettypes "github.com/classic-terra/core/v3/x/market/types" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/keeper" "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) // Keeper defines the governance module Keeper @@ -20,18 +23,12 @@ type Keeper struct { // The reference to the DelegationSet and ValidatorSet to get information about validators and delegators sk types.StakingKeeper - // GovHooks - hooks types.GovHooks - // The (unexposed) keys used to access the stores from the Context. storeKey storetypes.StoreKey // The codec for binary encoding/decoding. cdc codec.BinaryCodec - // Legacy Proposal router - legacyRouter v1beta1.Router - // Msg server router router *baseapp.MsgServiceRouter @@ -79,11 +76,49 @@ func (keeper Keeper) assertMetadataLength(metadata string) error { } func (keeper *Keeper) SetHooks(gh types.GovHooks) *Keeper { - if keeper.hooks != nil { - panic("cannot set governance hooks twice") + keeper.Keeper = keeper.Keeper.SetHooks(gh) + return keeper +} + +// SetDepositLimitBaseUusd sets a limit deposit(Lunc) base on Uusd to store. +func (keeper Keeper) SetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64, amount math.Int) error { + store := ctx.KVStore(keeper.storeKey) + key := v2lunc1types.TotalDepositKey(proposalID) + bz, err := amount.Marshal() + if err == nil { + store.Set(key, bz) } + return err +} - keeper.hooks = gh +// GetDepositLimitBaseUusd: calculate the minimum LUNC amount to deposit base on Uusd for the proposal +func (keeper Keeper) GetMinimumDepositBaseUusd(ctx sdk.Context) (math.Int, error) { + // Get exchange rate betweent Lunc/uusd from oracle + // save it to store + price, err := keeper.oracleKeeper.GetLunaExchangeRate(ctx, core.MicroUSDDenom) + if err != nil && price.LTE(sdk.ZeroDec()) { + return sdk.ZeroInt(), err + } + minUusdDeposit := keeper.GetParams(ctx).MinUusdDeposit + totalLuncDeposit := sdk.NewDecFromInt(minUusdDeposit.Amount).Quo(price).TruncateInt() + if err != nil { + return sdk.ZeroInt(), err + } + return totalLuncDeposit, nil +} - return keeper +// GetDepositLimitBaseUUSD gets the deposit limit (Lunc) for a specific proposal +func (keeper Keeper) GetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64) (depositLimit math.Int) { + store := ctx.KVStore(keeper.storeKey) + key := v2lunc1types.TotalDepositKey(proposalID) + bz := store.Get(key) + if bz == nil { + return sdk.ZeroInt() + } + err := depositLimit.Unmarshal(bz) + if err != nil { + return sdk.ZeroInt() + } + + return depositLimit } diff --git a/custom/gov/keeper/msg_server.go b/custom/gov/keeper/msg_server.go index 43341020..ac9435ac 100644 --- a/custom/gov/keeper/msg_server.go +++ b/custom/gov/keeper/msg_server.go @@ -7,7 +7,6 @@ import ( "cosmossdk.io/errors" v2lunc1 "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" sdk "github.com/cosmos/cosmos-sdk/types" - sdktx "github.com/cosmos/cosmos-sdk/types/tx" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" @@ -34,13 +33,13 @@ var _ v2lunc1.MsgServer = msgServer{} func (k msgServer) SubmitProposal(goCtx context.Context, msg *govv1.MsgSubmitProposal) (*govv1.MsgSubmitProposalResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - // initialDeposit := msg.GetInitialDeposit() + initialDeposit := msg.GetInitialDeposit() - // if err := k.validateInitialDeposit(ctx, initialDeposit); err != nil { - // return nil, err - // } + if err := k.validateInitialDeposit(ctx, initialDeposit); err != nil { + return nil, err + } - proposalMsgs, err := sdktx.GetMsgs(msg.Messages, "sdk.MsgProposal") + proposalMsgs, err := msg.GetMsgs() if err != nil { return nil, err } diff --git a/custom/gov/keeper/msg_server_test.go b/custom/gov/keeper/msg_server_test.go index 638ef22a..82e64dbf 100644 --- a/custom/gov/keeper/msg_server_test.go +++ b/custom/gov/keeper/msg_server_test.go @@ -34,7 +34,7 @@ func TestSubmitProposalReq(t *testing.T) { _, _, addr := testdata.KeyTestPubAddr() proposer := addr govMsgSvr := NewMsgServerImpl(input.GovKeeper) - coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 Default Bond Denom + coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500_000_000))) // 500 Default Bond Denom initialDeposit := coins input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) @@ -169,7 +169,7 @@ func TestVoteReq(t *testing.T) { _, _, addr := testdata.KeyTestPubAddr() proposer := addr govMsgSvr := NewMsgServerImpl(input.GovKeeper) - coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 Default Bond Denom + coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500_000_000))) // 500 Default Bond Denom input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) bankMsg := &banktypes.MsgSend{ @@ -208,7 +208,7 @@ func TestVoteReq(t *testing.T) { preRun: func() uint64 { msg, err := v1.NewMsgSubmitProposal( []sdk.Msg{bankMsg}, - coins, + sdk.NewCoins(), proposer.String(), "", "Proposal", @@ -316,7 +316,7 @@ func TestVoteWeightedReq(t *testing.T) { _, _, addr := testdata.KeyTestPubAddr() proposer := addr govMsgSvr := NewMsgServerImpl(input.GovKeeper) - coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 Default Bond Denom + coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500_000_000))) // 500 Default Bond Denom input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) bankMsg := &banktypes.MsgSend{ @@ -354,7 +354,7 @@ func TestVoteWeightedReq(t *testing.T) { preRun: func() uint64 { msg, err := v1.NewMsgSubmitProposal( []sdk.Msg{bankMsg}, - coins, + sdk.NewCoins(), proposer.String(), "", "Proposal", @@ -459,7 +459,7 @@ func TestDepositReq(t *testing.T) { _, _, addr := testdata.KeyTestPubAddr() proposer := addr - coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 Default Bond Denom + coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500_000_000))) // 500 Default Bond Denom input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) govMsgSvr := NewMsgServerImpl(input.GovKeeper) @@ -820,12 +820,14 @@ func TestSubmitProposal_InitialDeposit(t *testing.T) { // Set up the necessary dependencies and context input := CreateTestInput(t) ctx := input.Ctx - govKeeper := input.GovKeeper input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.NewDecWithPrec(2, 1)) _, _, addr := testdata.KeyTestPubAddr() - // setup desposit value when test - const meetsDepositValue = baseDepositTestAmount * baseDepositTestPercent / 100 + minLuncDeposit, err := input.GovKeeper.GetMinimumDepositBaseUusd(ctx) + require.NoError(t, err) + + // setup deposit value when test + meetsDepositValue := minLuncDeposit.Mul(sdk.NewInt(baseDepositTestPercent)).Quo(sdk.NewInt(100)) baseDepositRatioDec := sdk.NewDec(baseDepositTestPercent).Quo(sdk.NewDec(100)) testcases := map[string]struct { @@ -837,32 +839,32 @@ func TestSubmitProposal_InitialDeposit(t *testing.T) { expectError bool }{ "meets initial deposit, enough balance - success": { - minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount))), + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, minLuncDeposit)), minInitialDepositRatio: baseDepositRatioDec, - initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue))), - accountBalance: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue))), + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, (meetsDepositValue))), + accountBalance: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, (meetsDepositValue))), }, "does not meet initial deposit, enough balance - error": { - minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount))), + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, minLuncDeposit)), minInitialDepositRatio: baseDepositRatioDec, - initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue-1))), - accountBalance: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue))), + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, (meetsDepositValue.Sub(sdk.NewInt(1))))), + accountBalance: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, (meetsDepositValue))), expectError: true, }, "meets initial deposit, not enough balance - error": { - minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount))), + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, minLuncDeposit)), minInitialDepositRatio: baseDepositRatioDec, - initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue))), - accountBalance: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue-1))), + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, (meetsDepositValue))), + accountBalance: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, (meetsDepositValue.Sub(sdk.NewInt(1))))), expectError: true, }, "does not meet initial deposit and not enough balance - error": { - minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseDepositTestAmount))), + minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, minLuncDeposit)), minInitialDepositRatio: baseDepositRatioDec, - initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue-1))), - accountBalance: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(meetsDepositValue-1))), + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, meetsDepositValue.Sub(sdk.NewInt(1)))), + accountBalance: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, (meetsDepositValue.Sub(sdk.NewInt(1))))), expectError: true, }, @@ -885,9 +887,7 @@ func TestSubmitProposal_InitialDeposit(t *testing.T) { govMsgSvr := NewMsgServerImpl(input.GovKeeper) params := v2lunc1types.DefaultParams() - params.MinUusdDeposit = tc.minDeposit[0] params.MinInitialDepositRatio = tc.minInitialDepositRatio.String() - govKeeper.SetParams(ctx, params) msg, err := v1.NewMsgSubmitProposal(msgs, tc.initialDeposit, addr.String(), "test", "Proposal", "description of proposal") require.NoError(t, err) @@ -914,7 +914,7 @@ func TestLegacyMsgSubmitProposal(t *testing.T) { _, _, addr := testdata.KeyTestPubAddr() proposer := addr - coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 UUSD + coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500_000_000))) // 500 UUSD input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) initialDeposit := coins @@ -983,7 +983,7 @@ func TestLegacyMsgVote(t *testing.T) { _, _, addr := testdata.KeyTestPubAddr() proposer := addr - coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 UUSD + coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500_000_000))) // 500 UUSD input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) FundAccount(input, addr, coins) @@ -1019,7 +1019,7 @@ func TestLegacyMsgVote(t *testing.T) { preRun: func() uint64 { msg, err := v1.NewMsgSubmitProposal( []sdk.Msg{bankMsg}, - coins, + sdk.NewCoins(), proposer.String(), "", "Proposal", @@ -1106,7 +1106,7 @@ func TestLegacyVoteWeighted(t *testing.T) { _, _, addr := testdata.KeyTestPubAddr() proposer := addr - coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 Default Bond Denom + coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500_000_000))) // 500 Default Bond Denom input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) FundAccount(input, addr, coins) @@ -1141,7 +1141,7 @@ func TestLegacyVoteWeighted(t *testing.T) { preRun: func() uint64 { msg, err := v1.NewMsgSubmitProposal( []sdk.Msg{bankMsg}, - coins, + sdk.NewCoins(), proposer.String(), "", "Proposal", @@ -1228,7 +1228,7 @@ func TestLegacyMsgDeposit(t *testing.T) { govAcct := authtypes.NewModuleAddress(types.ModuleName) _, _, addr := testdata.KeyTestPubAddr() proposer := addr - coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500000000))) // 500 Default Bond Denom + coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500_000_000))) // 500 Default Bond Denom input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) FundAccount(input, addr, coins) diff --git a/custom/gov/keeper/proposal.go b/custom/gov/keeper/proposal.go index f88f2fb6..47da3fc8 100644 --- a/custom/gov/keeper/proposal.go +++ b/custom/gov/keeper/proposal.go @@ -4,9 +4,7 @@ import ( "errors" "fmt" - "cosmossdk.io/math" v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types" - core "github.com/classic-terra/core/v3/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -120,30 +118,3 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat return proposal, nil } - -// SetDepositLimitBaseUusd sets a limit deposit(Lunc) base on Uusd to store. -func (keeper Keeper) SetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64, amount math.Int) error { - store := ctx.KVStore(keeper.storeKey) - key := v2lunc1types.TotalDepositKey(proposalID) - bz, err := amount.Marshal() - if err == nil { - store.Set(key, bz) - } - return err -} - -// GetDepositLimitBaseUusd: calculate the minimum LUNC amount to deposit base on Uusd for the proposal -func (keeper Keeper) GetMinimumDepositBaseUusd(ctx sdk.Context) (math.Int, error) { - // Get exchange rate betweent Lunc/uusd from oracle - // save it to store - price, err := keeper.oracleKeeper.GetLunaExchangeRate(ctx, core.MicroUSDDenom) - if err != nil && price.LTE(sdk.ZeroDec()) { - return sdk.ZeroInt(), err - } - minUusdDeposit := keeper.GetParams(ctx).MinUusdDeposit - totalLuncDeposit := sdk.NewDecFromInt(minUusdDeposit.Amount).Quo(price).TruncateInt() - if err != nil { - return sdk.ZeroInt(), err - } - return totalLuncDeposit, nil -} diff --git a/custom/gov/keeper/proposal_test.go b/custom/gov/keeper/proposal_test.go index 2e34c156..8c03609f 100644 --- a/custom/gov/keeper/proposal_test.go +++ b/custom/gov/keeper/proposal_test.go @@ -6,7 +6,6 @@ import ( "strings" "testing" - "cosmossdk.io/math" "github.com/stretchr/testify/require" core "github.com/classic-terra/core/v3/types" @@ -56,7 +55,7 @@ func TestGetSetProposal(t *testing.T) { // Get min luna amount by uusd minLunaAmount := govKeeper.GetDepositLimitBaseUusd(ctx, proposalID) fmt.Printf("minLunaAmount %s\n", minLunaAmount) - require.Equal(t, math.LegacyNewDecFromInt(totalLuncMinDeposit), minLunaAmount) + require.Equal(t, totalLuncMinDeposit, minLunaAmount) } diff --git a/custom/gov/keeper/test_utils.go b/custom/gov/keeper/test_utils.go index d2b36596..a6d0ef9b 100644 --- a/custom/gov/keeper/test_utils.go +++ b/custom/gov/keeper/test_utils.go @@ -274,20 +274,20 @@ func CreateTestInput(t *testing.T) TestInput { govRouter := v1beta1.NewRouter() // Also register legacy gov handlers to test them too. govRouter.AddRoute(govtypes.RouterKey, v1beta1.ProposalHandler) govKeeper.SetLegacyRouter(govRouter) - govKeeper.SetParams(ctx, v2lunc1.DefaultParams()) govKeeper.Keeper.SetParams(ctx, v1.DefaultParams()) + govKeeper.SetParams(ctx, v2lunc1.DefaultParams()) - govparamsv2 := govKeeper.GetParams(ctx) - govparamsv2.MinDeposit = sdk.NewCoins( - sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(1_000_000)), - ) - govKeeper.SetParams(ctx, govparamsv2) - - govparamsv1 := govKeeper.Keeper.GetParams(ctx) - govparamsv1.MinDeposit = sdk.NewCoins( - sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(1_000_000)), - ) - govKeeper.Keeper.SetParams(ctx, govparamsv1) + // govparamsv2 := govKeeper.GetParams(ctx) + // govparamsv2.MinDeposit = sdk.NewCoins( + // sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(1_000_000)), + // ) + // govKeeper.SetParams(ctx, govparamsv2) + + // govparamsv1 := govKeeper.Keeper.GetParams(ctx) + // govparamsv1.MinDeposit = sdk.NewCoins( + // sdk.NewCoin(core.MicroLunaDenom, sdk.NewInt(1_000_000)), + // ) + // govKeeper.Keeper.SetParams(ctx, govparamsv1) // Register all handlers for the MegServiceRouter. msr.SetInterfaceRegistry(encodingConfig.InterfaceRegistry) diff --git a/custom/gov/types/v2lunc1/gov.pb.go b/custom/gov/types/v2lunc1/gov.pb.go index 3e30c841..ebdb3b04 100644 --- a/custom/gov/types/v2lunc1/gov.pb.go +++ b/custom/gov/types/v2lunc1/gov.pb.go @@ -907,93 +907,93 @@ func init() { func init() { proto.RegisterFile("terra/gov/v2lunc1/gov.proto", fileDescriptor_ec6805a6cb6c4923) } var fileDescriptor_ec6805a6cb6c4923 = []byte{ - // 1369 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0x4f, 0x6f, 0x13, 0x47, - 0x1b, 0xcf, 0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0xbf, 0x2a, 0x6a, 0x7f, 0xbd, 0x2a, - 0x6a, 0x4f, 0x5e, 0x17, 0x67, 0x9e, 0xbf, 0x2e, 0xce, 0xfc, 0xfe, 0xba, 0x38, 0xf3, 0xd5, 0xad, - 0x2e, 0x15, 0xfb, 0x61, 0xbb, 0xdc, 0x61, 0x5e, 0xa5, 0xd3, 0xc3, 0x9c, 0xd3, 0xce, 0xb5, 0xf8, - 0xa3, 0xa5, 0xc3, 0x02, 0x52, 0x39, 0xb8, 0x51, 0xe9, 0x84, 0x5c, 0x30, 0x4f, 0x7e, 0xc3, 0x88, - 0x41, 0x9f, 0xf0, 0xe4, 0x4b, 0xa6, 0x9d, 0x95, 0x33, 0x79, 0xe3, 0x9f, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x8f, 0x00, 0x63, 0xda, 0xe5, 0x0c, 0x00, 0x00, + // 1371 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xcf, 0x6f, 0x13, 0xc7, + 0x17, 0xcf, 0xda, 0x8e, 0xe3, 0xbc, 0xc4, 0xce, 0x32, 0xe4, 0x0b, 0x4b, 0x20, 0x4e, 0xf0, 0x97, + 0x2f, 0xca, 0x97, 0x82, 0x5d, 0x42, 0xa9, 0x44, 0x5b, 0xa9, 0x72, 0xe2, 0xa5, 0x2c, 0x4a, 0x63, + 0x77, 0x6d, 0x42, 0xe9, 0x65, 0x35, 0xf6, 0x0e, 0xce, 0x48, 0xde, 0x1d, 0x77, 0x67, 0x36, 0xe0, + 0x3f, 0xa1, 0x52, 0x0f, 0x1c, 0x7b, 0x6a, 0x7b, 0xec, 0xb1, 0x07, 0x4e, 0xfd, 0x0b, 0x38, 0x55, + 0x88, 0x4b, 0x7b, 0x29, 0xad, 0xe0, 0x50, 0x89, 0xbf, 0xa2, 0xda, 0xd9, 0x59, 0xdb, 0x71, 0x5c, + 0x25, 0x70, 0xb1,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x33, 0xad, + 0x08, 0x66, 0x4b, 0x94, 0xad, 0x4b, 0xe6, 0x98, 0x04, 0x55, 0x61, 0x81, 0x87, 0x6d, 0x8f, 0x0a, + 0x27, 0x6a, 0x39, 0x63, 0x56, 0x9a, 0x59, 0x39, 0x12, 0x7d, 0x2b, 0xe9, 0xc7, 0xad, 0xcc, 0x93, + 0x3f, 0xd7, 0x34, 0x1b, 0x62, 0x52, 0x24, 0x46, 0x77, 0x41, 0x57, 0x59, 0x76, 0x88, 0xef, 0xc6, + 0x76, 0xb2, 0x27, 0xb4, 0x53, 0x50, 0x4c, 0xd3, 0x77, 0xa5, 0x2d, 0x0b, 0xf2, 0x82, 0x09, 0xdc, + 0x73, 0x94, 0xdc, 0x98, 0x7b, 0x8b, 0x5a, 0x2d, 0x4a, 0x6a, 0xd2, 0x48, 0x3b, 0x70, 0xea, 0x80, + 0x09, 0xea, 0x77, 0x1d, 0x2e, 0x70, 0xa0, 0xee, 0x97, 0x3b, 0x61, 0x5c, 0x4b, 0x31, 0xb5, 0x19, + 0x31, 0x65, 0x60, 0x77, 0x40, 0x89, 0x46, 0x77, 0x9c, 0x3f, 0xa1, 0xad, 0x7c, 0x4c, 0x4c, 0xae, + 0xb8, 0x12, 0x35, 0x8b, 0xc0, 0x2e, 0x16, 0xd8, 0x80, 0xa8, 0x7d, 0xed, 0xe1, 0x19, 0x2d, 0xc3, + 0xac, 0xa0, 0xa2, 0x47, 0x8c, 0x05, 0xa9, 0x88, 0x0f, 0xc8, 0x80, 0x39, 0x1e, 0x7a, 0x1e, 0x0e, + 0x06, 0xc6, 0xa2, 0x94, 0x27, 0x47, 0xf4, 0x01, 0xe4, 0xe2, 0xc9, 0x20, 0x81, 0x91, 0x3f, 0x66, + 0x14, 0x86, 0x48, 0x74, 0x01, 0xe6, 0xc9, 0xe3, 0x3e, 0x71, 0xa9, 0x20, 0xae, 0x51, 0x58, 0xd7, + 0x36, 0x72, 0xf6, 0x48, 0x80, 0xfe, 0x0b, 0xf9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, } func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { diff --git a/custom/gov/types/v2lunc1/params.go b/custom/gov/types/v2lunc1/params.go index 1140dba6..510bf03f 100644 --- a/custom/gov/types/v2lunc1/params.go +++ b/custom/gov/types/v2lunc1/params.go @@ -16,7 +16,7 @@ import ( // Default governance params var ( - DefaultMinUusdDepositTokens = sdk.NewInt(500000000) // Minimal uusd deposit for a proposal to enter voting period + DefaultMinUusdDepositTokens = sdk.NewInt(500_000_000) // Minimal uusd deposit for a proposal to enter voting period ) var _ sdk.Msg = &MsgUpdateParams{} diff --git a/proto/terra/gov/v2lunc1/gov.proto b/proto/terra/gov/v2lunc1/gov.proto index b69ce5b4..8216db8d 100644 --- a/proto/terra/gov/v2lunc1/gov.proto +++ b/proto/terra/gov/v2lunc1/gov.proto @@ -3,9 +3,9 @@ package terra.gov.v2lunc1; import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; +import "google/protobuf/timestamp.proto"; import "google/protobuf/duration.proto"; import "cosmos_proto/cosmos.proto"; -import "google/protobuf/timestamp.proto"; import "google/protobuf/any.proto"; import "amino/amino.proto"; From 9e52573f05d37d945b78a0e8633a693d5b1e6cbe Mon Sep 17 00:00:00 2001 From: tusoict Date: Mon, 28 Oct 2024 06:46:18 +0700 Subject: [PATCH 40/60] revert register distribution codec add get min-deposit if get min deposit not exists --- app/app.go | 2 +- custom/distribution/types/codec.go | 3 +++ custom/gov/keeper/deposit.go | 3 +++ custom/gov/types/v2lunc1/codec.go | 10 +++++++ custom/gov/types/v2lunc1/gov.pb.go | 1 - proto/terra/gov/v2lunc1/gov.proto | 2 -- scripts/gov_test/test-submit-proposal.sh | 14 ---------- .../test-upgrade-and-submit-proposal.sh | 27 +++++++++++++++++++ 8 files changed, 44 insertions(+), 18 deletions(-) delete mode 100755 scripts/gov_test/test-submit-proposal.sh create mode 100755 scripts/gov_test/test-upgrade-and-submit-proposal.sh diff --git a/app/app.go b/app/app.go index b46498da..d24d4c28 100644 --- a/app/app.go +++ b/app/app.go @@ -58,7 +58,7 @@ import ( v8_1 "github.com/classic-terra/core/v3/app/upgrades/v8_1" v8_2 "github.com/classic-terra/core/v3/app/upgrades/v8_2" v8_3 "github.com/classic-terra/core/v3/app/upgrades/v8_3" - "github.com/classic-terra/core/v3/app/upgrades/v8_4" + v8_4 "github.com/classic-terra/core/v3/app/upgrades/v8_4" customante "github.com/classic-terra/core/v3/custom/auth/ante" custompost "github.com/classic-terra/core/v3/custom/auth/post" diff --git a/custom/distribution/types/codec.go b/custom/distribution/types/codec.go index 6672264a..0e2e8ba5 100644 --- a/custom/distribution/types/codec.go +++ b/custom/distribution/types/codec.go @@ -5,6 +5,8 @@ import ( "github.com/cosmos/cosmos-sdk/codec/legacy" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/x/distribution/types" + + govtypes "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" ) // RegisterLegacyAminoCodec registers the necessary x/distribution interfaces and concrete types @@ -29,4 +31,5 @@ func init() { cryptocodec.RegisterCrypto(amino) amino.Seal() + govtypes.RegisterProposalTypeCodec(types.CommunityPoolSpendProposal{}, "distribution/CommunityPoolSpendProposal") } diff --git a/custom/gov/keeper/deposit.go b/custom/gov/keeper/deposit.go index df1dad37..b1f635b0 100644 --- a/custom/gov/keeper/deposit.go +++ b/custom/gov/keeper/deposit.go @@ -39,6 +39,9 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd // HandleCheckLimitDeposit minDeposit := keeper.GetParams(ctx).MinDeposit requiredAmount := keeper.GetDepositLimitBaseUusd(ctx, proposalID) + if requiredAmount.IsZero() { + requiredAmount = minDeposit[0].Amount + } // Should not set like this requiredDepositCoins := sdk.NewCoins( diff --git a/custom/gov/types/v2lunc1/codec.go b/custom/gov/types/v2lunc1/codec.go index 872580b8..c0be11bd 100644 --- a/custom/gov/types/v2lunc1/codec.go +++ b/custom/gov/types/v2lunc1/codec.go @@ -34,6 +34,16 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } +// RegisterProposalTypeCodec registers an external proposal content type defined +// in another module for the internal ModuleCdc. This allows the MsgSubmitProposal +// to be correctly Amino encoded and decoded. +// +// NOTE: This should only be used for applications that are still using a concrete +// Amino codec for serialization. +func RegisterProposalTypeCodec(o interface{}, name string) { + amino.RegisterConcrete(o, name, nil) +} + var ( amino = codec.NewLegacyAmino() diff --git a/custom/gov/types/v2lunc1/gov.pb.go b/custom/gov/types/v2lunc1/gov.pb.go index ebdb3b04..eb8887c1 100644 --- a/custom/gov/types/v2lunc1/gov.pb.go +++ b/custom/gov/types/v2lunc1/gov.pb.go @@ -752,7 +752,6 @@ func (m *TallyParams) GetVetoThreshold() string { // // Since: cosmos-sdk 0.47 type Params struct { - // Deprecated: min_deposit is deprecated and replaced by the min_uusd_deposit // Minimum deposit for a proposal to enter voting period. MinDeposit []types.Coin `protobuf:"bytes,1,rep,name=min_deposit,json=minDeposit,proto3" json:"min_deposit"` // Maximum period for Atom holders to deposit on a proposal. Initial value: 2 diff --git a/proto/terra/gov/v2lunc1/gov.proto b/proto/terra/gov/v2lunc1/gov.proto index 8216db8d..092f73f0 100644 --- a/proto/terra/gov/v2lunc1/gov.proto +++ b/proto/terra/gov/v2lunc1/gov.proto @@ -168,8 +168,6 @@ message TallyParams { // // Since: cosmos-sdk 0.47 message Params { - - // Deprecated: min_deposit is deprecated and replaced by the min_uusd_deposit // Minimum deposit for a proposal to enter voting period. repeated cosmos.base.v1beta1.Coin min_deposit = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; diff --git a/scripts/gov_test/test-submit-proposal.sh b/scripts/gov_test/test-submit-proposal.sh deleted file mode 100755 index e93448a4..00000000 --- a/scripts/gov_test/test-submit-proposal.sh +++ /dev/null @@ -1,14 +0,0 @@ -HOME_DIR=mytestnet -./build/terrad tx gov submit-proposal ./scripts/gov_test/draft_proposal.json --from test0 --home mytestnet --keyring-backend test -y - -./build/terrad tx gov deposit 6 "682221290668uluna" --from test1 --home mytestnet --keyring-backend test -y -./build/terrad tx gov deposit 6 "1uluna" --from test1 --home mytestnet --keyring-backend test -y -./build/terrad tx gov vote 6 yes --from test0 --home mytestnet --keyring-backend test -y -./build/terrad tx gov vote 6 yes --from test1 --home mytestnet --keyring-backend test -y -./build/terrad tx gov vote 6 yes --from test2 --home mytestnet --keyring-backend test -y -./build/terrad q gov proposal 6 -./build/terrad q gov min-deposit 6 - -564467876133 -582221290668 -56568876134 \ No newline at end of file diff --git a/scripts/gov_test/test-upgrade-and-submit-proposal.sh b/scripts/gov_test/test-upgrade-and-submit-proposal.sh new file mode 100755 index 00000000..11786008 --- /dev/null +++ b/scripts/gov_test/test-upgrade-and-submit-proposal.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Step 1: Run old chain --> Sub Proposal Upgrade (soft-upgrade) +# Step 2: Vote --> Proposal Passed +# Step 3: Stop old chain --> Switch new code --> Build --> Run new chain +# Step 4: Test Submit Proposal New Flow with MinUusd Deposit + + +HOME_DIR=mytestnet + +./build/terrad tx gov submit-legacy-proposal software-upgrade v8_4 --upgrade-height 20 --upgrade-info v8_4 --title "upgrade" --description "upgrade" --no-validate --deposit "100000000uluna" --from test0 --keyring-backend test --home mytestnet -y + +./build/terrad tx gov vote 1 yes --from test0 --home mytestnet --keyring-backend test -y +./build/terrad tx gov vote 1 yes --from test1 --home mytestnet --keyring-backend test -y +./build/terrad tx gov vote 1 yes --from test2 --home mytestnet --keyring-backend test -y + +./build/terrad q gov proposal 1 + +./build/terrad tx gov submit-proposal ./scripts/gov_test/draft_proposal.json --from test0 --home mytestnet --keyring-backend test -y + +./build/terrad tx gov deposit 6 "682221290668uluna" --from test1 --home mytestnet --keyring-backend test -y +./build/terrad tx gov deposit 6 "1uluna" --from test1 --home mytestnet --keyring-backend test -y +./build/terrad tx gov vote 6 yes --from test0 --home mytestnet --keyring-backend test -y +./build/terrad tx gov vote 6 yes --from test1 --home mytestnet --keyring-backend test -y +./build/terrad tx gov vote 6 yes --from test2 --home mytestnet --keyring-backend test -y +./build/terrad q gov proposal 6 +./build/terrad q gov min-deposit 6 From 6e0cf5ed8b45073fdb4b2df99d7c545d41647ceb Mon Sep 17 00:00:00 2001 From: tusoict Date: Mon, 28 Oct 2024 06:46:51 +0700 Subject: [PATCH 41/60] update scripts, logic get min deposit --- custom/gov/keeper/grpc_query.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/custom/gov/keeper/grpc_query.go b/custom/gov/keeper/grpc_query.go index 7597ca1b..1b8003eb 100644 --- a/custom/gov/keeper/grpc_query.go +++ b/custom/gov/keeper/grpc_query.go @@ -35,6 +35,12 @@ func (q queryServer) Params(ctx context.Context, _ *v2lunc1.QueryParamsRequest) func (q queryServer) ProposalMinimalLUNCByUusd(ctx context.Context, req *v2lunc1.QueryProposalRequest) (*v2lunc1.QueryMinimalDepositProposalResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) depositAmount := q.k.GetDepositLimitBaseUusd(sdkCtx, req.ProposalId) + coin := sdk.NewCoin(core.MicroLunaDenom, depositAmount) - return &v2lunc1.QueryMinimalDepositProposalResponse{MinimalDeposit: sdk.NewCoin(core.MicroLunaDenom, depositAmount)}, nil + // if no min deposit amount by uusd exists, return default min deposit amount + if depositAmount.IsZero() { + coin = q.k.GetParams(sdkCtx).MinDeposit[0] + } + + return &v2lunc1.QueryMinimalDepositProposalResponse{MinimalDeposit: coin}, nil } From a5ae5faee2c78cca96b7e47478f335db7562ea76 Mon Sep 17 00:00:00 2001 From: tusoict Date: Mon, 28 Oct 2024 07:24:18 +0700 Subject: [PATCH 42/60] added script for intergration testing --- scripts/run-node.sh | 4 +++- scripts/vote.sh | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 scripts/vote.sh diff --git a/scripts/run-node.sh b/scripts/run-node.sh index 30243cac..da15a152 100755 --- a/scripts/run-node.sh +++ b/scripts/run-node.sh @@ -62,7 +62,9 @@ $BINARY add-genesis-account $KEY1 "1000000000000${DENOM}" --keyring-backend $KEY $BINARY add-genesis-account $KEY2 "1000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME_DIR update_test_genesis '.app_state["mint"]["params"]["mint_denom"]="'$DENOM'"' -update_test_genesis '.app_state["gov"]["deposit_params"]["min_deposit"]=[{"denom":"'$DENOM'","amount": "1000000"}]' +update_test_genesis '.app_state["gov"]["params"]["min_deposit"]=[{"denom":"'$DENOM'","amount": "1000000"}]' +update_test_genesis '.app_state["gov"]["params"]["min_uusd_deposit"]={"denom":"uusd","amount": "500000000"}' +update_test_genesis '.app_state["oracle"]["params"]["vote_period"]=5' update_test_genesis '.app_state["crisis"]["constant_fee"]={"denom":"'$DENOM'","amount":"1000"}' update_test_genesis '.app_state["staking"]["params"]["bond_denom"]="'$DENOM'"' diff --git a/scripts/vote.sh b/scripts/vote.sh new file mode 100644 index 00000000..77823960 --- /dev/null +++ b/scripts/vote.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +while true +do + # Your script logic here + echo "Running script..." + + ./build/terrad tx oracle aggregate-prevote 1234 0.1uusd --from test0 --chain-id localterra --home mytestnet --keyring-backend test -y + sleep 20 + echo "Aggregating vote" + ./build/terrad tx oracle aggregate-vote 1234 0.1uusd $(./build/terrad q staking validators --output json | jq -r '.validators[0].operator_address') --from test0 --chain-id localterra --home mytestnet --keyring-backend test -y + sleep 10 + echo "Done" +done From 68f6d12437e2a9bbe4564f2709e376a55ef0258f Mon Sep 17 00:00:00 2001 From: tusoict Date: Mon, 28 Oct 2024 07:24:55 +0700 Subject: [PATCH 43/60] review and clean code --- custom/gov/client/cli/query.go | 3 ++- custom/gov/keeper/deposit.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/custom/gov/client/cli/query.go b/custom/gov/client/cli/query.go index 24bd28a3..ccc22b53 100644 --- a/custom/gov/client/cli/query.go +++ b/custom/gov/client/cli/query.go @@ -27,6 +27,7 @@ func GetQueryCmd() *cobra.Command { } govQueryCmd.AddCommand( + GetCmdQueryCustomParams(), GetCmdQueryMinimalDeposit(), govcli.GetCmdQueryProposal(), govcli.GetCmdQueryProposals(), @@ -48,7 +49,7 @@ func GetCmdQueryMinimalDeposit() *cobra.Command { cmd := &cobra.Command{ Use: "min-deposit [proposal-id]", Args: cobra.ExactArgs(1), - Short: "Query minimal deposit by min uusd of a single proposal", + Short: "Query minimal deposit of a single proposal", Long: strings.TrimSpace( fmt.Sprintf(`Query minimal deposit for a proposal. You can find the proposal-id by running "%s query gov min-deposit [proposal-id]". diff --git a/custom/gov/keeper/deposit.go b/custom/gov/keeper/deposit.go index b1f635b0..88699030 100644 --- a/custom/gov/keeper/deposit.go +++ b/custom/gov/keeper/deposit.go @@ -100,7 +100,7 @@ func (keeper Keeper) validateInitialDeposit(ctx sdk.Context, initialDeposit sdk. return err } for i := range minDepositCoins { - minDepositCoins[i].Amount = sdk.NewDecFromInt(minDepositCoins[i].Amount).Mul(minInitialDepositRatio).RoundInt() + minDepositCoins[i].Amount = sdk.NewDecFromInt(minDepositCoins[i].Amount).Mul(minInitialDepositRatio).TruncateInt() } if !initialDeposit.IsAllGTE(minDepositCoins) { return sdkerrors.Wrapf(types.ErrMinDepositTooSmall, "was (%s), need (%s)", initialDeposit, minDepositCoins) From 36a1f6e7303654ec299827f7986373d11b172fc5 Mon Sep 17 00:00:00 2001 From: tusoict Date: Mon, 28 Oct 2024 07:36:19 +0700 Subject: [PATCH 44/60] added README.md for custom gov module --- blvlabs_note.md | 48 ------------- custom/gov/README.md | 160 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 160 insertions(+), 48 deletions(-) delete mode 100644 blvlabs_note.md create mode 100644 custom/gov/README.md diff --git a/blvlabs_note.md b/blvlabs_note.md deleted file mode 100644 index 68a7ce9b..00000000 --- a/blvlabs_note.md +++ /dev/null @@ -1,48 +0,0 @@ -Proposal to improve the Gov Module Mechanism by BLV Labs (KYCed) - -Enhancing the Oracle Module to Optimize the Calculation of Minimum Deposit for Proposals in the Gov Module -Problem: -As we know, the cryptocurrency market is always very volatile with large fluctuations, and so is #lunc, the price can also fluctuate with large amplitude, falling sharply or rising sharply - -In the current gov module logic, when creating a proposal, the creator will have to deposit #lunc (5 million lunc) first to push the proposal to the voting stage. So what will happen if the lunc price drops sharply? or rises sharply? This leads to the value of the proposal is not guaranteed. When the price is too small, it can lead to bad guys being able to spam many proposals online. - -So we decided to propose an improvement to the gov module to fix this problem: - -Objective: -Use Oracle module to update and calculate the minimum deposit required to create a proposal in the Gov module. - -In the event of a sharp drop or spike in LUNC price, the system will automatically increase the minimum margin to ensure the value of the proposal is maintained. - -The proposal value is kept at $500 (as suggested by the community), which will change the required lunc amount. - -Benefit: -This ensures that the required margin amount remains stable, unaffected by market price fluctuations, thus helping the network operate stably without being affected by price changes. - -Additionally, this mechanism prevents the network from being spammed with proposals if the LUNC price drops too low, which could allow bad actors to flood the network with spam proposals. - -Updated (28/8/2024) -After a quick check of v0.50, we decided to implement the logic as v0.50’s Canceling gov Proposal logic this helps avoid any conflicts if upgrading to v0.50 - -Updated (16/9/2024) -After listening to feedback from the community and validators, we have updated our proposal: - -Focus on feature #1: Enhancing the Oracle Module to Optimize the Calculation of Minimum Deposit for Proposals in the Gov Module - -Remove features #2 & #3, as this feature has been developed on SDK v.0.50 - -In the first proposal, we want to focus on small improvements and will complete well to demonstrate the team’s capabilities, as we are a new team on the Lunc Ecosystem We will continue to propose more complex improvements and features in the next proposals after completing this first proposal - -We hope that the community will trust and support us with the common goal of Lunc blockchain continuing to develop. - -Development Plan -Phase 1: Complete Enhancement 1 (*) -Research and delve into the Oracle and Gov modules. -Add supplementary API logic to the Oracle module to determine the price of LUNC. -Use the Oracle module API to add the minimum deposit calculation mechanism in the Gov module. -Complete the feature. -Conduct testing and write documentation. -Estimated Time: 4 weeks - -Timeline: 4 weeks -Total Budget: $5,000 -NOTED: This is a text proposal, not a community spend. We will put another proposal up for funding once we complete the work listed above. \ No newline at end of file diff --git a/custom/gov/README.md b/custom/gov/README.md new file mode 100644 index 00000000..055a4bf0 --- /dev/null +++ b/custom/gov/README.md @@ -0,0 +1,160 @@ +--- +sidebar_position: 1 +--- + +# `x/gov` +# Custom Governace Module Updates + +## Concepts + +*Disclaimer: This is work in progress. Mechanisms are susceptible to change.* + +The governance process is divided in a few steps that are outlined below: +* **Proposal submission:** Proposal is submitted to the blockchain with a + deposit. +* **Vote:** When the deposit for a proposal reaches a minimum threshold equivalent to + 500 USD (`MinUusdDeposit`), proposal is confirmed and vote opens. +* **Execution** After a period of time, the votes are tallied and depending + on the result, the messages in the proposal will be executed. +### Proposal submission + +#### Right to submit a proposal + +Every account can submit proposals by sending a `MsgSubmitProposal` transaction. +Once a proposal is submitted, it is identified by its unique `proposalID`. +#### Proposal Messages + +A proposal includes an array of `sdk.Msg`s which are executed automatically if the +proposal passes. The messages are executed by the governance `ModuleAccount` itself. Modules +such as `x/upgrade`, that want to allow certain messages to be executed by governance +only should add a whitelist within the respective msg server, granting the governance +module the right to execute the message once a quorum has been reached. The governance +module uses the `MsgServiceRouter` to check that these messages are correctly constructed +and have a respective path to execute on but do not perform a full validity check. +### Deposit + +To prevent spam, proposals must be submitted with a deposit in the coins defined by the equation `luncMinDepositAmountBasedOnUusd` = `MinUusdDeposit` / real-time price of LUNC at the time of proposal submission. +```keeper reference +github.com/classic-terra/core/v3/custom/gov/keeper/proposal.go#L136-L149 +``` +The value of `luncMinDepositAmountBasedOnUusd` will be stored in KVStores, using a key defined as `UUSDMinKeyPrefix|proposalID`, where the proposal ID is appended to the prefix, represented as a single byte. +```types reference +github.com/classic-terra/core/v3/custom/gov/types/keys.go#L20-L22 +``` + +When a proposal is submitted, it has to be accompanied with a deposit that must be +strictly positive, but can be inferior to `luncMinDepositAmountBasedOnUusd`. The submitter doesn't need +to pay for the entire deposit on their own. The newly created proposal is stored in +an *inactive proposal queue* and stays there until its deposit passes the `luncMinDepositAmountBasedOnUusd`. +Other token holders can increase the proposal's deposit by sending a `Deposit` +transaction. If a proposal doesn't pass the `luncMinDepositAmountBasedOnUusd` before the deposit end time +(the time when deposits are no longer accepted), the proposal will be destroyed: the +proposal will be removed from state and the deposit will be burned (see x/gov `EndBlocker`). +When a proposal deposit passes the `luncMinDepositAmountBasedOnUusd` threshold (even during the proposal +submission) before the deposit end time, the proposal will be moved into the +*active proposal queue* and the voting period will begin. + +The deposit is kept in escrow and held by the governance `ModuleAccount` until the +proposal is finalized (passed or rejected). +#### Deposit refund and burn + +When a proposal is finalized, the coins from the deposit are either refunded or burned +according to the final tally of the proposal: + +* If the proposal is approved or rejected but *not* vetoed, each deposit will be + automatically refunded to its respective depositor (transferred from the governance + `ModuleAccount`). +* When the proposal is vetoed with greater than 1/3, deposits will be burned from the + governance `ModuleAccount` and the proposal information along with its deposit + information will be removed from state. +* All refunded or burned deposits are removed from the state. Events are issued when + burning or refunding a deposit. +### Vote + +#### Voting period + +Once a proposal reaches `luncMinDepositAmountBasedOnUusd`, it immediately enters `Voting period`. We +define `Voting period` as the interval between the moment the vote opens and +the moment the vote closes. `Voting period` should always be shorter than +`Unbonding period` to prevent double voting. The initial value of +`Voting period` is 2 weeks. + +## Stores + +:::note +Stores are KVStores in the multi-store. The key to find the store is the first parameter in the list +::: +We will use one KVStore `Governance` to store five mappings: + +* A mapping from `proposalID|'proposal'` to `Proposal`. +* A mapping from `proposalID|'addresses'|address` to `Vote`. This mapping allows + us to query all addresses that voted on the proposal along with their vote by + doing a range query on `proposalID:addresses`. +* A mapping from `ParamsKey|'Params'` to `Params`. This map allows to query all + x/gov params. +* A mapping from `VotingPeriodProposalKeyPrefix|proposalID` to a single byte. This allows + us to know if a proposal is in the voting period or not with very low gas cost. +* A mapping from `UUSDMinKeyPrefix|proposalID` to a single byte. This allows us to determine the minimum amount of LUNC that a specific proposal must deposit to pass the deposit phase. + +For pseudocode purposes, here are the two function we will use to read or write in stores: + +* `load(StoreKey, Key)`: Retrieve item stored at key `Key` in store found at key `StoreKey` in the multistore +* `store(StoreKey, Key, value)`: Write value `Value` at key `Key` in store found at key `StoreKey` in the multistore + +## Parameters + +The governance module contains the following parameters: + +| Key | Type | Example | +|-------------------------------|------------------|-----------------------------------------| +| min_deposit | array (coins) | [{"denom":"uatom","amount":"10000000"}] | +| max_deposit_period | string (time ns) | "172800000000000" (17280s) | +| voting_period | string (time ns) | "172800000000000" (17280s) | +| quorum | string (dec) | "0.334000000000000000" | +| threshold | string (dec) | "0.500000000000000000" | +| veto | string (dec) | "0.334000000000000000" | +| burn_proposal_deposit_prevote | bool | false | +| burn_vote_quorum | bool | false | +| burn_vote_veto | bool | true | +| min_uusd_deposit | coins |{"denom":"uusd","amount":"500000"} | +**NOTE**: +Aiming to establish a clearer and more consistent minimum deposit requirement for governance proposals, the default value of `min_uusd_deposit` is currently set to 500 USD. However, this value can be updated by the community in the future. This approach allows the module to adapt to fluctuations in the value of LUNC over time, ensuring a consistent threshold for proposals. + +## Client + +### CLI + +A user can query and interact with the `gov` module using the CLI. +We have added two new commands + +##### MinimalDeposit +The `MinimalDeposit` command enables users to query the minimum LUNC deposit required for a specific proposal, calculated based on the UUSD value. + + +```bash +terrad q gov min-deposit [proposal-id] +``` +Example: + +```bash +terrad q gov min-deposit 1 cosmos1.. +``` + +##### CustomParams +The `CustomParams` command allows users to query the custom parameters of the module. + + +```bash +terrad q gov custom-params +``` +Example: + +```bash +terrad q gov custom-params +``` +## Future Improvements +We have successfully upgraded the chain by increasing the consensus version to 5. Moving forward, + should the community require updates related to these matters, the BLV Team will be available to + assist with the implementation process. + +BlvLas proposal: https://commonwealth.im/terra-luna-classic-lunc/discussion/24630-proposal-to-improve-the-gov-module-mechanism-by-blv-labs From 3914bc8c47a923cd86bef87f653154ace40b2beb Mon Sep 17 00:00:00 2001 From: tusoict Date: Mon, 28 Oct 2024 11:59:36 +0700 Subject: [PATCH 45/60] revert register code from gov in others module --- custom/params/types/codec.go | 5 +++++ custom/upgrade/types/codec.go | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/custom/params/types/codec.go b/custom/params/types/codec.go index 1309a83c..5c4b5cea 100644 --- a/custom/params/types/codec.go +++ b/custom/params/types/codec.go @@ -1,6 +1,7 @@ package types import ( + govtypes "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/params/types/proposal" ) @@ -9,3 +10,7 @@ import ( func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&proposal.ParameterChangeProposal{}, "params/ParameterChangeProposal", nil) } + +func init() { + govtypes.RegisterProposalTypeCodec(&proposal.ParameterChangeProposal{}, "params/ParameterChangeProposal") +} diff --git a/custom/upgrade/types/codec.go b/custom/upgrade/types/codec.go index 8bb324a3..ac656c27 100644 --- a/custom/upgrade/types/codec.go +++ b/custom/upgrade/types/codec.go @@ -1,6 +1,7 @@ package types import ( + govtypes "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) @@ -11,3 +12,8 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&types.SoftwareUpgradeProposal{}, "upgrade/SoftwareUpgradeProposal", nil) cdc.RegisterConcrete(&types.CancelSoftwareUpgradeProposal{}, "upgrade/CancelSoftwareUpgradeProposal", nil) } + +func init() { + govtypes.RegisterProposalTypeCodec(&types.SoftwareUpgradeProposal{}, "upgrade/SoftwareUpgradeProposal") + govtypes.RegisterProposalTypeCodec(&types.CancelSoftwareUpgradeProposal{}, "upgrade/CancelSoftwareUpgradeProposal") +} From 603564094f0faf4da414551f10eff27cc99113ca Mon Sep 17 00:00:00 2001 From: tusoict Date: Mon, 28 Oct 2024 13:48:17 +0700 Subject: [PATCH 46/60] Review and clean code (if needed) --- x/oracle/keeper/msg_server.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/x/oracle/keeper/msg_server.go b/x/oracle/keeper/msg_server.go index 551ca464..a1a8d1eb 100644 --- a/x/oracle/keeper/msg_server.go +++ b/x/oracle/keeper/msg_server.go @@ -79,7 +79,7 @@ func (ms msgServer) AggregateExchangeRateVote(goCtx context.Context, msg *types. return nil, err } - // params := ms.GetParams(ctx) + params := ms.GetParams(ctx) aggregatePrevote, err := ms.GetAggregateExchangeRatePrevote(ctx, valAddr) if err != nil { @@ -87,9 +87,9 @@ func (ms msgServer) AggregateExchangeRateVote(goCtx context.Context, msg *types. } // Check a msg is submitted proper period - // if (uint64(ctx.BlockHeight())/params.VotePeriod)-(aggregatePrevote.SubmitBlock/params.VotePeriod) != 1 { - // return nil, types.ErrRevealPeriodMissMatch - // } + if (uint64(ctx.BlockHeight())/params.VotePeriod)-(aggregatePrevote.SubmitBlock/params.VotePeriod) != 1 { + return nil, types.ErrRevealPeriodMissMatch + } exchangeRateTuples, err := types.ParseExchangeRateTuples(msg.ExchangeRates) if err != nil { From bec6d63924ffd708ad1bf7a14e1378d40f9378fe Mon Sep 17 00:00:00 2001 From: tusoict Date: Mon, 28 Oct 2024 16:14:37 +0700 Subject: [PATCH 47/60] fixed checking rule: MinInitialDeposit in ante of auth module --- custom/auth/ante/min_initial_deposit.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/custom/auth/ante/min_initial_deposit.go b/custom/auth/ante/min_initial_deposit.go index 9a97fb04..12da97a8 100644 --- a/custom/auth/ante/min_initial_deposit.go +++ b/custom/auth/ante/min_initial_deposit.go @@ -4,13 +4,13 @@ import ( "fmt" errorsmod "cosmossdk.io/errors" + core "github.com/classic-terra/core/v3/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" customgovkeeper "github.com/classic-terra/core/v3/custom/gov/keeper" - core "github.com/classic-terra/core/v3/types" ) // MinInitialDeposit Decorator will check Initial Deposits for MsgSubmitProposal @@ -50,13 +50,11 @@ func HandleCheckMinInitialDeposit(ctx sdk.Context, msg sdk.Msg, govKeeper custom return fmt.Errorf("could not dereference msg as MsgSubmitProposal") } minLuncAmount, err := govKeeper.GetMinimumDepositBaseUusd(ctx) + minInitialDepositRatio := treasuryKeeper.GetMinInitialDepositRatio(ctx) if err == nil && minLuncAmount.GT(sdk.ZeroInt()) { - minLuncAmount = minLuncAmount.Mul(treasuryKeeper.GetMinInitialDepositRatio(ctx).TruncateInt()) - requiredDepositCoins := sdk.NewCoins( - sdk.NewCoin(core.MicroLunaDenom, minLuncAmount), - ) - + requiredDeposit := sdk.NewDecFromInt(minLuncAmount).Mul(minInitialDepositRatio).TruncateInt() + requiredDepositCoins := sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, requiredDeposit)) if initialDepositCoins.IsAllLT(requiredDepositCoins) { return fmt.Errorf("not enough initial deposit provided. Expected %q; got %q", requiredDepositCoins, initialDepositCoins) } From e957bfae497397409b5f16e87d6163b9c16daba6 Mon Sep 17 00:00:00 2001 From: tusoict Date: Mon, 28 Oct 2024 16:18:28 +0700 Subject: [PATCH 48/60] removed unused import in proto files --- proto/terra/gov/v2lunc1/genesis.proto | 4 ---- proto/terra/gov/v2lunc1/query.proto | 4 ---- 2 files changed, 8 deletions(-) diff --git a/proto/terra/gov/v2lunc1/genesis.proto b/proto/terra/gov/v2lunc1/genesis.proto index 9091aa59..5596e4d7 100644 --- a/proto/terra/gov/v2lunc1/genesis.proto +++ b/proto/terra/gov/v2lunc1/genesis.proto @@ -1,10 +1,6 @@ syntax = "proto3"; package terra.gov.v2lunc1; -import "cosmos/base/v1beta1/coin.proto"; -import "gogoproto/gogo.proto"; -import "google/protobuf/duration.proto"; -import "cosmos_proto/cosmos.proto"; import "terra/gov/v2lunc1/gov.proto"; import "cosmos/gov/v1/gov.proto"; diff --git a/proto/terra/gov/v2lunc1/query.proto b/proto/terra/gov/v2lunc1/query.proto index a3a82aba..592e8993 100644 --- a/proto/terra/gov/v2lunc1/query.proto +++ b/proto/terra/gov/v2lunc1/query.proto @@ -4,10 +4,6 @@ package terra.gov.v2lunc1; import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/any.proto"; -import "google/protobuf/duration.proto"; -import "cosmos_proto/cosmos.proto"; import "terra/gov/v2lunc1/gov.proto"; import "amino/amino.proto"; From a7ad120f9800c3012c4400813b71d5b1f877b20f Mon Sep 17 00:00:00 2001 From: tusoict Date: Mon, 28 Oct 2024 16:37:30 +0700 Subject: [PATCH 49/60] Fixed error (unknown field "min_uusd_deposit" in v1.Params) e2e test in init_test.go --- tests/e2e/initialization/config.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/e2e/initialization/config.go b/tests/e2e/initialization/config.go index 79a5bac5..8b7d4b91 100644 --- a/tests/e2e/initialization/config.go +++ b/tests/e2e/initialization/config.go @@ -19,7 +19,7 @@ import ( staketypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/gogo/protobuf/proto" - govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + govv2lunc1 "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" "github.com/classic-terra/core/v3/tests/e2e/util" treasurytypes "github.com/classic-terra/core/v3/x/treasury/types" @@ -246,7 +246,7 @@ func initGenesis(chain *internalChain, forkHeight int) error { return err } - err = updateModuleGenesis(appGenState, govtypes.ModuleName, &govv1.GenesisState{}, updateGovGenesis) + err = updateModuleGenesis(appGenState, govtypes.ModuleName, &govv2lunc1.GenesisState{}, updateGovGenesis) if err != nil { return err } @@ -312,7 +312,7 @@ func updateTreasuryGenesis(treasuryGenState *treasurytypes.GenesisState) { } } -func updateGovGenesis(govGenState *govv1.GenesisState) { +func updateGovGenesis(govGenState *govv2lunc1.GenesisState) { govGenState.Params.VotingPeriod = &OneMin govGenState.Params.Quorum = sdk.NewDecWithPrec(2, 1).String() govGenState.Params.MinDeposit = tenTerra From 6e3a28cd9878141cad1c0676e3fda90a35155953 Mon Sep 17 00:00:00 2001 From: tusoict Date: Mon, 28 Oct 2024 17:29:53 +0700 Subject: [PATCH 50/60] fixed bugs when build & Test / liveness-test in testnet.go --- cmd/terrad/testnet.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/terrad/testnet.go b/cmd/terrad/testnet.go index 46549397..f8e7d6b5 100644 --- a/cmd/terrad/testnet.go +++ b/cmd/terrad/testnet.go @@ -11,12 +11,12 @@ import ( "path/filepath" "time" + govv2lunc1 "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" tmconfig "github.com/cometbft/cometbft/config" tmos "github.com/cometbft/cometbft/libs/os" tmrand "github.com/cometbft/cometbft/libs/rand" "github.com/cometbft/cometbft/types" tmtime "github.com/cometbft/cometbft/types/time" - govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" @@ -309,7 +309,7 @@ func initGenFiles( appGenState[banktypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(&bankGenState) // set gov in the genesis state - var govGenState govv1.GenesisState + var govGenState govv2lunc1.GenesisState clientCtx.Codec.MustUnmarshalJSON(appGenState[govtypes.ModuleName], &govGenState) votingPeriod := time.Minute * 3 govGenState.Params.VotingPeriod = &votingPeriod From 30c7ccc5d0ce303e8897ccf9b8b2729e5bcf2bdf Mon Sep 17 00:00:00 2001 From: ntluongdev95 Date: Wed, 30 Oct 2024 10:28:28 +0700 Subject: [PATCH 51/60] fixed golangci-lint-Related Bugs --- app/modules.go | 6 +- custom/gov/client/cli/init_test.go | 60 +++++++-------- custom/gov/client/cli/query.go | 2 +- custom/gov/client/cli/query_test.go | 67 +++++++++-------- custom/gov/client/cli/util.go | 100 ++++++++++++------------- custom/gov/keeper/deposit_test.go | 5 +- custom/gov/keeper/grpc_query.go | 3 +- custom/gov/keeper/grpc_query_test.go | 78 +++++++++---------- custom/gov/keeper/migrator.go | 4 +- custom/gov/keeper/migrator_test.go | 38 ++++------ custom/gov/keeper/msg_server_test.go | 78 +++++++++---------- custom/gov/keeper/proposal.go | 3 +- custom/gov/keeper/proposal_test.go | 1 - custom/gov/migrations/v5/store_test.go | 5 +- custom/gov/module.go | 8 +- custom/gov/types/v2lunc1/genesis.go | 26 +++---- 16 files changed, 235 insertions(+), 249 deletions(-) diff --git a/app/modules.go b/app/modules.go index 4f947226..3b4ed8dc 100644 --- a/app/modules.go +++ b/app/modules.go @@ -12,7 +12,7 @@ import ( customdistr "github.com/classic-terra/core/v3/custom/distribution" customevidence "github.com/classic-terra/core/v3/custom/evidence" customfeegrant "github.com/classic-terra/core/v3/custom/feegrant" - "github.com/classic-terra/core/v3/custom/gov" + // "github.com/classic-terra/core/v3/custom/gov" customgov "github.com/classic-terra/core/v3/custom/gov" custommint "github.com/classic-terra/core/v3/custom/mint" customparams "github.com/classic-terra/core/v3/custom/params" @@ -167,7 +167,7 @@ func appModules( bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), - gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.OracleKeeper, app.GetSubspace(govtypes.ModuleName)), + customgov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.OracleKeeper, app.GetSubspace(govtypes.ModuleName)), mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName)), distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), @@ -202,7 +202,7 @@ func simulationModules( custombank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), - gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.OracleKeeper, app.GetSubspace(govtypes.ModuleName)), + customgov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.OracleKeeper, app.GetSubspace(govtypes.ModuleName)), mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName)), distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), diff --git a/custom/gov/client/cli/init_test.go b/custom/gov/client/cli/init_test.go index a2a906b2..817e3bed 100644 --- a/custom/gov/client/cli/init_test.go +++ b/custom/gov/client/cli/init_test.go @@ -1,42 +1,42 @@ -package cli_test +package cli_test import ( - - "io" - "testing" - "github.com/stretchr/testify/suite" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/crypto/keyring" - testutilmod "github.com/cosmos/cosmos-sdk/types/module/testutil" - "github.com/cosmos/cosmos-sdk/x/gov" - // "github.com/cosmos/cosmos-sdk/x/gov/client/cli" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - rpcclientmock "github.com/cometbft/cometbft/rpc/client/mock" + "io" + "testing" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/crypto/keyring" + testutilmod "github.com/cosmos/cosmos-sdk/types/module/testutil" + "github.com/cosmos/cosmos-sdk/x/gov" + "github.com/stretchr/testify/suite" + // "github.com/cosmos/cosmos-sdk/x/gov/client/cli" + rpcclientmock "github.com/cometbft/cometbft/rpc/client/mock" + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" ) type CLITestSuite struct { - suite.Suite + suite.Suite - kr keyring.Keyring - encCfg testutilmod.TestEncodingConfig //This holds the encoding configuration, which is crucial for marshaling and unmarshaling data for transactions and messages. - baseCtx client.Context //This is a base context used for all operations in the test suite. + kr keyring.Keyring + encCfg testutilmod.TestEncodingConfig // This holds the encoding configuration, which is crucial for marshaling and unmarshaling data for transactions and messages. + baseCtx client.Context // This is a base context used for all operations in the test suite. } func TestCLITestSuite(t *testing.T) { - suite.Run(t, new(CLITestSuite)) + suite.Run(t, new(CLITestSuite)) } -//run once before any tests in the suite + +// run once before any tests in the suite func (s *CLITestSuite) SetupSuite() { - //It initializes the necessary components, such as the codec, which is used for marshaling and unmarshaling data. - s.encCfg = testutilmod.MakeTestEncodingConfig(gov.AppModuleBasic{}) - s.kr = keyring.NewInMemory(s.encCfg.Codec) - s.baseCtx = client.Context{}. - WithKeyring(s.kr). - WithTxConfig(s.encCfg.TxConfig). - WithCodec(s.encCfg.Codec). - WithClient(clitestutil.MockTendermintRPC{Client: rpcclientmock.Client{}}). - WithAccountRetriever(client.MockAccountRetriever{}). - WithOutput(io.Discard). - WithChainID("test-chain") + s.encCfg = testutilmod.MakeTestEncodingConfig(gov.AppModuleBasic{}) + s.kr = keyring.NewInMemory(s.encCfg.Codec) + s.baseCtx = client.Context{}. + WithKeyring(s.kr). + WithTxConfig(s.encCfg.TxConfig). + WithCodec(s.encCfg.Codec). + WithClient(clitestutil.MockTendermintRPC{Client: rpcclientmock.Client{}}). + WithAccountRetriever(client.MockAccountRetriever{}). + WithOutput(io.Discard). + WithChainID("test-chain") +} -} \ No newline at end of file diff --git a/custom/gov/client/cli/query.go b/custom/gov/client/cli/query.go index ccc22b53..0b4c1ea5 100644 --- a/custom/gov/client/cli/query.go +++ b/custom/gov/client/cli/query.go @@ -97,7 +97,7 @@ func GetCmdQueryCustomParams() *cobra.Command { Use: "custom-params", Args: cobra.NoArgs, Short: "Query custom params of module", - RunE: func(cmd *cobra.Command, args []string) error { + RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) if err != nil { return err diff --git a/custom/gov/client/cli/query_test.go b/custom/gov/client/cli/query_test.go index 91dd66e0..fefe9155 100644 --- a/custom/gov/client/cli/query_test.go +++ b/custom/gov/client/cli/query_test.go @@ -1,40 +1,41 @@ -package cli_test +package cli_test import ( - "fmt" - "strings" - v2lunc1cli "github.com/classic-terra/core/v3/custom/gov/client/cli" + "fmt" + "strings" + + v2lunc1cli "github.com/classic-terra/core/v3/custom/gov/client/cli" ) func (s *CLITestSuite) TestGetCmdQueryMinimalDeposit() { - testCases := []struct { - name string - args []string - expCmdOutput string - }{ - { - "proposal with id", - []string{ - "1", - }, - "1", - }, - { - "proposal with no id", - []string{ - "", - }, - "", - }, - } + testCases := []struct { + name string + args []string + expCmdOutput string + }{ + { + "proposal with id", + []string{ + "1", + }, + "1", + }, + { + "proposal with no id", + []string{ + "", + }, + "", + }, + } - for _, tc := range testCases { - tc := tc + for _, tc := range testCases { + tc := tc - s.Run(tc.name, func() { - cmd := v2lunc1cli.GetCmdQueryMinimalDeposit() - cmd.SetArgs(tc.args) - s.Require().Contains(fmt.Sprint(cmd), strings.TrimSpace(tc.expCmdOutput)) - }) - } -} \ No newline at end of file + s.Run(tc.name, func() { + cmd := v2lunc1cli.GetCmdQueryMinimalDeposit() + cmd.SetArgs(tc.args) + s.Require().Contains(fmt.Sprint(cmd), strings.TrimSpace(tc.expCmdOutput)) + }) + } +} diff --git a/custom/gov/client/cli/util.go b/custom/gov/client/cli/util.go index 736569c7..85076bcd 100644 --- a/custom/gov/client/cli/util.go +++ b/custom/gov/client/cli/util.go @@ -1,52 +1,52 @@ package cli -import ( - "encoding/json" - "os" - - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// proposal defines the new Msg-based proposal. -type proposal struct { - // Msgs defines an array of sdk.Msgs proto-JSON-encoded as Anys. - Messages []json.RawMessage `json:"messages,omitempty"` - Metadata string `json:"metadata"` - Deposit string `json:"deposit"` - Title string `json:"title"` - Summary string `json:"summary"` -} - -// parseSubmitProposal reads and parses the proposal. -func parseSubmitProposal(cdc codec.Codec, path string) ([]sdk.Msg, string, string, string, sdk.Coins, error) { - var proposal proposal - - contents, err := os.ReadFile(path) - if err != nil { - return nil, "", "", "", nil, err - } - - err = json.Unmarshal(contents, &proposal) - if err != nil { - return nil, "", "", "", nil, err - } - - msgs := make([]sdk.Msg, len(proposal.Messages)) - for i, anyJSON := range proposal.Messages { - var msg sdk.Msg - err := cdc.UnmarshalInterfaceJSON(anyJSON, &msg) - if err != nil { - return nil, "", "", "", nil, err - } - - msgs[i] = msg - } - - deposit, err := sdk.ParseCoinsNormalized(proposal.Deposit) - if err != nil { - return nil, "", "", "", nil, err - } - - return msgs, proposal.Metadata, proposal.Title, proposal.Summary, deposit, nil -} +// import ( +// "encoding/json" +// "os" + +// "github.com/cosmos/cosmos-sdk/codec" +// sdk "github.com/cosmos/cosmos-sdk/types" +// ) + +// // proposal defines the new Msg-based proposal. +// type proposal struct { +// // Msgs defines an array of sdk.Msgs proto-JSON-encoded as Anys. +// Messages []json.RawMessage `json:"messages,omitempty"` +// Metadata string `json:"metadata"` +// Deposit string `json:"deposit"` +// Title string `json:"title"` +// Summary string `json:"summary"` +// } + +// // parseSubmitProposal reads and parses the proposal. +// func parseSubmitProposal(cdc codec.Codec, path string) ([]sdk.Msg, string, string, string, sdk.Coins, error) { +// var proposal proposal + +// contents, err := os.ReadFile(path) +// if err != nil { +// return nil, "", "", "", nil, err +// } + +// err = json.Unmarshal(contents, &proposal) +// if err != nil { +// return nil, "", "", "", nil, err +// } + +// msgs := make([]sdk.Msg, len(proposal.Messages)) +// for i, anyJSON := range proposal.Messages { +// var msg sdk.Msg +// err := cdc.UnmarshalInterfaceJSON(anyJSON, &msg) +// if err != nil { +// return nil, "", "", "", nil, err +// } + +// msgs[i] = msg +// } + +// deposit, err := sdk.ParseCoinsNormalized(proposal.Deposit) +// if err != nil { +// return nil, "", "", "", nil, err +// } + +// return msgs, proposal.Metadata, proposal.Title, proposal.Summary, deposit, nil +// } diff --git a/custom/gov/keeper/deposit_test.go b/custom/gov/keeper/deposit_test.go index 794e9f4f..4455dcdc 100644 --- a/custom/gov/keeper/deposit_test.go +++ b/custom/gov/keeper/deposit_test.go @@ -64,7 +64,7 @@ func TestAddDeposits(t *testing.T) { require.True(t, sdk.NewCoins(proposal.TotalDeposit...).IsEqual(sdk.NewCoins())) // Check no deposits at beginning - deposit, found := govKeeper.GetDeposit(ctx, proposalID, addr1) + _, found := govKeeper.GetDeposit(ctx, proposalID, addr1) require.False(t, found) proposal, ok := govKeeper.GetProposal(ctx, proposalID) require.True(t, ok) @@ -74,7 +74,7 @@ func TestAddDeposits(t *testing.T) { votingStarted, err := govKeeper.AddDeposit(ctx, proposalID, addr1, amountDeposit1) require.NoError(t, err) require.False(t, votingStarted) - deposit, found = govKeeper.GetDeposit(ctx, proposalID, addr1) + deposit, found := govKeeper.GetDeposit(ctx, proposalID, addr1) require.True(t, found) require.Equal(t, amountDeposit1, sdk.NewCoins(deposit.Amount...)) require.Equal(t, addr1.String(), deposit.Depositor) @@ -233,7 +233,6 @@ func TestValidateInitialDeposit(t *testing.T) { for name, tc := range testcases { t.Run(name, func(t *testing.T) { - params := v2lunc1.DefaultParams() params.MinDeposit = tc.minDeposit params.MinInitialDepositRatio = sdk.NewDec(tc.minInitialDepositPercent).Quo(sdk.NewDec(100)).String() diff --git a/custom/gov/keeper/grpc_query.go b/custom/gov/keeper/grpc_query.go index 1b8003eb..2a80bad4 100644 --- a/custom/gov/keeper/grpc_query.go +++ b/custom/gov/keeper/grpc_query.go @@ -15,7 +15,8 @@ var _ v2lunc1.QueryServer = queryServer{} func NewQueryServerImpl(k Keeper) v2lunc1.QueryServer { return queryServer{ k: k, - govQueryServer: govkeeper.NewLegacyQueryServer(k.Keeper)} + govQueryServer: govkeeper.NewLegacyQueryServer(k.Keeper), + } } type queryServer struct { diff --git a/custom/gov/keeper/grpc_query_test.go b/custom/gov/keeper/grpc_query_test.go index 54a3f1da..af1c14a4 100644 --- a/custom/gov/keeper/grpc_query_test.go +++ b/custom/gov/keeper/grpc_query_test.go @@ -1,55 +1,55 @@ package keeper_test - - import ( - "context" - "testing" - "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" // Adjust the import path as necessary - "github.com/stretchr/testify/require" + "context" + "fmt" + "testing" + + "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" // Adjust the import path as necessary + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" ) // MockQueryServer is a mock implementation of the v2lunc1.QueryServer interface type MockQueryServer struct { - // You can store any state needed for the mock here - ProposalResponse *v2lunc1.QueryMinimalDepositProposalResponse - Err error + // You can store any state needed for the mock here + ProposalResponse *v2lunc1.QueryMinimalDepositProposalResponse + Err error } // ProposalMinimalLUNCByUusd implements the v2lunc1.QueryServer interface -func (m *MockQueryServer) ProposalMinimalLUNCByUusd(ctx context.Context, req *v2lunc1.QueryProposalRequest) (*v2lunc1.QueryMinimalDepositProposalResponse, error) { - if m.Err != nil { - return nil, m.Err - } - return m.ProposalResponse, nil +func (m *MockQueryServer) ProposalMinimalLUNCByUusd(_ context.Context, _ *v2lunc1.QueryProposalRequest) (*v2lunc1.QueryMinimalDepositProposalResponse, error) { + if m.Err != nil { + return nil, m.Err + } + return m.ProposalResponse, nil } // Test your keeper logic with the mock func TestKeeperWithMockQueryServer(t *testing.T) { -mockQueryServer := &MockQueryServer{ - ProposalResponse: &v2lunc1.QueryMinimalDepositProposalResponse{ - //MinimalDeposit: sdk.Coin{sdk.NewCoin("uusd", sdk.NewInt(1000))}, - MinimalDeposit: sdk.NewCoin("uusd", sdk.NewInt(1000)), - }, + mockQueryServer := &MockQueryServer{ + ProposalResponse: &v2lunc1.QueryMinimalDepositProposalResponse{ + // MinimalDeposit: sdk.Coin{sdk.NewCoin("uusd", sdk.NewInt(1000))}, + MinimalDeposit: sdk.NewCoin("uusd", sdk.NewInt(1000)), + }, + } + + // Create your context and other setup logic as needed + + t.Run("successful query", func(t *testing.T) { + req := &v2lunc1.QueryProposalRequest{ProposalId: 1} + res, err := mockQueryServer.ProposalMinimalLUNCByUusd(context.Background(), req) + require.NoError(t, err) + require.NotNil(t, res) + require.Equal(t, sdk.NewInt(1000), res.MinimalDeposit.Amount) + }) + + t.Run("error when querying proposal", func(t *testing.T) { + mockQueryServer.Err = fmt.Errorf("proposal not found") + req := &v2lunc1.QueryProposalRequest{ProposalId: 1} + _, err := mockQueryServer.ProposalMinimalLUNCByUusd(context.Background(), req) + require.Error(t, err) + require.Equal(t, "proposal not found", err.Error()) + }) } - // Create your context and other setup logic as needed - - t.Run("successful query", func(t *testing.T) { - req := &v2lunc1.QueryProposalRequest{ProposalId: 1} - res, err := mockQueryServer.ProposalMinimalLUNCByUusd(context.Background(), req) - require.NoError(t, err) - require.NotNil(t, res) - require.Equal(t, sdk.NewInt(1000), res.MinimalDeposit.Amount) - }) - - t.Run("error when querying proposal", func(t *testing.T) { - mockQueryServer.Err = fmt.Errorf("proposal not found") - req := &v2lunc1.QueryProposalRequest{ProposalId: 1} - _, err := mockQueryServer.ProposalMinimalLUNCByUusd(context.Background(), req) - require.Error(t, err) - require.Equal(t, "proposal not found", err.Error()) - }) -} diff --git a/custom/gov/keeper/migrator.go b/custom/gov/keeper/migrator.go index 78921c53..e0e00a6c 100644 --- a/custom/gov/keeper/migrator.go +++ b/custom/gov/keeper/migrator.go @@ -1,12 +1,12 @@ package keeper import ( + v5 "github.com/classic-terra/core/v3/custom/gov/migrations/v5" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/exported" v2 "github.com/cosmos/cosmos-sdk/x/gov/migrations/v2" v3 "github.com/cosmos/cosmos-sdk/x/gov/migrations/v3" v4 "github.com/cosmos/cosmos-sdk/x/gov/migrations/v4" - v5 "github.com/classic-terra/core/v3/custom/gov/migrations/v5" ) // Migrator is a struct for handling in-place store migrations. @@ -41,4 +41,4 @@ func (m Migrator) Migrate3to4(ctx sdk.Context) error { // Migrate4to5 migrates from version 4 to 5. func (m Migrator) Migrate4to5(ctx sdk.Context) error { return v5.MigrateStore(ctx, m.keeper.storeKey, m.keeper.cdc) -} \ No newline at end of file +} diff --git a/custom/gov/keeper/migrator_test.go b/custom/gov/keeper/migrator_test.go index a3cfda3b..e6f046b0 100644 --- a/custom/gov/keeper/migrator_test.go +++ b/custom/gov/keeper/migrator_test.go @@ -3,38 +3,32 @@ package keeper_test import ( "testing" - //"github.com/cosmos/cosmos-sdk/x/gov/exported" + // "github.com/cosmos/cosmos-sdk/x/gov/exported" sdk "github.com/cosmos/cosmos-sdk/types" - //"github.com/cosmos/cosmos-sdk/x/gov/keeper" - "github.com/classic-terra/core/v3/custom/gov/keeper" + // "github.com/cosmos/cosmos-sdk/x/gov/keeper" + "github.com/classic-terra/core/v3/custom/gov/keeper" "github.com/stretchr/testify/require" - ) // MockParamSubspace is a mock implementation of ParamSubspace for testing. type MockParamSubspace struct{} - // Satisfy the ParamSubspace interface by adding dummy methods. -func (m MockParamSubspace) Get(ctx sdk.Context, key []byte, ptr interface{}) {} - +func (m MockParamSubspace) Get(_ sdk.Context, _ []byte, _ interface{}) {} // TestNewMigrator tests the NewMigrator constructor func TestNewMigrator(t *testing.T) { - - - // Create a keeper - mockKeeper := &keeper.Keeper{} - // mockKeeper := &keeper.Keeper{} - t.Logf("mockKeeper: %v", mockKeeper) - - // Use the mock ParamSubspace - mockSubspace := MockParamSubspace{} - t.Logf("mockSubspace: %v", mockSubspace) - - migrator := keeper.NewMigrator(mockKeeper, mockSubspace) - require.NotNil(t, migrator) - } - + // Create a keeper + mockKeeper := &keeper.Keeper{} + // mockKeeper := &keeper.Keeper{} + t.Logf("mockKeeper: %v", mockKeeper) + + // Use the mock ParamSubspace + mockSubspace := MockParamSubspace{} + t.Logf("mockSubspace: %v", mockSubspace) + + migrator := keeper.NewMigrator(mockKeeper, mockSubspace) + require.NotNil(t, migrator) +} diff --git a/custom/gov/keeper/msg_server_test.go b/custom/gov/keeper/msg_server_test.go index 82e64dbf..66588ac7 100644 --- a/custom/gov/keeper/msg_server_test.go +++ b/custom/gov/keeper/msg_server_test.go @@ -1,14 +1,13 @@ package keeper import ( + "strings" + "testing" "time" "github.com/cosmos/cosmos-sdk/testutil/testdata" "github.com/stretchr/testify/require" - "strings" - "testing" - sdk "github.com/cosmos/cosmos-sdk/types" v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" @@ -21,11 +20,11 @@ import ( ) const ( - baseDepositTestAmount = 100 + // baseDepositTestAmount = 100 + testQuorumABC = "abc" + testQuorumNeg01 = "-0.1" ) -var () - func TestSubmitProposalReq(t *testing.T) { // Set up the necessary dependencies and context input := CreateTestInput(t) @@ -193,8 +192,8 @@ func TestVoteReq(t *testing.T) { res, err := govMsgSvr.SubmitProposal(ctx, msg) require.NoError(t, err) require.NotNil(t, res.ProposalId) - proposalId := res.ProposalId - requiredAmount := govKeeper.GetDepositLimitBaseUusd(ctx, proposalId) + proposalID := res.ProposalId + requiredAmount := govKeeper.GetDepositLimitBaseUusd(ctx, proposalID) cases := map[string]struct { preRun func() uint64 @@ -230,11 +229,11 @@ func TestVoteReq(t *testing.T) { "metadata too long": { preRun: func() uint64 { // set proposal to status activedVoting - proposal, ok := govKeeper.GetProposal(ctx, proposalId) + proposal, ok := govKeeper.GetProposal(ctx, proposalID) require.True(t, ok) proposal.Status = v1.StatusVotingPeriod govKeeper.SetProposal(ctx, proposal) - return proposalId + return proposalID }, option: v1.VoteOption_VOTE_OPTION_YES, voter: proposer, @@ -244,7 +243,7 @@ func TestVoteReq(t *testing.T) { }, "voter error": { preRun: func() uint64 { - return proposalId + return proposalID }, option: v1.VoteOption_VOTE_OPTION_YES, voter: sdk.AccAddress(strings.Repeat("a", 300)), @@ -284,10 +283,9 @@ func TestVoteReq(t *testing.T) { for name, tc := range cases { t.Run(name, func(t *testing.T) { - - pId := tc.preRun() + pID := tc.preRun() FundAccount(input, addr, coins) - voteReq := v1.NewMsgVote(tc.voter, pId, tc.option, tc.metadata) + voteReq := v1.NewMsgVote(tc.voter, pID, tc.option, tc.metadata) _, err := govMsgSvr.Vote(ctx, voteReq) if tc.expErr { if err == nil { @@ -338,7 +336,7 @@ func TestVoteWeightedReq(t *testing.T) { res, err := govMsgSvr.SubmitProposal(ctx, msg) require.NoError(t, err) require.NotNil(t, res.ProposalId) - proposalId := res.ProposalId + proposalID := res.ProposalId // requiredAmount := suite.govKeeper.GetDepositLimitBaseUusd(suite.ctx, proposalId).TruncateInt() cases := map[string]struct { @@ -376,11 +374,11 @@ func TestVoteWeightedReq(t *testing.T) { "metadata too long": { preRun: func() uint64 { // set proposal to status activedVoting - proposal, ok := govKeeper.GetProposal(ctx, proposalId) + proposal, ok := govKeeper.GetProposal(ctx, proposalID) require.True(t, ok) proposal.Status = v1.StatusVotingPeriod govKeeper.SetProposal(ctx, proposal) - return proposalId + return proposalID }, option: v1.VoteOption_VOTE_OPTION_YES, voter: proposer, @@ -390,7 +388,7 @@ func TestVoteWeightedReq(t *testing.T) { }, "voter error": { preRun: func() uint64 { - return proposalId + return proposalID }, option: v1.VoteOption_VOTE_OPTION_YES, voter: sdk.AccAddress(strings.Repeat("a", 300)), @@ -429,9 +427,8 @@ func TestVoteWeightedReq(t *testing.T) { for name, tc := range cases { t.Run(name, func(t *testing.T) { - - pId := tc.preRun() - voteReq := v1.NewMsgVoteWeighted(tc.voter, pId, v1.NewNonSplitVoteOption(tc.option), tc.metadata) + pID := tc.preRun() + voteReq := v1.NewMsgVoteWeighted(tc.voter, pID, v1.NewNonSplitVoteOption(tc.option), tc.metadata) _, err := govMsgSvr.VoteWeighted(ctx, voteReq) if tc.expErr { if err == nil { @@ -482,12 +479,12 @@ func TestDepositReq(t *testing.T) { res, err := govMsgSvr.SubmitProposal(ctx, msg) require.NoError(t, err) require.NotNil(t, res.ProposalId) - pId := res.ProposalId + pID := res.ProposalId cases := map[string]struct { preRun func() uint64 expErr bool - proposalId uint64 + proposalID uint64 depositor sdk.AccAddress deposit sdk.Coins options v1.WeightedVoteOptions @@ -503,7 +500,7 @@ func TestDepositReq(t *testing.T) { }, "all good": { preRun: func() uint64 { - return pId + return pID }, depositor: proposer, deposit: coins, @@ -514,9 +511,9 @@ func TestDepositReq(t *testing.T) { for name, tc := range cases { t.Run(name, func(t *testing.T) { - proposalId := tc.preRun() + proposalID := tc.preRun() FundAccount(input, addr, coins) - depositReq := v1.NewMsgDeposit(tc.depositor, proposalId, tc.deposit) + depositReq := v1.NewMsgDeposit(tc.depositor, proposalID, tc.deposit) _, err := govMsgSvr.Deposit(ctx, depositReq) if tc.expErr { if err == nil { @@ -632,7 +629,7 @@ func TestMsgUpdateParams(t *testing.T) { name: "invalid quorum", input: func() *v2lunc1types.MsgUpdateParams { params1 := params - params1.Quorum = "abc" + params1.Quorum = testQuorumABC return &v2lunc1types.MsgUpdateParams{ Authority: authority, @@ -646,7 +643,7 @@ func TestMsgUpdateParams(t *testing.T) { name: "negative quorum", input: func() *v2lunc1types.MsgUpdateParams { params1 := params - params1.Quorum = "-0.1" + params1.Quorum = testQuorumNeg01 return &v2lunc1types.MsgUpdateParams{ Authority: authority, @@ -674,7 +671,7 @@ func TestMsgUpdateParams(t *testing.T) { name: "invalid threshold", input: func() *v2lunc1types.MsgUpdateParams { params1 := params - params1.Threshold = "abc" + params1.Threshold = testQuorumABC return &v2lunc1types.MsgUpdateParams{ Authority: authority, @@ -688,7 +685,7 @@ func TestMsgUpdateParams(t *testing.T) { name: "negative threshold", input: func() *v2lunc1types.MsgUpdateParams { params1 := params - params1.Threshold = "-0.1" + params1.Threshold = testQuorumNeg01 return &v2lunc1types.MsgUpdateParams{ Authority: authority, @@ -716,7 +713,7 @@ func TestMsgUpdateParams(t *testing.T) { name: "invalid veto threshold", input: func() *v2lunc1types.MsgUpdateParams { params1 := params - params1.VetoThreshold = "abc" + params1.VetoThreshold = testQuorumABC return &v2lunc1types.MsgUpdateParams{ Authority: authority, @@ -730,7 +727,7 @@ func TestMsgUpdateParams(t *testing.T) { name: "negative veto threshold", input: func() *v2lunc1types.MsgUpdateParams { params1 := params - params1.VetoThreshold = "-0.1" + params1.VetoThreshold = testQuorumNeg01 return &v2lunc1types.MsgUpdateParams{ Authority: authority, @@ -947,10 +944,8 @@ func TestLegacyMsgSubmitProposal(t *testing.T) { legacyMsgSrvr := NewLegacyMsgServerImpl(govAcct.String(), NewMsgServerImpl(input.GovKeeper)) for name, c := range cases { - t.Run(name, func(t *testing.T) { msg, err := c.preRun() - if err != nil { t.Fatalf("preRun error: %v", err) } @@ -1081,8 +1076,8 @@ func TestLegacyMsgVote(t *testing.T) { for name, tc := range cases { t.Run(name, func(t *testing.T) { - pId := tc.preRun() - voteReq := v1beta1.NewMsgVote(tc.voter, pId, tc.option) + pID := tc.preRun() + voteReq := v1beta1.NewMsgVote(tc.voter, pID, tc.option) _, err := legacyMsgSrvr.Vote(ctx, voteReq) proposal.Status = v1.StatusVotingPeriod input.GovKeeper.SetProposal(ctx, proposal) @@ -1111,7 +1106,6 @@ func TestLegacyVoteWeighted(t *testing.T) { FundAccount(input, addr, coins) proposal, err := input.GovKeeper.SubmitProposal(ctx, []sdk.Msg{}, "", "Test Proposal", "This is a test proposal", proposer) - if err != nil { t.Fatalf("preRun error: %v", err) } @@ -1203,9 +1197,9 @@ func TestLegacyVoteWeighted(t *testing.T) { for name, tc := range cases { t.Run(name, func(t *testing.T) { - pId := tc.preRun() + pID := tc.preRun() - voteReq := v1beta1.NewMsgVoteWeighted(tc.voter, pId, v1beta1.NewNonSplitVoteOption(v1beta1.VoteOption(tc.option))) + voteReq := v1beta1.NewMsgVoteWeighted(tc.voter, pID, v1beta1.NewNonSplitVoteOption(tc.option)) proposal.Status = v1.StatusVotingPeriod input.GovKeeper.SetProposal(ctx, proposal) _, err := legacyMsgSrvr.VoteWeighted(ctx, voteReq) @@ -1240,7 +1234,7 @@ func TestLegacyMsgDeposit(t *testing.T) { cases := map[string]struct { preRun func() uint64 expErr bool - proposalId uint64 + proposalID uint64 depositor sdk.AccAddress deposit sdk.Coins options v1beta1.WeightedVoteOptions @@ -1269,8 +1263,8 @@ func TestLegacyMsgDeposit(t *testing.T) { for name, tc := range cases { t.Run(name, func(t *testing.T) { - proposalId := tc.preRun() - depositReq := v1beta1.NewMsgDeposit(tc.depositor, proposalId, tc.deposit) + proposalID := tc.preRun() + depositReq := v1beta1.NewMsgDeposit(tc.depositor, proposalID, tc.deposit) _, err := legacyMsgSrvr.Deposit(ctx, depositReq) if tc.expErr { require.Error(t, err) diff --git a/custom/gov/keeper/proposal.go b/custom/gov/keeper/proposal.go index 47da3fc8..5de652ed 100644 --- a/custom/gov/keeper/proposal.go +++ b/custom/gov/keeper/proposal.go @@ -15,7 +15,6 @@ import ( // SubmitProposal creates a new proposal given an array of messages func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadata, title, summary string, proposer sdk.AccAddress) (v1.Proposal, error) { err := keeper.assertMetadataLength(metadata) - if err != nil { return v1.Proposal{}, err } @@ -69,7 +68,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat if msg, ok := msg.(*v1.MsgExecLegacyContent); ok { cacheCtx, _ := ctx.CacheContext() if _, err := handler(cacheCtx, msg); err != nil { - if errors.Is(types.ErrNoProposalHandlerExists, err) { + if errors.Is(err, types.ErrNoProposalHandlerExists) { return v1.Proposal{}, err } return v1.Proposal{}, sdkerrors.Wrap(types.ErrInvalidProposalContent, err.Error()) diff --git a/custom/gov/keeper/proposal_test.go b/custom/gov/keeper/proposal_test.go index 8c03609f..29f7b37b 100644 --- a/custom/gov/keeper/proposal_test.go +++ b/custom/gov/keeper/proposal_test.go @@ -56,7 +56,6 @@ func TestGetSetProposal(t *testing.T) { minLunaAmount := govKeeper.GetDepositLimitBaseUusd(ctx, proposalID) fmt.Printf("minLunaAmount %s\n", minLunaAmount) require.Equal(t, totalLuncMinDeposit, minLunaAmount) - } func TestDeleteProposal(t *testing.T) { diff --git a/custom/gov/migrations/v5/store_test.go b/custom/gov/migrations/v5/store_test.go index 5c0381a8..e322811d 100644 --- a/custom/gov/migrations/v5/store_test.go +++ b/custom/gov/migrations/v5/store_test.go @@ -33,8 +33,8 @@ func TestMigrateStore(t *testing.T) { storeService := storetypes.StoreKey(govKey) - maxDepositPeriod := time.Duration(time.Hour * 24 * 2) - votingPeriod := time.Duration(time.Hour * 24 * 3) + maxDepositPeriod := (time.Hour * 24 * 2) + votingPeriod := (time.Hour * 24 * 3) // Setup initial governance params in the store (old params before migration) oldParams := v1.Params{ @@ -88,5 +88,4 @@ func TestMigrateStore(t *testing.T) { // Check any new fields from the `v2lunc1.Params` require.Equal(t, v2lunc1.DefaultParams().MinUusdDeposit, newParams.MinUusdDeposit) - } diff --git a/custom/gov/module.go b/custom/gov/module.go index a0960124..b9810d38 100644 --- a/custom/gov/module.go +++ b/custom/gov/module.go @@ -89,7 +89,7 @@ func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) // DefaultGenesis returns default genesis state as raw bytes for the gov // module. -func (am AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { +func (a AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { // customize to set default genesis state deposit denom to uluna defaultGenesisState := v2lunc1.DefaultGenesisState() defaultGenesisState.Params.MinDeposit[0].Denom = core.MicroLunaDenom @@ -98,7 +98,7 @@ func (am AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the gov module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var data v2lunc1.GenesisState if err := cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", govtypes.ModuleName, err) @@ -216,12 +216,12 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { // ProposalContents returns all the gov content functions used to // simulate governance proposals. -func (AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { //nolint:staticcheck +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { return simulation.ProposalContents() } // ProposalMsgs returns all the gov msgs used to simulate governance proposals. -func (AppModule) ProposalMsgs(simState module.SimulationState) []simtypes.WeightedProposalMsg { +func (AppModule) ProposalMsgs(_ module.SimulationState) []simtypes.WeightedProposalMsg { return simulation.ProposalMsgs() } diff --git a/custom/gov/types/v2lunc1/genesis.go b/custom/gov/types/v2lunc1/genesis.go index 006ae2fb..d11f7d80 100644 --- a/custom/gov/types/v2lunc1/genesis.go +++ b/custom/gov/types/v2lunc1/genesis.go @@ -43,33 +43,33 @@ func ValidateGenesis(data *GenesisState) error { var errGroup errgroup.Group // weed out duplicate proposals - proposalIds := make(map[uint64]struct{}) + proposalIDs := make(map[uint64]struct{}) for _, p := range data.Proposals { - if _, ok := proposalIds[p.Id]; ok { + if _, ok := proposalIDs[p.Id]; ok { return fmt.Errorf("duplicate proposal id: %d", p.Id) } - proposalIds[p.Id] = struct{}{} + proposalIDs[p.Id] = struct{}{} } // weed out duplicate deposits errGroup.Go(func() error { type depositKey struct { - ProposalId uint64 + ProposalID uint64 Depositor string } - depositIds := make(map[depositKey]struct{}) + depositIDs := make(map[depositKey]struct{}) for _, d := range data.Deposits { - if _, ok := proposalIds[d.ProposalId]; !ok { + if _, ok := proposalIDs[d.ProposalId]; !ok { return fmt.Errorf("deposit %v has non-existent proposal id: %d", d, d.ProposalId) } dk := depositKey{d.ProposalId, d.Depositor} - if _, ok := depositIds[dk]; ok { + if _, ok := depositIDs[dk]; ok { return fmt.Errorf("duplicate deposit: %v", d) } - depositIds[dk] = struct{}{} + depositIDs[dk] = struct{}{} } return nil @@ -78,21 +78,21 @@ func ValidateGenesis(data *GenesisState) error { // weed out duplicate votes errGroup.Go(func() error { type voteKey struct { - ProposalId uint64 + ProposalID uint64 Voter string } - voteIds := make(map[voteKey]struct{}) + voteIDs := make(map[voteKey]struct{}) for _, v := range data.Votes { - if _, ok := proposalIds[v.ProposalId]; !ok { + if _, ok := proposalIDs[v.ProposalId]; !ok { return fmt.Errorf("vote %v has non-existent proposal id: %d", v, v.ProposalId) } vk := voteKey{v.ProposalId, v.Voter} - if _, ok := voteIds[vk]; ok { + if _, ok := voteIDs[vk]; ok { return fmt.Errorf("duplicate vote: %v", v) } - voteIds[vk] = struct{}{} + voteIDs[vk] = struct{}{} } return nil From 0832c677ed494f22340ba84edc0e3c556b203009 Mon Sep 17 00:00:00 2001 From: ntluongdev95 Date: Wed, 30 Oct 2024 10:47:24 +0700 Subject: [PATCH 52/60] removed .history files --- custom/gov/client/cli/init_test.go | 1 - custom/gov/keeper/grpc_query_test.go | 1 - custom/gov/keeper/migrator_test.go | 1 - custom/gov/types/keys_test.go | 16 ++++++++-------- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/custom/gov/client/cli/init_test.go b/custom/gov/client/cli/init_test.go index 817e3bed..51583618 100644 --- a/custom/gov/client/cli/init_test.go +++ b/custom/gov/client/cli/init_test.go @@ -39,4 +39,3 @@ func (s *CLITestSuite) SetupSuite() { WithOutput(io.Discard). WithChainID("test-chain") } - diff --git a/custom/gov/keeper/grpc_query_test.go b/custom/gov/keeper/grpc_query_test.go index af1c14a4..9812c36e 100644 --- a/custom/gov/keeper/grpc_query_test.go +++ b/custom/gov/keeper/grpc_query_test.go @@ -52,4 +52,3 @@ func TestKeeperWithMockQueryServer(t *testing.T) { require.Equal(t, "proposal not found", err.Error()) }) } - diff --git a/custom/gov/keeper/migrator_test.go b/custom/gov/keeper/migrator_test.go index e6f046b0..f43cd8c7 100644 --- a/custom/gov/keeper/migrator_test.go +++ b/custom/gov/keeper/migrator_test.go @@ -31,4 +31,3 @@ func TestNewMigrator(t *testing.T) { migrator := keeper.NewMigrator(mockKeeper, mockSubspace) require.NotNil(t, migrator) } - diff --git a/custom/gov/types/keys_test.go b/custom/gov/types/keys_test.go index 08c07d26..656d1319 100644 --- a/custom/gov/types/keys_test.go +++ b/custom/gov/types/keys_test.go @@ -17,19 +17,19 @@ func TestProposalKeys(t *testing.T) { // key proposal key := govtypes.ProposalKey(1) proposalID := govtypes.SplitProposalKey(key) - require.Equal(t, int(proposalID), 1) + require.Equal(t, proposalID, uint64(1)) // key active proposal queue now := time.Now() key = govtypes.ActiveProposalQueueKey(3, now) proposalID, expTime := govtypes.SplitActiveProposalQueueKey(key) - require.Equal(t, int(proposalID), 3) + require.Equal(t, proposalID, uint64(3)) require.True(t, now.Equal(expTime)) // key inactive proposal queue key = govtypes.InactiveProposalQueueKey(3, now) proposalID, expTime = govtypes.SplitInactiveProposalQueueKey(key) - require.Equal(t, int(proposalID), 3) + require.Equal(t, proposalID, uint64(3)) require.True(t, now.Equal(expTime)) // invalid key @@ -40,27 +40,27 @@ func TestProposalKeys(t *testing.T) { func TestDepositKeys(t *testing.T) { key := govtypes.DepositsKey(2) proposalID := govtypes.SplitProposalKey(key) - require.Equal(t, int(proposalID), 2) + require.Equal(t, proposalID, uint64(2)) key = govtypes.DepositKey(2, addr) proposalID, depositorAddr := govtypes.SplitKeyDeposit(key) - require.Equal(t, int(proposalID), 2) + require.Equal(t, proposalID, uint64(2)) require.Equal(t, addr, depositorAddr) } func TestVoteKeys(t *testing.T) { key := govtypes.VotesKey(2) proposalID := govtypes.SplitProposalKey(key) - require.Equal(t, int(proposalID), 2) + require.Equal(t, proposalID, uint64(2)) key = govtypes.VoteKey(2, addr) proposalID, voterAddr := govtypes.SplitKeyDeposit(key) - require.Equal(t, int(proposalID), 2) + require.Equal(t, proposalID, uint64(2)) require.Equal(t, addr, voterAddr) } func TestTotalDepositKeys(t *testing.T) { key := TotalDepositKey(2) proposalID := govtypes.SplitProposalKey(key) - require.Equal(t, int(proposalID), 2) + require.Equal(t, proposalID, uint64(2)) } From 4cd9346579ea1a765ff4fdc5aec37d3304631c18 Mon Sep 17 00:00:00 2001 From: duonghb53 Date: Sun, 3 Nov 2024 22:34:47 +0700 Subject: [PATCH 53/60] add logic get uusd --- custom/gov/keeper/keeper.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/custom/gov/keeper/keeper.go b/custom/gov/keeper/keeper.go index 6e319d4e..c2b25acc 100644 --- a/custom/gov/keeper/keeper.go +++ b/custom/gov/keeper/keeper.go @@ -96,14 +96,15 @@ func (keeper Keeper) GetMinimumDepositBaseUusd(ctx sdk.Context) (math.Int, error // Get exchange rate betweent Lunc/uusd from oracle // save it to store price, err := keeper.oracleKeeper.GetLunaExchangeRate(ctx, core.MicroUSDDenom) - if err != nil && price.LTE(sdk.ZeroDec()) { - return sdk.ZeroInt(), err + + // If can't get price from oracle, use min deposit + if err != nil { + return keeper.GetParams(ctx).MinDeposit[0].Amount, nil } + minUusdDeposit := keeper.GetParams(ctx).MinUusdDeposit totalLuncDeposit := sdk.NewDecFromInt(minUusdDeposit.Amount).Quo(price).TruncateInt() - if err != nil { - return sdk.ZeroInt(), err - } + return totalLuncDeposit, nil } From ae8d370a888b8479ef8fd1a1957507bc72378847 Mon Sep 17 00:00:00 2001 From: duonghb53 Date: Sun, 3 Nov 2024 22:55:53 +0700 Subject: [PATCH 54/60] fix lint --- custom/gov/keeper/keeper.go | 1 - 1 file changed, 1 deletion(-) diff --git a/custom/gov/keeper/keeper.go b/custom/gov/keeper/keeper.go index c2b25acc..2b88454f 100644 --- a/custom/gov/keeper/keeper.go +++ b/custom/gov/keeper/keeper.go @@ -96,7 +96,6 @@ func (keeper Keeper) GetMinimumDepositBaseUusd(ctx sdk.Context) (math.Int, error // Get exchange rate betweent Lunc/uusd from oracle // save it to store price, err := keeper.oracleKeeper.GetLunaExchangeRate(ctx, core.MicroUSDDenom) - // If can't get price from oracle, use min deposit if err != nil { return keeper.GetParams(ctx).MinDeposit[0].Amount, nil From d780c04650bef3fbf68704821fd079cbc7235a0d Mon Sep 17 00:00:00 2001 From: duonghb53 Date: Mon, 4 Nov 2024 10:10:46 +0700 Subject: [PATCH 55/60] fix generate address by order --- custom/gov/keeper/deposit_test.go | 8 ++++++-- custom/gov/keeper/test_utils.go | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/custom/gov/keeper/deposit_test.go b/custom/gov/keeper/deposit_test.go index 4455dcdc..0c773e5f 100644 --- a/custom/gov/keeper/deposit_test.go +++ b/custom/gov/keeper/deposit_test.go @@ -6,6 +6,7 @@ import ( "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" core "github.com/classic-terra/core/v3/types" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/testutil/testdata" @@ -27,13 +28,16 @@ func TestAddDeposits(t *testing.T) { bankKeeper := input.BankKeeper govKeeper := input.GovKeeper oracleKeeper := input.OracleKeeper + stakingKeeper := input.StakingKeeper ctx := input.Ctx oracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) lunaCoin := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(10_000_000_000))) - _, _, addr1 := testdata.KeyTestPubAddr() - _, _, addr2 := testdata.KeyTestPubAddr() + TestAddrs := simtestutil.AddTestAddrsIncremental(bankKeeper, stakingKeeper, ctx, 2, sdk.NewInt(10_000_000)) + addr1 := TestAddrs[0] + addr2 := TestAddrs[1] + err := FundAccount(input, addr1, lunaCoin) require.NoError(t, err) err1 := FundAccount(input, addr2, lunaCoin) diff --git a/custom/gov/keeper/test_utils.go b/custom/gov/keeper/test_utils.go index a6d0ef9b..372b0ac6 100644 --- a/custom/gov/keeper/test_utils.go +++ b/custom/gov/keeper/test_utils.go @@ -46,6 +46,7 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" @@ -164,6 +165,7 @@ func CreateTestInput(t *testing.T) TestInput { stakingtypes.NotBondedPoolName: true, stakingtypes.BondedPoolName: true, distrtypes.ModuleName: true, + minttypes.ModuleName: true, } maccPerms := map[string][]string{ @@ -175,6 +177,7 @@ func CreateTestInput(t *testing.T) TestInput { oracletypes.ModuleName: nil, markettypes.ModuleName: {authtypes.Burner, authtypes.Minter}, govtypes.ModuleName: {authtypes.Burner, authtypes.Minter}, + minttypes.ModuleName: {authtypes.Minter}, } paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, keyParams, tKeyParams) From 4c44c75cdd7ab36c281e9ad178d6e1cb7466332c Mon Sep 17 00:00:00 2001 From: tusoict Date: Wed, 6 Nov 2024 17:07:21 +0700 Subject: [PATCH 56/60] Deleted useless file to clean code --- custom/gov/client/cli/util.go | 52 ----------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 custom/gov/client/cli/util.go diff --git a/custom/gov/client/cli/util.go b/custom/gov/client/cli/util.go deleted file mode 100644 index 85076bcd..00000000 --- a/custom/gov/client/cli/util.go +++ /dev/null @@ -1,52 +0,0 @@ -package cli - -// import ( -// "encoding/json" -// "os" - -// "github.com/cosmos/cosmos-sdk/codec" -// sdk "github.com/cosmos/cosmos-sdk/types" -// ) - -// // proposal defines the new Msg-based proposal. -// type proposal struct { -// // Msgs defines an array of sdk.Msgs proto-JSON-encoded as Anys. -// Messages []json.RawMessage `json:"messages,omitempty"` -// Metadata string `json:"metadata"` -// Deposit string `json:"deposit"` -// Title string `json:"title"` -// Summary string `json:"summary"` -// } - -// // parseSubmitProposal reads and parses the proposal. -// func parseSubmitProposal(cdc codec.Codec, path string) ([]sdk.Msg, string, string, string, sdk.Coins, error) { -// var proposal proposal - -// contents, err := os.ReadFile(path) -// if err != nil { -// return nil, "", "", "", nil, err -// } - -// err = json.Unmarshal(contents, &proposal) -// if err != nil { -// return nil, "", "", "", nil, err -// } - -// msgs := make([]sdk.Msg, len(proposal.Messages)) -// for i, anyJSON := range proposal.Messages { -// var msg sdk.Msg -// err := cdc.UnmarshalInterfaceJSON(anyJSON, &msg) -// if err != nil { -// return nil, "", "", "", nil, err -// } - -// msgs[i] = msg -// } - -// deposit, err := sdk.ParseCoinsNormalized(proposal.Deposit) -// if err != nil { -// return nil, "", "", "", nil, err -// } - -// return msgs, proposal.Metadata, proposal.Title, proposal.Summary, deposit, nil -// } From 7955ba07cc08cf9942a239a0b203ff544a52fd78 Mon Sep 17 00:00:00 2001 From: tusoict Date: Sun, 10 Nov 2024 09:45:56 +0700 Subject: [PATCH 57/60] added offset buffet to reduce limit initial deposit when creating prop --- custom/auth/ante/min_initial_deposit.go | 7 +++--- custom/auth/ante/min_initial_deposit_test.go | 23 +++++--------------- custom/gov/keeper/deposit.go | 4 +++- custom/gov/keeper/deposit_test.go | 2 +- 4 files changed, 12 insertions(+), 24 deletions(-) diff --git a/custom/auth/ante/min_initial_deposit.go b/custom/auth/ante/min_initial_deposit.go index 12da97a8..cdf27825 100644 --- a/custom/auth/ante/min_initial_deposit.go +++ b/custom/auth/ante/min_initial_deposit.go @@ -40,7 +40,6 @@ func IsMsgSubmitProposal(msg sdk.Msg) bool { // HandleCheckMinInitialDeposit func HandleCheckMinInitialDeposit(ctx sdk.Context, msg sdk.Msg, govKeeper customgovkeeper.Keeper, treasuryKeeper TreasuryKeeper) (err error) { var initialDepositCoins sdk.Coins - switch submitPropMsg := msg.(type) { case *govv1beta1.MsgSubmitProposal: initialDepositCoins = submitPropMsg.GetInitialDeposit() @@ -49,16 +48,16 @@ func HandleCheckMinInitialDeposit(ctx sdk.Context, msg sdk.Msg, govKeeper custom default: return fmt.Errorf("could not dereference msg as MsgSubmitProposal") } + // set offset price change 3% + offsetPrice := sdk.NewDecWithPrec(97, 2) minLuncAmount, err := govKeeper.GetMinimumDepositBaseUusd(ctx) minInitialDepositRatio := treasuryKeeper.GetMinInitialDepositRatio(ctx) - if err == nil && minLuncAmount.GT(sdk.ZeroInt()) { - requiredDeposit := sdk.NewDecFromInt(minLuncAmount).Mul(minInitialDepositRatio).TruncateInt() + requiredDeposit := sdk.NewDecFromInt(minLuncAmount).Mul(minInitialDepositRatio).Mul(offsetPrice).TruncateInt() requiredDepositCoins := sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, requiredDeposit)) if initialDepositCoins.IsAllLT(requiredDepositCoins) { return fmt.Errorf("not enough initial deposit provided. Expected %q; got %q", requiredDepositCoins, initialDepositCoins) } - return nil } return fmt.Errorf("could not get minimum deposit base uusd") diff --git a/custom/auth/ante/min_initial_deposit_test.go b/custom/auth/ante/min_initial_deposit_test.go index 5f8c1955..6810cfcd 100644 --- a/custom/auth/ante/min_initial_deposit_test.go +++ b/custom/auth/ante/min_initial_deposit_test.go @@ -1,27 +1,14 @@ package ante_test import ( - // "fmt" - "fmt" + "github.com/classic-terra/core/v3/custom/auth/ante" + govv2lunc1 "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + core "github.com/classic-terra/core/v3/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" - - // banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - - "github.com/classic-terra/core/v3/custom/auth/ante" - core "github.com/classic-terra/core/v3/types" - - // core "github.com/terra-money/core/types" - // treasury "github.com/terra-money/core/x/treasury/types" - - // "github.com/cosmos/cosmos-sdk/types/query" - // cosmosante "github.com/cosmos/cosmos-sdk/x/auth/ante" - // "github.com/cosmos/cosmos-sdk/x/auth/types" - // minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - govv2lunc1 "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) @@ -93,7 +80,7 @@ func (suite *AnteTestSuite) TestMinInitialDepositRatioWithSufficientDeposit() { midd := ante.NewMinInitialDepositDecorator(suite.app.GovKeeper, suite.app.TreasuryKeeper) antehandler := sdk.ChainAnteDecorators(midd) - lunaPriceInUSD := sdk.MustNewDecFromStr("0.00008905") + lunaPriceInUSD := sdk.MustNewDecFromStr("0.0001") fmt.Printf("\n lunaPriceInUSD %s", lunaPriceInUSD.String()) suite.app.OracleKeeper.SetLunaExchangeRate(suite.ctx, core.MicroUSDDenom, lunaPriceInUSD) @@ -112,7 +99,7 @@ func (suite *AnteTestSuite) TestMinInitialDepositRatioWithSufficientDeposit() { // keys and addresses - initDeposit, _ := sdk.NewIntFromString("10000000000000") + initDeposit, _ := sdk.NewIntFromString("1000000000000") fmt.Printf("\n initDeposit %s", initDeposit.String()) priv1, _, addr1 := testdata.KeyTestPubAddr() diff --git a/custom/gov/keeper/deposit.go b/custom/gov/keeper/deposit.go index 88699030..39a79e45 100644 --- a/custom/gov/keeper/deposit.go +++ b/custom/gov/keeper/deposit.go @@ -85,6 +85,8 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd func (keeper Keeper) validateInitialDeposit(ctx sdk.Context, initialDeposit sdk.Coins) error { params := keeper.GetParams(ctx) minInitialDepositRatio, err := sdk.NewDecFromStr(params.MinInitialDepositRatio) + // set offset price change 3% + offsetPrice := sdk.NewDecWithPrec(97, 2) if err != nil { return err } @@ -100,7 +102,7 @@ func (keeper Keeper) validateInitialDeposit(ctx sdk.Context, initialDeposit sdk. return err } for i := range minDepositCoins { - minDepositCoins[i].Amount = sdk.NewDecFromInt(minDepositCoins[i].Amount).Mul(minInitialDepositRatio).TruncateInt() + minDepositCoins[i].Amount = sdk.NewDecFromInt(minDepositCoins[i].Amount).Mul(minInitialDepositRatio).Mul(offsetPrice).TruncateInt() } if !initialDeposit.IsAllGTE(minDepositCoins) { return sdkerrors.Wrapf(types.ErrMinDepositTooSmall, "was (%s), need (%s)", initialDeposit, minDepositCoins) diff --git a/custom/gov/keeper/deposit_test.go b/custom/gov/keeper/deposit_test.go index 0c773e5f..1e7985e1 100644 --- a/custom/gov/keeper/deposit_test.go +++ b/custom/gov/keeper/deposit_test.go @@ -210,7 +210,7 @@ func TestValidateInitialDeposit(t *testing.T) { "min deposit * initial percent > initial deposit (multiple coins): error": { minDeposit: sdk.NewCoins( sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseUSDDepositTestAmount)), - sdk.NewCoin("uosmo", sdk.NewInt(baseUSDDepositTestAmount*2))), + sdk.NewCoin("uosmo", sdk.NewInt(baseUSDDepositTestAmount*3))), minInitialDepositPercent: baseDepositTestPercent, initialDeposit: sdk.NewCoins( sdk.NewCoin(sdk.DefaultBondDenom, minLuncDeposit), From 2f1168f3b52389311595d9515a4756515209bae7 Mon Sep 17 00:00:00 2001 From: tusoict Date: Sun, 10 Nov 2024 10:19:51 +0700 Subject: [PATCH 58/60] Updated unitest --- custom/gov/keeper/deposit_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom/gov/keeper/deposit_test.go b/custom/gov/keeper/deposit_test.go index 1e7985e1..79663a74 100644 --- a/custom/gov/keeper/deposit_test.go +++ b/custom/gov/keeper/deposit_test.go @@ -182,7 +182,7 @@ func TestValidateInitialDeposit(t *testing.T) { "min deposit * initial percent > initial deposit: error": { minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseUSDDepositTestAmount))), minInitialDepositPercent: baseDepositTestPercent, - initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, meetsDepositValue.Sub(sdk.NewInt(1)))), + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, meetsDepositValue.Quo(sdk.NewInt(2)))), expectError: true, }, From 69c50191ea8e689f2fbda92a852f66cf9f6f8162 Mon Sep 17 00:00:00 2001 From: Maintain Date: Sat, 16 Nov 2024 08:40:57 +0700 Subject: [PATCH 59/60] update uusd amount --- custom/gov/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom/gov/README.md b/custom/gov/README.md index 055a4bf0..b56a5922 100644 --- a/custom/gov/README.md +++ b/custom/gov/README.md @@ -116,7 +116,7 @@ The governance module contains the following parameters: | burn_proposal_deposit_prevote | bool | false | | burn_vote_quorum | bool | false | | burn_vote_veto | bool | true | -| min_uusd_deposit | coins |{"denom":"uusd","amount":"500000"} | +| min_uusd_deposit | coins |{"denom":"uusd","amount":"500000000"} | **NOTE**: Aiming to establish a clearer and more consistent minimum deposit requirement for governance proposals, the default value of `min_uusd_deposit` is currently set to 500 USD. However, this value can be updated by the community in the future. This approach allows the module to adapt to fluctuations in the value of LUNC over time, ensuring a consistent threshold for proposals. From 43ef5925775ce35451db923ebb8afd3cc9b6307b Mon Sep 17 00:00:00 2001 From: duonghb53 Date: Fri, 29 Nov 2024 09:02:16 +0700 Subject: [PATCH 60/60] resolve comment --- app/app.go | 4 +- app/upgrades/{v8_4 => v10_1}/constants.go | 6 +- app/upgrades/{v8_4 => v10_1}/upgrades.go | 4 +- cmd/terrad/testnet.go | 4 +- custom/auth/ante/min_initial_deposit.go | 6 +- custom/auth/ante/min_initial_deposit_test.go | 20 +- custom/distribution/types/codec.go | 2 +- custom/gov/README.md | 18 +- custom/gov/client/cli/query.go | 12 +- custom/gov/client/cli/query_test.go | 4 +- custom/gov/genesis.go | 8 +- custom/gov/keeper/deposit.go | 4 +- custom/gov/keeper/deposit_test.go | 20 +- custom/gov/keeper/grpc_query.go | 18 +- custom/gov/keeper/grpc_query_test.go | 20 +- custom/gov/keeper/keeper.go | 24 +- custom/gov/keeper/msg_server.go | 16 +- custom/gov/keeper/msg_server_test.go | 88 +++---- custom/gov/keeper/params.go | 6 +- custom/gov/keeper/proposal.go | 10 +- custom/gov/keeper/proposal_test.go | 4 +- custom/gov/keeper/test_utils.go | 10 +- custom/gov/migrations/v5/store.go | 6 +- custom/gov/migrations/v5/store_test.go | 8 +- custom/gov/module.go | 18 +- custom/gov/types/errors.go | 2 +- custom/gov/types/keys.go | 6 +- .../gov/types/{v2lunc1 => v2custom}/codec.go | 2 +- .../types/{v2lunc1 => v2custom}/genesis.go | 2 +- .../types/{v2lunc1 => v2custom}/genesis.pb.go | 70 +++--- .../{v2lunc1 => v2custom}/genesis_test.go | 62 ++--- .../gov/types/{v2lunc1 => v2custom}/gov.pb.go | 236 +++++++++--------- .../gov/types/{v2lunc1 => v2custom}/params.go | 2 +- .../types/{v2lunc1 => v2custom}/query.pb.go | 130 +++++----- .../{v2lunc1 => v2custom}/query.pb.gw.go | 32 +-- .../gov/types/{v2lunc1 => v2custom}/tx.pb.go | 116 ++++----- custom/params/types/codec.go | 2 +- custom/upgrade/types/codec.go | 2 +- .../gov/{v2lunc1 => v2custom}/genesis.proto | 8 +- .../terra/gov/{v2lunc1 => v2custom}/gov.proto | 4 +- .../gov/{v2lunc1 => v2custom}/query.proto | 12 +- .../terra/gov/{v2lunc1 => v2custom}/tx.proto | 8 +- .../test-upgrade-and-submit-proposal.sh | 4 +- tests/e2e/initialization/config.go | 6 +- 44 files changed, 516 insertions(+), 530 deletions(-) rename app/upgrades/{v8_4 => v10_1}/constants.go (62%) rename app/upgrades/{v8_4 => v10_1}/upgrades.go (92%) rename custom/gov/types/{v2lunc1 => v2custom}/codec.go (99%) rename custom/gov/types/{v2lunc1 => v2custom}/genesis.go (99%) rename custom/gov/types/{v2lunc1 => v2custom}/genesis.pb.go (84%) rename custom/gov/types/{v2lunc1 => v2custom}/genesis_test.go (61%) rename custom/gov/types/{v2lunc1 => v2custom}/gov.pb.go (89%) rename custom/gov/types/{v2lunc1 => v2custom}/params.go (99%) rename custom/gov/types/{v2lunc1 => v2custom}/query.pb.go (81%) rename custom/gov/types/{v2lunc1 => v2custom}/query.pb.gw.go (88%) rename custom/gov/types/{v2lunc1 => v2custom}/tx.pb.go (83%) rename proto/terra/gov/{v2lunc1 => v2custom}/genesis.proto (90%) rename proto/terra/gov/{v2lunc1 => v2custom}/gov.proto (99%) rename proto/terra/gov/{v2lunc1 => v2custom}/query.proto (80%) rename proto/terra/gov/{v2lunc1 => v2custom}/tx.proto (92%) diff --git a/app/app.go b/app/app.go index a83973bd..a1c95648 100644 --- a/app/app.go +++ b/app/app.go @@ -58,10 +58,10 @@ import ( v8_1 "github.com/classic-terra/core/v3/app/upgrades/v8_1" v8_2 "github.com/classic-terra/core/v3/app/upgrades/v8_2" v8_3 "github.com/classic-terra/core/v3/app/upgrades/v8_3" - v8_4 "github.com/classic-terra/core/v3/app/upgrades/v8_4" // v9 had been used by tax2gas and has to be skipped v10 "github.com/classic-terra/core/v3/app/upgrades/v10" + v10_1 "github.com/classic-terra/core/v3/app/upgrades/v10_1" customante "github.com/classic-terra/core/v3/custom/auth/ante" custompost "github.com/classic-terra/core/v3/custom/auth/post" @@ -95,7 +95,7 @@ var ( v8_1.Upgrade, v8_2.Upgrade, v8_3.Upgrade, - v8_4.Upgrade, + v10_1.Upgrade, v10.Upgrade, } diff --git a/app/upgrades/v8_4/constants.go b/app/upgrades/v10_1/constants.go similarity index 62% rename from app/upgrades/v8_4/constants.go rename to app/upgrades/v10_1/constants.go index 980f6fef..60e40cc7 100644 --- a/app/upgrades/v8_4/constants.go +++ b/app/upgrades/v10_1/constants.go @@ -1,13 +1,13 @@ //nolint:revive -package v8_4 +package v10_1 import ( "github.com/classic-terra/core/v3/app/upgrades" ) -const UpgradeName = "v8_4" +const UpgradeName = "v10_1" var Upgrade = upgrades.Upgrade{ UpgradeName: UpgradeName, - CreateUpgradeHandler: CreateV84UpgradeHandler, + CreateUpgradeHandler: CreateV101UpgradeHandler, } diff --git a/app/upgrades/v8_4/upgrades.go b/app/upgrades/v10_1/upgrades.go similarity index 92% rename from app/upgrades/v8_4/upgrades.go rename to app/upgrades/v10_1/upgrades.go index bc7d162a..e4163131 100644 --- a/app/upgrades/v8_4/upgrades.go +++ b/app/upgrades/v10_1/upgrades.go @@ -1,5 +1,5 @@ //nolint:revive -package v8_4 +package v10_1 import ( "github.com/classic-terra/core/v3/app/keepers" @@ -9,7 +9,7 @@ import ( upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) -func CreateV84UpgradeHandler( +func CreateV101UpgradeHandler( mm *module.Manager, cfg module.Configurator, _ upgrades.BaseAppParamManager, diff --git a/cmd/terrad/testnet.go b/cmd/terrad/testnet.go index f8e7d6b5..3d6f9201 100644 --- a/cmd/terrad/testnet.go +++ b/cmd/terrad/testnet.go @@ -11,7 +11,7 @@ import ( "path/filepath" "time" - govv2lunc1 "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + govv2custom "github.com/classic-terra/core/v3/custom/gov/types/v2custom" tmconfig "github.com/cometbft/cometbft/config" tmos "github.com/cometbft/cometbft/libs/os" tmrand "github.com/cometbft/cometbft/libs/rand" @@ -309,7 +309,7 @@ func initGenFiles( appGenState[banktypes.ModuleName] = clientCtx.Codec.MustMarshalJSON(&bankGenState) // set gov in the genesis state - var govGenState govv2lunc1.GenesisState + var govGenState govv2custom.GenesisState clientCtx.Codec.MustUnmarshalJSON(appGenState[govtypes.ModuleName], &govGenState) votingPeriod := time.Minute * 3 govGenState.Params.VotingPeriod = &votingPeriod diff --git a/custom/auth/ante/min_initial_deposit.go b/custom/auth/ante/min_initial_deposit.go index cdf27825..7b32902f 100644 --- a/custom/auth/ante/min_initial_deposit.go +++ b/custom/auth/ante/min_initial_deposit.go @@ -50,10 +50,10 @@ func HandleCheckMinInitialDeposit(ctx sdk.Context, msg sdk.Msg, govKeeper custom } // set offset price change 3% offsetPrice := sdk.NewDecWithPrec(97, 2) - minLuncAmount, err := govKeeper.GetMinimumDepositBaseUusd(ctx) + minUlunaAmount, err := govKeeper.GetMinimumDepositBaseUstc(ctx) minInitialDepositRatio := treasuryKeeper.GetMinInitialDepositRatio(ctx) - if err == nil && minLuncAmount.GT(sdk.ZeroInt()) { - requiredDeposit := sdk.NewDecFromInt(minLuncAmount).Mul(minInitialDepositRatio).Mul(offsetPrice).TruncateInt() + if err == nil && minUlunaAmount.GT(sdk.ZeroInt()) { + requiredDeposit := sdk.NewDecFromInt(minUlunaAmount).Mul(minInitialDepositRatio).Mul(offsetPrice).TruncateInt() requiredDepositCoins := sdk.NewCoins(sdk.NewCoin(core.MicroLunaDenom, requiredDeposit)) if initialDepositCoins.IsAllLT(requiredDepositCoins) { return fmt.Errorf("not enough initial deposit provided. Expected %q; got %q", requiredDepositCoins, initialDepositCoins) diff --git a/custom/auth/ante/min_initial_deposit_test.go b/custom/auth/ante/min_initial_deposit_test.go index 6810cfcd..f4ad0e46 100644 --- a/custom/auth/ante/min_initial_deposit_test.go +++ b/custom/auth/ante/min_initial_deposit_test.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/classic-terra/core/v3/custom/auth/ante" - govv2lunc1 "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + govv2custom "github.com/classic-terra/core/v3/custom/gov/types/v2custom" core "github.com/classic-terra/core/v3/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" "github.com/cosmos/cosmos-sdk/testutil/testdata" @@ -25,13 +25,13 @@ func (suite *AnteTestSuite) TestMinInitialDepositRatioDefault() { suite.app.OracleKeeper.SetLunaExchangeRate(suite.ctx, core.MicroUSDDenom, lunaPriceInUSD) // set required deposit to uluna - suite.app.GovKeeper.SetParams(suite.ctx, govv2lunc1.DefaultParams()) + suite.app.GovKeeper.SetParams(suite.ctx, govv2custom.DefaultParams()) govparams := suite.app.GovKeeper.GetParams(suite.ctx) govparams.MinUusdDeposit = sdk.NewCoin(core.MicroUSDDenom, sdk.NewInt(500_000_000)) suite.app.GovKeeper.SetParams(suite.ctx, govparams) - price, _ := suite.app.GovKeeper.GetMinimumDepositBaseUusd(suite.ctx) - fmt.Printf("\n GetMinimumDepositBaseUusd %s", price.String()) + price, _ := suite.app.GovKeeper.GetMinimumDepositBaseUstc(suite.ctx) + fmt.Printf("\n GetMinimumDepositBaseUstc %s", price.String()) // set initial deposit ratio to 0.0 ratio := sdk.ZeroDec() @@ -85,13 +85,13 @@ func (suite *AnteTestSuite) TestMinInitialDepositRatioWithSufficientDeposit() { suite.app.OracleKeeper.SetLunaExchangeRate(suite.ctx, core.MicroUSDDenom, lunaPriceInUSD) // set required deposit to uluna - suite.app.GovKeeper.SetParams(suite.ctx, govv2lunc1.DefaultParams()) + suite.app.GovKeeper.SetParams(suite.ctx, govv2custom.DefaultParams()) govparams := suite.app.GovKeeper.GetParams(suite.ctx) govparams.MinUusdDeposit = sdk.NewCoin(core.MicroUSDDenom, sdk.NewInt(500_000_000)) suite.app.GovKeeper.SetParams(suite.ctx, govparams) - price, _ := suite.app.GovKeeper.GetMinimumDepositBaseUusd(suite.ctx) - fmt.Printf("\n GetMinimumDepositBaseUusd %s", price.String()) + price, _ := suite.app.GovKeeper.GetMinimumDepositBaseUstc(suite.ctx) + fmt.Printf("\n GetMinimumDepositBaseUstc %s", price.String()) // set initial deposit ratio to 0.2 ratio := sdk.NewDecWithPrec(2, 1) @@ -151,13 +151,13 @@ func (suite *AnteTestSuite) TestMinInitialDepositRatioWithInsufficientDeposit() suite.app.OracleKeeper.SetLunaExchangeRate(suite.ctx, core.MicroUSDDenom, lunaPriceInUSD) // set required deposit to uluna - suite.app.GovKeeper.SetParams(suite.ctx, govv2lunc1.DefaultParams()) + suite.app.GovKeeper.SetParams(suite.ctx, govv2custom.DefaultParams()) govparams := suite.app.GovKeeper.GetParams(suite.ctx) govparams.MinUusdDeposit = sdk.NewCoin(core.MicroUSDDenom, sdk.NewInt(500_000_000)) suite.app.GovKeeper.SetParams(suite.ctx, govparams) - price, _ := suite.app.GovKeeper.GetMinimumDepositBaseUusd(suite.ctx) - fmt.Printf("\n GetMinimumDepositBaseUusd %s", price.String()) + price, _ := suite.app.GovKeeper.GetMinimumDepositBaseUstc(suite.ctx) + fmt.Printf("\n GetMinimumDepositBaseUstc %s", price.String()) // set initial deposit ratio to 0.2 ratio := sdk.NewDecWithPrec(2, 1) diff --git a/custom/distribution/types/codec.go b/custom/distribution/types/codec.go index 0e2e8ba5..7fe9dfcf 100644 --- a/custom/distribution/types/codec.go +++ b/custom/distribution/types/codec.go @@ -6,7 +6,7 @@ import ( cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" "github.com/cosmos/cosmos-sdk/x/distribution/types" - govtypes "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + govtypes "github.com/classic-terra/core/v3/custom/gov/types/v2custom" ) // RegisterLegacyAminoCodec registers the necessary x/distribution interfaces and concrete types diff --git a/custom/gov/README.md b/custom/gov/README.md index b56a5922..e1cdda5f 100644 --- a/custom/gov/README.md +++ b/custom/gov/README.md @@ -33,24 +33,24 @@ module uses the `MsgServiceRouter` to check that these messages are correctly co and have a respective path to execute on but do not perform a full validity check. ### Deposit -To prevent spam, proposals must be submitted with a deposit in the coins defined by the equation `luncMinDepositAmountBasedOnUusd` = `MinUusdDeposit` / real-time price of LUNC at the time of proposal submission. +To prevent spam, proposals must be submitted with a deposit in the coins defined by the equation `luncMinDepositAmountBasedOnUstc` = `MinUusdDeposit` / real-time price of LUNC at the time of proposal submission. ```keeper reference github.com/classic-terra/core/v3/custom/gov/keeper/proposal.go#L136-L149 ``` -The value of `luncMinDepositAmountBasedOnUusd` will be stored in KVStores, using a key defined as `UUSDMinKeyPrefix|proposalID`, where the proposal ID is appended to the prefix, represented as a single byte. +The value of `luncMinDepositAmountBasedOnUstc` will be stored in KVStores, using a key defined as `USTCMinKeyPrefix|proposalID`, where the proposal ID is appended to the prefix, represented as a single byte. ```types reference github.com/classic-terra/core/v3/custom/gov/types/keys.go#L20-L22 ``` When a proposal is submitted, it has to be accompanied with a deposit that must be -strictly positive, but can be inferior to `luncMinDepositAmountBasedOnUusd`. The submitter doesn't need +strictly positive, but can be inferior to `luncMinDepositAmountBasedOnUstc`. The submitter doesn't need to pay for the entire deposit on their own. The newly created proposal is stored in -an *inactive proposal queue* and stays there until its deposit passes the `luncMinDepositAmountBasedOnUusd`. +an *inactive proposal queue* and stays there until its deposit passes the `luncMinDepositAmountBasedOnUstc`. Other token holders can increase the proposal's deposit by sending a `Deposit` -transaction. If a proposal doesn't pass the `luncMinDepositAmountBasedOnUusd` before the deposit end time +transaction. If a proposal doesn't pass the `luncMinDepositAmountBasedOnUstc` before the deposit end time (the time when deposits are no longer accepted), the proposal will be destroyed: the proposal will be removed from state and the deposit will be burned (see x/gov `EndBlocker`). -When a proposal deposit passes the `luncMinDepositAmountBasedOnUusd` threshold (even during the proposal +When a proposal deposit passes the `luncMinDepositAmountBasedOnUstc` threshold (even during the proposal submission) before the deposit end time, the proposal will be moved into the *active proposal queue* and the voting period will begin. @@ -73,7 +73,7 @@ according to the final tally of the proposal: #### Voting period -Once a proposal reaches `luncMinDepositAmountBasedOnUusd`, it immediately enters `Voting period`. We +Once a proposal reaches `luncMinDepositAmountBasedOnUstc`, it immediately enters `Voting period`. We define `Voting period` as the interval between the moment the vote opens and the moment the vote closes. `Voting period` should always be shorter than `Unbonding period` to prevent double voting. The initial value of @@ -94,7 +94,7 @@ We will use one KVStore `Governance` to store five mappings: x/gov params. * A mapping from `VotingPeriodProposalKeyPrefix|proposalID` to a single byte. This allows us to know if a proposal is in the voting period or not with very low gas cost. -* A mapping from `UUSDMinKeyPrefix|proposalID` to a single byte. This allows us to determine the minimum amount of LUNC that a specific proposal must deposit to pass the deposit phase. +* A mapping from `USTCMinKeyPrefix|proposalID` to a single byte. This allows us to determine the minimum amount of LUNC that a specific proposal must deposit to pass the deposit phase. For pseudocode purposes, here are the two function we will use to read or write in stores: @@ -128,7 +128,7 @@ A user can query and interact with the `gov` module using the CLI. We have added two new commands ##### MinimalDeposit -The `MinimalDeposit` command enables users to query the minimum LUNC deposit required for a specific proposal, calculated based on the UUSD value. +The `MinimalDeposit` command enables users to query the minimum LUNC deposit required for a specific proposal, calculated based on the USTC value. ```bash diff --git a/custom/gov/client/cli/query.go b/custom/gov/client/cli/query.go index 0b4c1ea5..4dd81fc4 100644 --- a/custom/gov/client/cli/query.go +++ b/custom/gov/client/cli/query.go @@ -7,7 +7,7 @@ import ( "github.com/spf13/cobra" - v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + v2customtypes "github.com/classic-terra/core/v3/custom/gov/types/v2custom" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/version" @@ -65,7 +65,7 @@ $ %s query gov min-deposit 1 if err != nil { return err } - queryClient := v2lunc1types.NewQueryClient(clientCtx) + queryClient := v2customtypes.NewQueryClient(clientCtx) // validate that the proposal id is a uint proposalID, err := strconv.ParseUint(args[0], 10, 64) @@ -74,9 +74,9 @@ $ %s query gov min-deposit 1 } // Query the proposal - res, err := queryClient.ProposalMinimalLUNCByUusd( + res, err := queryClient.ProposalMinimalLUNCByUstc( cmd.Context(), - &v2lunc1types.QueryProposalRequest{ProposalId: proposalID}, + &v2customtypes.QueryProposalRequest{ProposalId: proposalID}, ) if err != nil { return err @@ -102,11 +102,11 @@ func GetCmdQueryCustomParams() *cobra.Command { if err != nil { return err } - queryClient := v2lunc1types.NewQueryClient(clientCtx) + queryClient := v2customtypes.NewQueryClient(clientCtx) // Query the proposal res, err := queryClient.Params( cmd.Context(), - &v2lunc1types.QueryParamsRequest{}, + &v2customtypes.QueryParamsRequest{}, ) if err != nil { return err diff --git a/custom/gov/client/cli/query_test.go b/custom/gov/client/cli/query_test.go index fefe9155..4b29d904 100644 --- a/custom/gov/client/cli/query_test.go +++ b/custom/gov/client/cli/query_test.go @@ -4,7 +4,7 @@ import ( "fmt" "strings" - v2lunc1cli "github.com/classic-terra/core/v3/custom/gov/client/cli" + v2customcli "github.com/classic-terra/core/v3/custom/gov/client/cli" ) func (s *CLITestSuite) TestGetCmdQueryMinimalDeposit() { @@ -33,7 +33,7 @@ func (s *CLITestSuite) TestGetCmdQueryMinimalDeposit() { tc := tc s.Run(tc.name, func() { - cmd := v2lunc1cli.GetCmdQueryMinimalDeposit() + cmd := v2customcli.GetCmdQueryMinimalDeposit() cmd.SetArgs(tc.args) s.Require().Contains(fmt.Sprint(cmd), strings.TrimSpace(tc.expCmdOutput)) }) diff --git a/custom/gov/genesis.go b/custom/gov/genesis.go index e0f5d1ca..0d4808bf 100644 --- a/custom/gov/genesis.go +++ b/custom/gov/genesis.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/classic-terra/core/v3/custom/gov/keeper" - "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + "github.com/classic-terra/core/v3/custom/gov/types/v2custom" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -12,7 +12,7 @@ import ( ) // InitGenesis - store genesis parameters -func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, k *keeper.Keeper, data *v2lunc1.GenesisState) { +func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, k *keeper.Keeper, data *v2custom.GenesisState) { k.SetProposalID(ctx, data.StartingProposalId) k.SetParams(ctx, *data.Params) @@ -55,7 +55,7 @@ func InitGenesis(ctx sdk.Context, ak types.AccountKeeper, bk types.BankKeeper, k } // ExportGenesis - output genesis parameters -func ExportGenesis(ctx sdk.Context, k *keeper.Keeper) *v2lunc1.GenesisState { +func ExportGenesis(ctx sdk.Context, k *keeper.Keeper) *v2custom.GenesisState { startingProposalID, _ := k.GetProposalID(ctx) proposals := k.GetProposals(ctx) params := k.GetParams(ctx) @@ -70,7 +70,7 @@ func ExportGenesis(ctx sdk.Context, k *keeper.Keeper) *v2lunc1.GenesisState { proposalsVotes = append(proposalsVotes, votes...) } - return &v2lunc1.GenesisState{ + return &v2custom.GenesisState{ StartingProposalId: startingProposalID, Deposits: proposalsDeposits, Votes: proposalsVotes, diff --git a/custom/gov/keeper/deposit.go b/custom/gov/keeper/deposit.go index 39a79e45..8920de70 100644 --- a/custom/gov/keeper/deposit.go +++ b/custom/gov/keeper/deposit.go @@ -38,7 +38,7 @@ func (keeper Keeper) AddDeposit(ctx sdk.Context, proposalID uint64, depositorAdd // HandleCheckLimitDeposit minDeposit := keeper.GetParams(ctx).MinDeposit - requiredAmount := keeper.GetDepositLimitBaseUusd(ctx, proposalID) + requiredAmount := keeper.GetDepositLimitBaseUstc(ctx, proposalID) if requiredAmount.IsZero() { requiredAmount = minDeposit[0].Amount } @@ -93,7 +93,7 @@ func (keeper Keeper) validateInitialDeposit(ctx sdk.Context, initialDeposit sdk. if minInitialDepositRatio.IsZero() { return nil } - totalLuncDeposit, err := keeper.GetMinimumDepositBaseUusd(ctx) + totalLuncDeposit, err := keeper.GetMinimumDepositBaseUstc(ctx) luncCoin := sdk.NewCoin(params.MinDeposit[0].Denom, totalLuncDeposit) minDepositCoins := params.MinDeposit minDepositCoins[0] = luncCoin diff --git a/custom/gov/keeper/deposit_test.go b/custom/gov/keeper/deposit_test.go index 79663a74..1d1e4a30 100644 --- a/custom/gov/keeper/deposit_test.go +++ b/custom/gov/keeper/deposit_test.go @@ -4,7 +4,7 @@ import ( "fmt" "testing" - "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + "github.com/classic-terra/core/v3/custom/gov/types/v2custom" core "github.com/classic-terra/core/v3/types" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" "github.com/stretchr/testify/require" @@ -156,11 +156,11 @@ func TestValidateInitialDeposit(t *testing.T) { govKeeper := input.GovKeeper ctx := input.Ctx input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.NewDec(1)) - minLuncDeposit, err := input.GovKeeper.GetMinimumDepositBaseUusd(ctx) + minUlunaAmount, err := input.GovKeeper.GetMinimumDepositBaseUstc(ctx) require.NoError(t, err) // setup deposit value when test - meetsDepositValue := minLuncDeposit.Mul(sdk.NewInt(baseDepositTestPercent)).Quo(sdk.NewInt(100)) + meetsDepositValue := minUlunaAmount.Mul(sdk.NewInt(baseDepositTestPercent)).Quo(sdk.NewInt(100)) testcases := map[string]struct { minDeposit sdk.Coins @@ -189,12 +189,12 @@ func TestValidateInitialDeposit(t *testing.T) { "min deposit * initial percent == initial deposit (non-base values and denom): success": { minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(56912))), minInitialDepositPercent: 50, - initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, minLuncDeposit.Mul(sdk.NewInt(50)).Quo(sdk.NewInt(100)).Add(sdk.NewInt(10)))), + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, minUlunaAmount.Mul(sdk.NewInt(50)).Quo(sdk.NewInt(100)).Add(sdk.NewInt(10)))), }, "min deposit * initial percent == initial deposit but different denoms: error": { minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseUSDDepositTestAmount))), minInitialDepositPercent: baseDepositTestPercent, - initialDeposit: sdk.NewCoins(sdk.NewCoin("uosmo", minLuncDeposit)), + initialDeposit: sdk.NewCoins(sdk.NewCoin("uosmo", minUlunaAmount)), expectError: true, }, "min deposit * initial percent == initial deposit (multiple coins): success": { @@ -203,7 +203,7 @@ func TestValidateInitialDeposit(t *testing.T) { sdk.NewCoin("uosmo", sdk.NewInt(baseUSDDepositTestAmount*2))), minInitialDepositPercent: baseDepositTestPercent, initialDeposit: sdk.NewCoins( - sdk.NewCoin(sdk.DefaultBondDenom, minLuncDeposit), + sdk.NewCoin(sdk.DefaultBondDenom, minUlunaAmount), sdk.NewCoin("uosmo", sdk.NewInt(baseUSDDepositTestAmount*2*baseDepositTestPercent/100)), ), }, @@ -213,7 +213,7 @@ func TestValidateInitialDeposit(t *testing.T) { sdk.NewCoin("uosmo", sdk.NewInt(baseUSDDepositTestAmount*3))), minInitialDepositPercent: baseDepositTestPercent, initialDeposit: sdk.NewCoins( - sdk.NewCoin(sdk.DefaultBondDenom, minLuncDeposit), + sdk.NewCoin(sdk.DefaultBondDenom, minUlunaAmount), sdk.NewCoin("uosmo", sdk.NewInt(baseUSDDepositTestAmount*2*baseDepositTestPercent/100-1)), ), @@ -224,20 +224,20 @@ func TestValidateInitialDeposit(t *testing.T) { sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseUSDDepositTestAmount))), minInitialDepositPercent: baseDepositTestPercent, initialDeposit: sdk.NewCoins( - sdk.NewCoin(sdk.DefaultBondDenom, minLuncDeposit), + sdk.NewCoin(sdk.DefaultBondDenom, minUlunaAmount), sdk.NewCoin("uosmo", sdk.NewInt(baseUSDDepositTestAmount*baseDepositTestPercent/100-1)), ), }, "0 initial percent: success": { minDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(baseUSDDepositTestAmount))), minInitialDepositPercent: 0, - initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, minLuncDeposit)), + initialDeposit: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, minUlunaAmount)), }, } for name, tc := range testcases { t.Run(name, func(t *testing.T) { - params := v2lunc1.DefaultParams() + params := v2custom.DefaultParams() params.MinDeposit = tc.minDeposit params.MinInitialDepositRatio = sdk.NewDec(tc.minInitialDepositPercent).Quo(sdk.NewDec(100)).String() govKeeper.SetParams(ctx, params) diff --git a/custom/gov/keeper/grpc_query.go b/custom/gov/keeper/grpc_query.go index 2a80bad4..75663f64 100644 --- a/custom/gov/keeper/grpc_query.go +++ b/custom/gov/keeper/grpc_query.go @@ -3,16 +3,16 @@ package keeper import ( "context" - v2lunc1 "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + v2custom "github.com/classic-terra/core/v3/custom/gov/types/v2custom" core "github.com/classic-terra/core/v3/types" sdk "github.com/cosmos/cosmos-sdk/types" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" ) -var _ v2lunc1.QueryServer = queryServer{} +var _ v2custom.QueryServer = queryServer{} -func NewQueryServerImpl(k Keeper) v2lunc1.QueryServer { +func NewQueryServerImpl(k Keeper) v2custom.QueryServer { return queryServer{ k: k, govQueryServer: govkeeper.NewLegacyQueryServer(k.Keeper), @@ -25,17 +25,17 @@ type queryServer struct { } // Params returns params of the mint module. -func (q queryServer) Params(ctx context.Context, _ *v2lunc1.QueryParamsRequest) (*v2lunc1.QueryParamsResponse, error) { +func (q queryServer) Params(ctx context.Context, _ *v2custom.QueryParamsRequest) (*v2custom.QueryParamsResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) params := q.k.GetParams(sdkCtx) - return &v2lunc1.QueryParamsResponse{Params: params}, nil + return &v2custom.QueryParamsResponse{Params: params}, nil } -// ProposalMinimalLUNCByUusd returns min Usd amount proposal needs to deposit -func (q queryServer) ProposalMinimalLUNCByUusd(ctx context.Context, req *v2lunc1.QueryProposalRequest) (*v2lunc1.QueryMinimalDepositProposalResponse, error) { +// ProposalMinimalLUNCByUstc returns min Usd amount proposal needs to deposit +func (q queryServer) ProposalMinimalLUNCByUstc(ctx context.Context, req *v2custom.QueryProposalRequest) (*v2custom.QueryMinimalDepositProposalResponse, error) { sdkCtx := sdk.UnwrapSDKContext(ctx) - depositAmount := q.k.GetDepositLimitBaseUusd(sdkCtx, req.ProposalId) + depositAmount := q.k.GetDepositLimitBaseUstc(sdkCtx, req.ProposalId) coin := sdk.NewCoin(core.MicroLunaDenom, depositAmount) // if no min deposit amount by uusd exists, return default min deposit amount @@ -43,5 +43,5 @@ func (q queryServer) ProposalMinimalLUNCByUusd(ctx context.Context, req *v2lunc1 coin = q.k.GetParams(sdkCtx).MinDeposit[0] } - return &v2lunc1.QueryMinimalDepositProposalResponse{MinimalDeposit: coin}, nil + return &v2custom.QueryMinimalDepositProposalResponse{MinimalDeposit: coin}, nil } diff --git a/custom/gov/keeper/grpc_query_test.go b/custom/gov/keeper/grpc_query_test.go index 9812c36e..7a97816d 100644 --- a/custom/gov/keeper/grpc_query_test.go +++ b/custom/gov/keeper/grpc_query_test.go @@ -5,20 +5,20 @@ import ( "fmt" "testing" - "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" // Adjust the import path as necessary + "github.com/classic-terra/core/v3/custom/gov/types/v2custom" // Adjust the import path as necessary sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" ) -// MockQueryServer is a mock implementation of the v2lunc1.QueryServer interface +// MockQueryServer is a mock implementation of the v2custom.QueryServer interface type MockQueryServer struct { // You can store any state needed for the mock here - ProposalResponse *v2lunc1.QueryMinimalDepositProposalResponse + ProposalResponse *v2custom.QueryMinimalDepositProposalResponse Err error } -// ProposalMinimalLUNCByUusd implements the v2lunc1.QueryServer interface -func (m *MockQueryServer) ProposalMinimalLUNCByUusd(_ context.Context, _ *v2lunc1.QueryProposalRequest) (*v2lunc1.QueryMinimalDepositProposalResponse, error) { +// ProposalMinimalLUNCByUstc implements the v2custom.QueryServer interface +func (m *MockQueryServer) ProposalMinimalLUNCByUstc(_ context.Context, _ *v2custom.QueryProposalRequest) (*v2custom.QueryMinimalDepositProposalResponse, error) { if m.Err != nil { return nil, m.Err } @@ -28,7 +28,7 @@ func (m *MockQueryServer) ProposalMinimalLUNCByUusd(_ context.Context, _ *v2lunc // Test your keeper logic with the mock func TestKeeperWithMockQueryServer(t *testing.T) { mockQueryServer := &MockQueryServer{ - ProposalResponse: &v2lunc1.QueryMinimalDepositProposalResponse{ + ProposalResponse: &v2custom.QueryMinimalDepositProposalResponse{ // MinimalDeposit: sdk.Coin{sdk.NewCoin("uusd", sdk.NewInt(1000))}, MinimalDeposit: sdk.NewCoin("uusd", sdk.NewInt(1000)), }, @@ -37,8 +37,8 @@ func TestKeeperWithMockQueryServer(t *testing.T) { // Create your context and other setup logic as needed t.Run("successful query", func(t *testing.T) { - req := &v2lunc1.QueryProposalRequest{ProposalId: 1} - res, err := mockQueryServer.ProposalMinimalLUNCByUusd(context.Background(), req) + req := &v2custom.QueryProposalRequest{ProposalId: 1} + res, err := mockQueryServer.ProposalMinimalLUNCByUstc(context.Background(), req) require.NoError(t, err) require.NotNil(t, res) require.Equal(t, sdk.NewInt(1000), res.MinimalDeposit.Amount) @@ -46,8 +46,8 @@ func TestKeeperWithMockQueryServer(t *testing.T) { t.Run("error when querying proposal", func(t *testing.T) { mockQueryServer.Err = fmt.Errorf("proposal not found") - req := &v2lunc1.QueryProposalRequest{ProposalId: 1} - _, err := mockQueryServer.ProposalMinimalLUNCByUusd(context.Background(), req) + req := &v2custom.QueryProposalRequest{ProposalId: 1} + _, err := mockQueryServer.ProposalMinimalLUNCByUstc(context.Background(), req) require.Error(t, err) require.Equal(t, "proposal not found", err.Error()) }) diff --git a/custom/gov/keeper/keeper.go b/custom/gov/keeper/keeper.go index 2b88454f..05fa4245 100644 --- a/custom/gov/keeper/keeper.go +++ b/custom/gov/keeper/keeper.go @@ -2,7 +2,7 @@ package keeper import ( "cosmossdk.io/math" - v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types" + v2customtypes "github.com/classic-terra/core/v3/custom/gov/types" core "github.com/classic-terra/core/v3/types" markettypes "github.com/classic-terra/core/v3/x/market/types" "github.com/cosmos/cosmos-sdk/baseapp" @@ -80,10 +80,10 @@ func (keeper *Keeper) SetHooks(gh types.GovHooks) *Keeper { return keeper } -// SetDepositLimitBaseUusd sets a limit deposit(Lunc) base on Uusd to store. -func (keeper Keeper) SetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64, amount math.Int) error { +// SetDepositLimitBaseUstc sets a limit deposit(Lunc) base on Ustc to store. +func (keeper Keeper) SetDepositLimitBaseUstc(ctx sdk.Context, proposalID uint64, amount math.Int) error { store := ctx.KVStore(keeper.storeKey) - key := v2lunc1types.TotalDepositKey(proposalID) + key := v2customtypes.TotalDepositKey(proposalID) bz, err := amount.Marshal() if err == nil { store.Set(key, bz) @@ -91,8 +91,8 @@ func (keeper Keeper) SetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64, return err } -// GetDepositLimitBaseUusd: calculate the minimum LUNC amount to deposit base on Uusd for the proposal -func (keeper Keeper) GetMinimumDepositBaseUusd(ctx sdk.Context) (math.Int, error) { +// GetDepositLimitBaseUstc: calculate the minimum LUNC amount to deposit base on Ustc for the proposal +func (keeper Keeper) GetMinimumDepositBaseUstc(ctx sdk.Context) (math.Int, error) { // Get exchange rate betweent Lunc/uusd from oracle // save it to store price, err := keeper.oracleKeeper.GetLunaExchangeRate(ctx, core.MicroUSDDenom) @@ -101,16 +101,16 @@ func (keeper Keeper) GetMinimumDepositBaseUusd(ctx sdk.Context) (math.Int, error return keeper.GetParams(ctx).MinDeposit[0].Amount, nil } - minUusdDeposit := keeper.GetParams(ctx).MinUusdDeposit - totalLuncDeposit := sdk.NewDecFromInt(minUusdDeposit.Amount).Quo(price).TruncateInt() + MinUusdDeposit := keeper.GetParams(ctx).MinUusdDeposit + totalUlunaDeposit := sdk.NewDecFromInt(MinUusdDeposit.Amount).Quo(price).TruncateInt() - return totalLuncDeposit, nil + return totalUlunaDeposit, nil } -// GetDepositLimitBaseUUSD gets the deposit limit (Lunc) for a specific proposal -func (keeper Keeper) GetDepositLimitBaseUusd(ctx sdk.Context, proposalID uint64) (depositLimit math.Int) { +// GetDepositLimitBaseUstc gets the deposit limit (Lunc) for a specific proposal +func (keeper Keeper) GetDepositLimitBaseUstc(ctx sdk.Context, proposalID uint64) (depositLimit math.Int) { store := ctx.KVStore(keeper.storeKey) - key := v2lunc1types.TotalDepositKey(proposalID) + key := v2customtypes.TotalDepositKey(proposalID) bz := store.Get(key) if bz == nil { return sdk.ZeroInt() diff --git a/custom/gov/keeper/msg_server.go b/custom/gov/keeper/msg_server.go index ac9435ac..ad6601da 100644 --- a/custom/gov/keeper/msg_server.go +++ b/custom/gov/keeper/msg_server.go @@ -5,7 +5,7 @@ import ( "fmt" "cosmossdk.io/errors" - v2lunc1 "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + v2custom "github.com/classic-terra/core/v3/custom/gov/types/v2custom" sdk "github.com/cosmos/cosmos-sdk/types" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -20,14 +20,14 @@ type msgServer struct { // NewMsgServerImpl returns an implementation of the gov MsgServer interface // for the provided Keeper. -func NewMsgServerImpl(keeper *Keeper) v2lunc1.MsgServer { +func NewMsgServerImpl(keeper *Keeper) v2custom.MsgServer { return &msgServer{ Keeper: keeper, v1MsgServer: govkeeper.NewMsgServerImpl(keeper.Keeper), } } -var _ v2lunc1.MsgServer = msgServer{} +var _ v2custom.MsgServer = msgServer{} // SubmitProposal implements the MsgServer.SubmitProposal method. func (k msgServer) SubmitProposal(goCtx context.Context, msg *govv1.MsgSubmitProposal) (*govv1.MsgSubmitProposalResponse, error) { @@ -119,7 +119,7 @@ func (k msgServer) VoteWeighted(goCtx context.Context, msg *govv1.MsgVoteWeighte return k.v1MsgServer.VoteWeighted(goCtx, msg) } -func (k msgServer) UpdateParams(goCtx context.Context, msg *v2lunc1.MsgUpdateParams) (*v2lunc1.MsgUpdateParamsResponse, error) { +func (k msgServer) UpdateParams(goCtx context.Context, msg *v2custom.MsgUpdateParams) (*v2custom.MsgUpdateParamsResponse, error) { if k.authority != msg.Authority { return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) } @@ -129,18 +129,18 @@ func (k msgServer) UpdateParams(goCtx context.Context, msg *v2lunc1.MsgUpdatePar return nil, err } - return &v2lunc1.MsgUpdateParamsResponse{}, nil + return &v2custom.MsgUpdateParamsResponse{}, nil } type legacyMsgServer struct { govAcct string - server v2lunc1.MsgServer + server v2custom.MsgServer } // NewLegacyMsgServerImpl returns an implementation of the v1beta1 legacy MsgServer interface. It wraps around // the current MsgServer -func NewLegacyMsgServerImpl(govAcct string, v2lunc1Server v2lunc1.MsgServer) govv1beta1.MsgServer { - return &legacyMsgServer{govAcct: govAcct, server: v2lunc1Server} +func NewLegacyMsgServerImpl(govAcct string, v2customServer v2custom.MsgServer) govv1beta1.MsgServer { + return &legacyMsgServer{govAcct: govAcct, server: v2customServer} } var _ govv1beta1.MsgServer = legacyMsgServer{} diff --git a/custom/gov/keeper/msg_server_test.go b/custom/gov/keeper/msg_server_test.go index 66588ac7..786ea6e8 100644 --- a/custom/gov/keeper/msg_server_test.go +++ b/custom/gov/keeper/msg_server_test.go @@ -10,7 +10,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + v2customtypes "github.com/classic-terra/core/v3/custom/gov/types/v2custom" core "github.com/classic-terra/core/v3/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -193,7 +193,7 @@ func TestVoteReq(t *testing.T) { require.NoError(t, err) require.NotNil(t, res.ProposalId) proposalID := res.ProposalId - requiredAmount := govKeeper.GetDepositLimitBaseUusd(ctx, proposalID) + requiredAmount := govKeeper.GetDepositLimitBaseUstc(ctx, proposalID) cases := map[string]struct { preRun func() uint64 @@ -337,7 +337,7 @@ func TestVoteWeightedReq(t *testing.T) { require.NoError(t, err) require.NotNil(t, res.ProposalId) proposalID := res.ProposalId - // requiredAmount := suite.govKeeper.GetDepositLimitBaseUusd(suite.ctx, proposalId).TruncateInt() + // requiredAmount := suite.govKeeper.GetDepositLimitBaseUstc(suite.ctx, proposalId).TruncateInt() cases := map[string]struct { preRun func() uint64 @@ -536,18 +536,18 @@ func TestMsgUpdateParams(t *testing.T) { ctx := input.Ctx govKeeper := input.GovKeeper authority := govKeeper.GetAuthority() - params := v2lunc1types.DefaultParams() + params := v2customtypes.DefaultParams() govMsgSvr := NewMsgServerImpl(input.GovKeeper) testCases := []struct { name string - input func() *v2lunc1types.MsgUpdateParams + input func() *v2customtypes.MsgUpdateParams expErr bool expErrMsg string }{ { name: "valid", - input: func() *v2lunc1types.MsgUpdateParams { - return &v2lunc1types.MsgUpdateParams{ + input: func() *v2customtypes.MsgUpdateParams { + return &v2customtypes.MsgUpdateParams{ Authority: authority, Params: params, } @@ -556,8 +556,8 @@ func TestMsgUpdateParams(t *testing.T) { }, { name: "invalid authority", - input: func() *v2lunc1types.MsgUpdateParams { - return &v2lunc1types.MsgUpdateParams{ + input: func() *v2customtypes.MsgUpdateParams { + return &v2customtypes.MsgUpdateParams{ Authority: "authority", Params: params, } @@ -567,11 +567,11 @@ func TestMsgUpdateParams(t *testing.T) { }, { name: "invalid min deposit", - input: func() *v2lunc1types.MsgUpdateParams { + input: func() *v2customtypes.MsgUpdateParams { params1 := params params1.MinDeposit = nil - return &v2lunc1types.MsgUpdateParams{ + return &v2customtypes.MsgUpdateParams{ Authority: authority, Params: params1, } @@ -581,14 +581,14 @@ func TestMsgUpdateParams(t *testing.T) { }, { name: "negative deposit", - input: func() *v2lunc1types.MsgUpdateParams { + input: func() *v2customtypes.MsgUpdateParams { params1 := params params1.MinDeposit = sdk.Coins{{ Denom: sdk.DefaultBondDenom, Amount: sdk.NewInt(-100), }} - return &v2lunc1types.MsgUpdateParams{ + return &v2customtypes.MsgUpdateParams{ Authority: authority, Params: params1, } @@ -598,11 +598,11 @@ func TestMsgUpdateParams(t *testing.T) { }, { name: "invalid max deposit period", - input: func() *v2lunc1types.MsgUpdateParams { + input: func() *v2customtypes.MsgUpdateParams { params1 := params params1.MaxDepositPeriod = nil - return &v2lunc1types.MsgUpdateParams{ + return &v2customtypes.MsgUpdateParams{ Authority: authority, Params: params1, } @@ -612,12 +612,12 @@ func TestMsgUpdateParams(t *testing.T) { }, { name: "zero max deposit period", - input: func() *v2lunc1types.MsgUpdateParams { + input: func() *v2customtypes.MsgUpdateParams { params1 := params duration := time.Duration(0) params1.MaxDepositPeriod = &duration - return &v2lunc1types.MsgUpdateParams{ + return &v2customtypes.MsgUpdateParams{ Authority: authority, Params: params1, } @@ -627,11 +627,11 @@ func TestMsgUpdateParams(t *testing.T) { }, { name: "invalid quorum", - input: func() *v2lunc1types.MsgUpdateParams { + input: func() *v2customtypes.MsgUpdateParams { params1 := params params1.Quorum = testQuorumABC - return &v2lunc1types.MsgUpdateParams{ + return &v2customtypes.MsgUpdateParams{ Authority: authority, Params: params1, } @@ -641,11 +641,11 @@ func TestMsgUpdateParams(t *testing.T) { }, { name: "negative quorum", - input: func() *v2lunc1types.MsgUpdateParams { + input: func() *v2customtypes.MsgUpdateParams { params1 := params params1.Quorum = testQuorumNeg01 - return &v2lunc1types.MsgUpdateParams{ + return &v2customtypes.MsgUpdateParams{ Authority: authority, Params: params1, } @@ -655,11 +655,11 @@ func TestMsgUpdateParams(t *testing.T) { }, { name: "quorum > 1", - input: func() *v2lunc1types.MsgUpdateParams { + input: func() *v2customtypes.MsgUpdateParams { params1 := params params1.Quorum = "2" - return &v2lunc1types.MsgUpdateParams{ + return &v2customtypes.MsgUpdateParams{ Authority: authority, Params: params1, } @@ -669,11 +669,11 @@ func TestMsgUpdateParams(t *testing.T) { }, { name: "invalid threshold", - input: func() *v2lunc1types.MsgUpdateParams { + input: func() *v2customtypes.MsgUpdateParams { params1 := params params1.Threshold = testQuorumABC - return &v2lunc1types.MsgUpdateParams{ + return &v2customtypes.MsgUpdateParams{ Authority: authority, Params: params1, } @@ -683,11 +683,11 @@ func TestMsgUpdateParams(t *testing.T) { }, { name: "negative threshold", - input: func() *v2lunc1types.MsgUpdateParams { + input: func() *v2customtypes.MsgUpdateParams { params1 := params params1.Threshold = testQuorumNeg01 - return &v2lunc1types.MsgUpdateParams{ + return &v2customtypes.MsgUpdateParams{ Authority: authority, Params: params1, } @@ -697,11 +697,11 @@ func TestMsgUpdateParams(t *testing.T) { }, { name: "threshold > 1", - input: func() *v2lunc1types.MsgUpdateParams { + input: func() *v2customtypes.MsgUpdateParams { params1 := params params1.Threshold = "2" - return &v2lunc1types.MsgUpdateParams{ + return &v2customtypes.MsgUpdateParams{ Authority: authority, Params: params1, } @@ -711,11 +711,11 @@ func TestMsgUpdateParams(t *testing.T) { }, { name: "invalid veto threshold", - input: func() *v2lunc1types.MsgUpdateParams { + input: func() *v2customtypes.MsgUpdateParams { params1 := params params1.VetoThreshold = testQuorumABC - return &v2lunc1types.MsgUpdateParams{ + return &v2customtypes.MsgUpdateParams{ Authority: authority, Params: params1, } @@ -725,11 +725,11 @@ func TestMsgUpdateParams(t *testing.T) { }, { name: "negative veto threshold", - input: func() *v2lunc1types.MsgUpdateParams { + input: func() *v2customtypes.MsgUpdateParams { params1 := params params1.VetoThreshold = testQuorumNeg01 - return &v2lunc1types.MsgUpdateParams{ + return &v2customtypes.MsgUpdateParams{ Authority: authority, Params: params1, } @@ -739,11 +739,11 @@ func TestMsgUpdateParams(t *testing.T) { }, { name: "veto threshold > 1", - input: func() *v2lunc1types.MsgUpdateParams { + input: func() *v2customtypes.MsgUpdateParams { params1 := params params1.VetoThreshold = "2" - return &v2lunc1types.MsgUpdateParams{ + return &v2customtypes.MsgUpdateParams{ Authority: authority, Params: params1, } @@ -753,11 +753,11 @@ func TestMsgUpdateParams(t *testing.T) { }, { name: "invalid voting period", - input: func() *v2lunc1types.MsgUpdateParams { + input: func() *v2customtypes.MsgUpdateParams { params1 := params params1.VotingPeriod = nil - return &v2lunc1types.MsgUpdateParams{ + return &v2customtypes.MsgUpdateParams{ Authority: authority, Params: params1, } @@ -767,12 +767,12 @@ func TestMsgUpdateParams(t *testing.T) { }, { name: "zero voting period", - input: func() *v2lunc1types.MsgUpdateParams { + input: func() *v2customtypes.MsgUpdateParams { params1 := params duration := time.Duration(0) params1.VotingPeriod = &duration - return &v2lunc1types.MsgUpdateParams{ + return &v2customtypes.MsgUpdateParams{ Authority: authority, Params: params1, } @@ -786,7 +786,7 @@ func TestMsgUpdateParams(t *testing.T) { tc := tc t.Run(tc.name, func(t *testing.T) { msg := tc.input() - exec := func(updateParams *v2lunc1types.MsgUpdateParams) error { + exec := func(updateParams *v2customtypes.MsgUpdateParams) error { if err := msg.ValidateBasic(); err != nil { return err } @@ -820,7 +820,7 @@ func TestSubmitProposal_InitialDeposit(t *testing.T) { input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.NewDecWithPrec(2, 1)) _, _, addr := testdata.KeyTestPubAddr() - minLuncDeposit, err := input.GovKeeper.GetMinimumDepositBaseUusd(ctx) + minLuncDeposit, err := input.GovKeeper.GetMinimumDepositBaseUstc(ctx) require.NoError(t, err) // setup deposit value when test @@ -883,7 +883,7 @@ func TestSubmitProposal_InitialDeposit(t *testing.T) { FundAccount(input, addr, tc.minDeposit) govMsgSvr := NewMsgServerImpl(input.GovKeeper) - params := v2lunc1types.DefaultParams() + params := v2customtypes.DefaultParams() params.MinInitialDepositRatio = tc.minInitialDepositRatio.String() msg, err := v1.NewMsgSubmitProposal(msgs, tc.initialDeposit, addr.String(), "test", "Proposal", "description of proposal") @@ -911,7 +911,7 @@ func TestLegacyMsgSubmitProposal(t *testing.T) { _, _, addr := testdata.KeyTestPubAddr() proposer := addr - coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500_000_000))) // 500 UUSD + coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500_000_000))) // 500 USTC input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) initialDeposit := coins @@ -978,7 +978,7 @@ func TestLegacyMsgVote(t *testing.T) { _, _, addr := testdata.KeyTestPubAddr() proposer := addr - coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500_000_000))) // 500 UUSD + coins := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(500_000_000))) // 500 USTC input.OracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, sdk.OneDec()) FundAccount(input, addr, coins) diff --git a/custom/gov/keeper/params.go b/custom/gov/keeper/params.go index cdd582c3..2fffb830 100644 --- a/custom/gov/keeper/params.go +++ b/custom/gov/keeper/params.go @@ -1,13 +1,13 @@ package keeper import ( - v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + v2customtypes "github.com/classic-terra/core/v3/custom/gov/types/v2custom" sdk "github.com/cosmos/cosmos-sdk/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) // SetParams sets the gov module's parameters. -func (k Keeper) SetParams(ctx sdk.Context, params v2lunc1types.Params) error { +func (k Keeper) SetParams(ctx sdk.Context, params v2customtypes.Params) error { store := ctx.KVStore(k.storeKey) bz, err := k.cdc.Marshal(¶ms) if err != nil { @@ -19,7 +19,7 @@ func (k Keeper) SetParams(ctx sdk.Context, params v2lunc1types.Params) error { } // GetParams gets the gov module's parameters. -func (k Keeper) GetParams(clientCtx sdk.Context) (params v2lunc1types.Params) { +func (k Keeper) GetParams(clientCtx sdk.Context) (params v2customtypes.Params) { store := clientCtx.KVStore(k.storeKey) bz := store.Get(govtypes.ParamsKey) if bz == nil { diff --git a/custom/gov/keeper/proposal.go b/custom/gov/keeper/proposal.go index 5de652ed..249322ca 100644 --- a/custom/gov/keeper/proposal.go +++ b/custom/gov/keeper/proposal.go @@ -4,7 +4,7 @@ import ( "errors" "fmt" - v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types" + v2customtypes "github.com/classic-terra/core/v3/custom/gov/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -94,14 +94,14 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat keeper.InsertInactiveProposalQueue(ctx, proposalID, *proposal.DepositEndTime) keeper.SetProposalID(ctx, proposalID+1) - totalLuncDeposit, err := keeper.GetMinimumDepositBaseUusd(ctx) + totalUlunaDeposit, err := keeper.GetMinimumDepositBaseUstc(ctx) if err != nil { - return v1.Proposal{}, sdkerrors.Wrap(v2lunc1types.ErrQueryExchangeRateUusdFail, err.Error()) + return v1.Proposal{}, sdkerrors.Wrap(v2customtypes.ErrQueryExchangeRateUstcFail, err.Error()) } - err = keeper.SetDepositLimitBaseUusd(ctx, proposalID, totalLuncDeposit) + err = keeper.SetDepositLimitBaseUstc(ctx, proposalID, totalUlunaDeposit) if err != nil { - return v1.Proposal{}, sdkerrors.Wrap(v2lunc1types.ErrQueryExchangeRateUusdFail, err.Error()) + return v1.Proposal{}, sdkerrors.Wrap(v2customtypes.ErrQueryExchangeRateUstcFail, err.Error()) } // called right after a proposal is submitted diff --git a/custom/gov/keeper/proposal_test.go b/custom/gov/keeper/proposal_test.go index 29f7b37b..1d47b100 100644 --- a/custom/gov/keeper/proposal_test.go +++ b/custom/gov/keeper/proposal_test.go @@ -40,7 +40,7 @@ func TestGetSetProposal(t *testing.T) { lunaPriceInUSD := sdk.MustNewDecFromStr("0.10008905") oracleKeeper.SetLunaExchangeRate(ctx, core.MicroUSDDenom, lunaPriceInUSD) - totalLuncMinDeposit, err := govKeeper.GetMinimumDepositBaseUusd(ctx) + totalLuncMinDeposit, err := govKeeper.GetMinimumDepositBaseUstc(ctx) require.NoError(t, err) proposal, err := govKeeper.SubmitProposal(ctx, tp, "", "test", "summary", sdk.AccAddress("cosmos1ghekyjucln7y67ntx7cf27m9dpuxxemn4c8g4r")) @@ -53,7 +53,7 @@ func TestGetSetProposal(t *testing.T) { require.Equal(t, proposal, gotProposal) // Get min luna amount by uusd - minLunaAmount := govKeeper.GetDepositLimitBaseUusd(ctx, proposalID) + minLunaAmount := govKeeper.GetDepositLimitBaseUstc(ctx, proposalID) fmt.Printf("minLunaAmount %s\n", minLunaAmount) require.Equal(t, totalLuncMinDeposit, minLunaAmount) } diff --git a/custom/gov/keeper/test_utils.go b/custom/gov/keeper/test_utils.go index 372b0ac6..f79f96a2 100644 --- a/custom/gov/keeper/test_utils.go +++ b/custom/gov/keeper/test_utils.go @@ -12,7 +12,7 @@ import ( customauth "github.com/classic-terra/core/v3/custom/auth" custombank "github.com/classic-terra/core/v3/custom/bank" customdistr "github.com/classic-terra/core/v3/custom/distribution" - "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + "github.com/classic-terra/core/v3/custom/gov/types/v2custom" customparams "github.com/classic-terra/core/v3/custom/params" customstaking "github.com/classic-terra/core/v3/custom/staking" core "github.com/classic-terra/core/v3/types" @@ -83,8 +83,8 @@ func MakeEncodingConfig(_ *testing.T) simparams.EncodingConfig { ModuleBasics.RegisterInterfaces(interfaceRegistry) v1beta1.RegisterLegacyAminoCodec(amino) v1beta1.RegisterInterfaces(interfaceRegistry) - v2lunc1.RegisterLegacyAminoCodec(amino) - v2lunc1.RegisterInterfaces(interfaceRegistry) + v2custom.RegisterLegacyAminoCodec(amino) + v2custom.RegisterInterfaces(interfaceRegistry) markettypes.RegisterLegacyAminoCodec(amino) markettypes.RegisterInterfaces(interfaceRegistry) @@ -278,7 +278,7 @@ func CreateTestInput(t *testing.T) TestInput { govRouter.AddRoute(govtypes.RouterKey, v1beta1.ProposalHandler) govKeeper.SetLegacyRouter(govRouter) govKeeper.Keeper.SetParams(ctx, v1.DefaultParams()) - govKeeper.SetParams(ctx, v2lunc1.DefaultParams()) + govKeeper.SetParams(ctx, v2custom.DefaultParams()) // govparamsv2 := govKeeper.GetParams(ctx) // govparamsv2.MinDeposit = sdk.NewCoins( @@ -296,7 +296,7 @@ func CreateTestInput(t *testing.T) TestInput { msr.SetInterfaceRegistry(encodingConfig.InterfaceRegistry) msgServer := NewMsgServerImpl(govKeeper) v1beta1.RegisterMsgServer(msr, NewLegacyMsgServerImpl(accountKeeper.GetModuleAddress(govtypes.ModuleName).String(), msgServer)) - v2lunc1.RegisterMsgServer(msr, msgServer) + v2custom.RegisterMsgServer(msr, msgServer) banktypes.RegisterMsgServer(msr, nil) // return TestInput{ctx, legacyAmino, accountKeeper, bankKeeper, oracleKeeper, stakingKeeper, govKeeper} diff --git a/custom/gov/migrations/v5/store.go b/custom/gov/migrations/v5/store.go index f9ef3395..c08c5972 100644 --- a/custom/gov/migrations/v5/store.go +++ b/custom/gov/migrations/v5/store.go @@ -1,7 +1,7 @@ package v5 import ( - "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + "github.com/classic-terra/core/v3/custom/gov/types/v2custom" "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" @@ -23,8 +23,8 @@ func migrateParams(ctx sdk.Context, storeKey storetypes.StoreKey, cdc codec.Bina return err } - defaultParams := v2lunc1.DefaultParams() - newParams := v2lunc1.NewParams( + defaultParams := v2custom.DefaultParams() + newParams := v2custom.NewParams( params.MinDeposit, *params.MaxDepositPeriod, *params.VotingPeriod, diff --git a/custom/gov/migrations/v5/store_test.go b/custom/gov/migrations/v5/store_test.go index e322811d..03593cbb 100644 --- a/custom/gov/migrations/v5/store_test.go +++ b/custom/gov/migrations/v5/store_test.go @@ -5,7 +5,7 @@ import ( "time" v5 "github.com/classic-terra/core/v3/custom/gov/migrations/v5" - "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + "github.com/classic-terra/core/v3/custom/gov/types/v2custom" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/bank" @@ -70,7 +70,7 @@ func TestMigrateStore(t *testing.T) { // Fetch the params after migration bz = store.Get(govtypes.ParamsKey) - var newParams v2lunc1.Params + var newParams v2custom.Params require.NoError(t, cdc.Unmarshal(bz, &newParams)) t.Logf("params2: %v", newParams) @@ -86,6 +86,6 @@ func TestMigrateStore(t *testing.T) { require.Equal(t, oldParams.BurnVoteQuorum, newParams.BurnVoteQuorum) require.Equal(t, oldParams.BurnVoteVeto, newParams.BurnVoteVeto) - // Check any new fields from the `v2lunc1.Params` - require.Equal(t, v2lunc1.DefaultParams().MinUusdDeposit, newParams.MinUusdDeposit) + // Check any new fields from the `v2custom.Params` + require.Equal(t, v2custom.DefaultParams().MinUusdDeposit, newParams.MinUusdDeposit) } diff --git a/custom/gov/module.go b/custom/gov/module.go index b9810d38..c15305bd 100644 --- a/custom/gov/module.go +++ b/custom/gov/module.go @@ -28,7 +28,7 @@ import ( customcli "github.com/classic-terra/core/v3/custom/gov/client/cli" "github.com/classic-terra/core/v3/custom/gov/keeper" - "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + "github.com/classic-terra/core/v3/custom/gov/types/v2custom" core "github.com/classic-terra/core/v3/types" markettypes "github.com/classic-terra/core/v3/x/market/types" ) @@ -78,20 +78,20 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command { // RegisterLegacyAminoCodec registers the gov module's types for the given codec. func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { v1beta1.RegisterLegacyAminoCodec(cdc) - v2lunc1.RegisterLegacyAminoCodec(cdc) + v2custom.RegisterLegacyAminoCodec(cdc) } // RegisterInterfaces implements InterfaceModule.RegisterInterfaces func (AppModuleBasic) RegisterInterfaces(registry codectypes.InterfaceRegistry) { v1beta1.RegisterInterfaces(registry) - v2lunc1.RegisterInterfaces(registry) + v2custom.RegisterInterfaces(registry) } // DefaultGenesis returns default genesis state as raw bytes for the gov // module. func (a AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { // customize to set default genesis state deposit denom to uluna - defaultGenesisState := v2lunc1.DefaultGenesisState() + defaultGenesisState := v2custom.DefaultGenesisState() defaultGenesisState.Params.MinDeposit[0].Denom = core.MicroLunaDenom return cdc.MustMarshalJSON(defaultGenesisState) @@ -99,12 +99,12 @@ func (a AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { // ValidateGenesis performs genesis state validation for the gov module. func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { - var data v2lunc1.GenesisState + var data v2custom.GenesisState if err := cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", govtypes.ModuleName, err) } - return v2lunc1.ValidateGenesis(&data) + return v2custom.ValidateGenesis(&data) } // RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the gov module. @@ -155,10 +155,10 @@ func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { func (am AppModule) RegisterServices(cfg module.Configurator) { msgServer := keeper.NewMsgServerImpl(&am.keeper) v1beta1.RegisterMsgServer(cfg.MsgServer(), keeper.NewLegacyMsgServerImpl(am.accountKeeper.GetModuleAddress(govtypes.ModuleName).String(), msgServer)) - v2lunc1.RegisterMsgServer(cfg.MsgServer(), msgServer) + v2custom.RegisterMsgServer(cfg.MsgServer(), msgServer) queryServer := keeper.NewQueryServerImpl(am.keeper) - v2lunc1.RegisterQueryServer(cfg.QueryServer(), queryServer) + v2custom.RegisterQueryServer(cfg.QueryServer(), queryServer) legacyQueryServer := govkeeper.NewLegacyQueryServer(am.keeper.Keeper) v1beta1.RegisterQueryServer(cfg.QueryServer(), legacyQueryServer) @@ -186,7 +186,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { // InitGenesis performs genesis initialization for the gov module. It returns // no validator updates. func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) []abci.ValidatorUpdate { - var genesisState v2lunc1.GenesisState + var genesisState v2custom.GenesisState cdc.MustUnmarshalJSON(data, &genesisState) InitGenesis(ctx, am.accountKeeper, am.bankKeeper, &am.keeper, &genesisState) return []abci.ValidatorUpdate{} diff --git a/custom/gov/types/errors.go b/custom/gov/types/errors.go index a084976b..bac26452 100644 --- a/custom/gov/types/errors.go +++ b/custom/gov/types/errors.go @@ -7,5 +7,5 @@ import ( // x/gov module sentinel errors var ( - ErrQueryExchangeRateUusdFail = sdkerrors.Register(govtypes.ModuleName, 17, "Get exchange rate lunc-uusd from oracle failed") + ErrQueryExchangeRateUstcFail = sdkerrors.Register(govtypes.ModuleName, 17, "Get exchange rate lunc-uusd from oracle failed") ) diff --git a/custom/gov/types/keys.go b/custom/gov/types/keys.go index 4dd72c4a..94b0b923 100644 --- a/custom/gov/types/keys.go +++ b/custom/gov/types/keys.go @@ -5,8 +5,8 @@ import "encoding/binary" // Keys for governance store // Items are stored with the following key: values var ( - // Minimum UUSD amount prefix - UUSDMinKeyPrefix = []byte{0x40} + // Minimum USTC amount prefix + USTCMinKeyPrefix = []byte{0x40} ) // GetProposalIDBytes returns the byte representation of the proposalID @@ -18,5 +18,5 @@ func GetProposalIDBytes(proposalID uint64) (proposalIDBz []byte) { // TotalDepositKey of the specific total amount to deposit based on the proposalID from the store func TotalDepositKey(proposalID uint64) []byte { - return append(UUSDMinKeyPrefix, GetProposalIDBytes(proposalID)...) + return append(USTCMinKeyPrefix, GetProposalIDBytes(proposalID)...) } diff --git a/custom/gov/types/v2lunc1/codec.go b/custom/gov/types/v2custom/codec.go similarity index 99% rename from custom/gov/types/v2lunc1/codec.go rename to custom/gov/types/v2custom/codec.go index c0be11bd..315ca1a9 100644 --- a/custom/gov/types/v2lunc1/codec.go +++ b/custom/gov/types/v2custom/codec.go @@ -1,4 +1,4 @@ -package v2lunc1 +package v2custom import ( "github.com/cosmos/cosmos-sdk/codec" diff --git a/custom/gov/types/v2lunc1/genesis.go b/custom/gov/types/v2custom/genesis.go similarity index 99% rename from custom/gov/types/v2lunc1/genesis.go rename to custom/gov/types/v2custom/genesis.go index d11f7d80..fe77ff0b 100644 --- a/custom/gov/types/v2lunc1/genesis.go +++ b/custom/gov/types/v2custom/genesis.go @@ -1,4 +1,4 @@ -package v2lunc1 +package v2custom import ( "errors" diff --git a/custom/gov/types/v2lunc1/genesis.pb.go b/custom/gov/types/v2custom/genesis.pb.go similarity index 84% rename from custom/gov/types/v2lunc1/genesis.pb.go rename to custom/gov/types/v2custom/genesis.pb.go index abd53cc3..828c617c 100644 --- a/custom/gov/types/v2lunc1/genesis.pb.go +++ b/custom/gov/types/v2custom/genesis.pb.go @@ -1,16 +1,12 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: terra/gov/v2lunc1/genesis.proto +// source: terra/gov/v2custom/genesis.proto -package v2lunc1 +package v2custom import ( fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/types" v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" - _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" - _ "github.com/gogo/protobuf/types" io "io" math "math" math_bits "math/bits" @@ -56,7 +52,7 @@ func (m *GenesisState) Reset() { *m = GenesisState{} } func (m *GenesisState) String() string { return proto.CompactTextString(m) } func (*GenesisState) ProtoMessage() {} func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_a6436cbb1ac17fc7, []int{0} + return fileDescriptor_19555697d819f2a4, []int{0} } func (m *GenesisState) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -145,41 +141,37 @@ func (m *GenesisState) GetParams() *Params { } func init() { - proto.RegisterType((*GenesisState)(nil), "terra.gov.v2lunc1.GenesisState") + proto.RegisterType((*GenesisState)(nil), "terra.gov.v2custom.GenesisState") } -func init() { proto.RegisterFile("terra/gov/v2lunc1/genesis.proto", fileDescriptor_a6436cbb1ac17fc7) } +func init() { proto.RegisterFile("terra/gov/v2custom/genesis.proto", fileDescriptor_19555697d819f2a4) } -var fileDescriptor_a6436cbb1ac17fc7 = []byte{ - // 440 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xc1, 0x6f, 0xd3, 0x30, - 0x14, 0xc6, 0x9b, 0x75, 0x2b, 0xc3, 0xed, 0x90, 0x30, 0x13, 0xcb, 0x3a, 0x14, 0x2a, 0x4e, 0xe5, - 0x40, 0x4c, 0x3a, 0x71, 0xe0, 0xc8, 0x34, 0x69, 0xe2, 0x36, 0x65, 0x88, 0x03, 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, 0x37, 0x1a, 0x61, 0x61, 0x37, 0x06, - 0xef, 0x2b, 0xa1, 0xdb, 0xad, 0xca, 0x06, 0x76, 0x73, 0x2e, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, - 0x70, 0x07, 0xb4, 0x0f, 0x16, 0x03, 0x00, 0x00, +var fileDescriptor_19555697d819f2a4 = []byte{ + // 381 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xbf, 0x8e, 0xda, 0x40, + 0x18, 0xc4, 0x31, 0xff, 0x42, 0x16, 0x48, 0xb1, 0x89, 0x82, 0x45, 0x90, 0x65, 0xa5, 0x22, 0x45, + 0xec, 0x60, 0x94, 0x26, 0x5d, 0x10, 0x12, 0xba, 0x0e, 0xf9, 0xd0, 0x15, 0xd7, 0xa0, 0xc5, 0x5e, + 0xf9, 0x2c, 0xd9, 0x7c, 0x96, 0xbf, 0x65, 0x25, 0xde, 0xe2, 0x1e, 0xeb, 0x4a, 0xca, 0x2b, 0xae, + 0x38, 0xc1, 0x8b, 0x9c, 0xf0, 0xda, 0x18, 0x01, 0xed, 0x37, 0xbf, 0x99, 0x1d, 0xad, 0x86, 0x98, + 0x82, 0xa7, 0x29, 0xb3, 0x03, 0x90, 0xb6, 0x74, 0xbc, 0x0d, 0x0a, 0x88, 0xed, 0x80, 0xaf, 0x39, + 0x86, 0x68, 0x25, 0x29, 0x08, 0xa0, 0x34, 0x23, 0xac, 0x00, 0xa4, 0x55, 0x10, 0xfd, 0xc1, 0x2d, + 0x17, 0x48, 0xe5, 0xe8, 0xf7, 0x3c, 0xc0, 0x18, 0x50, 0xc9, 0xa3, 0x52, 0xf8, 0xf9, 0x56, 0x23, + 0x9d, 0x99, 0x0a, 0xbf, 0x17, 0x4c, 0x70, 0xfa, 0x87, 0x7c, 0x43, 0xc1, 0x52, 0x11, 0xae, 0x83, + 0x65, 0x92, 0x42, 0x02, 0xc8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x3c, 0xfe, 0x0b, 0x42, 0xf1, 0xb4, + 0x59, 0x59, 0x1e, 0xc4, 0xb6, 0x17, 0x31, 0xc4, 0xd0, 0xfb, 0xad, 0x26, 0xe4, 0x41, 0xca, 0x6d, + 0x39, 0xb6, 0xcb, 0x11, 0xd9, 0x62, 0x9b, 0x70, 0x3c, 0xed, 0x6a, 0xd5, 0xcc, 0xb6, 0x33, 0xfe, + 0x08, 0x00, 0x00, 0xff, 0xff, 0x47, 0x1d, 0xc5, 0x89, 0xaa, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { diff --git a/custom/gov/types/v2lunc1/genesis_test.go b/custom/gov/types/v2custom/genesis_test.go similarity index 61% rename from custom/gov/types/v2lunc1/genesis_test.go rename to custom/gov/types/v2custom/genesis_test.go index d2626396..53bdb0b1 100644 --- a/custom/gov/types/v2lunc1/genesis_test.go +++ b/custom/gov/types/v2custom/genesis_test.go @@ -1,100 +1,100 @@ -package v2lunc1_test +package v2custom_test import ( "testing" - v2lunc1types "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + v2customtypes "github.com/classic-terra/core/v3/custom/gov/types/v2custom" sdk "github.com/cosmos/cosmos-sdk/types" v1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" "github.com/stretchr/testify/require" ) func TestEmptyGenesis(t *testing.T) { - state1 := v2lunc1types.GenesisState{} + state1 := v2customtypes.GenesisState{} require.True(t, state1.Empty()) - state2 := v2lunc1types.DefaultGenesisState() + state2 := v2customtypes.DefaultGenesisState() require.False(t, state2.Empty()) } func TestValidateGenesis(t *testing.T) { - params := v2lunc1types.DefaultParams() + params := v2customtypes.DefaultParams() testCases := []struct { name string - genesisState func() *v2lunc1types.GenesisState + genesisState func() *v2customtypes.GenesisState expErrMsg string }{ { name: "valid", - genesisState: func() *v2lunc1types.GenesisState { - return v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params) + genesisState: func() *v2customtypes.GenesisState { + return v2customtypes.NewGenesisState(v1.DefaultStartingProposalID, params) }, }, { name: "invalid StartingProposalId", - genesisState: func() *v2lunc1types.GenesisState { - return v2lunc1types.NewGenesisState(0, params) + genesisState: func() *v2customtypes.GenesisState { + return v2customtypes.NewGenesisState(0, params) }, expErrMsg: "starting proposal id must be greater than 0", }, { name: "invalid min deposit", - genesisState: func() *v2lunc1types.GenesisState { + genesisState: func() *v2customtypes.GenesisState { params1 := params params1.MinDeposit = sdk.Coins{{ Denom: sdk.DefaultBondDenom, Amount: sdk.NewInt(-100), }} - return v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params1) + return v2customtypes.NewGenesisState(v1.DefaultStartingProposalID, params1) }, expErrMsg: "invalid minimum deposit", }, { name: "invalid max deposit period", - genesisState: func() *v2lunc1types.GenesisState { + genesisState: func() *v2customtypes.GenesisState { params1 := params params1.MaxDepositPeriod = nil - return v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params1) + return v2customtypes.NewGenesisState(v1.DefaultStartingProposalID, params1) }, expErrMsg: "maximum deposit period must not be nil", }, { name: "invalid quorum", - genesisState: func() *v2lunc1types.GenesisState { + genesisState: func() *v2customtypes.GenesisState { params1 := params params1.Quorum = "2" - return v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params1) + return v2customtypes.NewGenesisState(v1.DefaultStartingProposalID, params1) }, expErrMsg: "quorom too large", }, { name: "invalid threshold", - genesisState: func() *v2lunc1types.GenesisState { + genesisState: func() *v2customtypes.GenesisState { params1 := params params1.Threshold = "2" - return v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params1) + return v2customtypes.NewGenesisState(v1.DefaultStartingProposalID, params1) }, expErrMsg: "vote threshold too large", }, { name: "invalid veto threshold", - genesisState: func() *v2lunc1types.GenesisState { + genesisState: func() *v2customtypes.GenesisState { params1 := params params1.VetoThreshold = "2" - return v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params1) + return v2customtypes.NewGenesisState(v1.DefaultStartingProposalID, params1) }, expErrMsg: "veto threshold too large", }, { name: "duplicate proposals", - genesisState: func() *v2lunc1types.GenesisState { - state := v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params) + genesisState: func() *v2customtypes.GenesisState { + state := v2customtypes.NewGenesisState(v1.DefaultStartingProposalID, params) state.Proposals = append(state.Proposals, &v1.Proposal{Id: 1}) state.Proposals = append(state.Proposals, &v1.Proposal{Id: 1}) @@ -104,8 +104,8 @@ func TestValidateGenesis(t *testing.T) { }, { name: "duplicate votes", - genesisState: func() *v2lunc1types.GenesisState { - state := v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params) + genesisState: func() *v2customtypes.GenesisState { + state := v2customtypes.NewGenesisState(v1.DefaultStartingProposalID, params) state.Proposals = append(state.Proposals, &v1.Proposal{Id: 1}) state.Votes = append(state.Votes, &v1.Vote{ @@ -123,8 +123,8 @@ func TestValidateGenesis(t *testing.T) { }, { name: "duplicate deposits", - genesisState: func() *v2lunc1types.GenesisState { - state := v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params) + genesisState: func() *v2customtypes.GenesisState { + state := v2customtypes.NewGenesisState(v1.DefaultStartingProposalID, params) state.Proposals = append(state.Proposals, &v1.Proposal{Id: 1}) state.Deposits = append(state.Deposits, &v1.Deposit{ @@ -142,8 +142,8 @@ func TestValidateGenesis(t *testing.T) { }, { name: "non-existent proposal id in votes", - genesisState: func() *v2lunc1types.GenesisState { - state := v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params) + genesisState: func() *v2customtypes.GenesisState { + state := v2customtypes.NewGenesisState(v1.DefaultStartingProposalID, params) state.Votes = append(state.Votes, &v1.Vote{ ProposalId: 1, @@ -156,8 +156,8 @@ func TestValidateGenesis(t *testing.T) { }, { name: "non-existent proposal id in deposits", - genesisState: func() *v2lunc1types.GenesisState { - state := v2lunc1types.NewGenesisState(v1.DefaultStartingProposalID, params) + genesisState: func() *v2customtypes.GenesisState { + state := v2customtypes.NewGenesisState(v1.DefaultStartingProposalID, params) state.Deposits = append(state.Deposits, &v1.Deposit{ ProposalId: 1, @@ -173,7 +173,7 @@ func TestValidateGenesis(t *testing.T) { for _, tc := range testCases { tc := tc t.Run(tc.name, func(t *testing.T) { - err := v2lunc1types.ValidateGenesis(tc.genesisState()) + err := v2customtypes.ValidateGenesis(tc.genesisState()) if tc.expErrMsg != "" { require.Error(t, err) require.ErrorContains(t, err, tc.expErrMsg) diff --git a/custom/gov/types/v2lunc1/gov.pb.go b/custom/gov/types/v2custom/gov.pb.go similarity index 89% rename from custom/gov/types/v2lunc1/gov.pb.go rename to custom/gov/types/v2custom/gov.pb.go index eb8887c1..355c94a4 100644 --- a/custom/gov/types/v2lunc1/gov.pb.go +++ b/custom/gov/types/v2custom/gov.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: terra/gov/v2lunc1/gov.proto +// source: terra/gov/v2custom/gov.proto -package v2lunc1 +package v2custom import ( fmt "fmt" @@ -68,7 +68,7 @@ func (x VoteOption) String() string { } func (VoteOption) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{0} + return fileDescriptor_de18f1a788afb560, []int{0} } // ProposalStatus enumerates the valid statuses of a proposal. @@ -117,13 +117,13 @@ func (x ProposalStatus) String() string { } func (ProposalStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{1} + return fileDescriptor_de18f1a788afb560, []int{1} } // WeightedVoteOption defines a unit of vote for vote split. type WeightedVoteOption struct { // option defines the valid vote options, it must not contain duplicate vote options. - Option VoteOption `protobuf:"varint,1,opt,name=option,proto3,enum=terra.gov.v2lunc1.VoteOption" json:"option,omitempty"` + Option VoteOption `protobuf:"varint,1,opt,name=option,proto3,enum=terra.gov.v2custom.VoteOption" json:"option,omitempty"` // weight is the vote weight associated with the vote option. Weight string `protobuf:"bytes,2,opt,name=weight,proto3" json:"weight,omitempty"` } @@ -132,7 +132,7 @@ func (m *WeightedVoteOption) Reset() { *m = WeightedVoteOption{} } func (m *WeightedVoteOption) String() string { return proto.CompactTextString(m) } func (*WeightedVoteOption) ProtoMessage() {} func (*WeightedVoteOption) Descriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{0} + return fileDescriptor_de18f1a788afb560, []int{0} } func (m *WeightedVoteOption) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -190,7 +190,7 @@ func (m *Deposit) Reset() { *m = Deposit{} } func (m *Deposit) String() string { return proto.CompactTextString(m) } func (*Deposit) ProtoMessage() {} func (*Deposit) Descriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{1} + return fileDescriptor_de18f1a788afb560, []int{1} } func (m *Deposit) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -247,7 +247,7 @@ type Proposal struct { // messages are the arbitrary messages to be executed if the proposal passes. Messages []*types1.Any `protobuf:"bytes,2,rep,name=messages,proto3" json:"messages,omitempty"` // status defines the proposal status. - Status ProposalStatus `protobuf:"varint,3,opt,name=status,proto3,enum=terra.gov.v2lunc1.ProposalStatus" json:"status,omitempty"` + Status ProposalStatus `protobuf:"varint,3,opt,name=status,proto3,enum=terra.gov.v2custom.ProposalStatus" json:"status,omitempty"` // final_tally_result is the final tally result of the proposal. When // querying a proposal via gRPC, this field is not populated until the // proposal's voting period has ended. @@ -292,7 +292,7 @@ func (m *Proposal) Reset() { *m = Proposal{} } func (m *Proposal) String() string { return proto.CompactTextString(m) } func (*Proposal) ProtoMessage() {} func (*Proposal) Descriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{2} + return fileDescriptor_de18f1a788afb560, []int{2} } func (m *Proposal) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -442,7 +442,7 @@ func (m *TallyResult) Reset() { *m = TallyResult{} } func (m *TallyResult) String() string { return proto.CompactTextString(m) } func (*TallyResult) ProtoMessage() {} func (*TallyResult) Descriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{3} + return fileDescriptor_de18f1a788afb560, []int{3} } func (m *TallyResult) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -517,7 +517,7 @@ func (m *Vote) Reset() { *m = Vote{} } func (m *Vote) String() string { return proto.CompactTextString(m) } func (*Vote) ProtoMessage() {} func (*Vote) Descriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{4} + return fileDescriptor_de18f1a788afb560, []int{4} } func (m *Vote) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -589,7 +589,7 @@ func (m *DepositParams) Reset() { *m = DepositParams{} } func (m *DepositParams) String() string { return proto.CompactTextString(m) } func (*DepositParams) ProtoMessage() {} func (*DepositParams) Descriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{5} + return fileDescriptor_de18f1a788afb560, []int{5} } func (m *DepositParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -644,7 +644,7 @@ func (m *VotingParams) Reset() { *m = VotingParams{} } func (m *VotingParams) String() string { return proto.CompactTextString(m) } func (*VotingParams) ProtoMessage() {} func (*VotingParams) Descriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{6} + return fileDescriptor_de18f1a788afb560, []int{6} } func (m *VotingParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -698,7 +698,7 @@ func (m *TallyParams) Reset() { *m = TallyParams{} } func (m *TallyParams) String() string { return proto.CompactTextString(m) } func (*TallyParams) ProtoMessage() {} func (*TallyParams) Descriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{7} + return fileDescriptor_de18f1a788afb560, []int{7} } func (m *TallyParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -783,7 +783,7 @@ func (m *Params) Reset() { *m = Params{} } func (m *Params) String() string { return proto.CompactTextString(m) } func (*Params) ProtoMessage() {} func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_ec6805a6cb6c4923, []int{8} + return fileDescriptor_de18f1a788afb560, []int{8} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -890,109 +890,109 @@ func (m *Params) GetMinUusdDeposit() types.Coin { } func init() { - proto.RegisterEnum("terra.gov.v2lunc1.VoteOption", VoteOption_name, VoteOption_value) - proto.RegisterEnum("terra.gov.v2lunc1.ProposalStatus", ProposalStatus_name, ProposalStatus_value) - proto.RegisterType((*WeightedVoteOption)(nil), "terra.gov.v2lunc1.WeightedVoteOption") - proto.RegisterType((*Deposit)(nil), "terra.gov.v2lunc1.Deposit") - proto.RegisterType((*Proposal)(nil), "terra.gov.v2lunc1.Proposal") - proto.RegisterType((*TallyResult)(nil), "terra.gov.v2lunc1.TallyResult") - proto.RegisterType((*Vote)(nil), "terra.gov.v2lunc1.Vote") - proto.RegisterType((*DepositParams)(nil), "terra.gov.v2lunc1.DepositParams") - proto.RegisterType((*VotingParams)(nil), "terra.gov.v2lunc1.VotingParams") - proto.RegisterType((*TallyParams)(nil), "terra.gov.v2lunc1.TallyParams") - proto.RegisterType((*Params)(nil), "terra.gov.v2lunc1.Params") -} - -func init() { proto.RegisterFile("terra/gov/v2lunc1/gov.proto", fileDescriptor_ec6805a6cb6c4923) } - -var fileDescriptor_ec6805a6cb6c4923 = []byte{ - // 1371 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xcf, 0x6f, 0x13, 0xc7, - 0x17, 0xcf, 0xda, 0x8e, 0xe3, 0xbc, 0xc4, 0xce, 0x32, 0xe4, 0x0b, 0x4b, 0x20, 0x4e, 0xf0, 0x97, - 0x2f, 0xca, 0x97, 0x82, 0x5d, 0x42, 0xa9, 0x44, 0x5b, 0xa9, 0x72, 0xe2, 0xa5, 0x2c, 0x4a, 0x63, - 0x77, 0x6d, 0x42, 0xe9, 0x65, 0x35, 0xf6, 0x0e, 0xce, 0x48, 0xde, 0x1d, 0x77, 0x67, 0x36, 0xe0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, 0x17, 0xa7, 0x24, 0x34, 0x71, - 0xd7, 0x94, 0x40, 0x5b, 0x11, 0xd0, 0x0e, 0xa0, 0x87, 0xd4, 0xc7, 0x3d, 0x47, 0xe0, 0x5e, 0x6f, - 0xe0, 0x04, 0x84, 0x87, 0x3d, 0x61, 0x64, 0xd6, 0xb5, 0x8d, 0x85, 0xcd, 0xe2, 0x14, 0x33, 0xad, - 0x08, 0x66, 0x4b, 0x94, 0xad, 0x4b, 0xe6, 0x98, 0x04, 0x55, 0x61, 0x81, 0x87, 0x6d, 0x8f, 0x0a, - 0x27, 0x6a, 0x39, 0x63, 0x56, 0x9a, 0x59, 0x39, 0x12, 0x7d, 0x2b, 0xe9, 0xc7, 0xad, 0xcc, 0x93, - 0x3f, 0xd7, 0x34, 0x1b, 0x62, 0x52, 0x24, 0x46, 0x77, 0x41, 0x57, 0x59, 0x76, 0x88, 0xef, 0xc6, - 0x76, 0xb2, 0x27, 0xb4, 0x53, 0x50, 0x4c, 0xd3, 0x77, 0xa5, 0x2d, 0x0b, 0xf2, 0x82, 0x09, 0xdc, - 0x73, 0x94, 0xdc, 0x98, 0x7b, 0x8b, 0x5a, 0x2d, 0x4a, 0x6a, 0xd2, 0x48, 0x3b, 0x70, 0xea, 0x80, - 0x09, 0xea, 0x77, 0x1d, 0x2e, 0x70, 0xa0, 0xee, 0x97, 0x3b, 0x61, 0x5c, 0x4b, 0x31, 0xb5, 0x19, - 0x31, 0x65, 0x60, 0x77, 0x40, 0x89, 0x46, 0x77, 0x9c, 0x3f, 0xa1, 0xad, 0x7c, 0x4c, 0x4c, 0xae, - 0xb8, 0x12, 0x35, 0x8b, 0xc0, 0x2e, 0x16, 0xd8, 0x80, 0xa8, 0x7d, 0xed, 0xe1, 0x19, 0x2d, 0xc3, - 0xac, 0xa0, 0xa2, 0x47, 0x8c, 0x05, 0xa9, 0x88, 0x0f, 0xc8, 0x80, 0x39, 0x1e, 0x7a, 0x1e, 0x0e, - 0x06, 0xc6, 0xa2, 0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0x1c, 0xdc, 0xa8, 0x74, 0x42, 0x2e, 0x98, 0x27, 0xbf, - 0x61, 0xc4, 0xa0, 0x4f, 0x78, 0xf2, 0x25, 0xd3, 0xce, 0xca, 0x99, 0xbc, 0xf1, 0x4f, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xe7, 0x7b, 0xb5, 0xd1, 0xe5, 0x0c, 0x00, 0x00, + proto.RegisterEnum("terra.gov.v2custom.VoteOption", VoteOption_name, VoteOption_value) + proto.RegisterEnum("terra.gov.v2custom.ProposalStatus", ProposalStatus_name, ProposalStatus_value) + proto.RegisterType((*WeightedVoteOption)(nil), "terra.gov.v2custom.WeightedVoteOption") + proto.RegisterType((*Deposit)(nil), "terra.gov.v2custom.Deposit") + proto.RegisterType((*Proposal)(nil), "terra.gov.v2custom.Proposal") + proto.RegisterType((*TallyResult)(nil), "terra.gov.v2custom.TallyResult") + proto.RegisterType((*Vote)(nil), "terra.gov.v2custom.Vote") + proto.RegisterType((*DepositParams)(nil), "terra.gov.v2custom.DepositParams") + proto.RegisterType((*VotingParams)(nil), "terra.gov.v2custom.VotingParams") + proto.RegisterType((*TallyParams)(nil), "terra.gov.v2custom.TallyParams") + proto.RegisterType((*Params)(nil), "terra.gov.v2custom.Params") +} + +func init() { proto.RegisterFile("terra/gov/v2custom/gov.proto", fileDescriptor_de18f1a788afb560) } + +var fileDescriptor_de18f1a788afb560 = []byte{ + // 1364 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0xcf, 0x73, 0xd3, 0xc6, + 0x17, 0x8f, 0x6c, 0xc7, 0x71, 0x5e, 0x62, 0x47, 0x2c, 0xf9, 0x82, 0x08, 0xc1, 0xce, 0xd7, 0x5f, + 0x86, 0xc9, 0x97, 0x82, 0x5d, 0x42, 0xcb, 0x81, 0xf6, 0x50, 0x27, 0x36, 0x45, 0x0c, 0xc4, 0xae, + 0x2c, 0x42, 0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26, + 0x64, 0xb9, 0xc0, 0x22, 0xe4, 0x46, 0x5a, 0x66, 0xb4, 0x3c, 0x2b, 0xa3, 0x89, 0xbf, 0xb6, 0x44, + 0x5a, 0x8a, 0x81, 0xee, 0x01, 0x7a, 0x44, 0x7d, 0xdc, 0x77, 0x04, 0xee, 0xf7, 0x87, 0x4e, 0x40, + 0x78, 0xd8, 0x17, 0x46, 0x66, 0x43, 0xdb, 0x5c, 0xda, 0x2a, 0xcd, 0xb2, 0x63, 0x47, 0x38, 0x4b, + 0xc2, 0x2c, 0x5d, 0x52, 0x27, 0x24, 0xa8, 0x06, 0x4b, 0x3c, 0xec, 0x78, 0x54, 0x38, 0x51, 0xd7, + 0x19, 0xf3, 0xd2, 0xce, 0xda, 0x91, 0xf8, 0xed, 0xa4, 0x25, 0xb7, 0x33, 0x4f, 0xff, 0x2c, 0x69, + 0x16, 0xc4, 0xa4, 0x48, 0x8c, 0xee, 0x80, 0xae, 0xf2, 0xec, 0x10, 0xdf, 0x8d, 0xed, 0x64, 0x4f, + 0x68, 0xa7, 0xa0, 0x98, 0x0d, 0xdf, 0x95, 0xb6, 0x4c, 0xc8, 0x0b, 0x26, 0x70, 0xdf, 0x51, 0x72, + 0x63, 0xe1, 0x1d, 0xaa, 0xb5, 0x2c, 0xa9, 0x49, 0x2b, 0xdd, 0x85, 0x53, 0x07, 0x4c, 0x50, 0xbf, + 0xe7, 0x70, 0x81, 0x03, 0x75, 0xbf, 0xdc, 0x09, 0xe3, 0x5a, 0x89, 0xa9, 0xed, 0x88, 0x29, 0x03, + 0xbb, 0x0d, 0x4a, 0x34, 0xbe, 0xe3, 0xe2, 0x09, 0x6d, 0xe5, 0x63, 0x62, 0x72, 0xc5, 0xb5, 0xa8, + 0x5d, 0x04, 0x76, 0xb1, 0xc0, 0x06, 0x44, 0x0d, 0x6c, 0x8d, 0xce, 0x68, 0x15, 0xe6, 0x05, 0x15, + 0x7d, 0x62, 0x2c, 0x49, 0x45, 0x7c, 0x40, 0x06, 0x2c, 0xf0, 0xd0, 0xf3, 0x70, 0x30, 0x34, 0x96, + 0xa5, 0x3c, 0x39, 0xa2, 0x8f, 0x20, 0x17, 0xcf, 0x06, 0x09, 0x8c, 0xfc, 0x31, 0xc3, 0x30, 0x42, + 0xa2, 0x75, 0x58, 0x24, 0x4f, 0x06, 0xc4, 0xa5, 0x82, 0xb8, 0x46, 0x61, 0x43, 0xdb, 0xcc, 0x59, + 0x63, 0x01, 0xfa, 0x1f, 0xe4, 0x1f, 0x61, 0xda, 0x27, 0xae, 0x13, 0x10, 0xcc, 0x99, 0x6f, 0xac, + 0x48, 0x9f, 0xcb, 0xb1, 0xd0, 0x92, 0xb2, 0xf2, 0x6f, 0x1a, 0x2c, 0x4d, 0xb6, 0xd1, 0x07, 0xb0, + 0x38, 0x24, 0xdc, 0xe9, 0xca, 0x09, 0xd3, 0x8e, 0x8c, 0xbb, 0xe9, 0x0b, 0x2b, 0x37, 0x24, 0x7c, + 0x27, 0xd2, 0xa3, 0xeb, 0x90, 0xc7, 0x1d, 0x2e, 0x30, 0xf5, 0x15, 0x21, 0x35, 0x93, 0xb0, 0xac, + 0x40, 0x31, 0xe9, 0xff, 0x90, 0xf3, 0x99, 0xc2, 0xa7, 0x67, 0xe2, 0x17, 0x7c, 0x16, 0x43, 0x3f, + 0x01, 0xe4, 0x33, 0xe7, 0x31, 0x15, 0xfb, 0xce, 0x01, 0x11, 0x09, 0x29, 0x33, 0x93, 0xb4, 0xe2, + 0xb3, 0x07, 0x54, 0xec, 0xef, 0x11, 0x11, 0x93, 0xcb, 0xbf, 0x68, 0x90, 0x89, 0x96, 0xd9, 0xf1, + 0xab, 0xa8, 0x02, 0xf3, 0x07, 0x4c, 0x90, 0xe3, 0xd7, 0x50, 0x0c, 0x43, 0x9f, 0xc1, 0x42, 0xbc, + 0x19, 0xb9, 0x91, 0x91, 0x5d, 0x7d, 0x69, 0xd6, 0xb8, 0x1e, 0x5d, 0xc0, 0x56, 0x42, 0x3b, 0xd4,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0xb2, 0x80, 0x54, 0x0f, 0xae, 0x57, 0xc7, 0x1f, 0x2f, 0x55, 0x31, 0x1c, 0x10, 0x3e, 0xfa, + 0x9e, 0xe9, 0x64, 0xe5, 0x50, 0x5e, 0xff, 0x27, 0x00, 0x00, 0xff, 0xff, 0x47, 0xf4, 0x7c, 0xaf, + 0xec, 0x0c, 0x00, 0x00, } func (m *WeightedVoteOption) Marshal() (dAtA []byte, err error) { diff --git a/custom/gov/types/v2lunc1/params.go b/custom/gov/types/v2custom/params.go similarity index 99% rename from custom/gov/types/v2lunc1/params.go rename to custom/gov/types/v2custom/params.go index 510bf03f..27e79cb2 100644 --- a/custom/gov/types/v2lunc1/params.go +++ b/custom/gov/types/v2custom/params.go @@ -1,4 +1,4 @@ -package v2lunc1 +package v2custom import ( fmt "fmt" diff --git a/custom/gov/types/v2lunc1/query.pb.go b/custom/gov/types/v2custom/query.pb.go similarity index 81% rename from custom/gov/types/v2lunc1/query.pb.go rename to custom/gov/types/v2custom/query.pb.go index 60fd6ba8..d468795d 100644 --- a/custom/gov/types/v2lunc1/query.pb.go +++ b/custom/gov/types/v2custom/query.pb.go @@ -1,19 +1,16 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: terra/gov/v2lunc1/query.proto +// source: terra/gov/v2custom/query.proto -package v2lunc1 +package v2custom import ( context "context" fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/codec/types" types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/cosmos-sdk/types/tx/amino" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" - _ "github.com/gogo/protobuf/types" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -42,7 +39,7 @@ func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } func (*QueryParamsRequest) ProtoMessage() {} func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_075d72aa1a1cda58, []int{0} + return fileDescriptor_52ac9ccd3a4fff51, []int{0} } func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -81,7 +78,7 @@ func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryParamsResponse) ProtoMessage() {} func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_075d72aa1a1cda58, []int{1} + return fileDescriptor_52ac9ccd3a4fff51, []int{1} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -127,7 +124,7 @@ func (m *QueryProposalRequest) Reset() { *m = QueryProposalRequest{} } func (m *QueryProposalRequest) String() string { return proto.CompactTextString(m) } func (*QueryProposalRequest) ProtoMessage() {} func (*QueryProposalRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_075d72aa1a1cda58, []int{2} + return fileDescriptor_52ac9ccd3a4fff51, []int{2} } func (m *QueryProposalRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -173,7 +170,7 @@ func (m *QueryMinimalDepositProposalResponse) Reset() { *m = QueryMinima func (m *QueryMinimalDepositProposalResponse) String() string { return proto.CompactTextString(m) } func (*QueryMinimalDepositProposalResponse) ProtoMessage() {} func (*QueryMinimalDepositProposalResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_075d72aa1a1cda58, []int{3} + return fileDescriptor_52ac9ccd3a4fff51, []int{3} } func (m *QueryMinimalDepositProposalResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -210,49 +207,46 @@ func (m *QueryMinimalDepositProposalResponse) GetMinimalDeposit() types.Coin { } func init() { - proto.RegisterType((*QueryParamsRequest)(nil), "terra.gov.v2lunc1.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "terra.gov.v2lunc1.QueryParamsResponse") - proto.RegisterType((*QueryProposalRequest)(nil), "terra.gov.v2lunc1.QueryProposalRequest") - proto.RegisterType((*QueryMinimalDepositProposalResponse)(nil), "terra.gov.v2lunc1.QueryMinimalDepositProposalResponse") -} - -func init() { proto.RegisterFile("terra/gov/v2lunc1/query.proto", fileDescriptor_075d72aa1a1cda58) } - -var fileDescriptor_075d72aa1a1cda58 = []byte{ - // 518 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0x4f, 0x6b, 0x14, 0x31, - 0x14, 0xdf, 0x29, 0x75, 0xc1, 0x14, 0x94, 0xc6, 0x3d, 0xb8, 0x63, 0x9d, 0x95, 0x11, 0xff, 0x20, - 0x74, 0xc2, 0x6e, 0xc1, 0x22, 0x88, 0x87, 0x6d, 0x2f, 0x82, 0x2d, 0xba, 0xd2, 0x8b, 0x97, 0x25, - 0x33, 0x13, 0xc7, 0xc0, 0x24, 0x6f, 0x3a, 0xc9, 0x0c, 0x2c, 0xc5, 0x8b, 0x9f, 0x40, 0xf0, 0x4b, - 0x78, 0xf4, 0x33, 0x78, 0xaa, 0xb7, 0x82, 0x17, 0x4f, 0x22, 0xbb, 0x82, 0x5f, 0x43, 0x26, 0xc9, - 0xaa, 0xdb, 0x6d, 0xed, 0x25, 0x24, 0xef, 0xf7, 0x7b, 0xef, 0xfd, 0xde, 0xef, 0x05, 0xdd, 0xd4, - 0xac, 0x2c, 0x29, 0xc9, 0xa0, 0x26, 0xf5, 0x20, 0xaf, 0x64, 0xd2, 0x27, 0x87, 0x15, 0x2b, 0x27, - 0x51, 0x51, 0x82, 0x06, 0xbc, 0x6e, 0xe0, 0x28, 0x83, 0x3a, 0x72, 0xb0, 0x1f, 0x24, 0xa0, 0x04, - 0x28, 0x12, 0x53, 0xc5, 0x48, 0xdd, 0x8f, 0x99, 0xa6, 0x7d, 0x92, 0x00, 0x97, 0x36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bc, 0x5b, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x73, 0x01, - 0x93, 0xde, 0xeb, 0x03, 0x00, 0x00, + proto.RegisterType((*QueryParamsRequest)(nil), "terra.gov.v2custom.QueryParamsRequest") + proto.RegisterType((*QueryParamsResponse)(nil), "terra.gov.v2custom.QueryParamsResponse") + proto.RegisterType((*QueryProposalRequest)(nil), "terra.gov.v2custom.QueryProposalRequest") + proto.RegisterType((*QueryMinimalDepositProposalResponse)(nil), "terra.gov.v2custom.QueryMinimalDepositProposalResponse") +} + +func init() { proto.RegisterFile("terra/gov/v2custom/query.proto", fileDescriptor_52ac9ccd3a4fff51) } + +var fileDescriptor_52ac9ccd3a4fff51 = []byte{ + // 479 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x52, 0x4d, 0x6b, 0x14, 0x41, + 0x10, 0xdd, 0x09, 0x71, 0xc1, 0x0e, 0x28, 0xb6, 0x7b, 0x30, 0xa3, 0x4e, 0x64, 0x02, 0x1a, 0x84, + 0x74, 0x91, 0xcd, 0x21, 0x22, 0x88, 0xb0, 0xd1, 0x83, 0x60, 0xfc, 0x58, 0xcc, 0xc5, 0x4b, 0xe8, + 0x9d, 0x6d, 0xc6, 0x86, 0x9d, 0xa9, 0xc9, 0x54, 0xef, 0xc0, 0x22, 0x7a, 0xf0, 0x17, 0x08, 0xfe, + 0x09, 0x8f, 0xfe, 0x09, 0x21, 0x37, 0x03, 0x5e, 0x3c, 0x89, 0xec, 0x0a, 0xfe, 0x0d, 0x99, 0xee, + 0x5e, 0xe3, 0x90, 0x8d, 0x5e, 0x86, 0xe1, 0xd5, 0xab, 0x7a, 0xaf, 0x5e, 0x17, 0x8b, 0x8c, 0x2a, + 0x4b, 0x09, 0x29, 0x56, 0x50, 0x75, 0x93, 0x31, 0x19, 0xcc, 0xe0, 0x70, 0xac, 0xca, 0x89, 0x28, + 0x4a, 0x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0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -270,7 +264,7 @@ type QueryClient interface { // Params queries the parameters for custom gov module Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // Proposal queries proposal details based on ProposalID. - ProposalMinimalLUNCByUusd(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryMinimalDepositProposalResponse, error) + ProposalMinimalLUNCByUstc(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryMinimalDepositProposalResponse, error) } type queryClient struct { @@ -283,16 +277,16 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Query/Params", in, out, opts...) + err := c.cc.Invoke(ctx, "/terra.gov.v2custom.Query/Params", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *queryClient) ProposalMinimalLUNCByUusd(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryMinimalDepositProposalResponse, error) { +func (c *queryClient) ProposalMinimalLUNCByUstc(ctx context.Context, in *QueryProposalRequest, opts ...grpc.CallOption) (*QueryMinimalDepositProposalResponse, error) { out := new(QueryMinimalDepositProposalResponse) - err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Query/ProposalMinimalLUNCByUusd", in, out, opts...) + err := c.cc.Invoke(ctx, "/terra.gov.v2custom.Query/ProposalMinimalLUNCByUstc", in, out, opts...) if err != nil { return nil, err } @@ -304,7 +298,7 @@ type QueryServer interface { // Params queries the parameters for custom gov module Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // Proposal queries proposal details based on ProposalID. - ProposalMinimalLUNCByUusd(context.Context, *QueryProposalRequest) (*QueryMinimalDepositProposalResponse, error) + ProposalMinimalLUNCByUstc(context.Context, *QueryProposalRequest) (*QueryMinimalDepositProposalResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -314,8 +308,8 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } -func (*UnimplementedQueryServer) ProposalMinimalLUNCByUusd(ctx context.Context, req *QueryProposalRequest) (*QueryMinimalDepositProposalResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method ProposalMinimalLUNCByUusd not implemented") +func (*UnimplementedQueryServer) ProposalMinimalLUNCByUstc(ctx context.Context, req *QueryProposalRequest) (*QueryMinimalDepositProposalResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ProposalMinimalLUNCByUstc not implemented") } func RegisterQueryServer(s grpc1.Server, srv QueryServer) { @@ -332,7 +326,7 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/terra.gov.v2lunc1.Query/Params", + FullMethod: "/terra.gov.v2custom.Query/Params", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) @@ -340,26 +334,26 @@ func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interf return interceptor(ctx, in, info, handler) } -func _Query_ProposalMinimalLUNCByUusd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _Query_ProposalMinimalLUNCByUstc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryProposalRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(QueryServer).ProposalMinimalLUNCByUusd(ctx, in) + return srv.(QueryServer).ProposalMinimalLUNCByUstc(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/terra.gov.v2lunc1.Query/ProposalMinimalLUNCByUusd", + FullMethod: "/terra.gov.v2custom.Query/ProposalMinimalLUNCByUstc", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).ProposalMinimalLUNCByUusd(ctx, req.(*QueryProposalRequest)) + return srv.(QueryServer).ProposalMinimalLUNCByUstc(ctx, req.(*QueryProposalRequest)) } return interceptor(ctx, in, info, handler) } var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "terra.gov.v2lunc1.Query", + ServiceName: "terra.gov.v2custom.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ { @@ -367,12 +361,12 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Handler: _Query_Params_Handler, }, { - MethodName: "ProposalMinimalLUNCByUusd", - Handler: _Query_ProposalMinimalLUNCByUusd_Handler, + MethodName: "ProposalMinimalLUNCByUstc", + Handler: _Query_ProposalMinimalLUNCByUstc_Handler, }, }, Streams: []grpc.StreamDesc{}, - Metadata: "terra/gov/v2lunc1/query.proto", + Metadata: "terra/gov/v2custom/query.proto", } func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { diff --git a/custom/gov/types/v2lunc1/query.pb.gw.go b/custom/gov/types/v2custom/query.pb.gw.go similarity index 88% rename from custom/gov/types/v2lunc1/query.pb.gw.go rename to custom/gov/types/v2custom/query.pb.gw.go index ba6a6add..6ab2ba49 100644 --- a/custom/gov/types/v2lunc1/query.pb.gw.go +++ b/custom/gov/types/v2custom/query.pb.gw.go @@ -1,12 +1,12 @@ // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: terra/gov/v2lunc1/query.proto +// source: terra/gov/v2custom/query.proto /* -Package v2lunc1 is a reverse proxy. +Package v2custom is a reverse proxy. It translates gRPC into RESTful JSON APIs. */ -package v2lunc1 +package v2custom import ( "context" @@ -51,7 +51,7 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal } -func request_Query_ProposalMinimalLUNCByUusd_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func request_Query_ProposalMinimalLUNCByUstc_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryProposalRequest var metadata runtime.ServerMetadata @@ -73,12 +73,12 @@ func request_Query_ProposalMinimalLUNCByUusd_0(ctx context.Context, marshaler ru return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) } - msg, err := client.ProposalMinimalLUNCByUusd(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + msg, err := client.ProposalMinimalLUNCByUstc(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) return msg, metadata, err } -func local_request_Query_ProposalMinimalLUNCByUusd_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { +func local_request_Query_ProposalMinimalLUNCByUstc_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryProposalRequest var metadata runtime.ServerMetadata @@ -100,7 +100,7 @@ func local_request_Query_ProposalMinimalLUNCByUusd_0(ctx context.Context, marsha return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "proposal_id", err) } - msg, err := server.ProposalMinimalLUNCByUusd(ctx, &protoReq) + msg, err := server.ProposalMinimalLUNCByUstc(ctx, &protoReq) return msg, metadata, err } @@ -134,7 +134,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_ProposalMinimalLUNCByUusd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ProposalMinimalLUNCByUstc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() var stream runtime.ServerTransportStream @@ -145,7 +145,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := local_request_Query_ProposalMinimalLUNCByUusd_0(rctx, inboundMarshaler, server, req, pathParams) + resp, md, err := local_request_Query_ProposalMinimalLUNCByUstc_0(rctx, inboundMarshaler, server, req, pathParams) md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { @@ -153,7 +153,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } - forward_Query_ProposalMinimalLUNCByUusd_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ProposalMinimalLUNCByUstc_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -218,7 +218,7 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_ProposalMinimalLUNCByUusd_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + mux.Handle("GET", pattern_Query_ProposalMinimalLUNCByUstc_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) @@ -227,14 +227,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - resp, md, err := request_Query_ProposalMinimalLUNCByUusd_0(rctx, inboundMarshaler, client, req, pathParams) + resp, md, err := request_Query_ProposalMinimalLUNCByUstc_0(rctx, inboundMarshaler, client, req, pathParams) ctx = runtime.NewServerMetadataContext(ctx, md) if err != nil { runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) return } - forward_Query_ProposalMinimalLUNCByUusd_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + forward_Query_ProposalMinimalLUNCByUstc_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -242,13 +242,13 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "gov", "v2lunc1", "params"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"cosmos", "gov", "v2custom", "params"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_ProposalMinimalLUNCByUusd_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmos", "gov", "v2lunc1", "proposals", "minimal-deposits", "proposal_id"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_ProposalMinimalLUNCByUstc_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4, 1, 0, 4, 1, 5, 5}, []string{"cosmos", "gov", "v2custom", "proposals", "minimal-deposits", "proposal_id"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_Params_0 = runtime.ForwardResponseMessage - forward_Query_ProposalMinimalLUNCByUusd_0 = runtime.ForwardResponseMessage + forward_Query_ProposalMinimalLUNCByUstc_0 = runtime.ForwardResponseMessage ) diff --git a/custom/gov/types/v2lunc1/tx.pb.go b/custom/gov/types/v2custom/tx.pb.go similarity index 83% rename from custom/gov/types/v2lunc1/tx.pb.go rename to custom/gov/types/v2custom/tx.pb.go index 546963d6..ca153d92 100644 --- a/custom/gov/types/v2lunc1/tx.pb.go +++ b/custom/gov/types/v2custom/tx.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: terra/gov/v2lunc1/tx.proto +// source: terra/gov/v2custom/tx.proto -package v2lunc1 +package v2custom import ( context "context" @@ -48,7 +48,7 @@ func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } func (*MsgUpdateParams) ProtoMessage() {} func (*MsgUpdateParams) Descriptor() ([]byte, []int) { - return fileDescriptor_9d64e87259bdff9f, []int{0} + return fileDescriptor_352810ea07a1c9db, []int{0} } func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -102,7 +102,7 @@ func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } func (*MsgUpdateParamsResponse) ProtoMessage() {} func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_9d64e87259bdff9f, []int{1} + return fileDescriptor_352810ea07a1c9db, []int{1} } func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -132,46 +132,46 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgUpdateParams)(nil), "terra.gov.v2lunc1.MsgUpdateParams") - proto.RegisterType((*MsgUpdateParamsResponse)(nil), "terra.gov.v2lunc1.MsgUpdateParamsResponse") -} - -func init() { proto.RegisterFile("terra/gov/v2lunc1/tx.proto", fileDescriptor_9d64e87259bdff9f) } - -var fileDescriptor_9d64e87259bdff9f = []byte{ - // 505 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4f, 0x8b, 0xd3, 0x40, - 0x14, 0x6f, 0x74, 0x5d, 0xe9, 0xb8, 0x28, 0x1d, 0x96, 0xdd, 0x76, 0x84, 0x58, 0xbb, 0x20, 0xa5, - 0xd2, 0x84, 0xed, 0xc2, 0x82, 0x22, 0x82, 0x55, 0xf1, 0x62, 0x61, 0x69, 0x71, 0x05, 0x11, 0x25, - 0x4d, 0x86, 0x69, 0xb0, 0xc9, 0x0b, 0x79, 0x93, 0xd2, 0xde, 0xc4, 0xa3, 0x27, 0xf1, 0x53, 0x78, - 0xec, 0xc1, 0xbb, 0xd7, 0x3d, 0x2e, 0x9e, 0x3c, 0x89, 0xb4, 0x87, 0x7e, 0x0d, 0x49, 0x32, 0x69, - 0xd9, 0x66, 0xd7, 0xf5, 0x12, 0x66, 0xde, 0xef, 0xdf, 0x64, 0xe6, 0x3d, 0xc2, 0x24, 0x0f, 0x43, - 0xcb, 0x14, 0x30, 0x32, 0x47, 0xad, 0x61, 0xe4, 0xdb, 0xfb, 0xa6, 0x1c, 0x1b, 0x41, 0x08, 0x12, - 0x68, 0x29, 0xc1, 0x0c, 0x01, 0x23, 0x43, 0x61, 0x6c, 0xc7, 0x06, 0xf4, 0x00, 0x53, 0xfe, 0x8a, - 0xca, 0xb6, 0x05, 0x08, 0x48, 0x96, 0x66, 0xbc, 0x52, 0xd5, 0xdb, 0x79, 0xf3, 0xd8, 0x2c, 0x05, - 0x2b, 0xa9, 0xd5, 0xfb, 0x54, 0x95, 0x6e, 0x14, 0xb4, 0xab, 0x52, 0x3c, 0x14, 0x71, 0x8a, 0x87, - 0x42, 0x01, 0x25, 0xcb, 0x73, 0x7d, 0x30, 0x93, 0x6f, 0x5a, 0xaa, 0xfd, 0xd0, 0xc8, 0xad, 0x0e, - 0x8a, 0x57, 0x81, 0x63, 0x49, 0x7e, 0x64, 0x85, 0x96, 0x87, 0xf4, 0x90, 0x14, 0xad, 0x48, 0x0e, - 0x20, 0x74, 0xe5, 0xa4, 0xac, 0x55, 0xb5, 0x7a, 0xb1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0xff, - 0xc6, 0x97, 0xbe, 0x2f, 0xc8, 0xf5, 0x67, 0x3c, 0x00, 0x74, 0x25, 0xad, 0xe4, 0x25, 0x0a, 0x62, - 0x77, 0x2f, 0x84, 0x96, 0x46, 0xef, 0xc8, 0xd6, 0x99, 0x36, 0xac, 0x9d, 0xd3, 0x3e, 0x6b, 0x2f, - 0xcd, 0x1a, 0x97, 0x73, 0x32, 0x7f, 0x76, 0xed, 0x63, 0xdc, 0x6f, 0xed, 0xde, 0xc9, 0x4c, 0xd7, - 0x4e, 0x67, 0xba, 0xf6, 0x67, 0xa6, 0x6b, 0x5f, 0xe6, 0x7a, 0xe1, 0x74, 0xae, 0x17, 0x7e, 0xcd, - 0xf5, 0xc2, 0x9b, 0x07, 0xc2, 0x95, 0x83, 0xa8, 0x6f, 0xd8, 0xe0, 0x99, 0xf6, 0xd0, 0x42, 0x74, - 0xed, 0x66, 0x3a, 0x82, 0x36, 0x84, 0xdc, 0x1c, 0x1d, 0x98, 0x76, 0x84, 0x12, 0xbc, 0xa4, 0x13, - 0xe5, 0x24, 0xe0, 0x98, 0xcd, 0x65, 0x7f, 0x33, 0x99, 0xa6, 0x83, 0xbf, 0x01, 0x00, 0x00, 0xff, - 0xff, 0x10, 0xdb, 0x9e, 0x6a, 0x10, 0x04, 0x00, 0x00, + proto.RegisterType((*MsgUpdateParams)(nil), "terra.gov.v2custom.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "terra.gov.v2custom.MsgUpdateParamsResponse") +} + +func init() { proto.RegisterFile("terra/gov/v2custom/tx.proto", fileDescriptor_352810ea07a1c9db) } + +var fileDescriptor_352810ea07a1c9db = []byte{ + // 504 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4f, 0x6b, 0x13, 0x41, + 0x14, 0xcf, 0x6a, 0xad, 0x64, 0x2c, 0x4a, 0x87, 0xd2, 0x26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0xc8, 0xcd, 0x67, 0xc2, 0x07, 0x74, 0x14, 0x2d, 0xe7, 0x25, + 0x09, 0xc4, 0x1e, 0x5c, 0x08, 0x65, 0x46, 0x1f, 0xc8, 0xda, 0xb9, 0x3e, 0xac, 0x2e, 0xeb, 0x9f, + 0x85, 0xa7, 0x66, 0x3b, 0x57, 0x20, 0xa5, 0x09, 0xec, 0xc6, 0xa7, 0xb0, 0xe3, 0x5a, 0xaf, 0x4e, + 0x27, 0xba, 0x76, 0x36, 0xd1, 0xb5, 0xbf, 0x13, 0x5d, 0xfb, 0x3a, 0xd5, 0x0b, 0x67, 0x53, 0xbd, + 0xf0, 0x7b, 0xaa, 0x17, 0xde, 0x1e, 0x48, 0x47, 0xf5, 0xfa, 0x5d, 0xc3, 0x02, 0x97, 0x5b, 0x27, + 0x26, 0xa2, 0x63, 0x35, 0xe2, 0x31, 0xb4, 0x20, 0x10, 0x7c, 0xb0, 0xc7, 0xe7, 0x83, 0xc8, 0xd5, + 0xc8, 0x17, 0x98, 0xcd, 0x66, 0x77, 0x35, 0x9a, 0xa8, 0xbd, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, + 0x0d, 0x4f, 0xdf, 0x8d, 0x17, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -214,7 +214,7 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { func (c *msgClient) SubmitProposal(ctx context.Context, in *v1.MsgSubmitProposal, opts ...grpc.CallOption) (*v1.MsgSubmitProposalResponse, error) { out := new(v1.MsgSubmitProposalResponse) - err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Msg/SubmitProposal", in, out, opts...) + err := c.cc.Invoke(ctx, "/terra.gov.v2custom.Msg/SubmitProposal", in, out, opts...) if err != nil { return nil, err } @@ -223,7 +223,7 @@ func (c *msgClient) SubmitProposal(ctx context.Context, in *v1.MsgSubmitProposal func (c *msgClient) ExecLegacyContent(ctx context.Context, in *v1.MsgExecLegacyContent, opts ...grpc.CallOption) (*v1.MsgExecLegacyContentResponse, error) { out := new(v1.MsgExecLegacyContentResponse) - err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Msg/ExecLegacyContent", in, out, opts...) + err := c.cc.Invoke(ctx, "/terra.gov.v2custom.Msg/ExecLegacyContent", in, out, opts...) if err != nil { return nil, err } @@ -232,7 +232,7 @@ func (c *msgClient) ExecLegacyContent(ctx context.Context, in *v1.MsgExecLegacyC func (c *msgClient) Vote(ctx context.Context, in *v1.MsgVote, opts ...grpc.CallOption) (*v1.MsgVoteResponse, error) { out := new(v1.MsgVoteResponse) - err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Msg/Vote", in, out, opts...) + err := c.cc.Invoke(ctx, "/terra.gov.v2custom.Msg/Vote", in, out, opts...) if err != nil { return nil, err } @@ -241,7 +241,7 @@ func (c *msgClient) Vote(ctx context.Context, in *v1.MsgVote, opts ...grpc.CallO func (c *msgClient) VoteWeighted(ctx context.Context, in *v1.MsgVoteWeighted, opts ...grpc.CallOption) (*v1.MsgVoteWeightedResponse, error) { out := new(v1.MsgVoteWeightedResponse) - err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Msg/VoteWeighted", in, out, opts...) + err := c.cc.Invoke(ctx, "/terra.gov.v2custom.Msg/VoteWeighted", in, out, opts...) if err != nil { return nil, err } @@ -250,7 +250,7 @@ func (c *msgClient) VoteWeighted(ctx context.Context, in *v1.MsgVoteWeighted, op func (c *msgClient) Deposit(ctx context.Context, in *v1.MsgDeposit, opts ...grpc.CallOption) (*v1.MsgDepositResponse, error) { out := new(v1.MsgDepositResponse) - err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Msg/Deposit", in, out, opts...) + err := c.cc.Invoke(ctx, "/terra.gov.v2custom.Msg/Deposit", in, out, opts...) if err != nil { return nil, err } @@ -259,7 +259,7 @@ func (c *msgClient) Deposit(ctx context.Context, in *v1.MsgDeposit, opts ...grpc func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { out := new(MsgUpdateParamsResponse) - err := c.cc.Invoke(ctx, "/terra.gov.v2lunc1.Msg/UpdateParams", in, out, opts...) + err := c.cc.Invoke(ctx, "/terra.gov.v2custom.Msg/UpdateParams", in, out, opts...) if err != nil { return nil, err } @@ -323,7 +323,7 @@ func _Msg_SubmitProposal_Handler(srv interface{}, ctx context.Context, dec func( } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/terra.gov.v2lunc1.Msg/SubmitProposal", + FullMethod: "/terra.gov.v2custom.Msg/SubmitProposal", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).SubmitProposal(ctx, req.(*v1.MsgSubmitProposal)) @@ -341,7 +341,7 @@ func _Msg_ExecLegacyContent_Handler(srv interface{}, ctx context.Context, dec fu } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/terra.gov.v2lunc1.Msg/ExecLegacyContent", + FullMethod: "/terra.gov.v2custom.Msg/ExecLegacyContent", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).ExecLegacyContent(ctx, req.(*v1.MsgExecLegacyContent)) @@ -359,7 +359,7 @@ func _Msg_Vote_Handler(srv interface{}, ctx context.Context, dec func(interface{ } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/terra.gov.v2lunc1.Msg/Vote", + FullMethod: "/terra.gov.v2custom.Msg/Vote", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).Vote(ctx, req.(*v1.MsgVote)) @@ -377,7 +377,7 @@ func _Msg_VoteWeighted_Handler(srv interface{}, ctx context.Context, dec func(in } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/terra.gov.v2lunc1.Msg/VoteWeighted", + FullMethod: "/terra.gov.v2custom.Msg/VoteWeighted", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).VoteWeighted(ctx, req.(*v1.MsgVoteWeighted)) @@ -395,7 +395,7 @@ func _Msg_Deposit_Handler(srv interface{}, ctx context.Context, dec func(interfa } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/terra.gov.v2lunc1.Msg/Deposit", + FullMethod: "/terra.gov.v2custom.Msg/Deposit", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).Deposit(ctx, req.(*v1.MsgDeposit)) @@ -413,7 +413,7 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/terra.gov.v2lunc1.Msg/UpdateParams", + FullMethod: "/terra.gov.v2custom.Msg/UpdateParams", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) @@ -422,7 +422,7 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in } var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "terra.gov.v2lunc1.Msg", + ServiceName: "terra.gov.v2custom.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { @@ -451,7 +451,7 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "terra/gov/v2lunc1/tx.proto", + Metadata: "terra/gov/v2custom/tx.proto", } func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { diff --git a/custom/params/types/codec.go b/custom/params/types/codec.go index 5c4b5cea..af0de4ad 100644 --- a/custom/params/types/codec.go +++ b/custom/params/types/codec.go @@ -1,7 +1,7 @@ package types import ( - govtypes "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + govtypes "github.com/classic-terra/core/v3/custom/gov/types/v2custom" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/params/types/proposal" ) diff --git a/custom/upgrade/types/codec.go b/custom/upgrade/types/codec.go index ac656c27..644e39d8 100644 --- a/custom/upgrade/types/codec.go +++ b/custom/upgrade/types/codec.go @@ -1,7 +1,7 @@ package types import ( - govtypes "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + govtypes "github.com/classic-terra/core/v3/custom/gov/types/v2custom" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/x/upgrade/types" ) diff --git a/proto/terra/gov/v2lunc1/genesis.proto b/proto/terra/gov/v2custom/genesis.proto similarity index 90% rename from proto/terra/gov/v2lunc1/genesis.proto rename to proto/terra/gov/v2custom/genesis.proto index 5596e4d7..010e6c9e 100644 --- a/proto/terra/gov/v2lunc1/genesis.proto +++ b/proto/terra/gov/v2custom/genesis.proto @@ -1,10 +1,10 @@ syntax = "proto3"; -package terra.gov.v2lunc1; +package terra.gov.v2custom; -import "terra/gov/v2lunc1/gov.proto"; +import "terra/gov/v2custom/gov.proto"; import "cosmos/gov/v1/gov.proto"; -option go_package = "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1"; +option go_package = "github.com/classic-terra/core/v3/custom/gov/types/v2custom"; // GenesisState defines the gov module's genesis state. message GenesisState { @@ -28,5 +28,5 @@ message GenesisState { // params defines all the paramaters of x/gov module. // // Since: cosmos-sdk 0.47 - terra.gov.v2lunc1.Params params = 8; + terra.gov.v2custom.Params params = 8; } diff --git a/proto/terra/gov/v2lunc1/gov.proto b/proto/terra/gov/v2custom/gov.proto similarity index 99% rename from proto/terra/gov/v2lunc1/gov.proto rename to proto/terra/gov/v2custom/gov.proto index 092f73f0..d8955183 100644 --- a/proto/terra/gov/v2lunc1/gov.proto +++ b/proto/terra/gov/v2custom/gov.proto @@ -1,5 +1,5 @@ syntax = "proto3"; -package terra.gov.v2lunc1; +package terra.gov.v2custom; import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; @@ -9,7 +9,7 @@ import "cosmos_proto/cosmos.proto"; import "google/protobuf/any.proto"; import "amino/amino.proto"; -option go_package = "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1"; +option go_package = "github.com/classic-terra/core/v3/custom/gov/types/v2custom"; // VoteOption enumerates the valid vote options for a given governance proposal. enum VoteOption { diff --git a/proto/terra/gov/v2lunc1/query.proto b/proto/terra/gov/v2custom/query.proto similarity index 80% rename from proto/terra/gov/v2lunc1/query.proto rename to proto/terra/gov/v2custom/query.proto index 592e8993..a2e5dbb9 100644 --- a/proto/terra/gov/v2lunc1/query.proto +++ b/proto/terra/gov/v2custom/query.proto @@ -1,24 +1,24 @@ syntax = "proto3"; -package terra.gov.v2lunc1; +package terra.gov.v2custom; import "cosmos/base/v1beta1/coin.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; -import "terra/gov/v2lunc1/gov.proto"; +import "terra/gov/v2custom/gov.proto"; import "amino/amino.proto"; -option go_package = "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1"; +option go_package = "github.com/classic-terra/core/v3/custom/gov/types/v2custom"; // Query defines the gRPC querier service for gov module service Query { // Params queries the parameters for custom gov module rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/cosmos/gov/v2lunc1/params"; + option (google.api.http).get = "/cosmos/gov/v2custom/params"; } // Proposal queries proposal details based on ProposalID. - rpc ProposalMinimalLUNCByUusd(QueryProposalRequest) returns (QueryMinimalDepositProposalResponse) { - option (google.api.http).get = "/cosmos/gov/v2lunc1/proposals/minimal-deposits/{proposal_id}"; + rpc ProposalMinimalLUNCByUstc(QueryProposalRequest) returns (QueryMinimalDepositProposalResponse) { + option (google.api.http).get = "/cosmos/gov/v2custom/proposals/minimal-deposits/{proposal_id}"; } } diff --git a/proto/terra/gov/v2lunc1/tx.proto b/proto/terra/gov/v2custom/tx.proto similarity index 92% rename from proto/terra/gov/v2lunc1/tx.proto rename to proto/terra/gov/v2custom/tx.proto index 264eea92..d39c8929 100644 --- a/proto/terra/gov/v2lunc1/tx.proto +++ b/proto/terra/gov/v2custom/tx.proto @@ -1,14 +1,14 @@ syntax = "proto3"; -package terra.gov.v2lunc1; +package terra.gov.v2custom; import "cosmos/gov/v1/tx.proto"; import "gogoproto/gogo.proto"; -import "terra/gov/v2lunc1/gov.proto"; +import "terra/gov/v2custom/gov.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; import "amino/amino.proto"; -option go_package = "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1"; +option go_package = "github.com/classic-terra/core/v3/custom/gov/types/v2custom"; // Msg defines the gov Msg service. service Msg { @@ -50,7 +50,7 @@ message MsgUpdateParams { // params defines the x/gov parameters to update. // // NOTE: All parameters must be supplied. - terra.gov.v2lunc1.Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + terra.gov.v2custom.Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; } // MsgUpdateParamsResponse defines the response structure for executing a diff --git a/scripts/gov_test/test-upgrade-and-submit-proposal.sh b/scripts/gov_test/test-upgrade-and-submit-proposal.sh index 11786008..ef06ab20 100755 --- a/scripts/gov_test/test-upgrade-and-submit-proposal.sh +++ b/scripts/gov_test/test-upgrade-and-submit-proposal.sh @@ -3,12 +3,12 @@ # Step 1: Run old chain --> Sub Proposal Upgrade (soft-upgrade) # Step 2: Vote --> Proposal Passed # Step 3: Stop old chain --> Switch new code --> Build --> Run new chain -# Step 4: Test Submit Proposal New Flow with MinUusd Deposit +# Step 4: Test Submit Proposal New Flow with MinUstc Deposit HOME_DIR=mytestnet -./build/terrad tx gov submit-legacy-proposal software-upgrade v8_4 --upgrade-height 20 --upgrade-info v8_4 --title "upgrade" --description "upgrade" --no-validate --deposit "100000000uluna" --from test0 --keyring-backend test --home mytestnet -y +./build/terrad tx gov submit-legacy-proposal software-upgrade v10_1 --upgrade-height 20 --upgrade-info v10_1 --title "upgrade" --description "upgrade" --no-validate --deposit "100000000uluna" --from test0 --keyring-backend test --home mytestnet -y ./build/terrad tx gov vote 1 yes --from test0 --home mytestnet --keyring-backend test -y ./build/terrad tx gov vote 1 yes --from test1 --home mytestnet --keyring-backend test -y diff --git a/tests/e2e/initialization/config.go b/tests/e2e/initialization/config.go index 32275320..2c3d0011 100644 --- a/tests/e2e/initialization/config.go +++ b/tests/e2e/initialization/config.go @@ -19,7 +19,7 @@ import ( staketypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/gogo/protobuf/proto" - govv2lunc1 "github.com/classic-terra/core/v3/custom/gov/types/v2lunc1" + govv2custom "github.com/classic-terra/core/v3/custom/gov/types/v2custom" "github.com/classic-terra/core/v3/tests/e2e/util" taxtypes "github.com/classic-terra/core/v3/x/tax/types" @@ -253,7 +253,7 @@ func initGenesis(chain *internalChain, forkHeight int) error { return err } - err = updateModuleGenesis(appGenState, govtypes.ModuleName, &govv2lunc1.GenesisState{}, updateGovGenesis) + err = updateModuleGenesis(appGenState, govtypes.ModuleName, &govv2custom.GenesisState{}, updateGovGenesis) if err != nil { return err } @@ -324,7 +324,7 @@ func updateTreasuryGenesis(treasuryGenState *treasurytypes.GenesisState) { } } -func updateGovGenesis(govGenState *govv2lunc1.GenesisState) { +func updateGovGenesis(govGenState *govv2custom.GenesisState) { govGenState.Params.VotingPeriod = &OneMin govGenState.Params.Quorum = sdk.NewDecWithPrec(2, 1).String() govGenState.Params.MinDeposit = tenTerra