Skip to content

Commit

Permalink
add privilage store
Browse files Browse the repository at this point in the history
  • Loading branch information
GNaD13 committed Jul 11, 2024
1 parent f0798bc commit d89525f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
Empty file added x/asset/keeper/privilege.go
Empty file.
27 changes: 27 additions & 0 deletions x/asset/keeper/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,30 @@ func (k Keeper) GetTokenManagement(ctx sdk.Context, tokenId string) (types.Token

return token, true
}

func (k Keeper) SetTokenPrivilegedAccount(
ctx sdk.Context,
tokenId string,
privilege string,
address sdk.AccAddress,
) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.PrivilegedAccountsKey)
key := append([]byte(tokenId), []byte(privilege)...)
store.Set(key, address)
}

func (k Keeper) GetTokenPrivilegedAccount(
ctx sdk.Context,
tokenId string,
privilege string,
) (sdk.AccAddress, bool) {
store := prefix.NewStore(ctx.KVStore(k.storeKey), types.PrivilegedAccountsKey)
key := append([]byte(tokenId), []byte(privilege)...)

bz := store.Get(key)
if bz == nil {
return sdk.AccAddress{}, false
}

return sdk.AccAddress(bz), true
}

0 comments on commit d89525f

Please sign in to comment.