Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ADR-043 BaseNFT Module #9284

Closed
wants to merge 2 commits into from
Closed

Add ADR-043 BaseNFT Module #9284

wants to merge 2 commits into from

Conversation

hulatown
Copy link

@hulatown hulatown commented May 8, 2021

Description

ref: #9174 #9065

This ADR defines a generic NFT module of x/nft which supports NFTs as a proto.Any and contains BaseNFT as the default implementation.


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer
  • Review Codecov Report in the comment section below once CI passes

@github-actions github-actions bot added T: ADR An issue or PR relating to an architectural decision record T:Docs Changes and features related to documentation. labels May 8, 2021

DRAFT

## Abstract
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @hulatown! But this ADR does not mention or talk about what NFTs are, why they're needed in the SDK, what owners are, what IDs are and their relationships. Any chance you can expand upon this ADR a bit more please?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd personally like to see a written tradeoff analysis of the alternatives outlined in the Context section, i.e why is this the best approach?

Copy link
Member

@tac0turtle tac0turtle May 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was discussed this module would have its own go.mod. This would coincide with needing direct owners for maintenance. Would be good to add a few sentences on this.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it! Thank you Alex, Fede and Marko! Will expand more on the introduction part.

}
```

We will also create `BaseNFT` as the default implementation of the `NFTI` interface:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explain what a base NFT is and why is it called Base


```go
// NFTI is an interface used to store NFTs at a given id and owner.
type NFTI interface {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type NFTI interface {
type NFT interface {

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it! Is the naming convention is the interface name without "I"? I see mixed usage in different places, like: https://github.com/cosmos/cosmos-sdk/blob/master/x/auth/keeper/keeper.go But will follow the convention suggestion

// NFTI is an interface used to store NFTs at a given id and owner.
type NFTI interface {
GetId() string // can not return empty string.
GetOwner() sdk.AccAddress
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the Owner expected to always be included on the NFT itself? why not have it as a second index key for the nft?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
GetOwner() sdk.AccAddress
GetOwner() sdk.AccAddress
Validate() error

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is the Owner expected to always be included on the NFT itself?

I think it's needed, and we should keep the transfer function(include ownership check) in the x/nft module. So /ibc/applications/nft module can use it to generate the ibc-nft transaction without importing the x/nft/collectibles module.

Comment on lines +105 to +106
- NFT functions available on Cosmos Hub
- NFT module which supports interoperability with IBC and other cross-chain infrastractures like Gravity Bridge
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these are not decided by the ADR process, but by the Hub CIP committee and governance. Also, there is no current implementation for the second item so I wouldn't consider it as positive for now.

@shahankhatch shahankhatch self-requested a review May 10, 2021 18:41
@shahankhatch
Copy link
Contributor

Thanks for writing this up @hulatown

I've made changes in my branch here, https://github.com/cosmos/cosmos-sdk/tree/shahan/adr-043-nft:

  • defined specifications for fields that are part of the interface
  • added clarity around methods (only get/set)
  • removed implementation methods that aren't part of the interface
  • added details why this spec is future-conformant, e.g., ERC-721

Please let me know what you think.

As an aside, I don't know if you need special permissions, but if you can push your work into a hulatown/adr-043-nft branch on this repo, I think it'll make it easier to cherrypick commits from different branches and get reviews done by other folks too.

@hulatown
Copy link
Author

Thank you @shahankhatch ! Your input looks great! And I think I have no permission for the moment to create a branch. Would you please help to grant the permission? I will follow your way to create a new push and probably will need to close the current PR and create a new one based on the branch when ready.

Thanks for writing this up @hulatown

I've made changes in my branch here, https://github.com/cosmos/cosmos-sdk/tree/shahan/adr-043-nft:

  • defined specifications for fields that are part of the interface
  • added clarity around methods (only get/set)
  • removed implementation methods that aren't part of the interface
  • added details why this spec is future-conformant, e.g., ERC-721

Please let me know what you think.

As an aside, I don't know if you need special permissions, but if you can push your work into a hulatown/adr-043-nft branch on this repo, I think it'll make it easier to cherrypick commits from different branches and get reviews done by other folks too.

@chengwenxi chengwenxi mentioned this pull request May 14, 2021
9 tasks
@chengwenxi
Copy link
Contributor

Replaced by #9329

@chengwenxi chengwenxi closed this May 14, 2021
chengwenxi added a commit that referenced this pull request May 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: ADR An issue or PR relating to an architectural decision record T:Docs Changes and features related to documentation.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants