34 lines
990 B
Go
34 lines
990 B
Go
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})
|
|
}
|