origami icon indicating copy to clipboard operation
origami copied to clipboard

[Feature]: ERC-721 Metadata hooks

Open rsodre opened this issue 1 year ago • 2 comments

Feature Request

Add a hook to Origami ERC-721 implementation to customize token_uri().

Proposed Solution

  • Create ERC721MetadataHooksTrait , containing a function custom_uri(), that can be implemented by the token contract.
  • This function will be called internally by called internally by erc721_metadata_component::token_uri() to customize its results.
  • The custom hook implementation is optional, and if not implemented, the token contract will have to import ERC721MetadataHooksEmptyImpl, an empty implementation that should not affect the standard uri.

Alternatives

Teh only way to customize the token uri is to clone erc721_metadata_component and use it on the token contract, instead of using Origami's own.

Related Code

OpenZeppelin has similar hooks at their ERC721 and ERC20 implementations

Additional context

This hook is required to allow fully on-chain metadata.

If the feature is accepted, would you be willing to contribute it?

  • [X] Yes I would be willing to contribute

rsodre avatar Jun 29 '24 20:06 rsodre

@rsodre I could work on this since it is yet to be assigned

ooochoche avatar Jun 29 '24 20:06 ooochoche

@rsodre I could work on this since it is yet to be assigned

I'm not an admin on this repository. But I'm already working on it for a personal project, and proposing a PR with my changes.

rsodre avatar Jun 29 '24 20:06 rsodre