Skip to content

Commit

Permalink
chore: move validation logic to validate function
Browse files Browse the repository at this point in the history
  • Loading branch information
jaeseung-bae committed Mar 15, 2024
1 parent c65474c commit 90b8a45
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
7 changes: 5 additions & 2 deletions x/collection/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@ func ValidateGenesis(data GenesisState) error {
if len(contractNextTokenIDs.TokenIds) == 0 {
return sdkerrors.ErrInvalidRequest.Wrap("next token ids cannot be empty")
}
for _, nextTokenIDs := range contractNextTokenIDs.TokenIds {
if err := ValidateClassID(nextTokenIDs.ClassId); err != nil {
for _, nextTokenID := range contractNextTokenIDs.TokenIds {
if nextTokenID.Id.IsZero() {
return sdkerrors.ErrInvalidRequest.Wrap("nextTokenID.Id is not supposed to be zero")
}
if err := ValidateClassID(nextTokenID.ClassId); err != nil {
return err
}
}
Expand Down
3 changes: 0 additions & 3 deletions x/collection/keeper/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,6 @@ func (k Keeper) InitGenesis(ctx sdk.Context, data *collection.GenesisState) {
contractID := contractNextTokenIDs.ContractId

for _, nextTokenID := range contractNextTokenIDs.TokenIds {
if nextTokenID.Id.IsZero() {
panic("nextTokenID.Id is not supposed to be zero")
}
k.setNextTokenID(ctx, contractID, nextTokenID.ClassId, nextTokenID.Id)
}

Expand Down

0 comments on commit 90b8a45

Please sign in to comment.