Dynamic Resolver
The DynamicUriResolver
The Resolver
analyzes the string passed as uri
, and renders it correctly.
For the analysis, it checks:
If the passed
uri
is static (i.e “traditional”) or dynamic.If static, it returns the
uri
as it was passed, i.e as plainUri.If dynamic, it checks if a
Renderer
contract was passed.If not, it returns plainUri.
If yes, it calls the
Renderer
’srender
function.If
render
doesn’t work, or if the string can’t be rendered (because it isn’t written correctly, contains errors or for another reason), it returnsplainUri
.If it does work, the dynamic metadata is rendered correctly.
The only function of the Resolver
is the resolve
function:
The function’s input parameters are as follows:
address subject
-> as theresolve
function is external, it must be called by an external contract; the addresssubject
is the address of that contract.string calldata plainUri
-> this string represents theuri
, which can be static or dynamic. If dynamic, it’s an encoded ABI string that contains a specificDynamicUriRenderer
contract and an optional payload of bytes.bytes calldata inputData
-> This contains encoded parameters in bytes form, which the Renderer can use to show some specific information.address caller
-> This is themsg.sender
of the function that requires the metadata. For example, you can call the Main Interface to pass theitemId
function.
If dynamic uri
is passed, it is resolved by the resolve
function.
The encoded uri string is decoded, retrieving the Renderer
contract address and any additional payload.
This additional rendererData
payload parameter must be passed, or passed as 0x
.
The resolve
function calls the render
function of the passed Renderer
address:
The Renderer
contract will try to render the metadata.
If it succeeds, it will return the renderedUri
.
Last updated