Skip to content

Commit

Permalink
change rollapp tags map to list
Browse files Browse the repository at this point in the history
  • Loading branch information
zale144 committed Nov 28, 2024
1 parent b313363 commit 60a187b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
6 changes: 1 addition & 5 deletions x/rollapp/keeper/grpc_query_rollapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,7 @@ func getSummaryResponse(ctx sdk.Context, k Keeper, rollapp types.Rollapp, ok, wi
// Tags returns all the tags available for rollapps.
// The order is non-deterministic.
func (k Keeper) Tags(context.Context, *types.QueryTagsRequest) (*types.QueryTagsResponse, error) {
tags := make([]string, 0, len(types.RollappTags))
for tag := range types.RollappTags {
tags = append(tags, tag)
}
return &types.QueryTagsResponse{
Tags: tags,
Tags: types.RollappTags,
}, nil
}
25 changes: 13 additions & 12 deletions x/rollapp/types/rollapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"net/url"
"slices"
"strings"

errorsmod "cosmossdk.io/errors"
Expand All @@ -23,17 +24,17 @@ const (
)

// RollappTags are hardcoded for now TODO: manage them through the store
var RollappTags = map[string]struct{}{
"Meme": {},
"AI": {},
"DeFI": {},
"NFT": {},
"Gaming": {},
"Betting": {},
"Community": {},
"Social": {},
"DePIN": {},
"Launchpad": {},
var RollappTags = []string{
"Meme",
"AI",
"DeFI",
"NFT",
"Gaming",
"Betting",
"Community",
"Social",
"DePIN",
"Launchpad",
}

type AllowedDecimals uint32
Expand Down Expand Up @@ -253,7 +254,7 @@ func (md *RollappMetadata) Validate() error {
seen := make(map[string]struct{})

for _, tag := range md.Tags {
if _, ok := RollappTags[tag]; !ok {
if !slices.Contains(RollappTags, tag) {
return ErrInvalidTag
}
if _, ok := seen[tag]; ok {
Expand Down

0 comments on commit 60a187b

Please sign in to comment.