Skip to content

Commit

Permalink
fix: add_artwork permisions
Browse files Browse the repository at this point in the history
  • Loading branch information
lxgr-linux committed Oct 23, 2024
1 parent 3aec59b commit 1b036cd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions x/cardchain/keeper/msg_server_add_artwork.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ func (k msgServer) AddArtwork(goCtx context.Context, msg *types.MsgAddArtwork) (
card := k.Cards.Get(ctx, msg.CardId)
image := k.Images.Get(ctx, card.ImageId)

// TODO
//if card.Status != types.Status_prototype {
// return nil, sdkerrors.Wrap(types.ErrInvalidCardStatus, "Card has to be a prototype to be changeable")
//}
councilEnabled, err := k.FeatureFlagModuleInstance.Get(ctx, string(types.FeatureFlagName_Council))
if err != nil {
return nil, err
}

if councilEnabled && card.Status != types.Status_prototype && card.Status != types.Status_scheme {
return nil, sdkerrors.Wrap(types.ErrInvalidCardStatus, "Card has to be a prototype to be changeable")
}

if card.Artist != msg.Creator {
return nil, sdkerrors.Wrap(errors.ErrUnauthorized, "Incorrect Artist")
Expand Down

0 comments on commit 1b036cd

Please sign in to comment.