diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 1bd2c66..df12493 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -77242,6 +77242,8 @@ definitions: type: string planetmintgo.machine.MsgAttestMachineResponse: type: object + planetmintgo.machine.MsgMintProductionResponse: + type: object planetmintgo.machine.MsgNotarizeLiquidAssetResponse: type: object planetmintgo.machine.MsgRegisterTrustAnchorResponse: diff --git a/proto/planetmintgo/machine/tx.proto b/proto/planetmintgo/machine/tx.proto index 722ad06..71b2905 100644 --- a/proto/planetmintgo/machine/tx.proto +++ b/proto/planetmintgo/machine/tx.proto @@ -10,6 +10,7 @@ import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; import "cosmos/msg/v1/msg.proto"; +import "cosmos/base/v1beta1/coin.proto"; option go_package = "github.com/planetmint/planetmint-go/x/machine/types"; @@ -19,6 +20,7 @@ service Msg { rpc RegisterTrustAnchor (MsgRegisterTrustAnchor) returns (MsgRegisterTrustAnchorResponse); rpc NotarizeLiquidAsset (MsgNotarizeLiquidAsset) returns (MsgNotarizeLiquidAssetResponse); rpc UpdateParams (MsgUpdateParams ) returns (MsgUpdateParamsResponse ); + rpc MintProduction (MsgMintProduction ) returns (MsgMintProductionResponse ); } message MsgAttestMachine { string creator = 1; @@ -55,3 +57,10 @@ message MsgUpdateParams { message MsgUpdateParamsResponse {} +message MsgMintProduction { + string creator = 1; + repeated cosmos.base.v1beta1.Coin production = 2 [(gogoproto.nullable) = false]; +} + +message MsgMintProductionResponse {} + diff --git a/x/machine/client/cli/tx.go b/x/machine/client/cli/tx.go index 7984c91..5627274 100644 --- a/x/machine/client/cli/tx.go +++ b/x/machine/client/cli/tx.go @@ -28,6 +28,7 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand(CmdRegisterTrustAnchor()) cmd.AddCommand(CmdNotarizeLiquidAsset()) cmd.AddCommand(CmdUpdateParams()) + cmd.AddCommand(CmdMintProduction()) // this line is used by starport scaffolding # 1 return cmd diff --git a/x/machine/client/cli/tx_mint_production.go b/x/machine/client/cli/tx_mint_production.go new file mode 100644 index 0000000..b6168fb --- /dev/null +++ b/x/machine/client/cli/tx_mint_production.go @@ -0,0 +1,46 @@ +package cli + +import ( + "strconv" + + "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/planetmint/planetmint-go/x/machine/types" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +func CmdMintProduction() *cobra.Command { + cmd := &cobra.Command{ + Use: "mint-production [production]", + Short: "Broadcast message mint-production", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + argProduction, err := sdk.ParseCoinsNormalized(args[0]) + if err != nil { + return err + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgMintProduction( + clientCtx.GetFromAddress().String(), + argProduction, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/machine/keeper/msg_server_mint_production.go b/x/machine/keeper/msg_server_mint_production.go new file mode 100644 index 0000000..68bddc1 --- /dev/null +++ b/x/machine/keeper/msg_server_mint_production.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/planetmint/planetmint-go/x/machine/types" +) + +func (k msgServer) MintProduction(goCtx context.Context, msg *types.MsgMintProduction) (*types.MsgMintProductionResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // TODO: Handling the message + _ = ctx + + return &types.MsgMintProductionResponse{}, nil +} diff --git a/x/machine/module_simulation.go b/x/machine/module_simulation.go index 64e5d24..7fe6270 100644 --- a/x/machine/module_simulation.go +++ b/x/machine/module_simulation.go @@ -39,6 +39,10 @@ const ( // TODO: Determine the simulation weight value defaultWeightMsgUpdateParams int = 100 + opWeightMsgMintProduction = "op_weight_msg_mint_production" + // TODO: Determine the simulation weight value + defaultWeightMsgMintProduction int = 100 + // this line is used by starport scaffolding # simapp/module/const ) @@ -113,6 +117,17 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp machinesimulation.SimulateMsgUpdateParams(am.accountKeeper, am.bankKeeper, am.keeper), )) + var weightMsgMintProduction int + simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgMintProduction, &weightMsgMintProduction, nil, + func(_ *rand.Rand) { + weightMsgMintProduction = defaultWeightMsgMintProduction + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgMintProduction, + machinesimulation.SimulateMsgMintProduction(am.accountKeeper, am.bankKeeper, am.keeper), + )) + // this line is used by starport scaffolding # simapp/module/operation return operations @@ -153,6 +168,14 @@ func (am AppModule) ProposalMsgs(_ module.SimulationState) []simtypes.WeightedPr return nil }, ), + simulation.NewWeightedProposalMsg( + opWeightMsgMintProduction, + defaultWeightMsgMintProduction, + func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg { + machinesimulation.SimulateMsgMintProduction(am.accountKeeper, am.bankKeeper, am.keeper) + return nil + }, + ), // this line is used by starport scaffolding # simapp/module/OpMsg } } diff --git a/x/machine/simulation/mint_production.go b/x/machine/simulation/mint_production.go new file mode 100644 index 0000000..c03f8ea --- /dev/null +++ b/x/machine/simulation/mint_production.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/planetmint/planetmint-go/x/machine/keeper" + "github.com/planetmint/planetmint-go/x/machine/types" +) + +func SimulateMsgMintProduction( + 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.MsgMintProduction{ + Creator: simAccount.Address.String(), + } + + // TODO: Handling the MintProduction simulation + + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "MintProduction simulation not implemented"), nil, nil + } +} diff --git a/x/machine/types/codec.go b/x/machine/types/codec.go index e93dc93..3bfb99d 100644 --- a/x/machine/types/codec.go +++ b/x/machine/types/codec.go @@ -12,6 +12,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgRegisterTrustAnchor{}, "machine/RegisterTrustAnchor", nil) cdc.RegisterConcrete(&MsgNotarizeLiquidAsset{}, "machine/NotarizeLiquidAsset", nil) cdc.RegisterConcrete(&MsgUpdateParams{}, "machine/UpdateParams", nil) + cdc.RegisterConcrete(&MsgMintProduction{}, "machine/MintProduction", nil) // this line is used by starport scaffolding # 2 } @@ -28,6 +29,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgUpdateParams{}, ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgMintProduction{}, + ) // this line is used by starport scaffolding # 3 msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/machine/types/message_mint_production.go b/x/machine/types/message_mint_production.go new file mode 100644 index 0000000..24b399b --- /dev/null +++ b/x/machine/types/message_mint_production.go @@ -0,0 +1,46 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const TypeMsgMintProduction = "mint_production" + +var _ sdk.Msg = &MsgMintProduction{} + +func NewMsgMintProduction(creator string, production sdk.Coins) *MsgMintProduction { + return &MsgMintProduction{ + Creator: creator, + Production: production, + } +} + +func (msg *MsgMintProduction) Route() string { + return RouterKey +} + +func (msg *MsgMintProduction) Type() string { + return TypeMsgMintProduction +} + +func (msg *MsgMintProduction) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgMintProduction) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgMintProduction) 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/machine/types/message_mint_production_test.go b/x/machine/types/message_mint_production_test.go new file mode 100644 index 0000000..2cff560 --- /dev/null +++ b/x/machine/types/message_mint_production_test.go @@ -0,0 +1,40 @@ +package types + +import ( + "testing" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/planetmint/planetmint-go/testutil/sample" + "github.com/stretchr/testify/require" +) + +func TestMsgMintProduction_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgMintProduction + err error + }{ + { + name: "invalid address", + msg: MsgMintProduction{ + Creator: "invalid_address", + }, + err: sdkerrors.ErrInvalidAddress, + }, { + name: "valid address", + msg: MsgMintProduction{ + 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/machine/types/tx.pb.go b/x/machine/types/tx.pb.go index d3b77f6..51e7c44 100644 --- a/x/machine/types/tx.pb.go +++ b/x/machine/types/tx.pb.go @@ -7,6 +7,7 @@ import ( context "context" fmt "fmt" _ "github.com/cosmos/cosmos-proto" + types "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" @@ -385,6 +386,94 @@ func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo +type MsgMintProduction struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Production []types.Coin `protobuf:"bytes,2,rep,name=production,proto3" json:"production"` +} + +func (m *MsgMintProduction) Reset() { *m = MsgMintProduction{} } +func (m *MsgMintProduction) String() string { return proto.CompactTextString(m) } +func (*MsgMintProduction) ProtoMessage() {} +func (*MsgMintProduction) Descriptor() ([]byte, []int) { + return fileDescriptor_85ac37e5c8e5251d, []int{8} +} +func (m *MsgMintProduction) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMintProduction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMintProduction.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 *MsgMintProduction) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMintProduction.Merge(m, src) +} +func (m *MsgMintProduction) XXX_Size() int { + return m.Size() +} +func (m *MsgMintProduction) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMintProduction.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMintProduction proto.InternalMessageInfo + +func (m *MsgMintProduction) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgMintProduction) GetProduction() []types.Coin { + if m != nil { + return m.Production + } + return nil +} + +type MsgMintProductionResponse struct { +} + +func (m *MsgMintProductionResponse) Reset() { *m = MsgMintProductionResponse{} } +func (m *MsgMintProductionResponse) String() string { return proto.CompactTextString(m) } +func (*MsgMintProductionResponse) ProtoMessage() {} +func (*MsgMintProductionResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_85ac37e5c8e5251d, []int{9} +} +func (m *MsgMintProductionResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgMintProductionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgMintProductionResponse.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 *MsgMintProductionResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgMintProductionResponse.Merge(m, src) +} +func (m *MsgMintProductionResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgMintProductionResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgMintProductionResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgMintProductionResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgAttestMachine)(nil), "planetmintgo.machine.MsgAttestMachine") proto.RegisterType((*MsgAttestMachineResponse)(nil), "planetmintgo.machine.MsgAttestMachineResponse") @@ -394,47 +483,55 @@ func init() { proto.RegisterType((*MsgNotarizeLiquidAssetResponse)(nil), "planetmintgo.machine.MsgNotarizeLiquidAssetResponse") proto.RegisterType((*MsgUpdateParams)(nil), "planetmintgo.machine.MsgUpdateParams") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "planetmintgo.machine.MsgUpdateParamsResponse") + proto.RegisterType((*MsgMintProduction)(nil), "planetmintgo.machine.MsgMintProduction") + proto.RegisterType((*MsgMintProductionResponse)(nil), "planetmintgo.machine.MsgMintProductionResponse") } func init() { proto.RegisterFile("planetmintgo/machine/tx.proto", fileDescriptor_85ac37e5c8e5251d) } var fileDescriptor_85ac37e5c8e5251d = []byte{ - // 553 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x4f, 0x6f, 0xd3, 0x30, - 0x18, 0xc6, 0x1b, 0x26, 0x6d, 0xaa, 0x37, 0xfe, 0x85, 0x8a, 0x65, 0x11, 0x0b, 0x5d, 0x24, 0x60, - 0x9a, 0x68, 0x22, 0x36, 0x04, 0x12, 0x17, 0xd4, 0x22, 0x6e, 0x04, 0xa1, 0x00, 0x17, 0x2e, 0x95, - 0x97, 0x58, 0xae, 0xa5, 0x25, 0x0e, 0xb6, 0x0b, 0x2b, 0x47, 0x3e, 0x01, 0x67, 0x3e, 0x01, 0xc7, - 0x1d, 0xf8, 0x10, 0x13, 0xa7, 0x89, 0x13, 0x27, 0x84, 0xda, 0xc3, 0xbe, 0x06, 0x6a, 0xec, 0x2c, - 0x69, 0xe5, 0x46, 0xdd, 0x25, 0xb1, 0xf3, 0x3e, 0xef, 0xfb, 0xfc, 0xe4, 0x3c, 0x32, 0xd8, 0xce, - 0x8e, 0x60, 0x8a, 0x44, 0x42, 0x52, 0x81, 0xa9, 0x9f, 0xc0, 0x68, 0x40, 0x52, 0xe4, 0x8b, 0x63, - 0x2f, 0x63, 0x54, 0x50, 0xb3, 0x55, 0x2d, 0x7b, 0xaa, 0x6c, 0xbb, 0xda, 0x26, 0xf5, 0x96, 0x9d, - 0xf6, 0x03, 0xfd, 0x60, 0x36, 0xe4, 0xa2, 0x0f, 0xd3, 0x68, 0x40, 0x59, 0xad, 0xf0, 0x88, 0x7c, - 0x1c, 0x92, 0xb8, 0x0f, 0x39, 0x47, 0x42, 0x09, 0x77, 0xb4, 0xc2, 0x0c, 0x32, 0x98, 0x70, 0x25, - 0xb9, 0x09, 0x13, 0x92, 0x52, 0x3f, 0x7f, 0xaa, 0x4f, 0x2d, 0x4c, 0x31, 0xcd, 0x97, 0xfe, 0x74, - 0xa5, 0xbe, 0x6e, 0x45, 0x94, 0x27, 0x94, 0xf7, 0x65, 0x41, 0x6e, 0x54, 0x69, 0x53, 0xee, 0xfc, - 0x84, 0x63, 0xff, 0xd3, 0xa3, 0xe9, 0x4b, 0x16, 0x5c, 0x04, 0x6e, 0x04, 0x1c, 0x77, 0x85, 0x40, - 0x5c, 0x04, 0xd2, 0xdd, 0xb4, 0xc0, 0x5a, 0xc4, 0x10, 0x14, 0x94, 0x59, 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0x9e, 0x11, 0xaa, 0xb6, 0x67, 0xd7, 0xbe, 0x9e, 0x9f, 0xec, 0x95, 0x03, 0xdd, 0x2d, 0xb0, - 0x39, 0xc7, 0x56, 0x70, 0xef, 0xff, 0x5a, 0x01, 0x2b, 0x01, 0xc7, 0x26, 0x06, 0x57, 0x67, 0x73, - 0x77, 0x7f, 0x41, 0x98, 0xe6, 0x82, 0x63, 0x7b, 0xcb, 0xe9, 0x0a, 0x43, 0x73, 0x04, 0x6e, 0xe9, - 0xd2, 0xf5, 0x70, 0xe1, 0x18, 0x8d, 0xda, 0x7e, 0x7c, 0x19, 0x75, 0xd5, 0x5a, 0x97, 0x9e, 0xc5, - 0xd6, 0x1a, 0x75, 0x8d, 0x75, 0x4d, 0x3c, 0xcc, 0x18, 0x6c, 0xcc, 0x44, 0xe3, 0xde, 0xc2, 0x29, - 0x55, 0x99, 0xdd, 0x59, 0x4a, 0x56, 0xb8, 0xf4, 0x82, 0xd3, 0xb1, 0x63, 0x9c, 0x8d, 0x1d, 0xe3, - 0xdf, 0xd8, 0x31, 0xbe, 0x4d, 0x9c, 0xc6, 0xd9, 0xc4, 0x69, 0xfc, 0x99, 0x38, 0x8d, 0x0f, 0x07, - 0x98, 0x88, 0xc1, 0xf0, 0xd0, 0x8b, 0x68, 0xe2, 0x97, 0x23, 0x2b, 0xcb, 0x0e, 0xa6, 0xfe, 0x71, - 0x79, 0x89, 0x8e, 0x32, 0xc4, 0x0f, 0x57, 0xf3, 0x5b, 0xe9, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x27, 0x5b, 0xe7, 0x57, 0xc2, 0x05, 0x00, 0x00, + // 643 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0x41, 0x4f, 0xd4, 0x4e, + 0x1c, 0xdd, 0x02, 0x81, 0x30, 0xf0, 0xe7, 0x2f, 0x95, 0x48, 0xb7, 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x92, 0x70, 0xc7, 0x8f, 0x18, 0xa1, 0x45, 0xdd, 0x45, 0xe0, 0x56, 0x20, 0x70, 0x53, + 0x4a, 0x24, 0x64, 0x50, 0xb8, 0x33, 0x2d, 0x30, 0x17, 0x71, 0x04, 0x25, 0xe3, 0x96, 0xd1, 0x30, + 0x36, 0xe7, 0xc3, 0xfe, 0xd6, 0x7c, 0x0a, 0xe6, 0xd4, 0x11, 0xac, 0xa9, 0x86, 0xb1, 0xb9, 0xb0, + 0xbb, 0xe6, 0xe9, 0x66, 0xed, 0x29, 0xa6, 0xb0, 0x8f, 0x76, 0x6d, 0x60, 0x8d, 0xcb, 0x84, 0x48, + 0xa4, 0x8c, 0x0a, 0xe4, 0x7e, 0x00, 0x77, 0x02, 0x81, 0x43, 0x84, 0x89, 0x90, 0x88, 0xbf, 0xce, + 0x86, 0xdd, 0xcc, 0x67, 0x5d, 0x61, 0xe4, 0x00, 0x2c, 0xc8, 0x21, 0x50, 0x99, 0x59, 0xd7, 0x9b, + 0x29, 0x31, 0x86, 0xe5, 0x2e, 0xb7, 0x01, 0x1c, 0xbd, 0xf0, 0xc0, 0x5a, 0x2f, 0xb7, 0xf6, 0x92, + 0x49, 0xc8, 0xc9, 0x47, 0xf4, 0x22, 0xbf, 0xde, 0x66, 0x76, 0xbb, 0x15, 0xd6, 0x9e, 0x83, 0x45, + 0x5a, 0x34, 0x40, 0x49, 0x18, 0xad, 0xf6, 0x56, 0xa2, 0x0c, 0x47, 0xda, 0x94, 0x39, 0x8d, 0xf4, + 0xc0, 0xdc, 0x17, 0x03, 0xfc, 0x1f, 0x08, 0xfc, 0x26, 0x8d, 0xa1, 0x44, 0x87, 0x79, 0xa2, 0xcc, + 0x27, 0x60, 0x1e, 0x76, 0x65, 0x87, 0x71, 0x22, 0x7b, 0x85, 0xb1, 0x96, 0xf5, 0xe3, 0xdb, 0xf6, + 0x8a, 0x0a, 0x4b, 0x33, 0x8e, 0x39, 0x12, 0xe2, 0x95, 0xe4, 0x84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 0x15, 0x9c, 0x5f, 0x3a, 0xc6, 0xc5, 0xa5, 0x63, 0xfc, 0xbe, 0x74, 0x8c, 0xcf, 0x57, 0x4e, + 0xed, 0xe2, 0xca, 0xa9, 0xfd, 0xbc, 0x72, 0x6a, 0x6f, 0xf7, 0x30, 0x91, 0x9d, 0x6e, 0xdb, 0x8b, + 0x58, 0xe2, 0x0f, 0x49, 0x4b, 0xcb, 0x6d, 0xcc, 0xfc, 0xd3, 0xe1, 0xbf, 0x4b, 0x2f, 0x45, 0xa2, + 0x3d, 0x9b, 0xff, 0x1c, 0xef, 0xfd, 0x09, 0x00, 0x00, 0xff, 0xff, 0xef, 0x5b, 0x89, 0x1b, 0xdb, + 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -453,6 +550,7 @@ type MsgClient interface { RegisterTrustAnchor(ctx context.Context, in *MsgRegisterTrustAnchor, opts ...grpc.CallOption) (*MsgRegisterTrustAnchorResponse, error) NotarizeLiquidAsset(ctx context.Context, in *MsgNotarizeLiquidAsset, opts ...grpc.CallOption) (*MsgNotarizeLiquidAssetResponse, error) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) + MintProduction(ctx context.Context, in *MsgMintProduction, opts ...grpc.CallOption) (*MsgMintProductionResponse, error) } type msgClient struct { @@ -499,12 +597,22 @@ func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts return out, nil } +func (c *msgClient) MintProduction(ctx context.Context, in *MsgMintProduction, opts ...grpc.CallOption) (*MsgMintProductionResponse, error) { + out := new(MsgMintProductionResponse) + err := c.cc.Invoke(ctx, "/planetmintgo.machine.Msg/MintProduction", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { AttestMachine(context.Context, *MsgAttestMachine) (*MsgAttestMachineResponse, error) RegisterTrustAnchor(context.Context, *MsgRegisterTrustAnchor) (*MsgRegisterTrustAnchorResponse, error) NotarizeLiquidAsset(context.Context, *MsgNotarizeLiquidAsset) (*MsgNotarizeLiquidAssetResponse, error) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) + MintProduction(context.Context, *MsgMintProduction) (*MsgMintProductionResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -523,6 +631,9 @@ func (*UnimplementedMsgServer) NotarizeLiquidAsset(ctx context.Context, req *Msg func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } +func (*UnimplementedMsgServer) MintProduction(ctx context.Context, req *MsgMintProduction) (*MsgMintProductionResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method MintProduction not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -600,6 +711,24 @@ func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(in return interceptor(ctx, in, info, handler) } +func _Msg_MintProduction_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgMintProduction) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).MintProduction(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/planetmintgo.machine.Msg/MintProduction", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).MintProduction(ctx, req.(*MsgMintProduction)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "planetmintgo.machine.Msg", HandlerType: (*MsgServer)(nil), @@ -620,6 +749,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdateParams", Handler: _Msg_UpdateParams_Handler, }, + { + MethodName: "MintProduction", + Handler: _Msg_MintProduction_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "planetmintgo/machine/tx.proto", @@ -883,6 +1016,73 @@ func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *MsgMintProduction) 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 *MsgMintProduction) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMintProduction) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Production) > 0 { + for iNdEx := len(m.Production) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Production[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.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 *MsgMintProductionResponse) 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 *MsgMintProductionResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgMintProductionResponse) 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 @@ -996,6 +1196,34 @@ func (m *MsgUpdateParamsResponse) Size() (n int) { return n } +func (m *MsgMintProduction) 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)) + } + if len(m.Production) > 0 { + for _, e := range m.Production { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgMintProductionResponse) 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 } @@ -1671,6 +1899,172 @@ func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgMintProduction) 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: MsgMintProduction: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMintProduction: 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 Production", 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.Production = append(m.Production, types.Coin{}) + if err := m.Production[len(m.Production)-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 *MsgMintProductionResponse) 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: MsgMintProductionResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgMintProductionResponse: 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