diff --git a/x/market/keeper/msg_server_create_drop.go b/x/market/keeper/msg_server_create_drop.go index abfbb46..7e05605 100644 --- a/x/market/keeper/msg_server_create_drop.go +++ b/x/market/keeper/msg_server_create_drop.go @@ -46,8 +46,12 @@ func (k msgServer) CreateDrop(goCtx context.Context, msg *types.MsgCreateDrop) ( return nil, types.ErrMemberBalanceZero } + // Create the uid + uid := k.GetUidCount(ctx) + _ = memberA _ = memberB + _ = uid.Count return &types.MsgCreateDropResponse{}, nil } diff --git a/x/market/keeper/uid.go b/x/market/keeper/uid.go index 444b4bd..031a428 100644 --- a/x/market/keeper/uid.go +++ b/x/market/keeper/uid.go @@ -1,22 +1,25 @@ package keeper import ( - "github.com/cosmos/cosmos-sdk/runtime" - "context" "onex/x/market/types" + + "cosmossdk.io/math" + "github.com/cosmos/cosmos-sdk/runtime" ) -// GetParams get all parameters as types.Params +// GetUidCount gets the current unique identifier func (k Keeper) GetUidCount( ctx context.Context, -) (uid types.Uid, found bool) { +) (uid types.Uid) { store := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) bz := store.Get(types.UidKey()) if bz == nil { - return uid, false + return types.Uid{ + Count: math.OneInt().Uint64(), + } } k.cdc.MustUnmarshal(bz, &uid) - return uid, true + return uid }