-
Notifications
You must be signed in to change notification settings - Fork 7
Add metadata extensions on CreateMint
#208
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Are you also going to allow this to be updated? For metaplex metadata accounts, this is actually a PDA, and for Token-2022 metadata-enabled mints, this authority can be separate from the mint authority.
Is it possible to first check if the metadata extensions exists already and if so, inherit those first?
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.
I think we have four cases that need to be handled after this:
These should exist to essentially sync metadata state from the unwrapped to wrapped.
I worry about moving some of the above's case branching into the initialization logic. It seems simpler to separate this complexity into the individual instructions handling those. I don't think it should be too difficult for the consumer to make an additional call to update. What do you think?
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.
Will I be able to call "SyncMetadata" again if my unwrapped token's metadata changes? Also, if my unwrapped token has no metadata, am I paying extra rent on the wrapped mint for no reason?
This is kind of a tradeoff, since if we only added metadata for tokens who have it during the time of wrapping, then we lose the ability to sync newly created metadata on the unwrapped token with the wrapped token.
Nonetheless I think it's ok to leave this as the program's mint authority PDA as long as it never goes beyond sync.
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.
Yes, I was intending for that subsequent instruction to be something that can be repeatedly called
Ah, this is an important point I think. As of this PR, for token-2022 wrapped mints, the answer is yes. If we were to move
initialize_token_metadata()
to a dedicated instruction, this would move this from opt-out to opt-in. Think that is probably best. Will follow up with a PR for that.Uh oh!
There was an error while loading. Please reload this page.
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.
I think the only gotcha there is that you can create Metaplex token metadata for your mint anytime after it's been initialized, as long as you hold the mint authority. However, for Token-2022, the
MetadataPointer
extension can only be added before the mint is initialized.So, if you have no metadata on an SPL Token, and you wrap it under Token-2022, then later you create metadata for your unwrapped mint via Metaplex, you wouldn't be able to add metadata to the already-wrapped mint. You'd have to burn it all and re-wrap.
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.
True, don't think we could ever get around removing the MetadataPointer extension. We'd have to continue adding that to each mint.