diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 94d7590..9281b51 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -30789,6 +30789,8 @@ definitions: type: string colinear.colinearcore.MsgNewBidResponse: type: object + colinear.colinearcore.MsgUnlockFundsResponse: + type: object colinear.colinearcore.NextAuction: type: object properties: diff --git a/proto/colinearcore/tx.proto b/proto/colinearcore/tx.proto index b34823f..2d8f563 100644 --- a/proto/colinearcore/tx.proto +++ b/proto/colinearcore/tx.proto @@ -10,6 +10,7 @@ service Msg { rpc NewAuction(MsgNewAuction) returns (MsgNewAuctionResponse); rpc NewBid(MsgNewBid) returns (MsgNewBidResponse); rpc LockFunds(MsgLockFunds) returns (MsgLockFundsResponse); + rpc UnlockFunds(MsgUnlockFunds) returns (MsgUnlockFundsResponse); // this line is used by starport scaffolding # proto/tx/rpc } @@ -43,4 +44,12 @@ message MsgLockFunds { message MsgLockFundsResponse { } +message MsgUnlockFunds { + string creator = 1; + string amount = 2; +} + +message MsgUnlockFundsResponse { +} + // this line is used by starport scaffolding # proto/tx/message diff --git a/x/colinearcore/client/cli/tx.go b/x/colinearcore/client/cli/tx.go index 17e98dc..f5c05b2 100644 --- a/x/colinearcore/client/cli/tx.go +++ b/x/colinearcore/client/cli/tx.go @@ -33,6 +33,7 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand(CmdNewAuction()) cmd.AddCommand(CmdNewBid()) cmd.AddCommand(CmdLockFunds()) + cmd.AddCommand(CmdUnlockFunds()) // this line is used by starport scaffolding # 1 return cmd diff --git a/x/colinearcore/client/cli/tx_unlock_funds.go b/x/colinearcore/client/cli/tx_unlock_funds.go new file mode 100644 index 0000000..483f65d --- /dev/null +++ b/x/colinearcore/client/cli/tx_unlock_funds.go @@ -0,0 +1,42 @@ +package cli + +import ( + "strconv" + + "colinear/x/colinearcore/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" +) + +var _ = strconv.Itoa(0) + +func CmdUnlockFunds() *cobra.Command { + cmd := &cobra.Command{ + Use: "unlock-funds [amount]", + Short: "Broadcast message unlockFunds", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + argAmount := args[0] + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgUnlockFunds( + clientCtx.GetFromAddress().String(), + argAmount, + ) + if err := msg.ValidateBasic(); err != nil { + return err + } + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + + flags.AddTxFlagsToCmd(cmd) + + return cmd +} diff --git a/x/colinearcore/handler.go b/x/colinearcore/handler.go index 79e8d37..f2dd65e 100644 --- a/x/colinearcore/handler.go +++ b/x/colinearcore/handler.go @@ -27,6 +27,9 @@ func NewHandler(k keeper.Keeper) sdk.Handler { case *types.MsgLockFunds: res, err := msgServer.LockFunds(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgUnlockFunds: + res, err := msgServer.UnlockFunds(sdk.WrapSDKContext(ctx), msg) + return sdk.WrapServiceResult(ctx, res, err) // this line is used by starport scaffolding # 1 default: errMsg := fmt.Sprintf("unrecognized %s message type: %T", types.ModuleName, msg) diff --git a/x/colinearcore/keeper/msg_server_unlock_funds.go b/x/colinearcore/keeper/msg_server_unlock_funds.go new file mode 100644 index 0000000..76b9ac1 --- /dev/null +++ b/x/colinearcore/keeper/msg_server_unlock_funds.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "context" + + "colinear/x/colinearcore/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (k msgServer) UnlockFunds(goCtx context.Context, msg *types.MsgUnlockFunds) (*types.MsgUnlockFundsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // TODO: Handling the message + _ = ctx + + return &types.MsgUnlockFundsResponse{}, nil +} diff --git a/x/colinearcore/module_simulation.go b/x/colinearcore/module_simulation.go index e3b609c..fc08d0a 100644 --- a/x/colinearcore/module_simulation.go +++ b/x/colinearcore/module_simulation.go @@ -37,6 +37,10 @@ const ( // TODO: Determine the simulation weight value defaultWeightMsgLockFunds int = 100 + opWeightMsgUnlockFunds = "op_weight_msg_unlock_funds" + // TODO: Determine the simulation weight value + defaultWeightMsgUnlockFunds int = 100 + // this line is used by starport scaffolding # simapp/module/const ) @@ -104,6 +108,17 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp colinearcoresimulation.SimulateMsgLockFunds(am.accountKeeper, am.bankKeeper, am.keeper), )) + var weightMsgUnlockFunds int + simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgUnlockFunds, &weightMsgUnlockFunds, nil, + func(_ *rand.Rand) { + weightMsgUnlockFunds = defaultWeightMsgUnlockFunds + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgUnlockFunds, + colinearcoresimulation.SimulateMsgUnlockFunds(am.accountKeeper, am.bankKeeper, am.keeper), + )) + // this line is used by starport scaffolding # simapp/module/operation return operations diff --git a/x/colinearcore/simulation/unlock_funds.go b/x/colinearcore/simulation/unlock_funds.go new file mode 100644 index 0000000..06b1776 --- /dev/null +++ b/x/colinearcore/simulation/unlock_funds.go @@ -0,0 +1,29 @@ +package simulation + +import ( + "math/rand" + + "colinear/x/colinearcore/keeper" + "colinear/x/colinearcore/types" + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + simtypes "github.com/cosmos/cosmos-sdk/types/simulation" +) + +func SimulateMsgUnlockFunds( + 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.MsgUnlockFunds{ + Creator: simAccount.Address.String(), + } + + // TODO: Handling the UnlockFunds simulation + + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "UnlockFunds simulation not implemented"), nil, nil + } +} diff --git a/x/colinearcore/types/codec.go b/x/colinearcore/types/codec.go index abcf38d..0c681b5 100644 --- a/x/colinearcore/types/codec.go +++ b/x/colinearcore/types/codec.go @@ -11,6 +11,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgNewAuction{}, "colinear/NewAuction", nil) cdc.RegisterConcrete(&MsgNewBid{}, "colinear/NewBid", nil) cdc.RegisterConcrete(&MsgLockFunds{}, "colinearcore/LockFunds", nil) + cdc.RegisterConcrete(&MsgUnlockFunds{}, "colinearcore/UnlockFunds", nil) // this line is used by starport scaffolding # 2 } @@ -24,6 +25,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgLockFunds{}, ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUnlockFunds{}, + ) // this line is used by starport scaffolding # 3 msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/colinearcore/types/message_unlock_funds.go b/x/colinearcore/types/message_unlock_funds.go new file mode 100644 index 0000000..db5ee29 --- /dev/null +++ b/x/colinearcore/types/message_unlock_funds.go @@ -0,0 +1,46 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const TypeMsgUnlockFunds = "unlock_funds" + +var _ sdk.Msg = &MsgUnlockFunds{} + +func NewMsgUnlockFunds(creator string, amount string) *MsgUnlockFunds { + return &MsgUnlockFunds{ + Creator: creator, + Amount: amount, + } +} + +func (msg *MsgUnlockFunds) Route() string { + return RouterKey +} + +func (msg *MsgUnlockFunds) Type() string { + return TypeMsgUnlockFunds +} + +func (msg *MsgUnlockFunds) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgUnlockFunds) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgUnlockFunds) 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/colinearcore/types/message_unlock_funds_test.go b/x/colinearcore/types/message_unlock_funds_test.go new file mode 100644 index 0000000..8e9d7c6 --- /dev/null +++ b/x/colinearcore/types/message_unlock_funds_test.go @@ -0,0 +1,41 @@ +package types + +import ( + "testing" + + "colinear/testutil/sample" + + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" +) + +func TestMsgUnlockFunds_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgUnlockFunds + err error + }{ + { + name: "invalid address", + msg: MsgUnlockFunds{ + Creator: "invalid_address", + }, + err: sdkerrors.ErrInvalidAddress, + }, { + name: "valid address", + msg: MsgUnlockFunds{ + 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/colinearcore/types/tx.pb.go b/x/colinearcore/types/tx.pb.go index 83c31be..02a70cf 100644 --- a/x/colinearcore/types/tx.pb.go +++ b/x/colinearcore/types/tx.pb.go @@ -339,6 +339,94 @@ func (m *MsgLockFundsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgLockFundsResponse proto.InternalMessageInfo +type MsgUnlockFunds struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + Amount string `protobuf:"bytes,2,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (m *MsgUnlockFunds) Reset() { *m = MsgUnlockFunds{} } +func (m *MsgUnlockFunds) String() string { return proto.CompactTextString(m) } +func (*MsgUnlockFunds) ProtoMessage() {} +func (*MsgUnlockFunds) Descriptor() ([]byte, []int) { + return fileDescriptor_0c3854a2a9bba3b4, []int{6} +} +func (m *MsgUnlockFunds) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUnlockFunds) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUnlockFunds.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 *MsgUnlockFunds) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUnlockFunds.Merge(m, src) +} +func (m *MsgUnlockFunds) XXX_Size() int { + return m.Size() +} +func (m *MsgUnlockFunds) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUnlockFunds.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUnlockFunds proto.InternalMessageInfo + +func (m *MsgUnlockFunds) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgUnlockFunds) GetAmount() string { + if m != nil { + return m.Amount + } + return "" +} + +type MsgUnlockFundsResponse struct { +} + +func (m *MsgUnlockFundsResponse) Reset() { *m = MsgUnlockFundsResponse{} } +func (m *MsgUnlockFundsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUnlockFundsResponse) ProtoMessage() {} +func (*MsgUnlockFundsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0c3854a2a9bba3b4, []int{7} +} +func (m *MsgUnlockFundsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUnlockFundsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUnlockFundsResponse.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 *MsgUnlockFundsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUnlockFundsResponse.Merge(m, src) +} +func (m *MsgUnlockFundsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUnlockFundsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUnlockFundsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUnlockFundsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgNewAuction)(nil), "colinear.colinearcore.MsgNewAuction") proto.RegisterType((*MsgNewAuctionResponse)(nil), "colinear.colinearcore.MsgNewAuctionResponse") @@ -346,36 +434,41 @@ func init() { proto.RegisterType((*MsgNewBidResponse)(nil), "colinear.colinearcore.MsgNewBidResponse") proto.RegisterType((*MsgLockFunds)(nil), "colinear.colinearcore.MsgLockFunds") proto.RegisterType((*MsgLockFundsResponse)(nil), "colinear.colinearcore.MsgLockFundsResponse") + proto.RegisterType((*MsgUnlockFunds)(nil), "colinear.colinearcore.MsgUnlockFunds") + proto.RegisterType((*MsgUnlockFundsResponse)(nil), "colinear.colinearcore.MsgUnlockFundsResponse") } func init() { proto.RegisterFile("colinearcore/tx.proto", fileDescriptor_0c3854a2a9bba3b4) } var fileDescriptor_0c3854a2a9bba3b4 = []byte{ - // 383 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcd, 0x4a, 0xf3, 0x40, - 0x14, 0x6d, 0xfa, 0x93, 0xef, 0xcb, 0xfd, 0xfa, 0x2d, 0x1c, 0xdb, 0x12, 0x82, 0x86, 0x10, 0x5d, - 0x14, 0x94, 0x14, 0x14, 0x71, 0xab, 0x05, 0x05, 0xc1, 0xba, 0x28, 0xae, 0x04, 0xc1, 0x98, 0xb9, - 0x84, 0xc1, 0x76, 0x26, 0x64, 0x52, 0xac, 0x6f, 0xe1, 0x03, 0xf8, 0x06, 0xbe, 0x88, 0xcb, 0x2e, - 0x5d, 0x4a, 0xfb, 0x22,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x3e, 0x81, 0xe6, 0x40, 0xfa, - 0x97, 0xc2, 0x7b, 0x38, 0x9f, 0x70, 0x2a, 0x57, 0x3c, 0xbd, 0xb4, 0xad, 0x96, 0x6c, 0x3b, 0xd0, - 0x2a, 0x3a, 0x64, 0xce, 0x07, 0x2f, 0x55, 0xa8, 0x0d, 0xa4, 0x4f, 0xee, 0x00, 0x0a, 0x5f, 0xb7, - 0xeb, 0x7c, 0xfb, 0xc9, 0x4e, 0x29, 0x33, 0x63, 0x7f, 0x9d, 0xaa, 0x3c, 0xd9, 0x6b, 0x50, 0xd3, - 0xe0, 0xac, 0x95, 0xba, 0x3e, 0xa3, 0x46, 0xf7, 0xb7, 0x8a, 0xdc, 0xf5, 0x16, 0xb4, 0x65, 0x2c, - 0x3b, 0x3f, 0xcb, 0xf2, 0x22, 0x63, 0x6f, 0x8d, 0xa2, 0xcc, 0xbe, 0x7f, 0xfc, 0x36, 0x37, 0x95, - 0xd9, 0xdc, 0x54, 0x3e, 0xe6, 0xa6, 0xf2, 0xbc, 0x30, 0x2b, 0xb3, 0x85, 0x59, 0x79, 0x5f, 0x98, - 0x95, 0x9b, 0xed, 0x4c, 0xdc, 0x9b, 0xf6, 0xca, 0x8b, 0xf2, 0x14, 0xa0, 0xbc, 0x57, 0xe3, 0x65, - 0x39, 0xfc, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x79, 0x5d, 0x54, 0xc3, 0x45, 0x03, 0x00, 0x00, + // 420 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x93, 0xcd, 0x6a, 0xdb, 0x40, + 0x14, 0x85, 0x2d, 0xff, 0xa8, 0xd5, 0xb5, 0x5b, 0xe8, 0xd4, 0x36, 0x83, 0x68, 0x85, 0x50, 0x5b, + 0x30, 0xb4, 0x95, 0xa1, 0xa5, 0x74, 0xdb, 0x0a, 0x5a, 0x08, 0x44, 0x59, 0x98, 0x64, 0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xff, 0xf4, 0x46, 0xb8, 0x57, + 0x08, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -393,6 +486,7 @@ type MsgClient interface { NewAuction(ctx context.Context, in *MsgNewAuction, opts ...grpc.CallOption) (*MsgNewAuctionResponse, error) NewBid(ctx context.Context, in *MsgNewBid, opts ...grpc.CallOption) (*MsgNewBidResponse, error) LockFunds(ctx context.Context, in *MsgLockFunds, opts ...grpc.CallOption) (*MsgLockFundsResponse, error) + UnlockFunds(ctx context.Context, in *MsgUnlockFunds, opts ...grpc.CallOption) (*MsgUnlockFundsResponse, error) } type msgClient struct { @@ -430,11 +524,21 @@ func (c *msgClient) LockFunds(ctx context.Context, in *MsgLockFunds, opts ...grp return out, nil } +func (c *msgClient) UnlockFunds(ctx context.Context, in *MsgUnlockFunds, opts ...grpc.CallOption) (*MsgUnlockFundsResponse, error) { + out := new(MsgUnlockFundsResponse) + err := c.cc.Invoke(ctx, "/colinear.colinearcore.Msg/UnlockFunds", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { NewAuction(context.Context, *MsgNewAuction) (*MsgNewAuctionResponse, error) NewBid(context.Context, *MsgNewBid) (*MsgNewBidResponse, error) LockFunds(context.Context, *MsgLockFunds) (*MsgLockFundsResponse, error) + UnlockFunds(context.Context, *MsgUnlockFunds) (*MsgUnlockFundsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -450,6 +554,9 @@ func (*UnimplementedMsgServer) NewBid(ctx context.Context, req *MsgNewBid) (*Msg func (*UnimplementedMsgServer) LockFunds(ctx context.Context, req *MsgLockFunds) (*MsgLockFundsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method LockFunds not implemented") } +func (*UnimplementedMsgServer) UnlockFunds(ctx context.Context, req *MsgUnlockFunds) (*MsgUnlockFundsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnlockFunds not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -509,6 +616,24 @@ func _Msg_LockFunds_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } +func _Msg_UnlockFunds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUnlockFunds) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UnlockFunds(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/colinear.colinearcore.Msg/UnlockFunds", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UnlockFunds(ctx, req.(*MsgUnlockFunds)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "colinear.colinearcore.Msg", HandlerType: (*MsgServer)(nil), @@ -525,6 +650,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "LockFunds", Handler: _Msg_LockFunds_Handler, }, + { + MethodName: "UnlockFunds", + Handler: _Msg_UnlockFunds_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "colinearcore/tx.proto", @@ -750,6 +879,66 @@ func (m *MsgLockFundsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgUnlockFunds) 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 *MsgUnlockFunds) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUnlockFunds) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Amount) > 0 { + i -= len(m.Amount) + copy(dAtA[i:], m.Amount) + i = encodeVarintTx(dAtA, i, uint64(len(m.Amount))) + 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 *MsgUnlockFundsResponse) 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 *MsgUnlockFundsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUnlockFundsResponse) 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 @@ -862,6 +1051,32 @@ func (m *MsgLockFundsResponse) Size() (n int) { return n } +func (m *MsgUnlockFunds) 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.Amount) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + return n +} + +func (m *MsgUnlockFundsResponse) 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 } @@ -1539,6 +1754,170 @@ func (m *MsgLockFundsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUnlockFunds) 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: MsgUnlockFunds: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUnlockFunds: 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 Amount", 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.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUnlockFundsResponse) 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: MsgUnlockFundsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUnlockFundsResponse: 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