From 42bb8112ad55c223e85f5f163a25648f0d2b14a6 Mon Sep 17 00:00:00 2001 From: turtlebasket Date: Thu, 8 Sep 2022 23:29:08 +0000 Subject: [PATCH] scaffold unlock all funds msg --- proto/colinearcore/tx.proto | 8 + x/colinearcore/client/cli/tx.go | 1 + .../client/cli/tx_unlock_all_funds.go | 40 ++ x/colinearcore/handler.go | 3 + .../keeper/msg_server_unlock_all_funds.go | 17 + x/colinearcore/module_simulation.go | 15 + x/colinearcore/simulation/unlock_all_funds.go | 29 ++ x/colinearcore/types/codec.go | 4 + .../types/message_unlock_all_funds.go | 45 ++ .../types/message_unlock_all_funds_test.go | 40 ++ x/colinearcore/types/tx.pb.go | 383 ++++++++++++++++-- 11 files changed, 557 insertions(+), 28 deletions(-) create mode 100644 x/colinearcore/client/cli/tx_unlock_all_funds.go create mode 100644 x/colinearcore/keeper/msg_server_unlock_all_funds.go create mode 100644 x/colinearcore/simulation/unlock_all_funds.go create mode 100644 x/colinearcore/types/message_unlock_all_funds.go create mode 100644 x/colinearcore/types/message_unlock_all_funds_test.go diff --git a/proto/colinearcore/tx.proto b/proto/colinearcore/tx.proto index 2d8f563..ee37ac9 100644 --- a/proto/colinearcore/tx.proto +++ b/proto/colinearcore/tx.proto @@ -11,6 +11,7 @@ service Msg { rpc NewBid(MsgNewBid) returns (MsgNewBidResponse); rpc LockFunds(MsgLockFunds) returns (MsgLockFundsResponse); rpc UnlockFunds(MsgUnlockFunds) returns (MsgUnlockFundsResponse); + rpc UnlockAllFunds(MsgUnlockAllFunds) returns (MsgUnlockAllFundsResponse); // this line is used by starport scaffolding # proto/tx/rpc } @@ -52,4 +53,11 @@ message MsgUnlockFunds { message MsgUnlockFundsResponse { } +message MsgUnlockAllFunds { + string creator = 1; +} + +message MsgUnlockAllFundsResponse { +} + // 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 f5c05b2..b8500ee 100644 --- a/x/colinearcore/client/cli/tx.go +++ b/x/colinearcore/client/cli/tx.go @@ -34,6 +34,7 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand(CmdNewBid()) cmd.AddCommand(CmdLockFunds()) cmd.AddCommand(CmdUnlockFunds()) + cmd.AddCommand(CmdUnlockAllFunds()) // this line is used by starport scaffolding # 1 return cmd diff --git a/x/colinearcore/client/cli/tx_unlock_all_funds.go b/x/colinearcore/client/cli/tx_unlock_all_funds.go new file mode 100644 index 0000000..ed99747 --- /dev/null +++ b/x/colinearcore/client/cli/tx_unlock_all_funds.go @@ -0,0 +1,40 @@ +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 CmdUnlockAllFunds() *cobra.Command { + cmd := &cobra.Command{ + Use: "unlock-all-funds", + Short: "Broadcast message unlockAllFunds", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) (err error) { + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgUnlockAllFunds( + clientCtx.GetFromAddress().String(), + ) + 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 f2dd65e..ecc9894 100644 --- a/x/colinearcore/handler.go +++ b/x/colinearcore/handler.go @@ -30,6 +30,9 @@ func NewHandler(k keeper.Keeper) sdk.Handler { case *types.MsgUnlockFunds: res, err := msgServer.UnlockFunds(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgUnlockAllFunds: + res, err := msgServer.UnlockAllFunds(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_all_funds.go b/x/colinearcore/keeper/msg_server_unlock_all_funds.go new file mode 100644 index 0000000..008098d --- /dev/null +++ b/x/colinearcore/keeper/msg_server_unlock_all_funds.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "context" + + "colinear/x/colinearcore/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (k msgServer) UnlockAllFunds(goCtx context.Context, msg *types.MsgUnlockAllFunds) (*types.MsgUnlockAllFundsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // TODO: Handling the message + _ = ctx + + return &types.MsgUnlockAllFundsResponse{}, nil +} diff --git a/x/colinearcore/module_simulation.go b/x/colinearcore/module_simulation.go index fc08d0a..8689473 100644 --- a/x/colinearcore/module_simulation.go +++ b/x/colinearcore/module_simulation.go @@ -41,6 +41,10 @@ const ( // TODO: Determine the simulation weight value defaultWeightMsgUnlockFunds int = 100 + opWeightMsgUnlockAllFunds = "op_weight_msg_unlock_all_funds" + // TODO: Determine the simulation weight value + defaultWeightMsgUnlockAllFunds int = 100 + // this line is used by starport scaffolding # simapp/module/const ) @@ -119,6 +123,17 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp colinearcoresimulation.SimulateMsgUnlockFunds(am.accountKeeper, am.bankKeeper, am.keeper), )) + var weightMsgUnlockAllFunds int + simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgUnlockAllFunds, &weightMsgUnlockAllFunds, nil, + func(_ *rand.Rand) { + weightMsgUnlockAllFunds = defaultWeightMsgUnlockAllFunds + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgUnlockAllFunds, + colinearcoresimulation.SimulateMsgUnlockAllFunds(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_all_funds.go b/x/colinearcore/simulation/unlock_all_funds.go new file mode 100644 index 0000000..c2244d6 --- /dev/null +++ b/x/colinearcore/simulation/unlock_all_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 SimulateMsgUnlockAllFunds( + 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.MsgUnlockAllFunds{ + Creator: simAccount.Address.String(), + } + + // TODO: Handling the UnlockAllFunds simulation + + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "UnlockAllFunds simulation not implemented"), nil, nil + } +} diff --git a/x/colinearcore/types/codec.go b/x/colinearcore/types/codec.go index 0c681b5..ce30552 100644 --- a/x/colinearcore/types/codec.go +++ b/x/colinearcore/types/codec.go @@ -12,6 +12,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgNewBid{}, "colinear/NewBid", nil) cdc.RegisterConcrete(&MsgLockFunds{}, "colinearcore/LockFunds", nil) cdc.RegisterConcrete(&MsgUnlockFunds{}, "colinearcore/UnlockFunds", nil) + cdc.RegisterConcrete(&MsgUnlockAllFunds{}, "colinearcore/UnlockAllFunds", nil) // this line is used by starport scaffolding # 2 } @@ -28,6 +29,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgUnlockFunds{}, ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgUnlockAllFunds{}, + ) // this line is used by starport scaffolding # 3 msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/colinearcore/types/message_unlock_all_funds.go b/x/colinearcore/types/message_unlock_all_funds.go new file mode 100644 index 0000000..f9081f9 --- /dev/null +++ b/x/colinearcore/types/message_unlock_all_funds.go @@ -0,0 +1,45 @@ +package types + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const TypeMsgUnlockAllFunds = "unlock_all_funds" + +var _ sdk.Msg = &MsgUnlockAllFunds{} + +func NewMsgUnlockAllFunds(creator string) *MsgUnlockAllFunds { + return &MsgUnlockAllFunds{ + Creator: creator, + } +} + +func (msg *MsgUnlockAllFunds) Route() string { + return RouterKey +} + +func (msg *MsgUnlockAllFunds) Type() string { + return TypeMsgUnlockAllFunds +} + +func (msg *MsgUnlockAllFunds) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgUnlockAllFunds) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgUnlockAllFunds) 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_all_funds_test.go b/x/colinearcore/types/message_unlock_all_funds_test.go new file mode 100644 index 0000000..5a1b6c3 --- /dev/null +++ b/x/colinearcore/types/message_unlock_all_funds_test.go @@ -0,0 +1,40 @@ +package types + +import ( + "testing" + + "colinear/testutil/sample" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" +) + +func TestMsgUnlockAllFunds_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgUnlockAllFunds + err error + }{ + { + name: "invalid address", + msg: MsgUnlockAllFunds{ + Creator: "invalid_address", + }, + err: sdkerrors.ErrInvalidAddress, + }, { + name: "valid address", + msg: MsgUnlockAllFunds{ + 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 02a70cf..8623ae2 100644 --- a/x/colinearcore/types/tx.pb.go +++ b/x/colinearcore/types/tx.pb.go @@ -427,6 +427,86 @@ func (m *MsgUnlockFundsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUnlockFundsResponse proto.InternalMessageInfo +type MsgUnlockAllFunds struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` +} + +func (m *MsgUnlockAllFunds) Reset() { *m = MsgUnlockAllFunds{} } +func (m *MsgUnlockAllFunds) String() string { return proto.CompactTextString(m) } +func (*MsgUnlockAllFunds) ProtoMessage() {} +func (*MsgUnlockAllFunds) Descriptor() ([]byte, []int) { + return fileDescriptor_0c3854a2a9bba3b4, []int{8} +} +func (m *MsgUnlockAllFunds) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUnlockAllFunds) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUnlockAllFunds.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 *MsgUnlockAllFunds) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUnlockAllFunds.Merge(m, src) +} +func (m *MsgUnlockAllFunds) XXX_Size() int { + return m.Size() +} +func (m *MsgUnlockAllFunds) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUnlockAllFunds.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUnlockAllFunds proto.InternalMessageInfo + +func (m *MsgUnlockAllFunds) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +type MsgUnlockAllFundsResponse struct { +} + +func (m *MsgUnlockAllFundsResponse) Reset() { *m = MsgUnlockAllFundsResponse{} } +func (m *MsgUnlockAllFundsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUnlockAllFundsResponse) ProtoMessage() {} +func (*MsgUnlockAllFundsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0c3854a2a9bba3b4, []int{9} +} +func (m *MsgUnlockAllFundsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUnlockAllFundsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUnlockAllFundsResponse.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 *MsgUnlockAllFundsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUnlockAllFundsResponse.Merge(m, src) +} +func (m *MsgUnlockAllFundsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUnlockAllFundsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUnlockAllFundsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUnlockAllFundsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgNewAuction)(nil), "colinear.colinearcore.MsgNewAuction") proto.RegisterType((*MsgNewAuctionResponse)(nil), "colinear.colinearcore.MsgNewAuctionResponse") @@ -436,39 +516,43 @@ func init() { proto.RegisterType((*MsgLockFundsResponse)(nil), "colinear.colinearcore.MsgLockFundsResponse") proto.RegisterType((*MsgUnlockFunds)(nil), "colinear.colinearcore.MsgUnlockFunds") proto.RegisterType((*MsgUnlockFundsResponse)(nil), "colinear.colinearcore.MsgUnlockFundsResponse") + proto.RegisterType((*MsgUnlockAllFunds)(nil), "colinear.colinearcore.MsgUnlockAllFunds") + proto.RegisterType((*MsgUnlockAllFundsResponse)(nil), "colinear.colinearcore.MsgUnlockAllFundsResponse") } func init() { proto.RegisterFile("colinearcore/tx.proto", fileDescriptor_0c3854a2a9bba3b4) } var fileDescriptor_0c3854a2a9bba3b4 = []byte{ - // 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, 0x13, 0x08, - 0x44, 0xd1, 0x0c, 0x42, 0x44, 0x9e, 0x11, 0x1a, 0x99, 0x38, 0xcb, 0xbc, 0x41, 0xde, 0x23, 0x2f, - 0x92, 0xa5, 0x97, 0x59, 0x06, 0xfb, 0x45, 0x42, 0xf4, 0x33, 0x96, 0x20, 0x76, 0x0c, 0xd9, 0xe9, - 0x1e, 0x9d, 0xf3, 0xcd, 0xdc, 0xb9, 0x33, 0x30, 0xf0, 0x79, 0x14, 0x32, 0xea, 0x25, 0x3e, 0x4f, - 0xe8, 0x38, 0x9d, 0xdb, 0x71, 0xc2, 0x53, 0x8e, 0xa4, 0x6c, 0x57, 0xff, 0x5b, 0x37, 0x0a, 0xbc, - 0x71, 0x45, 0x70, 0x40, 0x2f, 0xfe, 0xce, 0xfc, 0x34, 0xe4, 0x0c, 0x61, 0x78, 0xe5, 0x27, 0xd4, - 0x4b, 0x79, 0x82, 0x15, 0x53, 0x19, 0x69, 0x93, 0xb2, 0x44, 0x08, 0xda, 0xcc, 0x9b, 0x52, 0xdc, - 0xcc, 0xe4, 0xec, 0x1b, 0x99, 0xd0, 0x25, 0x54, 0xf8, 0x49, 0x18, 0x3f, 0x86, 0x71, 0x2b, 0xfb, - 0x55, 0x95, 0x32, 0x1e, 0x0d, 0xa3, 0x90, 0x05, 0xb8, 0x5d, 0xf0, 0xf2, 0x12, 0xf5, 0xa1, 0x43, - 0x28, 0xe3, 0x53, 0xdc, 0xc9, 0xf4, 0xbc, 0x40, 0x3a, 0xbc, 0x8e, 0xa8, 0x27, 0xe8, 0x3f, 0x46, - 0xb0, 0x6a, 0x2a, 0xa3, 0xf6, 0x44, 0xd6, 0xd6, 0x2f, 0x18, 0xd4, 0x36, 0x3b, 0xa1, 0x22, 0xe6, - 0x4c, 0x50, 0xf4, 0x01, 0x34, 0x2f, 0x97, 0xf6, 0x48, 0xb1, 0xed, 0xb5, 0x60, 0x79, 0xa0, 0xe5, - 0x31, 0x27, 0x24, 0x5b, 0xfa, 0xb3, 0xa0, 0x57, 0x66, 0x18, 0xa1, 0xf3, 0xa2, 0xcf, 0x9a, 0x86, - 0x86, 0xa0, 0x7a, 0x53, 0x3e, 0x63, 0x69, 0xd1, 0x6a, 0x51, 0x59, 0xef, 0xe1, 0x9d, 0x5c, 0xa2, - 0xdc, 0x95, 0xf5, 0x07, 0x7a, 0xae, 0x08, 0xf6, 0xb9, 0x7f, 0xfe, 0x7f, 0xc6, 0x88, 0xd8, 0xb2, - 0xf4, 0x1a, 0xdb, 0xac, 0x61, 0x87, 0xd0, 0xaf, 0x12, 0x24, 0xd9, 0x81, 0xb7, 0xae, 0x08, 0x8e, - 0x58, 0xf4, 0x02, 0x36, 0x86, 0x61, 0x9d, 0x51, 0xd2, 0x7f, 0x5c, 0xb5, 0xa0, 0xe5, 0x8a, 0x00, - 0x9d, 0x02, 0x54, 0x2e, 0xc6, 0x67, 0xfb, 0xc9, 0x2b, 0x64, 0xd7, 0x26, 0xa2, 0x7f, 0xdb, 0xc5, - 0x25, 0xe7, 0x76, 0x08, 0x6a, 0x31, 0x16, 0x73, 0x6b, 0xce, 0x09, 0x89, 0x3e, 0x7a, 0xce, 0x21, - 0xa9, 0x27, 0xa0, 0xad, 0x0f, 0xfd, 0xd3, 0xe6, 0x98, 0x34, 0xe9, 0x5f, 0x77, 0x30, 0x49, 0xbc, - 0x0f, 0xdd, 0xea, 0xc9, 0x7f, 0xd9, 0x9c, 0xad, 0xd8, 0xf4, 0xef, 0x3b, 0xd9, 0xca, 0x45, 0x9c, - 0xdf, 0xb7, 0x4b, 0x43, 0x59, 0x2c, 0x0d, 0xe5, 0x7e, 0x69, 0x28, 0xd7, 0x2b, 0xa3, 0xb1, 0x58, - 0x19, 0x8d, 0xbb, 0x95, 0xd1, 0x38, 0xfe, 0x58, 0xc6, 0xc7, 0xf3, 0x71, 0xfd, 0xad, 0x5f, 0xc6, - 0x54, 0x9c, 0xa9, 0xd9, 0x7b, 0xff, 0xf9, 0x10, 0x00, 0x00, 0xff, 0xff, 0xf4, 0x46, 0xb8, 0x57, - 0x08, 0x04, 0x00, 0x00, + // 449 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x94, 0xcd, 0xea, 0xd3, 0x40, + 0x14, 0xc5, 0x9b, 0x7f, 0xdb, 0x68, 0x6e, 0x6b, 0xc1, 0xb1, 0x2d, 0x63, 0xd4, 0x10, 0xa2, 0x42, + 0x40, 0x9b, 0x8a, 0x22, 0x6e, 0x6d, 0x40, 0x41, 0x30, 0x2e, 0x8a, 0x6e, 0x04, 0xc1, 0x98, 0x19, + 0x42, 0x30, 0x9d, 0x09, 0x99, 0x14, 0xeb, 0x5b, 0xf8, 0x1e, 0xbe, 0x88, 0xcb, 0x2e, 0x5d, 0x4a, + 0xfb, 0x00, 0xbe, 0x82, 0x98, 0x8f, 0x69, 0xa2, 0xb6, 0x0d, 0xb8, 0xcb, 0x3d, 0x73, 0xce, 0xef, + 0xce, 0xe5, 0x0e, 0x81, 0x49, 0xc0, 0xe3, 0x88, 0x51, 0x3f, 0x0d, 0x78, 0x4a, 0xe7, 0xd9, 0xc6, + 0x49, 0x52, 0x9e, 0x71, 0x24, 0x65, 0xa7, 0x7e, 0x6e, 0x7d, 0x55, 0xe0, 0x8a, 0x27, 0xc2, 0x57, + 0xf4, 0xd3, 0x62, 0x1d, 0x64, 0x11, 0x67, 0x08, 0xc3, 0xa5, 0x20, 0xa5, 0x7e, 0xc6, 0x53, 0xac, + 0x98, 0x8a, 0xad, 0x2d, 0xab, 0x12, 0x21, 0xe8, 0x31, 0x7f, 0x45, 0xf1, 0x45, 0x2e, 0xe7, 0xdf, + 0xc8, 0x84, 0x01, 0xa1, 0x22, 0x48, 0xa3, 0xe4, 0x77, 0x18, 0x77, 0xf3, 0xa3, 0xba, 0x94, 0xf3, + 0x68, 0x14, 0x47, 0x2c, 0xc4, 0xbd, 0x92, 0x57, 0x94, 0x68, 0x0c, 0x7d, 0x42, 0x19, 0x5f, 0xe1, + 0x7e, 0xae, 0x17, 0x05, 0xd2, 0xe1, 0x72, 0x4c, 0x7d, 0x41, 0x9f, 0x31, 0x82, 0x55, 0x53, 0xb1, + 0x7b, 0x4b, 0x59, 0x5b, 0x8f, 0x61, 0xd2, 0xb8, 0xec, 0x92, 0x8a, 0x84, 0x33, 0x41, 0xd1, 0x4d, + 0xd0, 0xfc, 0x42, 0x7a, 0x41, 0xca, 0x6b, 0x1f, 0x04, 0xcb, 0x07, 0xad, 0x88, 0xb9, 0x11, 0x39, + 0x31, 0x9f, 0x05, 0xc3, 0x2a, 0xc3, 0x08, 0xdd, 0x94, 0x73, 0x36, 0x34, 0x34, 0x05, 0xd5, 0x5f, + 0xf1, 0x35, 0xcb, 0xca, 0x51, 0xcb, 0xca, 0xba, 0x06, 0x57, 0x65, 0x8b, 0xea, 0x56, 0xd6, 0x53, + 0x18, 0x7a, 0x22, 0x7c, 0xc9, 0x83, 0x8f, 0xcf, 0xd7, 0x8c, 0x88, 0x13, 0xad, 0x0f, 0xd8, 0x8b, + 0x06, 0x76, 0x0a, 0xe3, 0x3a, 0x41, 0x92, 0x5d, 0x18, 0x79, 0x22, 0x7c, 0xc3, 0xe2, 0xff, 0x60, + 0x63, 0x98, 0x36, 0x19, 0x92, 0x3e, 0xcb, 0x87, 0x29, 0x4e, 0x16, 0x71, 0x7c, 0xa6, 0x81, 0x75, + 0x03, 0xae, 0xff, 0x65, 0xaf, 0x58, 0x0f, 0x7f, 0x76, 0xa1, 0xeb, 0x89, 0x10, 0xbd, 0x07, 0xa8, + 0x3d, 0xb2, 0x3b, 0xce, 0x3f, 0x9f, 0xa3, 0xd3, 0xd8, 0xae, 0x7e, 0xbf, 0x8d, 0x4b, 0xbe, 0x81, + 0xd7, 0xa0, 0x96, 0x2b, 0x36, 0x4f, 0xe6, 0xdc, 0x88, 0xe8, 0xf6, 0x39, 0x87, 0xa4, 0xbe, 0x03, + 0xed, 0xb0, 0xc0, 0xdb, 0xc7, 0x63, 0xd2, 0xa4, 0xdf, 0x6b, 0x61, 0x92, 0xf8, 0x00, 0x06, 0xf5, + 0x2d, 0xde, 0x3d, 0x9e, 0xad, 0xd9, 0xf4, 0x59, 0x2b, 0x9b, 0x6c, 0x12, 0xc3, 0xe8, 0x8f, 0x65, + 0xda, 0xe7, 0x00, 0x95, 0x53, 0x7f, 0xd0, 0xd6, 0x59, 0x75, 0x73, 0x9f, 0x7c, 0xdb, 0x19, 0xca, + 0x76, 0x67, 0x28, 0x3f, 0x76, 0x86, 0xf2, 0x65, 0x6f, 0x74, 0xb6, 0x7b, 0xa3, 0xf3, 0x7d, 0x6f, + 0x74, 0xde, 0xde, 0xaa, 0x08, 0xf3, 0xcd, 0xbc, 0xf9, 0x97, 0xfa, 0x9c, 0x50, 0xf1, 0x41, 0xcd, + 0xff, 0x54, 0x8f, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, 0x20, 0xbb, 0xf4, 0x20, 0xc2, 0x04, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -487,6 +571,7 @@ type MsgClient interface { 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) + UnlockAllFunds(ctx context.Context, in *MsgUnlockAllFunds, opts ...grpc.CallOption) (*MsgUnlockAllFundsResponse, error) } type msgClient struct { @@ -533,12 +618,22 @@ func (c *msgClient) UnlockFunds(ctx context.Context, in *MsgUnlockFunds, opts .. return out, nil } +func (c *msgClient) UnlockAllFunds(ctx context.Context, in *MsgUnlockAllFunds, opts ...grpc.CallOption) (*MsgUnlockAllFundsResponse, error) { + out := new(MsgUnlockAllFundsResponse) + err := c.cc.Invoke(ctx, "/colinear.colinearcore.Msg/UnlockAllFunds", 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) + UnlockAllFunds(context.Context, *MsgUnlockAllFunds) (*MsgUnlockAllFundsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -557,6 +652,9 @@ func (*UnimplementedMsgServer) LockFunds(ctx context.Context, req *MsgLockFunds) func (*UnimplementedMsgServer) UnlockFunds(ctx context.Context, req *MsgUnlockFunds) (*MsgUnlockFundsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UnlockFunds not implemented") } +func (*UnimplementedMsgServer) UnlockAllFunds(ctx context.Context, req *MsgUnlockAllFunds) (*MsgUnlockAllFundsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UnlockAllFunds not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -634,6 +732,24 @@ func _Msg_UnlockFunds_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } +func _Msg_UnlockAllFunds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUnlockAllFunds) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UnlockAllFunds(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/colinear.colinearcore.Msg/UnlockAllFunds", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UnlockAllFunds(ctx, req.(*MsgUnlockAllFunds)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "colinear.colinearcore.Msg", HandlerType: (*MsgServer)(nil), @@ -654,6 +770,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UnlockFunds", Handler: _Msg_UnlockFunds_Handler, }, + { + MethodName: "UnlockAllFunds", + Handler: _Msg_UnlockAllFunds_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "colinearcore/tx.proto", @@ -939,6 +1059,59 @@ func (m *MsgUnlockFundsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *MsgUnlockAllFunds) 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 *MsgUnlockAllFunds) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUnlockAllFunds) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + 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 *MsgUnlockAllFundsResponse) 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 *MsgUnlockAllFundsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUnlockAllFundsResponse) 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 @@ -1077,6 +1250,28 @@ func (m *MsgUnlockFundsResponse) Size() (n int) { return n } +func (m *MsgUnlockAllFunds) 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)) + } + return n +} + +func (m *MsgUnlockAllFundsResponse) 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 } @@ -1918,6 +2113,138 @@ func (m *MsgUnlockFundsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUnlockAllFunds) 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: MsgUnlockAllFunds: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUnlockAllFunds: 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 + 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 *MsgUnlockAllFundsResponse) 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: MsgUnlockAllFundsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUnlockAllFundsResponse: 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