Skip to content

Commit

Permalink
fix(onft): royalty splits update (#135)
Browse files Browse the repository at this point in the history
* update onft genesis validation

* update example cmds with royalty receivers

* fix royalty splits update tx
  • Loading branch information
harish551 authored Jan 31, 2024
1 parent ad4e06b commit e6d15ae
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
6 changes: 3 additions & 3 deletions x/onft/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ func GetCmdCreateDenom() *cobra.Command {
fmt.Sprintf(`Create a new denom.
Example:
$ %s tx onft create [symbol] --name=<name> --schema=<schema> --description=<description>
--uri=<uri> --uri-hash=<uri hash> --preview-uri=<preview-uri> --creation-fee <fee>
--chain-id=<chain-id> --from=<key-name> --fees=<fee>`,
--uri=<uri> --uri-hash=<uri hash> --preview-uri=<preview-uri> --royalty-receivers=<"addr1:weight,addr2:weight">
--creation-fee <fee> --chain-id=<chain-id> --from=<key-name> --fees=<fee>`,
version.AppName,
),
),
Expand Down Expand Up @@ -296,7 +296,7 @@ func GetCmdUpdateDenom() *cobra.Command {
fmt.Sprintf(`Edit the data of Denom.
Example:
$ %s tx onft update-denom [denom-id] --name=<onft-name> --description=<onft-description>
--preview-uri=<uri> --from=<key-name> --chain-id=<chain-id> --fees=<fee>`,
--preview-uri=<uri> --royalty-receivers="addr1:weight,addr2:weight" --from=<key-name> --chain-id=<chain-id> --fees=<fee>`,
version.AppName,
),
),
Expand Down
9 changes: 5 additions & 4 deletions x/onft/keeper/denom.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,11 @@ func (k Keeper) UpdateDenom(ctx sdk.Context, msg *types.MsgUpdateDenom) error {
}

denomMetadata := &types.DenomMetadata{
Creator: denom.Creator,
Schema: denom.Schema,
PreviewUri: denom.PreviewURI,
Data: denom.Data,
Creator: denom.Creator,
Schema: denom.Schema,
PreviewUri: denom.PreviewURI,
Data: denom.Data,
RoyaltyReceivers: denom.RoyaltyReceivers,
}
if msg.PreviewURI != types.DoNotModify {
denomMetadata.PreviewUri = msg.PreviewURI
Expand Down
5 changes: 5 additions & 0 deletions x/onft/types/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ func ValidateGenesis(data GenesisState) error {
if err := ValidateURI(c.Denom.PreviewURI); err != nil {
return err
}
if c.Denom.RoyaltyReceivers != nil {
if err := ValidateWeightedAddresses(c.Denom.RoyaltyReceivers); err != nil {
return err
}
}

for _, nft := range c.ONFTs {
if nft.GetOwner().Empty() {
Expand Down

0 comments on commit e6d15ae

Please sign in to comment.