-
Notifications
You must be signed in to change notification settings - Fork 352
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
ERC-721 token_uri() Hook #1184
Comments
Hey @rsodre, thanks for taking the time for such a detailed request. Hooks are designed to extend functionality by appending and/or pretending code to already existing logic. However, they are not intended as a mechanism for simulating the override of functions, which is more suitable for the use case of changing the Note that you can "override" the token_uri function to customize the logic, by implementing the IERC721Metadata interface directly in your contract, instead of embedding the component implementation. With this said, this is a thing we have in scope for improving, and in the future we may provide some custom traits associated to components that will allow customizing the logic without this much verbosity. This still won't be Hooks as a concept. |
Not really... that would be the straight-forward solution, but can't do it currently because IERC721Metadata is embedded into IERC721Mixin. But anyway, I think this is an issue that needs to be addressed. |
Noted, we will try to prioritize this accordingly, thanks for bringing it up.
No need for cloning the while Mixin, you will need to embed the implementations separately, but that's about it, besides implementing just IERC721Metadata. This:
instead of this:
|
🧐 Motivation
We need more freedom to build
token_uri
.The current implementation of
token_uri()
just concatenates thebase_uri
andtoken_id
, which is limited to provide a URL.Fully on-chain tokens need to provide the full json metadata, which needs to be rendered on the contract, from a hook.
📝 Details
Proposed solution:
token_uri(token_id: u256)
hook toERC721Component::ERC721HooksTrait
ERC721Metadata::token_uri
The text was updated successfully, but these errors were encountered: