diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index d0458d44..390b7389 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -50989,6 +50989,7 @@ paths: - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET + - BITCOIN_DEFAULT_DEFAULT - ETHEREUM_MAINNET_MAINNET - ETHEREUM_TESTNET_GOERLI - ETHEREUM_TESTNET_SEPOLIA @@ -51006,15 +51007,19 @@ paths: - ARBITRUM_TESTNET_GOERLI - SHARDEUM_BETANET_SPHINX - ZETA_TESTNET_ATHENS + - EVM_DEFAULT_DEFAULT - APTOS_MAINNET_MAINNET - APTOS_TESTNET_TESTNET - SUI_MAINNET_MAINNET - SUI_TESTNET_TESTNET + - MOVE_DEFAULT_DEFAULT - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET + - SOLANA_DEFAULT_DEFAULT default: NO_NETWORK description: |- - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - BITCOIN_DEFAULT_DEFAULT: DEFAULT - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon @@ -51028,10 +51033,13 @@ paths: SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain ZETA_MAINNET_MAINNET = 20018; + - EVM_DEFAULT_DEFAULT: DEFAULT - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui + - MOVE_DEFAULT_DEFAULT: DEFAULT - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx + - SOLANA_DEFAULT_DEFAULT: DEFAULT title: 'Rule: CHAINNAME_ENVIRONMENT_NETWORK' value: type: string @@ -51238,6 +51246,7 @@ paths: - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET + - BITCOIN_DEFAULT_DEFAULT - ETHEREUM_MAINNET_MAINNET - ETHEREUM_TESTNET_GOERLI - ETHEREUM_TESTNET_SEPOLIA @@ -51255,15 +51264,19 @@ paths: - ARBITRUM_TESTNET_GOERLI - SHARDEUM_BETANET_SPHINX - ZETA_TESTNET_ATHENS + - EVM_DEFAULT_DEFAULT - APTOS_MAINNET_MAINNET - APTOS_TESTNET_TESTNET - SUI_MAINNET_MAINNET - SUI_TESTNET_TESTNET + - MOVE_DEFAULT_DEFAULT - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET + - SOLANA_DEFAULT_DEFAULT default: NO_NETWORK description: |- - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - BITCOIN_DEFAULT_DEFAULT: DEFAULT - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon @@ -51277,10 +51290,13 @@ paths: SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain ZETA_MAINNET_MAINNET = 20018; + - EVM_DEFAULT_DEFAULT: DEFAULT - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui + - MOVE_DEFAULT_DEFAULT: DEFAULT - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx + - SOLANA_DEFAULT_DEFAULT: DEFAULT title: 'Rule: CHAINNAME_ENVIRONMENT_NETWORK' value: type: string @@ -81733,6 +81749,195 @@ definitions: Coin defines a token with a denomination and an amount. + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + mycel.registry.MsgSubmitTopLevelDomainProposalResponse: + type: object + properties: + topLevelDomain: + type: object + properties: + name: + type: string + expirationDate: + type: string + format: date-time + subdomainConfig: + type: object + properties: + maxSubdomainRegistrations: + type: string + format: uint64 + subdomainRegistrationFees: + type: object + properties: + feeByLength: + type: array + items: + type: object + properties: + length: + type: integer + format: int64 + isRegistrable: + type: boolean + fee: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements + the custom method + + signatures required by gogoproto. + feeByName: + type: array + items: + type: object + properties: + name: + type: string + isRegistrable: + type: boolean + fee: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an + amount. + + + NOTE: The amount field is an Int which implements + the custom method + + signatures required by gogoproto. + defaultFee: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the + custom method + + signatures required by gogoproto. + isRegistrable: + type: boolean + registrableRole: + type: string + enum: + - NO_ROLE + - OWNER + - EDITOR + default: NO_ROLE + customExpirationDate: + type: boolean + registrationPolicy: + type: string + enum: + - PRIVATE + - PUBLIC + default: PRIVATE + subdomainCount: + type: string + format: uint64 + accessControl: + type: array + items: + type: object + properties: + address: + type: string + role: + type: string + enum: + - NO_ROLE + - OWNER + - EDITOR + default: NO_ROLE + totalWithdrawalAmount: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + fee: + type: object + properties: + totalFee: + type: array + items: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + burnWeight: + type: string + feeToBurn: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + + NOTE: The amount field is an Int which implements the custom + method + + signatures required by gogoproto. + feeToTreasury: + type: object + properties: + denom: + type: string + amount: + type: string + description: >- + Coin defines a token with a denomination and an amount. + + NOTE: The amount field is an Int which implements the custom method @@ -82624,6 +82829,7 @@ definitions: - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET + - BITCOIN_DEFAULT_DEFAULT - ETHEREUM_MAINNET_MAINNET - ETHEREUM_TESTNET_GOERLI - ETHEREUM_TESTNET_SEPOLIA @@ -82641,15 +82847,19 @@ definitions: - ARBITRUM_TESTNET_GOERLI - SHARDEUM_BETANET_SPHINX - ZETA_TESTNET_ATHENS + - EVM_DEFAULT_DEFAULT - APTOS_MAINNET_MAINNET - APTOS_TESTNET_TESTNET - SUI_MAINNET_MAINNET - SUI_TESTNET_TESTNET + - MOVE_DEFAULT_DEFAULT - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET + - SOLANA_DEFAULT_DEFAULT default: NO_NETWORK description: |- - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - BITCOIN_DEFAULT_DEFAULT: DEFAULT - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon @@ -82663,10 +82873,13 @@ definitions: SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain ZETA_MAINNET_MAINNET = 20018; + - EVM_DEFAULT_DEFAULT: DEFAULT - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui + - MOVE_DEFAULT_DEFAULT: DEFAULT - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx + - SOLANA_DEFAULT_DEFAULT: DEFAULT title: 'Rule: CHAINNAME_ENVIRONMENT_NETWORK' mycel.registry.Record: type: object @@ -82699,6 +82912,7 @@ definitions: - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET + - BITCOIN_DEFAULT_DEFAULT - ETHEREUM_MAINNET_MAINNET - ETHEREUM_TESTNET_GOERLI - ETHEREUM_TESTNET_SEPOLIA @@ -82716,15 +82930,19 @@ definitions: - ARBITRUM_TESTNET_GOERLI - SHARDEUM_BETANET_SPHINX - ZETA_TESTNET_ATHENS + - EVM_DEFAULT_DEFAULT - APTOS_MAINNET_MAINNET - APTOS_TESTNET_TESTNET - SUI_MAINNET_MAINNET - SUI_TESTNET_TESTNET + - MOVE_DEFAULT_DEFAULT - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET + - SOLANA_DEFAULT_DEFAULT default: NO_NETWORK description: |- - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - BITCOIN_DEFAULT_DEFAULT: DEFAULT - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon @@ -82738,10 +82956,13 @@ definitions: SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain ZETA_MAINNET_MAINNET = 20018; + - EVM_DEFAULT_DEFAULT: DEFAULT - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui + - MOVE_DEFAULT_DEFAULT: DEFAULT - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx + - SOLANA_DEFAULT_DEFAULT: DEFAULT title: 'Rule: CHAINNAME_ENVIRONMENT_NETWORK' value: type: string @@ -82768,6 +82989,7 @@ definitions: - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET + - BITCOIN_DEFAULT_DEFAULT - ETHEREUM_MAINNET_MAINNET - ETHEREUM_TESTNET_GOERLI - ETHEREUM_TESTNET_SEPOLIA @@ -82785,15 +83007,19 @@ definitions: - ARBITRUM_TESTNET_GOERLI - SHARDEUM_BETANET_SPHINX - ZETA_TESTNET_ATHENS + - EVM_DEFAULT_DEFAULT - APTOS_MAINNET_MAINNET - APTOS_TESTNET_TESTNET - SUI_MAINNET_MAINNET - SUI_TESTNET_TESTNET + - MOVE_DEFAULT_DEFAULT - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET + - SOLANA_DEFAULT_DEFAULT default: NO_NETWORK description: |- - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - BITCOIN_DEFAULT_DEFAULT: DEFAULT - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon @@ -82807,10 +83033,13 @@ definitions: SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain ZETA_MAINNET_MAINNET = 20018; + - EVM_DEFAULT_DEFAULT: DEFAULT - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui + - MOVE_DEFAULT_DEFAULT: DEFAULT - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx + - SOLANA_DEFAULT_DEFAULT: DEFAULT title: 'Rule: CHAINNAME_ENVIRONMENT_NETWORK' value: type: string @@ -82853,6 +83082,7 @@ definitions: - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET + - BITCOIN_DEFAULT_DEFAULT - ETHEREUM_MAINNET_MAINNET - ETHEREUM_TESTNET_GOERLI - ETHEREUM_TESTNET_SEPOLIA @@ -82870,15 +83100,19 @@ definitions: - ARBITRUM_TESTNET_GOERLI - SHARDEUM_BETANET_SPHINX - ZETA_TESTNET_ATHENS + - EVM_DEFAULT_DEFAULT - APTOS_MAINNET_MAINNET - APTOS_TESTNET_TESTNET - SUI_MAINNET_MAINNET - SUI_TESTNET_TESTNET + - MOVE_DEFAULT_DEFAULT - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET + - SOLANA_DEFAULT_DEFAULT default: NO_NETWORK description: |- - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - BITCOIN_DEFAULT_DEFAULT: DEFAULT - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon @@ -82892,10 +83126,13 @@ definitions: SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain ZETA_MAINNET_MAINNET = 20018; + - EVM_DEFAULT_DEFAULT: DEFAULT - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui + - MOVE_DEFAULT_DEFAULT: DEFAULT - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx + - SOLANA_DEFAULT_DEFAULT: DEFAULT title: 'Rule: CHAINNAME_ENVIRONMENT_NETWORK' value: type: string @@ -82957,6 +83194,7 @@ definitions: - NO_NETWORK - BITCOIN_MAINNET_MAINNET - BITCOIN_TESTNET_TESTNET + - BITCOIN_DEFAULT_DEFAULT - ETHEREUM_MAINNET_MAINNET - ETHEREUM_TESTNET_GOERLI - ETHEREUM_TESTNET_SEPOLIA @@ -82974,15 +83212,19 @@ definitions: - ARBITRUM_TESTNET_GOERLI - SHARDEUM_BETANET_SPHINX - ZETA_TESTNET_ATHENS + - EVM_DEFAULT_DEFAULT - APTOS_MAINNET_MAINNET - APTOS_TESTNET_TESTNET - SUI_MAINNET_MAINNET - SUI_TESTNET_TESTNET + - MOVE_DEFAULT_DEFAULT - SOLANA_MAINNET_MAINNET - SOLANA_TESTNET_TESTNET + - SOLANA_DEFAULT_DEFAULT default: NO_NETWORK description: |- - BITCOIN_MAINNET_MAINNET: BTC 1xxx + - BITCOIN_DEFAULT_DEFAULT: DEFAULT - ETHEREUM_MAINNET_MAINNET: EVM 2xxxx Etheruem - POLYGON_MAINNET_MAINNET: Polygon @@ -82996,10 +83238,13 @@ definitions: SHARDEUM_TESTNET_ = 20016; - ZETA_TESTNET_ATHENS: Zetachain ZETA_MAINNET_MAINNET = 20018; + - EVM_DEFAULT_DEFAULT: DEFAULT - APTOS_MAINNET_MAINNET: MOVE 3xxxx Aptos - SUI_MAINNET_MAINNET: Sui + - MOVE_DEFAULT_DEFAULT: DEFAULT - SOLANA_MAINNET_MAINNET: SOLANA 4xxxx + - SOLANA_DEFAULT_DEFAULT: DEFAULT title: 'Rule: CHAINNAME_ENVIRONMENT_NETWORK' value: type: string diff --git a/proto/mycel/registry/tx.proto b/proto/mycel/registry/tx.proto index 7a2ec14c..9b94bcb7 100644 --- a/proto/mycel/registry/tx.proto +++ b/proto/mycel/registry/tx.proto @@ -18,6 +18,7 @@ service Msg { rpc ExtendTopLevelDomainExpirationDate (MsgExtendTopLevelDomainExpirationDate ) returns (MsgExtendTopLevelDomainExpirationDateResponse ); rpc UpdateTextRecord (MsgUpdateTextRecord ) returns (MsgUpdateTextRecordResponse ); rpc UpdateTopLevelDomainRegistrationPolicy (MsgUpdateTopLevelDomainRegistrationPolicy) returns (MsgUpdateTopLevelDomainRegistrationPolicyResponse); + rpc SubmitTopLevelDomainProposal (MsgSubmitTopLevelDomainProposal ) returns (MsgSubmitTopLevelDomainProposalResponse ); } message MsgUpdateWalletRecord { string creator = 1; @@ -97,3 +98,14 @@ message MsgUpdateTopLevelDomainRegistrationPolicy { message MsgUpdateTopLevelDomainRegistrationPolicyResponse {} +message MsgSubmitTopLevelDomainProposal { + string creator = 1; + string name = 2; + uint64 registrationPeriodInYear = 3; +} + +message MsgSubmitTopLevelDomainProposalResponse { + TopLevelDomain topLevelDomain = 1; + TopLevelDomainFee fee = 2; +} + diff --git a/x/registry/client/cli/tx.go b/x/registry/client/cli/tx.go index 727d7dcd..062196b0 100644 --- a/x/registry/client/cli/tx.go +++ b/x/registry/client/cli/tx.go @@ -37,6 +37,7 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand(CmdExtendTopLevelDomainExpirationDate()) cmd.AddCommand(CmdUpdateTextRecord()) cmd.AddCommand(CmdUpdateTopLevelDomainRegistrationPolicy()) + cmd.AddCommand(CmdSubmitTopLevelDomainProposal()) // this line is used by starport scaffolding # 1 return cmd diff --git a/x/registry/client/cli/tx_submit_top_level_domain_proposal.go b/x/registry/client/cli/tx_submit_top_level_domain_proposal.go new file mode 100644 index 00000000..f54c9cee --- /dev/null +++ b/x/registry/client/cli/tx_submit_top_level_domain_proposal.go @@ -0,0 +1,69 @@ +package cli + +import ( + "fmt" + "strconv" + + errorsmod "cosmossdk.io/errors" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/address" + "github.com/cosmos/cosmos-sdk/x/gov/client/cli" + "github.com/mycel-domain/mycel/x/registry/types" + "github.com/spf13/cast" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +func CmdSubmitTopLevelDomainProposal() *cobra.Command { + cmd := &cobra.Command{ + Use: "submit-top-level-domain-proposal [name] [registration-period-in-year] [flags]", + Short: "Broadcast message submit-top-level-domain-proposal", + Args: cobra.ExactArgs(2), + RunE: func(cmd *cobra.Command, args []string) (err error) { + argName := args[0] + argRegistrationPeriodInYear, err := cast.ToUint64E(args[1]) + if err != nil { + return err + } + if argRegistrationPeriodInYear < 1 || argRegistrationPeriodInYear > 4 { + return errorsmod.Wrapf(types.ErrTopLevelDomainInvalidRegistrationPeriod, "%d year(s)", argRegistrationPeriodInYear) + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + proposal, err := cli.ReadGovPropFlags(clientCtx, cmd.Flags()) + if err != nil { + return err + } + + msg := types.NewMsgSubmitTopLevelDomainProposal( + sdk.AccAddress(address.Module("gov")).String(), + argName, + argRegistrationPeriodInYear, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + + if err := proposal.SetMsgs([]sdk.Msg{msg}); err != nil { + return fmt.Errorf("failed to create submit top-level-domain proposal message: %w", err) + } + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposal) + }, + } + + // add common proposal flags + flags.AddTxFlagsToCmd(cmd) + cli.AddGovPropFlagsToCmd(cmd) + cmd.MarkFlagRequired(cli.FlagTitle) + + return cmd +} diff --git a/x/registry/keeper/msg_server_submit_top_level_domain_proposal.go b/x/registry/keeper/msg_server_submit_top_level_domain_proposal.go new file mode 100644 index 00000000..66d36fc8 --- /dev/null +++ b/x/registry/keeper/msg_server_submit_top_level_domain_proposal.go @@ -0,0 +1,28 @@ +package keeper + +import ( + "context" + + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/mycel-domain/mycel/x/registry/types" +) + +func (k msgServer) SubmitTopLevelDomainProposal(goCtx context.Context, msg *types.MsgSubmitTopLevelDomainProposal) (*types.MsgSubmitTopLevelDomainProposalResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // NOTE: Same as x/registry/keeper/msg_server_register_top_level_domain.go + if msg.RegistrationPeriodInYear < 1 || msg.RegistrationPeriodInYear > 4 { + return nil, errorsmod.Wrapf(types.ErrTopLevelDomainInvalidRegistrationPeriod, "%d year(s)", msg.RegistrationPeriodInYear) + } + + topLevelDomain, fee, err := k.Keeper.RegisterTopLevelDomain(ctx, msg.Creator, msg.Name, msg.RegistrationPeriodInYear) + if err != nil { + return nil, err + } + + return &types.MsgSubmitTopLevelDomainProposalResponse{ + TopLevelDomain: &topLevelDomain, + Fee: &fee, + }, nil +} diff --git a/x/registry/module_simulation.go b/x/registry/module_simulation.go index e609d9ff..ec11fdc9 100644 --- a/x/registry/module_simulation.go +++ b/x/registry/module_simulation.go @@ -52,6 +52,10 @@ const ( // TODO: Determine the simulation weight value defaultWeightMsgUpdateTopLevelDomainRegistrationPolicy int = 100 + opWeightMsgSubmitTopLevelDomainProposal = "op_weight_msg_submit_top_level_domain_proposal" + // TODO: Determine the simulation weight value + defaultWeightMsgSubmitTopLevelDomainProposal int = 100 + // this line is used by starport scaffolding # simapp/module/const ) @@ -157,6 +161,17 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp registrysimulation.SimulateMsgUpdateTopLevelDomainRegistrationPolicy(am.accountKeeper, am.bankKeeper, am.keeper), )) + var weightMsgSubmitTopLevelDomainProposal int + simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgSubmitTopLevelDomainProposal, &weightMsgSubmitTopLevelDomainProposal, nil, + func(_ *rand.Rand) { + weightMsgSubmitTopLevelDomainProposal = defaultWeightMsgSubmitTopLevelDomainProposal + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgSubmitTopLevelDomainProposal, + registrysimulation.SimulateMsgSubmitTopLevelDomainProposal(am.accountKeeper, am.bankKeeper, am.keeper), + )) + // this line is used by starport scaffolding # simapp/module/operation return operations diff --git a/x/registry/simulation/submit_top_level_domain_proposal.go b/x/registry/simulation/submit_top_level_domain_proposal.go new file mode 100644 index 00000000..dc5019da --- /dev/null +++ b/x/registry/simulation/submit_top_level_domain_proposal.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/mycel-domain/mycel/x/registry/keeper" + "github.com/mycel-domain/mycel/x/registry/types" +) + +func SimulateMsgSubmitTopLevelDomainProposal( + ak types.AccountKeeper, + bk types.BankKeeper, + k keeper.Keeper, +) simtypes.Operation { + return func(r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, + ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { + simAccount, _ := simtypes.RandomAcc(r, accs) + msg := &types.MsgSubmitTopLevelDomainProposal{ + Creator: simAccount.Address.String(), + } + + // TODO: Handling the SubmitTopLevelDomainProposal simulation + + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "SubmitTopLevelDomainProposal simulation not implemented"), nil, nil + } +} diff --git a/x/registry/types/codec.go b/x/registry/types/codec.go index bf6d6381..c09f1f90 100644 --- a/x/registry/types/codec.go +++ b/x/registry/types/codec.go @@ -15,6 +15,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgExtendTopLevelDomainExpirationDate{}, "registry/ExtendTopLevelDomainExpirationDate", nil) cdc.RegisterConcrete(&MsgUpdateTextRecord{}, "registry/UpdateTextRecord", nil) cdc.RegisterConcrete(&MsgUpdateTopLevelDomainRegistrationPolicy{}, "registry/UpdateTopLevelDomainRegistrationPolicy", nil) + cdc.RegisterConcrete(&MsgSubmitTopLevelDomainProposal{}, "registry/SubmitTopLevelDomainProposal", nil) // this line is used by starport scaffolding # 2 } @@ -40,6 +41,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgUpdateTopLevelDomainRegistrationPolicy{}, ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgSubmitTopLevelDomainProposal{}, + ) // this line is used by starport scaffolding # 3 msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/registry/types/message_submit_top_level_domain_proposal.go b/x/registry/types/message_submit_top_level_domain_proposal.go new file mode 100644 index 00000000..2725639b --- /dev/null +++ b/x/registry/types/message_submit_top_level_domain_proposal.go @@ -0,0 +1,47 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const TypeMsgSubmitTopLevelDomainProposal = "submit_top_level_domain_proposal" + +var _ sdk.Msg = &MsgSubmitTopLevelDomainProposal{} + +func NewMsgSubmitTopLevelDomainProposal(creator string, name string, registrationPeriodInYear uint64) *MsgSubmitTopLevelDomainProposal { + return &MsgSubmitTopLevelDomainProposal{ + Creator: creator, + Name: name, + RegistrationPeriodInYear: registrationPeriodInYear, + } +} + +func (msg *MsgSubmitTopLevelDomainProposal) Route() string { + return RouterKey +} + +func (msg *MsgSubmitTopLevelDomainProposal) Type() string { + return TypeMsgSubmitTopLevelDomainProposal +} + +func (msg *MsgSubmitTopLevelDomainProposal) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgSubmitTopLevelDomainProposal) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgSubmitTopLevelDomainProposal) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + return nil +} diff --git a/x/registry/types/message_submit_top_level_domain_proposal_test.go b/x/registry/types/message_submit_top_level_domain_proposal_test.go new file mode 100644 index 00000000..29e1406b --- /dev/null +++ b/x/registry/types/message_submit_top_level_domain_proposal_test.go @@ -0,0 +1,40 @@ +package types + +import ( + "testing" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/mycel-domain/mycel/testutil/sample" + "github.com/stretchr/testify/require" +) + +func TestMsgSubmitTopLevelDomainProposal_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgSubmitTopLevelDomainProposal + err error + }{ + { + name: "invalid address", + msg: MsgSubmitTopLevelDomainProposal{ + Creator: "invalid_address", + }, + err: sdkerrors.ErrInvalidAddress, + }, { + name: "valid address", + msg: MsgSubmitTopLevelDomainProposal{ + Creator: sample.AccAddress(), + }, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.err != nil { + require.ErrorIs(t, err, tt.err) + return + } + require.NoError(t, err) + }) + } +} diff --git a/x/registry/types/tx.pb.go b/x/registry/types/tx.pb.go index edfc0bc4..c3b6fcdf 100644 --- a/x/registry/types/tx.pb.go +++ b/x/registry/types/tx.pb.go @@ -898,6 +898,120 @@ func (m *MsgUpdateTopLevelDomainRegistrationPolicyResponse) XXX_DiscardUnknown() var xxx_messageInfo_MsgUpdateTopLevelDomainRegistrationPolicyResponse proto.InternalMessageInfo +type MsgSubmitTopLevelDomainProposal struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + RegistrationPeriodInYear uint64 `protobuf:"varint,3,opt,name=registrationPeriodInYear,proto3" json:"registrationPeriodInYear,omitempty"` +} + +func (m *MsgSubmitTopLevelDomainProposal) Reset() { *m = MsgSubmitTopLevelDomainProposal{} } +func (m *MsgSubmitTopLevelDomainProposal) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitTopLevelDomainProposal) ProtoMessage() {} +func (*MsgSubmitTopLevelDomainProposal) Descriptor() ([]byte, []int) { + return fileDescriptor_7a4e7619dfc6612f, []int{16} +} +func (m *MsgSubmitTopLevelDomainProposal) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitTopLevelDomainProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitTopLevelDomainProposal.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 *MsgSubmitTopLevelDomainProposal) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitTopLevelDomainProposal.Merge(m, src) +} +func (m *MsgSubmitTopLevelDomainProposal) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitTopLevelDomainProposal) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitTopLevelDomainProposal.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitTopLevelDomainProposal proto.InternalMessageInfo + +func (m *MsgSubmitTopLevelDomainProposal) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgSubmitTopLevelDomainProposal) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *MsgSubmitTopLevelDomainProposal) GetRegistrationPeriodInYear() uint64 { + if m != nil { + return m.RegistrationPeriodInYear + } + return 0 +} + +type MsgSubmitTopLevelDomainProposalResponse struct { + TopLevelDomain *TopLevelDomain `protobuf:"bytes,1,opt,name=topLevelDomain,proto3" json:"topLevelDomain,omitempty"` + Fee *TopLevelDomainFee `protobuf:"bytes,2,opt,name=fee,proto3" json:"fee,omitempty"` +} + +func (m *MsgSubmitTopLevelDomainProposalResponse) Reset() { + *m = MsgSubmitTopLevelDomainProposalResponse{} +} +func (m *MsgSubmitTopLevelDomainProposalResponse) String() string { return proto.CompactTextString(m) } +func (*MsgSubmitTopLevelDomainProposalResponse) ProtoMessage() {} +func (*MsgSubmitTopLevelDomainProposalResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7a4e7619dfc6612f, []int{17} +} +func (m *MsgSubmitTopLevelDomainProposalResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgSubmitTopLevelDomainProposalResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgSubmitTopLevelDomainProposalResponse.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 *MsgSubmitTopLevelDomainProposalResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgSubmitTopLevelDomainProposalResponse.Merge(m, src) +} +func (m *MsgSubmitTopLevelDomainProposalResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgSubmitTopLevelDomainProposalResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgSubmitTopLevelDomainProposalResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgSubmitTopLevelDomainProposalResponse proto.InternalMessageInfo + +func (m *MsgSubmitTopLevelDomainProposalResponse) GetTopLevelDomain() *TopLevelDomain { + if m != nil { + return m.TopLevelDomain + } + return nil +} + +func (m *MsgSubmitTopLevelDomainProposalResponse) GetFee() *TopLevelDomainFee { + if m != nil { + return m.Fee + } + return nil +} + func init() { proto.RegisterType((*MsgUpdateWalletRecord)(nil), "mycel.registry.MsgUpdateWalletRecord") proto.RegisterType((*MsgUpdateWalletRecordResponse)(nil), "mycel.registry.MsgUpdateWalletRecordResponse") @@ -915,63 +1029,68 @@ func init() { proto.RegisterType((*MsgUpdateTextRecordResponse)(nil), "mycel.registry.MsgUpdateTextRecordResponse") proto.RegisterType((*MsgUpdateTopLevelDomainRegistrationPolicy)(nil), "mycel.registry.MsgUpdateTopLevelDomainRegistrationPolicy") proto.RegisterType((*MsgUpdateTopLevelDomainRegistrationPolicyResponse)(nil), "mycel.registry.MsgUpdateTopLevelDomainRegistrationPolicyResponse") + proto.RegisterType((*MsgSubmitTopLevelDomainProposal)(nil), "mycel.registry.MsgSubmitTopLevelDomainProposal") + proto.RegisterType((*MsgSubmitTopLevelDomainProposalResponse)(nil), "mycel.registry.MsgSubmitTopLevelDomainProposalResponse") } func init() { proto.RegisterFile("mycel/registry/tx.proto", fileDescriptor_7a4e7619dfc6612f) } var fileDescriptor_7a4e7619dfc6612f = []byte{ - // 804 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4f, 0x4f, 0xd4, 0x40, - 0x14, 0xdf, 0x71, 0xf9, 0x13, 0x1f, 0x11, 0x48, 0xe5, 0x4f, 0xa9, 0x50, 0xa0, 0x02, 0x01, 0x74, - 0x5b, 0x77, 0xc1, 0x83, 0x26, 0x1e, 0x44, 0x20, 0x6a, 0xdc, 0xc4, 0x54, 0x0c, 0xd1, 0x0b, 0xe9, - 0xb6, 0xcf, 0x52, 0xd9, 0xed, 0x34, 0x6d, 0x59, 0x76, 0x4f, 0x1e, 0x8c, 0x07, 0xe3, 0xc5, 0x93, - 0x07, 0x3d, 0xc8, 0xc9, 0x83, 0xf1, 0x83, 0x70, 0xe4, 0xe8, 0x49, 0x0d, 0x7c, 0x05, 0x3f, 0x80, - 0xd9, 0x76, 0xb7, 0xec, 0x9f, 0x76, 0xb7, 0x4b, 0x38, 0x78, 0xea, 0xcc, 0xbc, 0xdf, 0x7b, 0xf3, - 0x7b, 0x9d, 0x37, 0xbf, 0x37, 0x30, 0x5e, 0x28, 0xab, 0x98, 0x97, 0x6c, 0xd4, 0x0d, 0xc7, 0xb5, - 0xcb, 0x92, 0x5b, 0x12, 0x2d, 0x9b, 0xba, 0x94, 0x19, 0xf4, 0x0c, 0x62, 0xcd, 0xc0, 0xf1, 0x2a, - 0x75, 0x0a, 0xd4, 0x91, 0x72, 0x8a, 0x83, 0x52, 0x31, 0x9d, 0x43, 0x57, 0x49, 0x4b, 0x2a, 0x35, - 0x4c, 0x1f, 0xcf, 0x8d, 0xe8, 0x54, 0xa7, 0xde, 0x50, 0xaa, 0x8c, 0xaa, 0xab, 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 0xcb, 0x2d, 0x20, 0xa7, 0xc1, 0x70, 0x8b, 0x92, 0x5c, 0x8f, 0x2c, 0xa8, 0x33, 0x10, 0x77, - 0x23, 0x06, 0x28, 0xd8, 0xe5, 0x1b, 0x81, 0x85, 0x98, 0x5a, 0x70, 0x27, 0x3a, 0x6e, 0x07, 0x57, - 0xee, 0xfe, 0xb9, 0x5d, 0x6b, 0x44, 0xd7, 0x1e, 0x1e, 0x9d, 0xf0, 0xe4, 0xf8, 0x84, 0x27, 0x7f, - 0x4e, 0x78, 0xf2, 0xf1, 0x94, 0x4f, 0x1c, 0x9f, 0xf2, 0x89, 0x9f, 0xa7, 0x7c, 0xe2, 0xa5, 0x58, - 0xd7, 0xee, 0xbc, 0x6d, 0x52, 0xfe, 0x63, 0xd9, 0x9f, 0x48, 0xa5, 0xba, 0xe7, 0x74, 0xa5, 0xf5, - 0xe5, 0xfa, 0xbc, 0x47, 0xf4, 0xca, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x48, 0xd9, 0xd6, 0x2e, - 0xcc, 0x0b, 0x00, 0x00, + // 854 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x57, 0xcf, 0x4f, 0xf4, 0x44, + 0x18, 0xde, 0x71, 0xf9, 0xbe, 0x4f, 0x5f, 0x22, 0x90, 0xca, 0x8f, 0x52, 0xa1, 0x0b, 0x15, 0x10, + 0xd0, 0x6d, 0xdd, 0x05, 0x63, 0x34, 0xf1, 0x20, 0x02, 0x51, 0xe3, 0x26, 0xa4, 0x60, 0x88, 0x5e, + 0x48, 0xb7, 0x1d, 0x4b, 0xa5, 0xdb, 0x69, 0x3a, 0xb3, 0xcb, 0xee, 0xc9, 0x83, 0x31, 0xd1, 0x70, + 0xf1, 0xe4, 0x41, 0x0f, 0x72, 0xe2, 0x60, 0xfc, 0x43, 0x38, 0x72, 0xf4, 0xa4, 0x06, 0xfe, 0x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7, 0x15, 0x82, 0x37, 0x87, 0xa8, 0x79, 0x12, 0x8b, 0xb3, 0xf8, 0xef, 0xcb, + 0x90, 0x2d, 0x51, 0x5b, 0xf8, 0x06, 0x84, 0x98, 0xff, 0x86, 0xd5, 0x5e, 0x96, 0xd8, 0xd3, 0x5b, + 0xca, 0xa7, 0x82, 0xf1, 0x82, 0x0d, 0x98, 0xec, 0x3d, 0xe0, 0x95, 0x44, 0x06, 0x8e, 0x91, 0x36, + 0x87, 0x63, 0xf8, 0x14, 0xdf, 0xc2, 0x7c, 0xf2, 0x61, 0xfc, 0x76, 0x0c, 0x51, 0x22, 0x5a, 0xda, + 0x1e, 0x05, 0xcd, 0x05, 0xd4, 0x60, 0x36, 0xe1, 0x08, 0xdd, 0x18, 0xc0, 0xd7, 0x0d, 0x95, 0x0a, + 0xa9, 0xa1, 0x7c, 0xde, 0x06, 0xcc, 0x25, 0x1d, 0x48, 0x71, 0xef, 0x2f, 0x01, 0x2b, 0x15, 0xd3, + 0x63, 0xf9, 0xd4, 0xbf, 0x20, 0x50, 0x52, 0x9c, 0x10, 0xef, 0xc6, 0x50, 0x0f, 0x4f, 0x93, 0x3e, + 0x7c, 0x50, 0x1a, 0x17, 0x67, 0xc1, 0x54, 0x9f, 0x01, 0xbf, 0x91, 0xb8, 0xa0, 0xee, 0x41, 0xd2, + 0x5b, 0x29, 0x40, 0x7c, 0x96, 0x2b, 0x04, 0x6b, 0x29, 0x2d, 0xf4, 0xfd, 0x64, 0xde, 0x21, 0xa9, + 0xd2, 0x47, 0x0f, 0x4e, 0xe5, 0x42, 0x7f, 0x40, 0xb0, 0x30, 0xd0, 0x2a, 0xb5, 0x98, 0x39, 0x06, + 0x25, 0x48, 0xef, 0x8d, 0x98, 0xd0, 0x96, 0xb2, 0xf3, 0xc9, 0xf5, 0xad, 0x8c, 0x6e, 0x6e, 0x65, + 0xf4, 0xcf, 0xad, 0x8c, 0x7e, 0xba, 0x93, 0x33, 0x37, 0x77, 0x72, 0xe6, 0xcf, 0x3b, 0x39, 0xf3, + 0x95, 0xda, 0xf1, 0xc3, 0x12, 0x92, 0xe7, 0xa3, 0xeb, 0x4e, 0xd4, 0xd1, 0xea, 0x1d, 0x17, 0xa2, + 0xe6, 0xcf, 0x4b, 0xf9, 0x79, 0x78, 0x0d, 0xda, 0xfa, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x39, 0x30, + 0xdf, 0xf5, 0x8e, 0x0d, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -994,6 +1113,7 @@ type MsgClient interface { ExtendTopLevelDomainExpirationDate(ctx context.Context, in *MsgExtendTopLevelDomainExpirationDate, opts ...grpc.CallOption) (*MsgExtendTopLevelDomainExpirationDateResponse, error) UpdateTextRecord(ctx context.Context, in *MsgUpdateTextRecord, opts ...grpc.CallOption) (*MsgUpdateTextRecordResponse, error) UpdateTopLevelDomainRegistrationPolicy(ctx context.Context, in *MsgUpdateTopLevelDomainRegistrationPolicy, opts ...grpc.CallOption) (*MsgUpdateTopLevelDomainRegistrationPolicyResponse, error) + SubmitTopLevelDomainProposal(ctx context.Context, in *MsgSubmitTopLevelDomainProposal, opts ...grpc.CallOption) (*MsgSubmitTopLevelDomainProposalResponse, error) } type msgClient struct { @@ -1076,6 +1196,15 @@ func (c *msgClient) UpdateTopLevelDomainRegistrationPolicy(ctx context.Context, return out, nil } +func (c *msgClient) SubmitTopLevelDomainProposal(ctx context.Context, in *MsgSubmitTopLevelDomainProposal, opts ...grpc.CallOption) (*MsgSubmitTopLevelDomainProposalResponse, error) { + out := new(MsgSubmitTopLevelDomainProposalResponse) + err := c.cc.Invoke(ctx, "/mycel.registry.Msg/SubmitTopLevelDomainProposal", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { UpdateWalletRecord(context.Context, *MsgUpdateWalletRecord) (*MsgUpdateWalletRecordResponse, error) @@ -1086,6 +1215,7 @@ type MsgServer interface { ExtendTopLevelDomainExpirationDate(context.Context, *MsgExtendTopLevelDomainExpirationDate) (*MsgExtendTopLevelDomainExpirationDateResponse, error) UpdateTextRecord(context.Context, *MsgUpdateTextRecord) (*MsgUpdateTextRecordResponse, error) UpdateTopLevelDomainRegistrationPolicy(context.Context, *MsgUpdateTopLevelDomainRegistrationPolicy) (*MsgUpdateTopLevelDomainRegistrationPolicyResponse, error) + SubmitTopLevelDomainProposal(context.Context, *MsgSubmitTopLevelDomainProposal) (*MsgSubmitTopLevelDomainProposalResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -1116,6 +1246,9 @@ func (*UnimplementedMsgServer) UpdateTextRecord(ctx context.Context, req *MsgUpd func (*UnimplementedMsgServer) UpdateTopLevelDomainRegistrationPolicy(ctx context.Context, req *MsgUpdateTopLevelDomainRegistrationPolicy) (*MsgUpdateTopLevelDomainRegistrationPolicyResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateTopLevelDomainRegistrationPolicy not implemented") } +func (*UnimplementedMsgServer) SubmitTopLevelDomainProposal(ctx context.Context, req *MsgSubmitTopLevelDomainProposal) (*MsgSubmitTopLevelDomainProposalResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method SubmitTopLevelDomainProposal not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -1265,6 +1398,24 @@ func _Msg_UpdateTopLevelDomainRegistrationPolicy_Handler(srv interface{}, ctx co return interceptor(ctx, in, info, handler) } +func _Msg_SubmitTopLevelDomainProposal_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgSubmitTopLevelDomainProposal) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).SubmitTopLevelDomainProposal(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/mycel.registry.Msg/SubmitTopLevelDomainProposal", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).SubmitTopLevelDomainProposal(ctx, req.(*MsgSubmitTopLevelDomainProposal)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "mycel.registry.Msg", HandlerType: (*MsgServer)(nil), @@ -1301,6 +1452,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateTopLevelDomainRegistrationPolicy", Handler: _Msg_UpdateTopLevelDomainRegistrationPolicy_Handler, }, + { + MethodName: "SubmitTopLevelDomainProposal", + Handler: _Msg_SubmitTopLevelDomainProposal_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "mycel/registry/tx.proto", @@ -1940,6 +2095,95 @@ func (m *MsgUpdateTopLevelDomainRegistrationPolicyResponse) MarshalToSizedBuffer return len(dAtA) - i, nil } +func (m *MsgSubmitTopLevelDomainProposal) 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 *MsgSubmitTopLevelDomainProposal) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitTopLevelDomainProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.RegistrationPeriodInYear != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.RegistrationPeriodInYear)) + i-- + dAtA[i] = 0x18 + } + if len(m.Name) > 0 { + i -= len(m.Name) + copy(dAtA[i:], m.Name) + i = encodeVarintTx(dAtA, i, uint64(len(m.Name))) + i-- + dAtA[i] = 0x12 + } + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgSubmitTopLevelDomainProposalResponse) 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 *MsgSubmitTopLevelDomainProposalResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgSubmitTopLevelDomainProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Fee != nil { + { + size, err := m.Fee.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if m.TopLevelDomain != nil { + { + size, err := m.TopLevelDomain.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 encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -2234,6 +2478,43 @@ func (m *MsgUpdateTopLevelDomainRegistrationPolicyResponse) Size() (n int) { return n } +func (m *MsgSubmitTopLevelDomainProposal) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Name) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.RegistrationPeriodInYear != 0 { + n += 1 + sovTx(uint64(m.RegistrationPeriodInYear)) + } + return n +} + +func (m *MsgSubmitTopLevelDomainProposalResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.TopLevelDomain != nil { + l = m.TopLevelDomain.Size() + n += 1 + l + sovTx(uint64(l)) + } + if m.Fee != nil { + l = m.Fee.Size() + n += 1 + l + sovTx(uint64(l)) + } + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -4139,6 +4420,261 @@ func (m *MsgUpdateTopLevelDomainRegistrationPolicyResponse) Unmarshal(dAtA []byt } return nil } +func (m *MsgSubmitTopLevelDomainProposal) 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: MsgSubmitTopLevelDomainProposal: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitTopLevelDomainProposal: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", 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.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", 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.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field RegistrationPeriodInYear", wireType) + } + m.RegistrationPeriodInYear = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.RegistrationPeriodInYear |= 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 *MsgSubmitTopLevelDomainProposalResponse) 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: MsgSubmitTopLevelDomainProposalResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgSubmitTopLevelDomainProposalResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field TopLevelDomain", 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 + } + if m.TopLevelDomain == nil { + m.TopLevelDomain = &TopLevelDomain{} + } + if err := m.TopLevelDomain.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Fee", 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 + } + if m.Fee == nil { + m.Fee = &TopLevelDomainFee{} + } + if err := m.Fee.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 skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0