-
Notifications
You must be signed in to change notification settings - Fork 39
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
New Standard: NFT metadata - Milestone 1 #32
New Standard: NFT metadata - Milestone 1 #32
Conversation
…1/coelacant/NFTStandard.cdc
I have pushed Milestone 2 into the PR. |
RemotePNGProvider is an example of an implementation of IMetaDataProvider that allows multiple NFTs to share the same image via Capability reference. | ||
*/ | ||
|
||
pub contract MetaDataUtil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the Cadence code that Dapper has written, we tend to use descriptive names that provide context and/or indicate intent, rather than well-known prefixes/suffixes. We describe the scope, constraint, or affordance provided by Capability interfaces, e.g. CollectionPublic
, Provider
, Receiver
. And for concrete types we tend to emphasize what they are or what they do, e.g. NonFungibleToken
, FlowEpoch
, NodeDelegator
.
None of this is a criticism of other approaches to naming, or to the specific naming used here - which is very clear, regular, and logical, all of which is of advantage when reading a codebase. I would however imagine that we will be looking for naming that reads similarly to the existing standard and core contracts, and this may be worth considering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gotcha. I will consider renaming. This is the first thing I've ever written in Cadence, so I am not very familiar with the standards as of yet.
} | ||
|
||
pub struct MetaData { | ||
pub let elements : [MetaDataElement] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that the content of this array can be manipulated by the owner of the MetaData struct, and functions called on value types within it (and on types in arrays/dictionaries within those, and so on recursively...).
I usually recommend using access(self) for the metadata stored in an object, and returning (an implicitly lazy copy of) it with a
pub` accessor.
i.e.:
access(self) let elements: [MetaDataElement]
pub fun getElements(): [MetaDataElement] {
return self.elements
}
This applies to all the types below that expose a dictionary or array as a pub
member variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I had gone through looking for that issue and changed a few others, but missed that one!
compressedMime replaced with innerMime so it can be used by linked data
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved for milestone 1! Thanks for writing up the Cadence code, @figs999.
However, before we merge, can you update this PR to be only milestone 1 files? We'll review milestone 2 separately.
Done! |
Approving and merging! @figs999 |
Description
This PR is for issue #16
This PR fulfils Milestone 1 Requirement:
"Define a rough outline of your proposal. This can be a written document (i.e. a GitHub issue), but should also include Cadence code snippets that illustrate the core concepts of the standard."
Submission Links & Documents
NA
Requirements Check
Other Details
Please review "Milestone 1/NFTStandard.cdc", comments describe functionality and intended usage.
The NFT Metadata discussion thread
The primary concerns that contributors have brought up are the competing needs for a flexible but parsable schema,
immutable and mutable metadata, and storage cost minimization.