ignite scaffold message mint-production production:coins --module machine

Signed-off-by: Lorenz Herzberger <lorenzherzberger@gmail.com>
This commit is contained in:
Lorenz Herzberger 2024-08-05 15:22:59 +02:00
parent c473ccc252
commit 7b658121ee
No known key found for this signature in database
GPG Key ID: FA5EE906EB55316A
11 changed files with 648 additions and 42 deletions

View File

@ -77242,6 +77242,8 @@ definitions:
type: string type: string
planetmintgo.machine.MsgAttestMachineResponse: planetmintgo.machine.MsgAttestMachineResponse:
type: object type: object
planetmintgo.machine.MsgBurnConsumptionResponse:
type: object
planetmintgo.machine.MsgMintProductionResponse: planetmintgo.machine.MsgMintProductionResponse:
type: object type: object
planetmintgo.machine.MsgNotarizeLiquidAssetResponse: planetmintgo.machine.MsgNotarizeLiquidAssetResponse:

View File

@ -21,6 +21,7 @@ service Msg {
rpc NotarizeLiquidAsset (MsgNotarizeLiquidAsset) returns (MsgNotarizeLiquidAssetResponse); rpc NotarizeLiquidAsset (MsgNotarizeLiquidAsset) returns (MsgNotarizeLiquidAssetResponse);
rpc UpdateParams (MsgUpdateParams ) returns (MsgUpdateParamsResponse ); rpc UpdateParams (MsgUpdateParams ) returns (MsgUpdateParamsResponse );
rpc MintProduction (MsgMintProduction ) returns (MsgMintProductionResponse ); rpc MintProduction (MsgMintProduction ) returns (MsgMintProductionResponse );
rpc BurnConsumption (MsgBurnConsumption ) returns (MsgBurnConsumptionResponse );
} }
message MsgAttestMachine { message MsgAttestMachine {
string creator = 1; string creator = 1;
@ -64,3 +65,10 @@ message MsgMintProduction {
message MsgMintProductionResponse {} message MsgMintProductionResponse {}
message MsgBurnConsumption {
string creator = 1;
repeated cosmos.base.v1beta1.Coin consumption = 2 [(gogoproto.nullable) = false];
}
message MsgBurnConsumptionResponse {}

View File

@ -29,6 +29,7 @@ func GetTxCmd() *cobra.Command {
cmd.AddCommand(CmdNotarizeLiquidAsset()) cmd.AddCommand(CmdNotarizeLiquidAsset())
cmd.AddCommand(CmdUpdateParams()) cmd.AddCommand(CmdUpdateParams())
cmd.AddCommand(CmdMintProduction()) cmd.AddCommand(CmdMintProduction())
cmd.AddCommand(CmdBurnConsumption())
// this line is used by starport scaffolding # 1 // this line is used by starport scaffolding # 1
return cmd return cmd

View File

@ -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 CmdBurnConsumption() *cobra.Command {
cmd := &cobra.Command{
Use: "burn-consumption [consumption]",
Short: "Broadcast message burn-consumption",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) (err error) {
argConsumption, err := sdk.ParseCoinsNormalized(args[0])
if err != nil {
return err
}
clientCtx, err := client.GetClientTxContext(cmd)
if err != nil {
return err
}
msg := types.NewMsgBurnConsumption(
clientCtx.GetFromAddress().String(),
argConsumption,
)
if err := msg.ValidateBasic(); err != nil {
return err
}
return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg)
},
}
flags.AddTxFlagsToCmd(cmd)
return cmd
}

View File

@ -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) BurnConsumption(goCtx context.Context, msg *types.MsgBurnConsumption) (*types.MsgBurnConsumptionResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)
// TODO: Handling the message
_ = ctx
return &types.MsgBurnConsumptionResponse{}, nil
}

View File

@ -43,6 +43,10 @@ const (
// TODO: Determine the simulation weight value // TODO: Determine the simulation weight value
defaultWeightMsgMintProduction int = 100 defaultWeightMsgMintProduction int = 100
opWeightMsgBurnConsumption = "op_weight_msg_burn_consumption"
// TODO: Determine the simulation weight value
defaultWeightMsgBurnConsumption int = 100
// this line is used by starport scaffolding # simapp/module/const // this line is used by starport scaffolding # simapp/module/const
) )
@ -128,6 +132,17 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp
machinesimulation.SimulateMsgMintProduction(am.accountKeeper, am.bankKeeper, am.keeper), machinesimulation.SimulateMsgMintProduction(am.accountKeeper, am.bankKeeper, am.keeper),
)) ))
var weightMsgBurnConsumption int
simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgBurnConsumption, &weightMsgBurnConsumption, nil,
func(_ *rand.Rand) {
weightMsgBurnConsumption = defaultWeightMsgBurnConsumption
},
)
operations = append(operations, simulation.NewWeightedOperation(
weightMsgBurnConsumption,
machinesimulation.SimulateMsgBurnConsumption(am.accountKeeper, am.bankKeeper, am.keeper),
))
// this line is used by starport scaffolding # simapp/module/operation // this line is used by starport scaffolding # simapp/module/operation
return operations return operations
@ -176,6 +191,14 @@ func (am AppModule) ProposalMsgs(_ module.SimulationState) []simtypes.WeightedPr
return nil return nil
}, },
), ),
simulation.NewWeightedProposalMsg(
opWeightMsgBurnConsumption,
defaultWeightMsgBurnConsumption,
func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) sdk.Msg {
machinesimulation.SimulateMsgBurnConsumption(am.accountKeeper, am.bankKeeper, am.keeper)
return nil
},
),
// this line is used by starport scaffolding # simapp/module/OpMsg // this line is used by starport scaffolding # simapp/module/OpMsg
} }
} }

View File

@ -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 SimulateMsgBurnConsumption(
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.MsgBurnConsumption{
Creator: simAccount.Address.String(),
}
// TODO: Handling the BurnConsumption simulation
return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "BurnConsumption simulation not implemented"), nil, nil
}
}

View File

@ -13,6 +13,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(&MsgNotarizeLiquidAsset{}, "machine/NotarizeLiquidAsset", nil) cdc.RegisterConcrete(&MsgNotarizeLiquidAsset{}, "machine/NotarizeLiquidAsset", nil)
cdc.RegisterConcrete(&MsgUpdateParams{}, "machine/UpdateParams", nil) cdc.RegisterConcrete(&MsgUpdateParams{}, "machine/UpdateParams", nil)
cdc.RegisterConcrete(&MsgMintProduction{}, "machine/MintProduction", nil) cdc.RegisterConcrete(&MsgMintProduction{}, "machine/MintProduction", nil)
cdc.RegisterConcrete(&MsgBurnConsumption{}, "machine/BurnConsumption", nil)
// this line is used by starport scaffolding # 2 // this line is used by starport scaffolding # 2
} }
@ -32,6 +33,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
registry.RegisterImplementations((*sdk.Msg)(nil), registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgMintProduction{}, &MsgMintProduction{},
) )
registry.RegisterImplementations((*sdk.Msg)(nil),
&MsgBurnConsumption{},
)
// this line is used by starport scaffolding # 3 // this line is used by starport scaffolding # 3
msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc)

View File

@ -0,0 +1,46 @@
package types
import (
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
const TypeMsgBurnConsumption = "burn_consumption"
var _ sdk.Msg = &MsgBurnConsumption{}
func NewMsgBurnConsumption(creator string, consumption sdk.Coins) *MsgBurnConsumption {
return &MsgBurnConsumption{
Creator: creator,
Consumption: consumption,
}
}
func (msg *MsgBurnConsumption) Route() string {
return RouterKey
}
func (msg *MsgBurnConsumption) Type() string {
return TypeMsgBurnConsumption
}
func (msg *MsgBurnConsumption) GetSigners() []sdk.AccAddress {
creator, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
panic(err)
}
return []sdk.AccAddress{creator}
}
func (msg *MsgBurnConsumption) GetSignBytes() []byte {
bz := ModuleCdc.MustMarshalJSON(msg)
return sdk.MustSortJSON(bz)
}
func (msg *MsgBurnConsumption) ValidateBasic() error {
_, err := sdk.AccAddressFromBech32(msg.Creator)
if err != nil {
return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err)
}
return nil
}

View File

@ -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 TestMsgBurnConsumption_ValidateBasic(t *testing.T) {
tests := []struct {
name string
msg MsgBurnConsumption
err error
}{
{
name: "invalid address",
msg: MsgBurnConsumption{
Creator: "invalid_address",
},
err: sdkerrors.ErrInvalidAddress,
}, {
name: "valid address",
msg: MsgBurnConsumption{
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)
})
}
}

View File

@ -474,6 +474,94 @@ func (m *MsgMintProductionResponse) XXX_DiscardUnknown() {
var xxx_messageInfo_MsgMintProductionResponse proto.InternalMessageInfo var xxx_messageInfo_MsgMintProductionResponse proto.InternalMessageInfo
type MsgBurnConsumption struct {
Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"`
Consumption []types.Coin `protobuf:"bytes,2,rep,name=consumption,proto3" json:"consumption"`
}
func (m *MsgBurnConsumption) Reset() { *m = MsgBurnConsumption{} }
func (m *MsgBurnConsumption) String() string { return proto.CompactTextString(m) }
func (*MsgBurnConsumption) ProtoMessage() {}
func (*MsgBurnConsumption) Descriptor() ([]byte, []int) {
return fileDescriptor_85ac37e5c8e5251d, []int{10}
}
func (m *MsgBurnConsumption) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgBurnConsumption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgBurnConsumption.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 *MsgBurnConsumption) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgBurnConsumption.Merge(m, src)
}
func (m *MsgBurnConsumption) XXX_Size() int {
return m.Size()
}
func (m *MsgBurnConsumption) XXX_DiscardUnknown() {
xxx_messageInfo_MsgBurnConsumption.DiscardUnknown(m)
}
var xxx_messageInfo_MsgBurnConsumption proto.InternalMessageInfo
func (m *MsgBurnConsumption) GetCreator() string {
if m != nil {
return m.Creator
}
return ""
}
func (m *MsgBurnConsumption) GetConsumption() []types.Coin {
if m != nil {
return m.Consumption
}
return nil
}
type MsgBurnConsumptionResponse struct {
}
func (m *MsgBurnConsumptionResponse) Reset() { *m = MsgBurnConsumptionResponse{} }
func (m *MsgBurnConsumptionResponse) String() string { return proto.CompactTextString(m) }
func (*MsgBurnConsumptionResponse) ProtoMessage() {}
func (*MsgBurnConsumptionResponse) Descriptor() ([]byte, []int) {
return fileDescriptor_85ac37e5c8e5251d, []int{11}
}
func (m *MsgBurnConsumptionResponse) XXX_Unmarshal(b []byte) error {
return m.Unmarshal(b)
}
func (m *MsgBurnConsumptionResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
if deterministic {
return xxx_messageInfo_MsgBurnConsumptionResponse.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 *MsgBurnConsumptionResponse) XXX_Merge(src proto.Message) {
xxx_messageInfo_MsgBurnConsumptionResponse.Merge(m, src)
}
func (m *MsgBurnConsumptionResponse) XXX_Size() int {
return m.Size()
}
func (m *MsgBurnConsumptionResponse) XXX_DiscardUnknown() {
xxx_messageInfo_MsgBurnConsumptionResponse.DiscardUnknown(m)
}
var xxx_messageInfo_MsgBurnConsumptionResponse proto.InternalMessageInfo
func init() { func init() {
proto.RegisterType((*MsgAttestMachine)(nil), "planetmintgo.machine.MsgAttestMachine") proto.RegisterType((*MsgAttestMachine)(nil), "planetmintgo.machine.MsgAttestMachine")
proto.RegisterType((*MsgAttestMachineResponse)(nil), "planetmintgo.machine.MsgAttestMachineResponse") proto.RegisterType((*MsgAttestMachineResponse)(nil), "planetmintgo.machine.MsgAttestMachineResponse")
@ -485,53 +573,58 @@ func init() {
proto.RegisterType((*MsgUpdateParamsResponse)(nil), "planetmintgo.machine.MsgUpdateParamsResponse") proto.RegisterType((*MsgUpdateParamsResponse)(nil), "planetmintgo.machine.MsgUpdateParamsResponse")
proto.RegisterType((*MsgMintProduction)(nil), "planetmintgo.machine.MsgMintProduction") proto.RegisterType((*MsgMintProduction)(nil), "planetmintgo.machine.MsgMintProduction")
proto.RegisterType((*MsgMintProductionResponse)(nil), "planetmintgo.machine.MsgMintProductionResponse") proto.RegisterType((*MsgMintProductionResponse)(nil), "planetmintgo.machine.MsgMintProductionResponse")
proto.RegisterType((*MsgBurnConsumption)(nil), "planetmintgo.machine.MsgBurnConsumption")
proto.RegisterType((*MsgBurnConsumptionResponse)(nil), "planetmintgo.machine.MsgBurnConsumptionResponse")
} }
func init() { proto.RegisterFile("planetmintgo/machine/tx.proto", fileDescriptor_85ac37e5c8e5251d) } func init() { proto.RegisterFile("planetmintgo/machine/tx.proto", fileDescriptor_85ac37e5c8e5251d) }
var fileDescriptor_85ac37e5c8e5251d = []byte{ var fileDescriptor_85ac37e5c8e5251d = []byte{
// 643 bytes of a gzipped FileDescriptorProto // 692 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 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x67, 0x50, 0x35, 0xb3, 0xdc, 0xc2, 0xcc, 0x39, 0x1d, 0x7c, 0x5d, 0x7b, 0x21,
0x12, 0xad, 0x99, 0xf8, 0x73, 0xb4, 0xfb, 0x27, 0x00, 0x00, 0xff, 0xff, 0x8c, 0x3b, 0xab, 0x34,
0xdb, 0x07, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -551,6 +644,7 @@ type MsgClient interface {
NotarizeLiquidAsset(ctx context.Context, in *MsgNotarizeLiquidAsset, opts ...grpc.CallOption) (*MsgNotarizeLiquidAssetResponse, error) NotarizeLiquidAsset(ctx context.Context, in *MsgNotarizeLiquidAsset, opts ...grpc.CallOption) (*MsgNotarizeLiquidAssetResponse, error)
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
MintProduction(ctx context.Context, in *MsgMintProduction, opts ...grpc.CallOption) (*MsgMintProductionResponse, error) MintProduction(ctx context.Context, in *MsgMintProduction, opts ...grpc.CallOption) (*MsgMintProductionResponse, error)
BurnConsumption(ctx context.Context, in *MsgBurnConsumption, opts ...grpc.CallOption) (*MsgBurnConsumptionResponse, error)
} }
type msgClient struct { type msgClient struct {
@ -606,6 +700,15 @@ func (c *msgClient) MintProduction(ctx context.Context, in *MsgMintProduction, o
return out, nil return out, nil
} }
func (c *msgClient) BurnConsumption(ctx context.Context, in *MsgBurnConsumption, opts ...grpc.CallOption) (*MsgBurnConsumptionResponse, error) {
out := new(MsgBurnConsumptionResponse)
err := c.cc.Invoke(ctx, "/planetmintgo.machine.Msg/BurnConsumption", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// MsgServer is the server API for Msg service. // MsgServer is the server API for Msg service.
type MsgServer interface { type MsgServer interface {
AttestMachine(context.Context, *MsgAttestMachine) (*MsgAttestMachineResponse, error) AttestMachine(context.Context, *MsgAttestMachine) (*MsgAttestMachineResponse, error)
@ -613,6 +716,7 @@ type MsgServer interface {
NotarizeLiquidAsset(context.Context, *MsgNotarizeLiquidAsset) (*MsgNotarizeLiquidAssetResponse, error) NotarizeLiquidAsset(context.Context, *MsgNotarizeLiquidAsset) (*MsgNotarizeLiquidAssetResponse, error)
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
MintProduction(context.Context, *MsgMintProduction) (*MsgMintProductionResponse, error) MintProduction(context.Context, *MsgMintProduction) (*MsgMintProductionResponse, error)
BurnConsumption(context.Context, *MsgBurnConsumption) (*MsgBurnConsumptionResponse, error)
} }
// UnimplementedMsgServer can be embedded to have forward compatible implementations. // UnimplementedMsgServer can be embedded to have forward compatible implementations.
@ -634,6 +738,9 @@ func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateP
func (*UnimplementedMsgServer) MintProduction(ctx context.Context, req *MsgMintProduction) (*MsgMintProductionResponse, error) { func (*UnimplementedMsgServer) MintProduction(ctx context.Context, req *MsgMintProduction) (*MsgMintProductionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method MintProduction not implemented") return nil, status.Errorf(codes.Unimplemented, "method MintProduction not implemented")
} }
func (*UnimplementedMsgServer) BurnConsumption(ctx context.Context, req *MsgBurnConsumption) (*MsgBurnConsumptionResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method BurnConsumption not implemented")
}
func RegisterMsgServer(s grpc1.Server, srv MsgServer) { func RegisterMsgServer(s grpc1.Server, srv MsgServer) {
s.RegisterService(&_Msg_serviceDesc, srv) s.RegisterService(&_Msg_serviceDesc, srv)
@ -729,6 +836,24 @@ func _Msg_MintProduction_Handler(srv interface{}, ctx context.Context, dec func(
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _Msg_BurnConsumption_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(MsgBurnConsumption)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(MsgServer).BurnConsumption(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/planetmintgo.machine.Msg/BurnConsumption",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(MsgServer).BurnConsumption(ctx, req.(*MsgBurnConsumption))
}
return interceptor(ctx, in, info, handler)
}
var _Msg_serviceDesc = grpc.ServiceDesc{ var _Msg_serviceDesc = grpc.ServiceDesc{
ServiceName: "planetmintgo.machine.Msg", ServiceName: "planetmintgo.machine.Msg",
HandlerType: (*MsgServer)(nil), HandlerType: (*MsgServer)(nil),
@ -753,6 +878,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{
MethodName: "MintProduction", MethodName: "MintProduction",
Handler: _Msg_MintProduction_Handler, Handler: _Msg_MintProduction_Handler,
}, },
{
MethodName: "BurnConsumption",
Handler: _Msg_BurnConsumption_Handler,
},
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},
Metadata: "planetmintgo/machine/tx.proto", Metadata: "planetmintgo/machine/tx.proto",
@ -1083,6 +1212,73 @@ func (m *MsgMintProductionResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro
return len(dAtA) - i, nil return len(dAtA) - i, nil
} }
func (m *MsgBurnConsumption) 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 *MsgBurnConsumption) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgBurnConsumption) MarshalToSizedBuffer(dAtA []byte) (int, error) {
i := len(dAtA)
_ = i
var l int
_ = l
if len(m.Consumption) > 0 {
for iNdEx := len(m.Consumption) - 1; iNdEx >= 0; iNdEx-- {
{
size, err := m.Consumption[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 *MsgBurnConsumptionResponse) 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 *MsgBurnConsumptionResponse) MarshalTo(dAtA []byte) (int, error) {
size := m.Size()
return m.MarshalToSizedBuffer(dAtA[:size])
}
func (m *MsgBurnConsumptionResponse) 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 { func encodeVarintTx(dAtA []byte, offset int, v uint64) int {
offset -= sovTx(v) offset -= sovTx(v)
base := offset base := offset
@ -1224,6 +1420,34 @@ func (m *MsgMintProductionResponse) Size() (n int) {
return n return n
} }
func (m *MsgBurnConsumption) 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.Consumption) > 0 {
for _, e := range m.Consumption {
l = e.Size()
n += 1 + l + sovTx(uint64(l))
}
}
return n
}
func (m *MsgBurnConsumptionResponse) Size() (n int) {
if m == nil {
return 0
}
var l int
_ = l
return n
}
func sovTx(x uint64) (n int) { func sovTx(x uint64) (n int) {
return (math_bits.Len64(x|1) + 6) / 7 return (math_bits.Len64(x|1) + 6) / 7
} }
@ -2065,6 +2289,172 @@ func (m *MsgMintProductionResponse) Unmarshal(dAtA []byte) error {
} }
return nil return nil
} }
func (m *MsgBurnConsumption) 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: MsgBurnConsumption: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgBurnConsumption: 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 Consumption", 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.Consumption = append(m.Consumption, types.Coin{})
if err := m.Consumption[len(m.Consumption)-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 *MsgBurnConsumptionResponse) 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: MsgBurnConsumptionResponse: wiretype end group for non-group")
}
if fieldNum <= 0 {
return fmt.Errorf("proto: MsgBurnConsumptionResponse: 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) { func skipTx(dAtA []byte) (n int, err error) {
l := len(dAtA) l := len(dAtA)
iNdEx := 0 iNdEx := 0