diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 742cde7..94d7590 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -4,6 +4,43 @@ info: name: '' description: '' paths: + /colinear/colinearcore/locked_users: + get: + summary: Queries a LockedUsers by index. + operationId: ColinearColinearcoreLockedUsers + responses: + '200': + description: A successful response. + schema: + type: object + properties: + LockedUsers: + type: object + properties: + users: + type: object + additionalProperties: + type: string + default: + description: An unexpected error response. + schema: + type: object + properties: + code: + type: integer + format: int32 + message: + type: string + details: + type: array + items: + type: object + properties: + '@type': + type: string + additionalProperties: {} + tags: + - Query /colinearcore/colinearcore/auction: get: summary: Queries a list of Auction items. @@ -141,16 +178,6 @@ paths: in: query required: false type: boolean - - name: pagination.reverse - description: >- - reverse is set to true if results are to be returned in the - descending order. - - - Since: cosmos-sdk 0.43 - in: query - required: false - type: boolean tags: - Query '/colinearcore/colinearcore/auction/{index}': @@ -30746,6 +30773,15 @@ definitions: type: string amount: type: string + colinear.colinearcore.LockedUsers: + type: object + properties: + users: + type: object + additionalProperties: + type: string + colinear.colinearcore.MsgLockFundsResponse: + type: object colinear.colinearcore.MsgNewAuctionResponse: type: object properties: @@ -30873,6 +30909,16 @@ definitions: format: uint64 remaining: type: string + colinear.colinearcore.QueryGetLockedUsersResponse: + type: object + properties: + LockedUsers: + type: object + properties: + users: + type: object + additionalProperties: + type: string colinear.colinearcore.QueryGetNextAuctionResponse: type: object properties: diff --git a/proto/colinearcore/genesis.proto b/proto/colinearcore/genesis.proto index bdc3776..4cbcf3e 100644 --- a/proto/colinearcore/genesis.proto +++ b/proto/colinearcore/genesis.proto @@ -5,6 +5,7 @@ import "gogoproto/gogo.proto"; import "colinearcore/params.proto"; import "colinearcore/next_auction.proto"; import "colinearcore/auction.proto"; +import "colinearcore/locked_users.proto"; // this line is used by starport scaffolding # genesis/proto/import option go_package = "colinear/x/colinearcore/types"; @@ -14,5 +15,6 @@ message GenesisState { Params params = 1 [(gogoproto.nullable) = false]; NextAuction nextAuction = 2; repeated Auction auctionList = 3 [(gogoproto.nullable) = false]; + LockedUsers lockedUsers = 4; // this line is used by starport scaffolding # genesis/proto/state } diff --git a/proto/colinearcore/locked_users.proto b/proto/colinearcore/locked_users.proto new file mode 100644 index 0000000..91b048d --- /dev/null +++ b/proto/colinearcore/locked_users.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; +package colinear.colinearcore; + +option go_package = "colinear/x/colinearcore/types"; + +message LockedUsers { + map users = 1; +} diff --git a/proto/colinearcore/query.proto b/proto/colinearcore/query.proto index 61edd6e..c0e9e48 100644 --- a/proto/colinearcore/query.proto +++ b/proto/colinearcore/query.proto @@ -8,6 +8,7 @@ import "colinearcore/params.proto"; import "colinearcore/next_auction.proto"; import "colinearcore/auction.proto"; import "colinearcore/bid.proto"; +import "colinearcore/locked_users.proto"; // this line is used by starport scaffolding # 1 option go_package = "colinear/x/colinearcore/types"; @@ -37,6 +38,10 @@ service Query { option (google.api.http).get = "/colinearcore/colinearcore/auction_bids/{index}"; } +// Queries a LockedUsers by index. + rpc LockedUsers(QueryGetLockedUsersRequest) returns (QueryGetLockedUsersResponse) { + option (google.api.http).get = "/colinear/colinearcore/locked_users"; + } // this line is used by starport scaffolding # 2 } @@ -80,4 +85,9 @@ message QueryAuctionBidsResponse { repeated Bid bids = 1; } +message QueryGetLockedUsersRequest {} + +message QueryGetLockedUsersResponse { + LockedUsers LockedUsers = 1 [(gogoproto.nullable) = false]; +} // this line is used by starport scaffolding # 3 diff --git a/proto/colinearcore/tx.proto b/proto/colinearcore/tx.proto index fab2a98..a882b54 100644 --- a/proto/colinearcore/tx.proto +++ b/proto/colinearcore/tx.proto @@ -9,6 +9,7 @@ option go_package = "colinear/x/colinearcore/types"; service Msg { rpc NewAuction(MsgNewAuction) returns (MsgNewAuctionResponse); rpc NewBid(MsgNewBid) returns (MsgNewBidResponse); + rpc LockFunds(MsgLockFunds) returns (MsgLockFundsResponse); // this line is used by starport scaffolding # proto/tx/rpc } @@ -34,4 +35,11 @@ message MsgNewBid { message MsgNewBidResponse { } +message MsgLockFunds { + string creator = 1; +} + +message MsgLockFundsResponse { +} + // this line is used by starport scaffolding # proto/tx/message diff --git a/x/colinearcore/auctionconfig/config.go b/x/colinearcore/auctionconfig/config.go index d913e36..73c1fb0 100644 --- a/x/colinearcore/auctionconfig/config.go +++ b/x/colinearcore/auctionconfig/config.go @@ -8,6 +8,15 @@ const ( MinLeasePeriod = 3_600 // 1 hour MaxLeasePeriod = 8_035_200 // 3 months + // Minimum required staked CLR to be a provider (i.e. to bid) + ProviderMinLockedClr = 500 + // Amount slashed when a provider is offline during an audit + ProviderLockedSlash = 100 + + // Blocks between provider audit pings + // 40 blocks ~40min-2hr + ProviderPingFrequency = 40 + // Gas Fees AuctionGas = 10 ) diff --git a/x/colinearcore/client/cli/query.go b/x/colinearcore/client/cli/query.go index 3243b9c..d65b7ba 100644 --- a/x/colinearcore/client/cli/query.go +++ b/x/colinearcore/client/cli/query.go @@ -30,6 +30,7 @@ func GetQueryCmd(queryRoute string) *cobra.Command { cmd.AddCommand(CmdShowAuction()) cmd.AddCommand(CmdAuctionBids()) + cmd.AddCommand(CmdShowLockedUsers()) // this line is used by starport scaffolding # 1 return cmd diff --git a/x/colinearcore/client/cli/query_locked_users.go b/x/colinearcore/client/cli/query_locked_users.go new file mode 100644 index 0000000..9330673 --- /dev/null +++ b/x/colinearcore/client/cli/query_locked_users.go @@ -0,0 +1,36 @@ +package cli + +import ( + "context" + + "colinear/x/colinearcore/types" + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" +) + +func CmdShowLockedUsers() *cobra.Command { + cmd := &cobra.Command{ + Use: "show-locked-users", + Short: "shows lockedUsers", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + params := &types.QueryGetLockedUsersRequest{} + + res, err := queryClient.LockedUsers(context.Background(), params) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/colinearcore/client/cli/query_locked_users_test.go b/x/colinearcore/client/cli/query_locked_users_test.go new file mode 100644 index 0000000..108193e --- /dev/null +++ b/x/colinearcore/client/cli/query_locked_users_test.go @@ -0,0 +1,72 @@ +package cli_test + +import ( + "fmt" + "testing" + + clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" + "github.com/stretchr/testify/require" + tmcli "github.com/tendermint/tendermint/libs/cli" + "google.golang.org/grpc/status" + + "colinear/testutil/network" + "colinear/testutil/nullify" + "colinear/x/colinearcore/client/cli" + "colinear/x/colinearcore/types" +) + +func networkWithLockedUsersObjects(t *testing.T) (*network.Network, types.LockedUsers) { + t.Helper() + cfg := network.DefaultConfig() + state := types.GenesisState{} + require.NoError(t, cfg.Codec.UnmarshalJSON(cfg.GenesisState[types.ModuleName], &state)) + + lockedUsers := &types.LockedUsers{} + nullify.Fill(&lockedUsers) + state.LockedUsers = lockedUsers + buf, err := cfg.Codec.MarshalJSON(&state) + require.NoError(t, err) + cfg.GenesisState[types.ModuleName] = buf + return network.New(t, cfg), *state.LockedUsers +} + +func TestShowLockedUsers(t *testing.T) { + net, obj := networkWithLockedUsersObjects(t) + + ctx := net.Validators[0].ClientCtx + common := []string{ + fmt.Sprintf("--%s=json", tmcli.OutputFlag), + } + for _, tc := range []struct { + desc string + args []string + err error + obj types.LockedUsers + }{ + { + desc: "get", + args: common, + obj: obj, + }, + } { + t.Run(tc.desc, func(t *testing.T) { + var args []string + args = append(args, tc.args...) + out, err := clitestutil.ExecTestCLICmd(ctx, cli.CmdShowLockedUsers(), args) + if tc.err != nil { + stat, ok := status.FromError(tc.err) + require.True(t, ok) + require.ErrorIs(t, stat.Err(), tc.err) + } else { + require.NoError(t, err) + var resp types.QueryGetLockedUsersResponse + require.NoError(t, net.Config.Codec.UnmarshalJSON(out.Bytes(), &resp)) + require.NotNil(t, resp.LockedUsers) + require.Equal(t, + nullify.Fill(&tc.obj), + nullify.Fill(&resp.LockedUsers), + ) + } + }) + } +} diff --git a/x/colinearcore/client/cli/tx.go b/x/colinearcore/client/cli/tx.go index cd61291..17e98dc 100644 --- a/x/colinearcore/client/cli/tx.go +++ b/x/colinearcore/client/cli/tx.go @@ -32,6 +32,7 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand(CmdNewAuction()) cmd.AddCommand(CmdNewBid()) + cmd.AddCommand(CmdLockFunds()) // this line is used by starport scaffolding # 1 return cmd diff --git a/x/colinearcore/client/cli/tx_lock_funds.go b/x/colinearcore/client/cli/tx_lock_funds.go new file mode 100644 index 0000000..7660adc --- /dev/null +++ b/x/colinearcore/client/cli/tx_lock_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 CmdLockFunds() *cobra.Command { + cmd := &cobra.Command{ + Use: "lock-funds", + Short: "Broadcast message lockFunds", + 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.NewMsgLockFunds( + 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/genesis.go b/x/colinearcore/genesis.go index 3bb200f..2de738a 100644 --- a/x/colinearcore/genesis.go +++ b/x/colinearcore/genesis.go @@ -18,6 +18,10 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) for _, elem := range genState.AuctionList { k.SetAuction(ctx, elem) } + // Set if defined + if genState.LockedUsers != nil { + k.SetLockedUsers(ctx, *genState.LockedUsers) + } // this line is used by starport scaffolding # genesis/module/init k.SetParams(ctx, genState.Params) } @@ -33,6 +37,11 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis.NextAuction = &nextAuction } genesis.AuctionList = k.GetAllAuction(ctx) + // Get all lockedUsers + lockedUsers, found := k.GetLockedUsers(ctx) + if found { + genesis.LockedUsers = &lockedUsers + } // this line is used by starport scaffolding # genesis/module/export return genesis diff --git a/x/colinearcore/genesis_test.go b/x/colinearcore/genesis_test.go index d7b9e47..6c13b57 100644 --- a/x/colinearcore/genesis_test.go +++ b/x/colinearcore/genesis_test.go @@ -26,6 +26,9 @@ func TestGenesis(t *testing.T) { Index: "1", }, }, + LockedUsers: &types.LockedUsers{ + Users: map[string]string{}, + }, // this line is used by starport scaffolding # genesis/test/state } @@ -39,5 +42,6 @@ func TestGenesis(t *testing.T) { require.Equal(t, genesisState.NextAuction, got.NextAuction) require.ElementsMatch(t, genesisState.AuctionList, got.AuctionList) + require.Equal(t, genesisState.LockedUsers, got.LockedUsers) // this line is used by starport scaffolding # genesis/test/assert } diff --git a/x/colinearcore/handler.go b/x/colinearcore/handler.go index 4ef94f7..79e8d37 100644 --- a/x/colinearcore/handler.go +++ b/x/colinearcore/handler.go @@ -24,6 +24,9 @@ func NewHandler(k keeper.Keeper) sdk.Handler { case *types.MsgNewBid: res, err := msgServer.NewBid(sdk.WrapSDKContext(ctx), msg) return sdk.WrapServiceResult(ctx, res, err) + case *types.MsgLockFunds: + res, err := msgServer.LockFunds(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/grpc_query_locked_users.go b/x/colinearcore/keeper/grpc_query_locked_users.go new file mode 100644 index 0000000..3a7d9e6 --- /dev/null +++ b/x/colinearcore/keeper/grpc_query_locked_users.go @@ -0,0 +1,24 @@ +package keeper + +import ( + "context" + + "colinear/x/colinearcore/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +func (k Keeper) LockedUsers(c context.Context, req *types.QueryGetLockedUsersRequest) (*types.QueryGetLockedUsersResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + val, found := k.GetLockedUsers(ctx) + if !found { + return nil, status.Error(codes.NotFound, "not found") + } + + return &types.QueryGetLockedUsersResponse{LockedUsers: val}, nil +} diff --git a/x/colinearcore/keeper/grpc_query_locked_users_test.go b/x/colinearcore/keeper/grpc_query_locked_users_test.go new file mode 100644 index 0000000..b725fb3 --- /dev/null +++ b/x/colinearcore/keeper/grpc_query_locked_users_test.go @@ -0,0 +1,49 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + keepertest "colinear/testutil/keeper" + "colinear/testutil/nullify" + "colinear/x/colinearcore/types" +) + +func TestLockedUsersQuery(t *testing.T) { + keeper, ctx := keepertest.ColinearcoreKeeper(t) + wctx := sdk.WrapSDKContext(ctx) + item := createTestLockedUsers(keeper, ctx) + for _, tc := range []struct { + desc string + request *types.QueryGetLockedUsersRequest + response *types.QueryGetLockedUsersResponse + err error + }{ + { + desc: "First", + request: &types.QueryGetLockedUsersRequest{}, + response: &types.QueryGetLockedUsersResponse{LockedUsers: item}, + }, + { + desc: "InvalidRequest", + err: status.Error(codes.InvalidArgument, "invalid request"), + }, + } { + t.Run(tc.desc, func(t *testing.T) { + response, err := keeper.LockedUsers(wctx, tc.request) + if tc.err != nil { + require.ErrorIs(t, err, tc.err) + } else { + require.NoError(t, err) + require.Equal(t, + nullify.Fill(tc.response), + nullify.Fill(response), + ) + } + }) + } +} diff --git a/x/colinearcore/keeper/locked_users.go b/x/colinearcore/keeper/locked_users.go new file mode 100644 index 0000000..3ad2eb9 --- /dev/null +++ b/x/colinearcore/keeper/locked_users.go @@ -0,0 +1,33 @@ +package keeper + +import ( + "colinear/x/colinearcore/types" + "github.com/cosmos/cosmos-sdk/store/prefix" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// SetLockedUsers set lockedUsers in the store +func (k Keeper) SetLockedUsers(ctx sdk.Context, lockedUsers types.LockedUsers) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LockedUsersKey)) + b := k.cdc.MustMarshal(&lockedUsers) + store.Set([]byte{0}, b) +} + +// GetLockedUsers returns lockedUsers +func (k Keeper) GetLockedUsers(ctx sdk.Context) (val types.LockedUsers, found bool) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LockedUsersKey)) + + b := store.Get([]byte{0}) + if b == nil { + return val, false + } + + k.cdc.MustUnmarshal(b, &val) + return val, true +} + +// RemoveLockedUsers removes lockedUsers from the store +func (k Keeper) RemoveLockedUsers(ctx sdk.Context) { + store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.LockedUsersKey)) + store.Delete([]byte{0}) +} diff --git a/x/colinearcore/keeper/locked_users_test.go b/x/colinearcore/keeper/locked_users_test.go new file mode 100644 index 0000000..1644dcc --- /dev/null +++ b/x/colinearcore/keeper/locked_users_test.go @@ -0,0 +1,38 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + keepertest "colinear/testutil/keeper" + "colinear/testutil/nullify" + "colinear/x/colinearcore/keeper" + "colinear/x/colinearcore/types" +) + +func createTestLockedUsers(keeper *keeper.Keeper, ctx sdk.Context) types.LockedUsers { + item := types.LockedUsers{} + keeper.SetLockedUsers(ctx, item) + return item +} + +func TestLockedUsersGet(t *testing.T) { + keeper, ctx := keepertest.ColinearcoreKeeper(t) + item := createTestLockedUsers(keeper, ctx) + rst, found := keeper.GetLockedUsers(ctx) + require.True(t, found) + require.Equal(t, + nullify.Fill(&item), + nullify.Fill(&rst), + ) +} + +func TestLockedUsersRemove(t *testing.T) { + keeper, ctx := keepertest.ColinearcoreKeeper(t) + createTestLockedUsers(keeper, ctx) + keeper.RemoveLockedUsers(ctx) + _, found := keeper.GetLockedUsers(ctx) + require.False(t, found) +} diff --git a/x/colinearcore/keeper/msg_server_lock_funds.go b/x/colinearcore/keeper/msg_server_lock_funds.go new file mode 100644 index 0000000..56b3b46 --- /dev/null +++ b/x/colinearcore/keeper/msg_server_lock_funds.go @@ -0,0 +1,18 @@ +package keeper + +import ( + "context" + + "colinear/x/colinearcore/types" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (k msgServer) LockFunds(goCtx context.Context, msg *types.MsgLockFunds) (*types.MsgLockFundsResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // TODO + _ = ctx + + return &types.MsgLockFundsResponse{}, nil +} diff --git a/x/colinearcore/keeper/msg_server_new_bid.go b/x/colinearcore/keeper/msg_server_new_bid.go index 79984de..dfe4f32 100644 --- a/x/colinearcore/keeper/msg_server_new_bid.go +++ b/x/colinearcore/keeper/msg_server_new_bid.go @@ -62,6 +62,8 @@ func (k msgServer) NewBid(goCtx context.Context, msg *types.MsgNewBid) (*types.M } } + // check that user has locked minimum required CLR + bid := &types.Bid{ Amount: msg.Amount, Owner: msg.Creator, @@ -71,8 +73,5 @@ func (k msgServer) NewBid(goCtx context.Context, msg *types.MsgNewBid) (*types.M return nil, fmt.Errorf("failed to add bid: %s", err) } - // auction.Bids = append(auction.Bids, bid) - // k.Keeper.SetAuction(ctx, auction) - return &types.MsgNewBidResponse{}, nil } diff --git a/x/colinearcore/module_simulation.go b/x/colinearcore/module_simulation.go index ece8667..e3b609c 100644 --- a/x/colinearcore/module_simulation.go +++ b/x/colinearcore/module_simulation.go @@ -4,7 +4,7 @@ import ( "math/rand" "colinear/testutil/sample" - colinearsimulation "colinear/x/colinearcore/simulation" + colinearcoresimulation "colinear/x/colinearcore/simulation" "colinear/x/colinearcore/types" "github.com/cosmos/cosmos-sdk/baseapp" @@ -18,7 +18,7 @@ import ( // avoid unused import issue var ( _ = sample.AccAddress - _ = colinearsimulation.FindAccount + _ = colinearcoresimulation.FindAccount _ = simappparams.StakePerAccount _ = simulation.MsgEntryKind _ = baseapp.Paramspace @@ -33,6 +33,10 @@ const ( // TODO: Determine the simulation weight value defaultWeightMsgNewBid int = 100 + opWeightMsgLockFunds = "op_weight_msg_lock_funds" + // TODO: Determine the simulation weight value + defaultWeightMsgLockFunds int = 100 + // this line is used by starport scaffolding # simapp/module/const ) @@ -75,7 +79,7 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp ) operations = append(operations, simulation.NewWeightedOperation( weightMsgNewAuction, - colinearsimulation.SimulateMsgNewAuction(am.accountKeeper, am.bankKeeper, am.keeper), + colinearcoresimulation.SimulateMsgNewAuction(am.accountKeeper, am.bankKeeper, am.keeper), )) var weightMsgNewBid int @@ -86,7 +90,18 @@ func (am AppModule) WeightedOperations(simState module.SimulationState) []simtyp ) operations = append(operations, simulation.NewWeightedOperation( weightMsgNewBid, - colinearsimulation.SimulateMsgNewBid(am.accountKeeper, am.bankKeeper, am.keeper), + colinearcoresimulation.SimulateMsgNewBid(am.accountKeeper, am.bankKeeper, am.keeper), + )) + + var weightMsgLockFunds int + simState.AppParams.GetOrGenerate(simState.Cdc, opWeightMsgLockFunds, &weightMsgLockFunds, nil, + func(_ *rand.Rand) { + weightMsgLockFunds = defaultWeightMsgLockFunds + }, + ) + operations = append(operations, simulation.NewWeightedOperation( + weightMsgLockFunds, + colinearcoresimulation.SimulateMsgLockFunds(am.accountKeeper, am.bankKeeper, am.keeper), )) // this line is used by starport scaffolding # simapp/module/operation diff --git a/x/colinearcore/simulation/lock_funds.go b/x/colinearcore/simulation/lock_funds.go new file mode 100644 index 0000000..6425921 --- /dev/null +++ b/x/colinearcore/simulation/lock_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 SimulateMsgLockFunds( + 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.MsgLockFunds{ + Creator: simAccount.Address.String(), + } + + // TODO: Handling the LockFunds simulation + + return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "LockFunds simulation not implemented"), nil, nil + } +} diff --git a/x/colinearcore/types/codec.go b/x/colinearcore/types/codec.go index 922449e..abcf38d 100644 --- a/x/colinearcore/types/codec.go +++ b/x/colinearcore/types/codec.go @@ -10,6 +10,7 @@ import ( func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgNewAuction{}, "colinear/NewAuction", nil) cdc.RegisterConcrete(&MsgNewBid{}, "colinear/NewBid", nil) + cdc.RegisterConcrete(&MsgLockFunds{}, "colinearcore/LockFunds", nil) // this line is used by starport scaffolding # 2 } @@ -20,6 +21,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgNewBid{}, ) + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgLockFunds{}, + ) // this line is used by starport scaffolding # 3 msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/colinearcore/types/genesis.go b/x/colinearcore/types/genesis.go index 41d6e1b..1e7c258 100644 --- a/x/colinearcore/types/genesis.go +++ b/x/colinearcore/types/genesis.go @@ -12,6 +12,7 @@ func DefaultGenesis() *GenesisState { return &GenesisState{ NextAuction: &NextAuction{AuctionId: 0}, AuctionList: []Auction{}, + LockedUsers: nil, // this line is used by starport scaffolding # genesis/types/default Params: DefaultParams(), } diff --git a/x/colinearcore/types/genesis.pb.go b/x/colinearcore/types/genesis.pb.go index 64474b6..bf41020 100644 --- a/x/colinearcore/types/genesis.pb.go +++ b/x/colinearcore/types/genesis.pb.go @@ -28,6 +28,7 @@ type GenesisState struct { Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` NextAuction *NextAuction `protobuf:"bytes,2,opt,name=nextAuction,proto3" json:"nextAuction,omitempty"` AuctionList []Auction `protobuf:"bytes,3,rep,name=auctionList,proto3" json:"auctionList"` + LockedUsers *LockedUsers `protobuf:"bytes,4,opt,name=lockedUsers,proto3" json:"lockedUsers,omitempty"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -84,6 +85,13 @@ func (m *GenesisState) GetAuctionList() []Auction { return nil } +func (m *GenesisState) GetLockedUsers() *LockedUsers { + if m != nil { + return m.LockedUsers + } + return nil +} + func init() { proto.RegisterType((*GenesisState)(nil), "colinear.colinearcore.GenesisState") } @@ -91,23 +99,25 @@ func init() { func init() { proto.RegisterFile("colinearcore/genesis.proto", fileDescriptor_bc4df5b37e28503f) } var fileDescriptor_bc4df5b37e28503f = []byte{ - // 247 bytes of a gzipped FileDescriptorProto + // 281 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0xce, 0xcf, 0xc9, 0xcc, 0x4b, 0x4d, 0x2c, 0x4a, 0xce, 0x2f, 0x4a, 0xd5, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x85, 0xc9, 0xe9, 0x21, 0x2b, 0x92, 0x12, 0x49, 0xcf, 0x4f, 0xcf, 0x07, 0xab, 0xd0, 0x07, 0xb1, 0x20, 0x8a, 0xa5, 0x24, 0x51, 0x0c, 0x2a, 0x48, 0x2c, 0x4a, 0xcc, 0x85, 0x9a, 0x23, 0x25, 0x8f, 0x22, 0x95, 0x97, 0x5a, 0x51, 0x12, 0x9f, 0x58, - 0x9a, 0x5c, 0x92, 0x99, 0x9f, 0x07, 0x55, 0x80, 0xea, 0x08, 0x14, 0x39, 0xa5, 0x9b, 0x8c, 0x5c, - 0x3c, 0xee, 0x10, 0x67, 0x05, 0x97, 0x24, 0x96, 0xa4, 0x0a, 0x59, 0x73, 0xb1, 0x41, 0x4c, 0x97, - 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x36, 0x92, 0xd5, 0xc3, 0xea, 0x4c, 0xbd, 0x00, 0xb0, 0x22, 0x27, - 0x96, 0x13, 0xf7, 0xe4, 0x19, 0x82, 0xa0, 0x5a, 0x84, 0x5c, 0xb8, 0xb8, 0x41, 0xf6, 0x3b, 0x42, - 0xac, 0x90, 0x60, 0x02, 0x9b, 0xa0, 0x84, 0xc3, 0x04, 0x3f, 0x84, 0xca, 0x20, 0x64, 0x6d, 0x42, - 0x6e, 0x5c, 0xdc, 0x50, 0x47, 0xfa, 0x64, 0x16, 0x97, 0x48, 0x30, 0x2b, 0x30, 0x6b, 0x70, 0x1b, - 0xc9, 0xe1, 0x30, 0x05, 0xaa, 0x09, 0xea, 0x10, 0x64, 0x8d, 0x4e, 0xe6, 0x27, 0x1e, 0xc9, 0x31, - 0x5e, 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, - 0x31, 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0x25, 0x0b, 0x33, 0x42, 0xbf, 0x42, 0x1f, 0x25, 0x70, 0x4a, - 0x2a, 0x0b, 0x52, 0x8b, 0x93, 0xd8, 0xc0, 0x61, 0x63, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xff, - 0xa0, 0xf4, 0x18, 0xbe, 0x01, 0x00, 0x00, + 0x9a, 0x5c, 0x92, 0x99, 0x9f, 0x07, 0x55, 0x80, 0xea, 0x08, 0x54, 0x39, 0x54, 0xcd, 0x39, 0xf9, + 0xc9, 0xd9, 0xa9, 0x29, 0xf1, 0xa5, 0xc5, 0xa9, 0x45, 0x50, 0xd3, 0x95, 0xe6, 0x33, 0x71, 0xf1, + 0xb8, 0x43, 0xdc, 0x1d, 0x5c, 0x92, 0x58, 0x92, 0x2a, 0x64, 0xcd, 0xc5, 0x06, 0xb1, 0x5e, 0x82, + 0x51, 0x81, 0x51, 0x83, 0xdb, 0x48, 0x56, 0x0f, 0xab, 0x3f, 0xf4, 0x02, 0xc0, 0x8a, 0x9c, 0x58, + 0x4e, 0xdc, 0x93, 0x67, 0x08, 0x82, 0x6a, 0x11, 0x72, 0xe1, 0xe2, 0x06, 0x39, 0xd0, 0x11, 0xe2, + 0x06, 0x09, 0x26, 0xb0, 0x09, 0x4a, 0x38, 0x4c, 0xf0, 0x43, 0xa8, 0x0c, 0x42, 0xd6, 0x26, 0xe4, + 0xc6, 0xc5, 0x0d, 0xf5, 0x85, 0x4f, 0x66, 0x71, 0x89, 0x04, 0xb3, 0x02, 0xb3, 0x06, 0xb7, 0x91, + 0x1c, 0x0e, 0x53, 0xa0, 0x9a, 0xa0, 0x0e, 0x41, 0xd6, 0x08, 0x72, 0x0d, 0xc4, 0xc7, 0xa1, 0x20, + 0x0f, 0x4b, 0xb0, 0xe0, 0x75, 0x8d, 0x0f, 0x42, 0x65, 0x10, 0xb2, 0x36, 0x27, 0xf3, 0x13, 0x8f, + 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, + 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x92, 0x85, 0x19, 0xa0, 0x5f, 0xa1, 0x8f, 0x12, + 0xce, 0x25, 0x95, 0x05, 0xa9, 0xc5, 0x49, 0x6c, 0xe0, 0x10, 0x36, 0x06, 0x04, 0x00, 0x00, 0xff, + 0xff, 0xad, 0x0f, 0xd8, 0x00, 0x25, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -130,6 +140,18 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.LockedUsers != nil { + { + size, err := m.LockedUsers.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + } if len(m.AuctionList) > 0 { for iNdEx := len(m.AuctionList) - 1; iNdEx >= 0; iNdEx-- { { @@ -198,6 +220,10 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } + if m.LockedUsers != nil { + l = m.LockedUsers.Size() + n += 1 + l + sovGenesis(uint64(l)) + } return n } @@ -339,6 +365,42 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LockedUsers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.LockedUsers == nil { + m.LockedUsers = &LockedUsers{} + } + if err := m.LockedUsers.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/colinearcore/types/genesis_test.go b/x/colinearcore/types/genesis_test.go index 4212298..3bd2370 100644 --- a/x/colinearcore/types/genesis_test.go +++ b/x/colinearcore/types/genesis_test.go @@ -34,6 +34,9 @@ func TestGenesisState_Validate(t *testing.T) { Index: "1", }, }, + LockedUsers: &types.LockedUsers{ + Users: map[string]string{}, + }, // this line is used by starport scaffolding # types/genesis/validField }, valid: true, diff --git a/x/colinearcore/types/keys.go b/x/colinearcore/types/keys.go index 0159eb4..33fa233 100644 --- a/x/colinearcore/types/keys.go +++ b/x/colinearcore/types/keys.go @@ -24,3 +24,7 @@ func KeyPrefix(p string) []byte { const ( NextAuctionKey = "NextAuction-value-" ) + +const ( + LockedUsersKey = "LockedUsers-value-" +) diff --git a/x/colinearcore/types/locked_users.pb.go b/x/colinearcore/types/locked_users.pb.go new file mode 100644 index 0000000..20f50d2 --- /dev/null +++ b/x/colinearcore/types/locked_users.pb.go @@ -0,0 +1,429 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: colinearcore/locked_users.proto + +package types + +import ( + fmt "fmt" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type LockedUsers struct { + Users map[string]string `protobuf:"bytes,1,rep,name=users,proto3" json:"users,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` +} + +func (m *LockedUsers) Reset() { *m = LockedUsers{} } +func (m *LockedUsers) String() string { return proto.CompactTextString(m) } +func (*LockedUsers) ProtoMessage() {} +func (*LockedUsers) Descriptor() ([]byte, []int) { + return fileDescriptor_a95f97d52ce10c20, []int{0} +} +func (m *LockedUsers) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LockedUsers) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LockedUsers.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 *LockedUsers) XXX_Merge(src proto.Message) { + xxx_messageInfo_LockedUsers.Merge(m, src) +} +func (m *LockedUsers) XXX_Size() int { + return m.Size() +} +func (m *LockedUsers) XXX_DiscardUnknown() { + xxx_messageInfo_LockedUsers.DiscardUnknown(m) +} + +var xxx_messageInfo_LockedUsers proto.InternalMessageInfo + +func (m *LockedUsers) GetUsers() map[string]string { + if m != nil { + return m.Users + } + return nil +} + +func init() { + proto.RegisterType((*LockedUsers)(nil), "colinear.colinearcore.LockedUsers") + proto.RegisterMapType((map[string]string)(nil), "colinear.colinearcore.LockedUsers.UsersEntry") +} + +func init() { proto.RegisterFile("colinearcore/locked_users.proto", fileDescriptor_a95f97d52ce10c20) } + +var fileDescriptor_a95f97d52ce10c20 = []byte{ + // 194 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xce, 0xcf, 0xc9, + 0xcc, 0x4b, 0x4d, 0x2c, 0x4a, 0xce, 0x2f, 0x4a, 0xd5, 0xcf, 0xc9, 0x4f, 0xce, 0x4e, 0x4d, 0x89, + 0x2f, 0x2d, 0x4e, 0x2d, 0x2a, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x85, 0x29, 0xd0, + 0x43, 0x56, 0xa9, 0xd4, 0xc3, 0xc8, 0xc5, 0xed, 0x03, 0x56, 0x1d, 0x0a, 0x52, 0x2c, 0xe4, 0xcc, + 0xc5, 0x0a, 0xd6, 0x25, 0xc1, 0xa8, 0xc0, 0xac, 0xc1, 0x6d, 0xa4, 0xab, 0x87, 0x55, 0x9b, 0x1e, + 0x92, 0x16, 0x3d, 0x30, 0xe9, 0x9a, 0x57, 0x52, 0x54, 0x19, 0x04, 0xd1, 0x2b, 0x65, 0xc1, 0xc5, + 0x85, 0x10, 0x14, 0x12, 0xe0, 0x62, 0xce, 0x4e, 0xad, 0x94, 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0c, + 0x02, 0x31, 0x85, 0x44, 0xb8, 0x58, 0xcb, 0x12, 0x73, 0x4a, 0x53, 0x25, 0x98, 0xc0, 0x62, 0x10, + 0x8e, 0x15, 0x93, 0x05, 0xa3, 0x93, 0xf9, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, + 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, + 0x44, 0xc9, 0xc2, 0xec, 0xd7, 0xaf, 0xd0, 0x47, 0xf1, 0x6b, 0x49, 0x65, 0x41, 0x6a, 0x71, 0x12, + 0x1b, 0xd8, 0x97, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x58, 0x07, 0xd9, 0x09, 0x08, 0x01, + 0x00, 0x00, +} + +func (m *LockedUsers) 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 *LockedUsers) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LockedUsers) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Users) > 0 { + for k := range m.Users { + v := m.Users[k] + baseI := i + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintLockedUsers(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintLockedUsers(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintLockedUsers(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func encodeVarintLockedUsers(dAtA []byte, offset int, v uint64) int { + offset -= sovLockedUsers(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *LockedUsers) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Users) > 0 { + for k, v := range m.Users { + _ = k + _ = v + mapEntrySize := 1 + len(k) + sovLockedUsers(uint64(len(k))) + 1 + len(v) + sovLockedUsers(uint64(len(v))) + n += mapEntrySize + 1 + sovLockedUsers(uint64(mapEntrySize)) + } + } + return n +} + +func sovLockedUsers(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozLockedUsers(x uint64) (n int) { + return sovLockedUsers(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *LockedUsers) 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 ErrIntOverflowLockedUsers + } + 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: LockedUsers: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LockedUsers: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Users", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLockedUsers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthLockedUsers + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthLockedUsers + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Users == nil { + m.Users = make(map[string]string) + } + var mapkey string + var mapvalue string + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLockedUsers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + var stringLenmapkey uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLockedUsers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapkey |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapkey := int(stringLenmapkey) + if intStringLenmapkey < 0 { + return ErrInvalidLengthLockedUsers + } + postStringIndexmapkey := iNdEx + intStringLenmapkey + if postStringIndexmapkey < 0 { + return ErrInvalidLengthLockedUsers + } + if postStringIndexmapkey > l { + return io.ErrUnexpectedEOF + } + mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) + iNdEx = postStringIndexmapkey + } else if fieldNum == 2 { + var stringLenmapvalue uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowLockedUsers + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLenmapvalue |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLenmapvalue := int(stringLenmapvalue) + if intStringLenmapvalue < 0 { + return ErrInvalidLengthLockedUsers + } + postStringIndexmapvalue := iNdEx + intStringLenmapvalue + if postStringIndexmapvalue < 0 { + return ErrInvalidLengthLockedUsers + } + if postStringIndexmapvalue > l { + return io.ErrUnexpectedEOF + } + mapvalue = string(dAtA[iNdEx:postStringIndexmapvalue]) + iNdEx = postStringIndexmapvalue + } else { + iNdEx = entryPreIndex + skippy, err := skipLockedUsers(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLockedUsers + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + m.Users[mapkey] = mapvalue + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipLockedUsers(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthLockedUsers + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipLockedUsers(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLockedUsers + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLockedUsers + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowLockedUsers + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthLockedUsers + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupLockedUsers + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthLockedUsers + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthLockedUsers = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowLockedUsers = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupLockedUsers = fmt.Errorf("proto: unexpected end of group") +) diff --git a/x/colinearcore/types/message_lock_funds.go b/x/colinearcore/types/message_lock_funds.go new file mode 100644 index 0000000..7ebf841 --- /dev/null +++ b/x/colinearcore/types/message_lock_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 TypeMsgLockFunds = "lock_funds" + +var _ sdk.Msg = &MsgLockFunds{} + +func NewMsgLockFunds(creator string) *MsgLockFunds { + return &MsgLockFunds{ + Creator: creator, + } +} + +func (msg *MsgLockFunds) Route() string { + return RouterKey +} + +func (msg *MsgLockFunds) Type() string { + return TypeMsgLockFunds +} + +func (msg *MsgLockFunds) GetSigners() []sdk.AccAddress { + creator, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{creator} +} + +func (msg *MsgLockFunds) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgLockFunds) 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_lock_funds_test.go b/x/colinearcore/types/message_lock_funds_test.go new file mode 100644 index 0000000..97a2275 --- /dev/null +++ b/x/colinearcore/types/message_lock_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 TestMsgLockFunds_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg MsgLockFunds + err error + }{ + { + name: "invalid address", + msg: MsgLockFunds{ + Creator: "invalid_address", + }, + err: sdkerrors.ErrInvalidAddress, + }, { + name: "valid address", + msg: MsgLockFunds{ + 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/query.pb.go b/x/colinearcore/types/query.pb.go index 5475c54..019e329 100644 --- a/x/colinearcore/types/query.pb.go +++ b/x/colinearcore/types/query.pb.go @@ -465,6 +465,86 @@ func (m *QueryAuctionBidsResponse) GetBids() []*Bid { return nil } +type QueryGetLockedUsersRequest struct { +} + +func (m *QueryGetLockedUsersRequest) Reset() { *m = QueryGetLockedUsersRequest{} } +func (m *QueryGetLockedUsersRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetLockedUsersRequest) ProtoMessage() {} +func (*QueryGetLockedUsersRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7b40a5389bf6a896, []int{10} +} +func (m *QueryGetLockedUsersRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetLockedUsersRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetLockedUsersRequest.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 *QueryGetLockedUsersRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetLockedUsersRequest.Merge(m, src) +} +func (m *QueryGetLockedUsersRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetLockedUsersRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetLockedUsersRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetLockedUsersRequest proto.InternalMessageInfo + +type QueryGetLockedUsersResponse struct { + LockedUsers LockedUsers `protobuf:"bytes,1,opt,name=LockedUsers,proto3" json:"LockedUsers"` +} + +func (m *QueryGetLockedUsersResponse) Reset() { *m = QueryGetLockedUsersResponse{} } +func (m *QueryGetLockedUsersResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetLockedUsersResponse) ProtoMessage() {} +func (*QueryGetLockedUsersResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7b40a5389bf6a896, []int{11} +} +func (m *QueryGetLockedUsersResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetLockedUsersResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetLockedUsersResponse.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 *QueryGetLockedUsersResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetLockedUsersResponse.Merge(m, src) +} +func (m *QueryGetLockedUsersResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetLockedUsersResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetLockedUsersResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetLockedUsersResponse proto.InternalMessageInfo + +func (m *QueryGetLockedUsersResponse) GetLockedUsers() LockedUsers { + if m != nil { + return m.LockedUsers + } + return LockedUsers{} +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "colinear.colinearcore.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "colinear.colinearcore.QueryParamsResponse") @@ -476,51 +556,57 @@ func init() { proto.RegisterType((*QueryAllAuctionResponse)(nil), "colinear.colinearcore.QueryAllAuctionResponse") proto.RegisterType((*QueryAuctionBidsRequest)(nil), "colinear.colinearcore.QueryAuctionBidsRequest") proto.RegisterType((*QueryAuctionBidsResponse)(nil), "colinear.colinearcore.QueryAuctionBidsResponse") + proto.RegisterType((*QueryGetLockedUsersRequest)(nil), "colinear.colinearcore.QueryGetLockedUsersRequest") + proto.RegisterType((*QueryGetLockedUsersResponse)(nil), "colinear.colinearcore.QueryGetLockedUsersResponse") } func init() { proto.RegisterFile("colinearcore/query.proto", fileDescriptor_7b40a5389bf6a896) } var fileDescriptor_7b40a5389bf6a896 = []byte{ - // 610 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x95, 0xc1, 0x6b, 0x13, 0x41, - 0x14, 0xc6, 0x33, 0xb5, 0x4d, 0x71, 0x7a, 0x1b, 0x6b, 0xad, 0x6b, 0xbb, 0xd5, 0x51, 0xac, 0x09, - 0x3a, 0x43, 0xe2, 0xa1, 0x07, 0x41, 0x48, 0x0e, 0x16, 0x7a, 0x90, 0xba, 0x37, 0xbd, 0xd4, 0x49, - 0x32, 0x2c, 0x0b, 0xdb, 0x9d, 0x6d, 0x76, 0x23, 0x29, 0xe2, 0xc5, 0xa3, 0x27, 0xc1, 0x83, 0x17, - 0x41, 0x10, 0xc4, 0x7f, 0xa5, 0xc7, 0x82, 0x17, 0x4f, 0x22, 0x89, 0x7f, 0x88, 0x64, 0xe6, 0x2d, - 0xee, 0x74, 0x93, 0x4d, 0x7a, 0x4b, 0xe6, 0x7d, 0xdf, 0xfb, 0x7e, 0xb3, 0x79, 0x2f, 0x8b, 0x37, - 0xbb, 0x2a, 0x0c, 0x22, 0x29, 0xfa, 0x5d, 0xd5, 0x97, 0xfc, 0x64, 0x20, 0xfb, 0xa7, 0x2c, 0xee, - 0xab, 0x54, 0x91, 0xeb, 0x59, 0x85, 0xe5, 0x25, 0xce, 0xba, 0xaf, 0x7c, 0xa5, 0x15, 0x7c, 0x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35, 0x35, 0xdb, 0x43, 0x52, 0x2f, - 0x61, 0x03, 0x2c, 0xfe, 0x56, 0x0f, 0xca, 0x3b, 0xf2, 0x19, 0x61, 0x0c, 0x7d, 0x5a, 0x61, 0x58, - 0x4e, 0x58, 0xd8, 0xc2, 0x72, 0xc2, 0xe2, 0x46, 0xd1, 0xba, 0x26, 0xbc, 0x47, 0xe8, 0x7c, 0x42, - 0xf2, 0x03, 0xe1, 0xb5, 0xdc, 0xfc, 0x92, 0xf2, 0xac, 0xc2, 0x66, 0x38, 0x7c, 0x61, 0x3d, 0xc0, - 0xed, 0x69, 0xb8, 0x06, 0xe1, 0xf3, 0xe1, 0x8e, 0x26, 0x9b, 0x91, 0x3d, 0xc3, 0xf6, 0xde, 0xd9, - 0xc8, 0x45, 0xe7, 0x23, 0x17, 0xfd, 0x19, 0xb9, 0xe8, 0xe3, 0xd8, 0xad, 0x9c, 0x8f, 0xdd, 0xca, - 0xaf, 0xb1, 0x5b, 0x79, 0xb5, 0x9d, 0x99, 0xf9, 0xd0, 0xee, 0x93, 0x9e, 0xc6, 0x32, 0xe9, 0x54, - 0xf5, 0x3b, 0xe6, 0xf1, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x03, 0x0b, 0x40, 0x22, 0x66, 0x07, - 0x00, 0x00, + // 675 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x95, 0x3d, 0x6f, 0xd3, 0x40, + 0x1c, 0xc6, 0x73, 0xa5, 0x2f, 0xe2, 0xba, 0x1d, 0xa5, 0x14, 0xd3, 0xba, 0x70, 0x05, 0x4a, 0x03, + 0xf8, 0x94, 0x30, 0x74, 0x40, 0x42, 0x6a, 0x06, 0x2a, 0x55, 0x08, 0x15, 0x4b, 0x0c, 0xb0, 0x84, + 0x4b, 0x7c, 0xb2, 0x2c, 0x5c, 0x9f, 0x6b, 0x3b, 0x28, 0x15, 0x62, 0x61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, 0x42, 0x8e, 0xef, 0x0a, 0xde, 0x5b, 0x68, 0x63, 0x8c, 0x48, 0x26, 0x7e, 0x56, 0x5b, 0xdb, + 0xc7, 0x03, 0x13, 0x9c, 0x0c, 0x4c, 0xf0, 0x77, 0x60, 0x82, 0x8f, 0x43, 0xb3, 0x76, 0x32, 0x34, + 0x6b, 0xbf, 0x87, 0x66, 0xed, 0xe5, 0xda, 0x78, 0xba, 0xaf, 0xcf, 0x27, 0x47, 0x21, 0x8b, 0x3b, + 0xf3, 0xe2, 0x83, 0xfc, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd1, 0xf1, 0xb6, 0x7a, 0xb4, + 0x08, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -545,6 +631,8 @@ type QueryClient interface { AuctionAll(ctx context.Context, in *QueryAllAuctionRequest, opts ...grpc.CallOption) (*QueryAllAuctionResponse, error) // Queries a list of AuctionBids items. AuctionBids(ctx context.Context, in *QueryAuctionBidsRequest, opts ...grpc.CallOption) (*QueryAuctionBidsResponse, error) + // Queries a LockedUsers by index. + LockedUsers(ctx context.Context, in *QueryGetLockedUsersRequest, opts ...grpc.CallOption) (*QueryGetLockedUsersResponse, error) } type queryClient struct { @@ -600,6 +688,15 @@ func (c *queryClient) AuctionBids(ctx context.Context, in *QueryAuctionBidsReque return out, nil } +func (c *queryClient) LockedUsers(ctx context.Context, in *QueryGetLockedUsersRequest, opts ...grpc.CallOption) (*QueryGetLockedUsersResponse, error) { + out := new(QueryGetLockedUsersResponse) + err := c.cc.Invoke(ctx, "/colinear.colinearcore.Query/LockedUsers", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Parameters queries the parameters of the module. @@ -612,6 +709,8 @@ type QueryServer interface { AuctionAll(context.Context, *QueryAllAuctionRequest) (*QueryAllAuctionResponse, error) // Queries a list of AuctionBids items. AuctionBids(context.Context, *QueryAuctionBidsRequest) (*QueryAuctionBidsResponse, error) + // Queries a LockedUsers by index. + LockedUsers(context.Context, *QueryGetLockedUsersRequest) (*QueryGetLockedUsersResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -633,6 +732,9 @@ func (*UnimplementedQueryServer) AuctionAll(ctx context.Context, req *QueryAllAu func (*UnimplementedQueryServer) AuctionBids(ctx context.Context, req *QueryAuctionBidsRequest) (*QueryAuctionBidsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method AuctionBids not implemented") } +func (*UnimplementedQueryServer) LockedUsers(ctx context.Context, req *QueryGetLockedUsersRequest) (*QueryGetLockedUsersResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LockedUsers not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -728,6 +830,24 @@ func _Query_AuctionBids_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } +func _Query_LockedUsers_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetLockedUsersRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).LockedUsers(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/colinear.colinearcore.Query/LockedUsers", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).LockedUsers(ctx, req.(*QueryGetLockedUsersRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "colinear.colinearcore.Query", HandlerType: (*QueryServer)(nil), @@ -752,6 +872,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "AuctionBids", Handler: _Query_AuctionBids_Handler, }, + { + MethodName: "LockedUsers", + Handler: _Query_LockedUsers_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "colinearcore/query.proto", @@ -1083,6 +1207,62 @@ func (m *QueryAuctionBidsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *QueryGetLockedUsersRequest) 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 *QueryGetLockedUsersRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetLockedUsersRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryGetLockedUsersResponse) 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 *QueryGetLockedUsersResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetLockedUsersResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.LockedUsers.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -1218,6 +1398,26 @@ func (m *QueryAuctionBidsResponse) Size() (n int) { return n } +func (m *QueryGetLockedUsersRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryGetLockedUsersResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.LockedUsers.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -2027,6 +2227,139 @@ func (m *QueryAuctionBidsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryGetLockedUsersRequest) 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 ErrIntOverflowQuery + } + 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: QueryGetLockedUsersRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetLockedUsersRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetLockedUsersResponse) 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 ErrIntOverflowQuery + } + 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: QueryGetLockedUsersResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetLockedUsersResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LockedUsers", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LockedUsers.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/colinearcore/types/query.pb.gw.go b/x/colinearcore/types/query.pb.gw.go index b02134c..9f29494 100644 --- a/x/colinearcore/types/query.pb.gw.go +++ b/x/colinearcore/types/query.pb.gw.go @@ -213,6 +213,24 @@ func local_request_Query_AuctionBids_0(ctx context.Context, marshaler runtime.Ma } +func request_Query_LockedUsers_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetLockedUsersRequest + var metadata runtime.ServerMetadata + + msg, err := client.LockedUsers(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_LockedUsers_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetLockedUsersRequest + var metadata runtime.ServerMetadata + + msg, err := server.LockedUsers(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -334,6 +352,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_LockedUsers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_LockedUsers_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_LockedUsers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -475,6 +516,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_LockedUsers_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_LockedUsers_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_LockedUsers_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -488,6 +549,8 @@ var ( pattern_Query_AuctionAll_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 0, 2, 1}, []string{"colinearcore", "auction"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_AuctionBids_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 0, 2, 1, 1, 0, 4, 1, 5, 2}, []string{"colinearcore", "auction_bids", "index"}, "", runtime.AssumeColonVerbOpt(true))) + + pattern_Query_LockedUsers_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"colinear", "colinearcore", "locked_users"}, "", runtime.AssumeColonVerbOpt(true))) ) var ( @@ -500,4 +563,6 @@ var ( forward_Query_AuctionAll_0 = runtime.ForwardResponseMessage forward_Query_AuctionBids_0 = runtime.ForwardResponseMessage + + forward_Query_LockedUsers_0 = runtime.ForwardResponseMessage ) diff --git a/x/colinearcore/types/tx.pb.go b/x/colinearcore/types/tx.pb.go index a462271..20e060c 100644 --- a/x/colinearcore/types/tx.pb.go +++ b/x/colinearcore/types/tx.pb.go @@ -251,38 +251,123 @@ func (m *MsgNewBidResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgNewBidResponse proto.InternalMessageInfo +type MsgLockFunds struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` +} + +func (m *MsgLockFunds) Reset() { *m = MsgLockFunds{} } +func (m *MsgLockFunds) String() string { return proto.CompactTextString(m) } +func (*MsgLockFunds) ProtoMessage() {} +func (*MsgLockFunds) Descriptor() ([]byte, []int) { + return fileDescriptor_0c3854a2a9bba3b4, []int{4} +} +func (m *MsgLockFunds) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgLockFunds) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgLockFunds.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 *MsgLockFunds) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgLockFunds.Merge(m, src) +} +func (m *MsgLockFunds) XXX_Size() int { + return m.Size() +} +func (m *MsgLockFunds) XXX_DiscardUnknown() { + xxx_messageInfo_MsgLockFunds.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgLockFunds proto.InternalMessageInfo + +func (m *MsgLockFunds) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +type MsgLockFundsResponse struct { +} + +func (m *MsgLockFundsResponse) Reset() { *m = MsgLockFundsResponse{} } +func (m *MsgLockFundsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgLockFundsResponse) ProtoMessage() {} +func (*MsgLockFundsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_0c3854a2a9bba3b4, []int{5} +} +func (m *MsgLockFundsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgLockFundsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgLockFundsResponse.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 *MsgLockFundsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgLockFundsResponse.Merge(m, src) +} +func (m *MsgLockFundsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgLockFundsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgLockFundsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgLockFundsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgNewAuction)(nil), "colinear.colinearcore.MsgNewAuction") proto.RegisterType((*MsgNewAuctionResponse)(nil), "colinear.colinearcore.MsgNewAuctionResponse") proto.RegisterType((*MsgNewBid)(nil), "colinear.colinearcore.MsgNewBid") proto.RegisterType((*MsgNewBidResponse)(nil), "colinear.colinearcore.MsgNewBidResponse") + proto.RegisterType((*MsgLockFunds)(nil), "colinear.colinearcore.MsgLockFunds") + proto.RegisterType((*MsgLockFundsResponse)(nil), "colinear.colinearcore.MsgLockFundsResponse") } func init() { proto.RegisterFile("colinearcore/tx.proto", fileDescriptor_0c3854a2a9bba3b4) } var fileDescriptor_0c3854a2a9bba3b4 = []byte{ - // 336 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x92, 0xc1, 0x4a, 0xc3, 0x40, - 0x10, 0x86, 0xbb, 0xb6, 0x8d, 0x76, 0xd4, 0x83, 0xab, 0x95, 0xa5, 0x68, 0x08, 0xc1, 0x43, 0x0f, - 0x92, 0x82, 0x22, 0x9e, 0x2d, 0x78, 0xf0, 0x50, 0x0f, 0xc5, 0x93, 0x27, 0xd7, 0xec, 0x50, 0x16, - 0xda, 0xdd, 0x90, 0x4d, 0xb1, 0xbe, 0x85, 0xef, 0xe1, 0x33, 0x78, 0xf7, 0xd8, 0xa3, 0x47, 0x69, - 0x5f, 0x44, 0xdc, 0x6c, 0x62, 0x03, 0x52, 0xbd, 0xe5, 0xff, 0x66, 0xfe, 0xc9, 0xfc, 0xc9, 0x40, - 0x3b, 0xd6, 0x63, 0xa9, 0x90, 0xa7, 0xb1, 0x4e, 0xb1, 0x97, 0xcd, 0xa2, 0x24, 0xd5, 0x99, 0xa6, - 0x25, 0x8e, 0x56, 0xeb, 0xe1, 0x2b, 0x81, 0xdd, 0x81, 0x19, 0xdd, 0xe2, 0xd3, 0xd5, 0x34, 0xce, - 0xa4, 0x56, 0x94, 0xc1, 0x66, 0x9c, 0x22, 0xcf, 0x74, 0xca, 0x48, 0x40, 0xba, 0xad, 0x61, 0x21, - 0x29, 0x85, 0x86, 0xe2, 0x13, 0x64, 0x1b, 0x16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xcd, 0xa3, 0x67, - 0x6f, 0xee, 0xfc, 0x2b, 0x00, 0x00, 0xff, 0xff, 0xe4, 0x6a, 0x01, 0x5c, 0x8c, 0x02, 0x00, 0x00, + // 376 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcb, 0x4a, 0xc3, 0x40, + 0x14, 0x6d, 0xfa, 0x88, 0xe6, 0x5a, 0x17, 0x8e, 0x6d, 0x09, 0x41, 0x43, 0x88, 0x2e, 0x02, 0x4a, + 0x0a, 0x8a, 0xb8, 0xb6, 0xa0, 0x20, 0x58, 0x17, 0xc5, 0x95, 0x20, 0x18, 0x33, 0x97, 0x10, 0x6c, + 0x67, 0x42, 0x26, 0xc5, 0xfa, 0x17, 0x7e, 0x80, 0x7f, 0xe0, 0x8f, 0xb8, 0xec, 0xd2, 0xa5, 0xb4, + 0x3f, 0x22, 0xe6, 0xd5, 0x04, 0x6c, 0xed, 0x6e, 0xce, 0x99, 0x73, 0xce, 0xdc, 0x7b, 0x87, 0x0b, + 0x6d, 0x97, 0x0f, 0x7d, 0x86, 0x4e, 0xe8, 0xf2, 0x10, 0xbb, 0xd1, 0xc4, 0x0e, 0x42, 0x1e, 0x71, + 0x92, 0xd3, 0x76, 0xf1, 0xde, 0xfc, 0x90, 0x60, 0xbb, 0x2f, 0xbc, 0x5b, 0x7c, 0xb9, 0x18, 0xbb, + 0x91, 0xcf, 0x19, 0x51, 0x61, 0xc3, 0x0d, 0xd1, 0x89, 0x78, 0xa8, 0x4a, 0x86, 0x64, 0x29, 0x83, + 0x0c, 0x12, 0x02, 0x75, 0xe6, 0x8c, 0x50, 0xad, 0xc6, 0x74, 0x7c, 0x26, 0x06, 0x6c, 0x51, 0x14, + 0x6e, 0xe8, 0x07, 0xbf, 0x66, 0xb5, 0x16, 0x5f, 0x15, 0xa9, 0x38, 0x0f, 0xfd, 0xa1, 0xcf, 0x3c, + 0xb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xf9, 0x9a, 0xeb, 0x95, 0xfb, 0xfd, 0xcc, 0xdc, 0x9d, 0x74, + 0xcb, 0x0b, 0xf1, 0x1a, 0xa0, 0x78, 0x92, 0xe3, 0xa5, 0x38, 0xfd, 0x09, 0x00, 0x00, 0xff, 0xff, + 0x3b, 0x99, 0x2d, 0x8c, 0x2d, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -299,6 +384,7 @@ const _ = grpc.SupportPackageIsVersion4 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) } type msgClient struct { @@ -327,10 +413,20 @@ func (c *msgClient) NewBid(ctx context.Context, in *MsgNewBid, opts ...grpc.Call return out, nil } +func (c *msgClient) LockFunds(ctx context.Context, in *MsgLockFunds, opts ...grpc.CallOption) (*MsgLockFundsResponse, error) { + out := new(MsgLockFundsResponse) + err := c.cc.Invoke(ctx, "/colinear.colinearcore.Msg/LockFunds", 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) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -343,6 +439,9 @@ func (*UnimplementedMsgServer) NewAuction(ctx context.Context, req *MsgNewAuctio func (*UnimplementedMsgServer) NewBid(ctx context.Context, req *MsgNewBid) (*MsgNewBidResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method NewBid not implemented") } +func (*UnimplementedMsgServer) LockFunds(ctx context.Context, req *MsgLockFunds) (*MsgLockFundsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method LockFunds not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -384,6 +483,24 @@ func _Msg_NewBid_Handler(srv interface{}, ctx context.Context, dec func(interfac return interceptor(ctx, in, info, handler) } +func _Msg_LockFunds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgLockFunds) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).LockFunds(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/colinear.colinearcore.Msg/LockFunds", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).LockFunds(ctx, req.(*MsgLockFunds)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "colinear.colinearcore.Msg", HandlerType: (*MsgServer)(nil), @@ -396,6 +513,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "NewBid", Handler: _Msg_NewBid_Handler, }, + { + MethodName: "LockFunds", + Handler: _Msg_LockFunds_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "colinearcore/tx.proto", @@ -561,6 +682,59 @@ func (m *MsgNewBidResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgLockFunds) 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 *MsgLockFunds) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgLockFunds) 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 *MsgLockFundsResponse) 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 *MsgLockFundsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgLockFundsResponse) 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 @@ -647,6 +821,28 @@ func (m *MsgNewBidResponse) Size() (n int) { return n } +func (m *MsgLockFunds) 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 *MsgLockFundsResponse) 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 } @@ -1160,6 +1356,138 @@ func (m *MsgNewBidResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgLockFunds) 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: MsgLockFunds: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgLockFunds: 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 *MsgLockFundsResponse) 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: MsgLockFundsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgLockFundsResponse: 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