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

feat: Erc1155MetadataUri extension #416

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open

Conversation

0xNeshi
Copy link
Collaborator

@0xNeshi 0xNeshi commented Nov 21, 2024

Resolves #364

PR Checklist

  • Tests
  • Documentation
  • Changelog

Copy link

netlify bot commented Nov 21, 2024

Deploy Preview for contracts-stylus canceled.

Name Link
🔨 Latest commit 14b7af3
🔍 Latest deploy log https://app.netlify.com/sites/contracts-stylus/deploys/6745c90cca6f640008e6ec45

@0xNeshi 0xNeshi marked this pull request as draft November 21, 2024 11:19
@0xNeshi 0xNeshi marked this pull request as ready for review November 21, 2024 11:26
Copy link
Collaborator

@bidzyyys bidzyyys left a 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.

contracts/src/token/erc1155/extensions/metadata_uri.rs Outdated Show resolved Hide resolved
contracts/src/token/erc1155/mod.rs Outdated Show resolved Hide resolved
examples/erc1155/src/lib.rs Outdated Show resolved Hide resolved
examples/erc1155/tests/abi/mod.rs Outdated Show resolved Hide resolved
docs/modules/ROOT/pages/erc721-uri-storage.adoc Outdated Show resolved Hide resolved
@@ -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,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

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,
Copy link
Collaborator

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.

Copy link
Collaborator Author

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?

Copy link
Collaborator

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.

docs/modules/ROOT/pages/erc1155-metadata-uri.adoc Outdated Show resolved Hide resolved
Copy link
Collaborator

@bidzyyys bidzyyys left a 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.
Copy link
Collaborator

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,
Copy link
Collaborator

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(
Copy link
Collaborator

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))
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: ERC1155MetadataURI extension
2 participants