-
Notifications
You must be signed in to change notification settings - Fork 23
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
feat: Erc1155MetadataUri
extension
#416
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for contracts-stylus canceled.
|
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.
Left some comments. I believe, this extension should be treated as introduction to URIStorage; as we have for Metadata & URI Storage extensions for ERC-721.
@@ -0,0 +1,75 @@ | |||
= ERC-1155 Metadata URI | |||
|
|||
The OpenZeppelin xref:erc1155.adoc[ERC-1155] Metadata URI extension is needed to manage and store URIs for individual tokens. This extension allows each token to have its own unique URI, |
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.
Make use of this docs -> https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions
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.
Let me know what you think, see cfe28f5
[[usage]] | ||
== Usage | ||
|
||
In order to make an xref:erc1155.adoc[ERC-1155] token with https://docs.rs/openzeppelin-stylus/0.2.0-alpha/openzeppelin_stylus/token/erc1155/extensions/metadata_uri/index.html[Metadata URI] flavour, |
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.
Wrong version in the link, may not work in CI jobs.
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.
Should I omit the URL altogether for now?
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.
Try with 0.2.0-alpha.2
(this version will include Metadata URI extension) and check if CI passes.
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.
Almost ready to merge!
fn uri(&self, id: U256) -> String; | ||
} | ||
|
||
// FIXME: Apply multi-level inheritance to export Metadata's functions. |
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.
Do we need this comment here? I am not sure as we do not re-export anything here.
[[usage]] | ||
== Usage | ||
|
||
In order to make an xref:erc1155.adoc[ERC-1155] token with https://docs.rs/openzeppelin-stylus/0.2.0-alpha/openzeppelin_stylus/token/erc1155/extensions/metadata_uri/index.html[Metadata URI] flavour, |
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.
Try with 0.2.0-alpha.2
(this version will include Metadata URI extension) and check if CI passes.
#[public] | ||
#[inherit(Erc1155, Erc1155MetadataUri)] | ||
impl Erc1155Example { | ||
pub fn mint( |
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 believe we do not need to have mint
and mint_batch
fns in docs for Metadata URI extension. I would say that it should be enough:
#[public]
#[inherit(Erc1155, Erc1155MetadataUri)]
impl Erc1155Example {
// ...
}
Like for Erc20 Metadata.
let _contract = Erc1155::new(contract_addr, &alice.wallet); | ||
let contract_addr = alice | ||
.as_deployer() | ||
.with_constructor(ctr(URI)) |
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 would suggest adding with_default_constructor()
as we have e.g. in Erc20; Applies to all E2E tests here.
Resolves #364
PR Checklist