The erc721_metadata
function of the collection_manager.cairo
contract is responsible for extracting metadata from a given ERC721 contract. This function constructs an ERC721Metadata
struct, which includes fields such as name
, symbol
, base_uri
, and uris
. The base_uri
field is crucial as it typically forms the base part of the URI for token metadata.
In the current implementation, the base_uri
is hardcoded to an empty string (""
). This is problematic because the base_uri
should be retrieved from the ERC721 contract to ensure the metadata is complete and accurate. By setting it to an empty string, the function returns incomplete metadata, which can lead to issues for applications relying on this data.
Relevant code snippet:
The impact of this issue is that any application or user relying on the erc721_metadata
function to retrieve metadata will receive incomplete information. Specifically, the base_uri
will always be an empty string, which can lead to incorrect or missing metadata URIs. This can cause confusion and potential issues in applications that depend on accurate metadata, such as NFT marketplaces or wallets.
A user calls the erc721_metadata
function with a valid contract_address
and an optional list of token_ids
.
The function constructs the ERC721Metadata
struct.
The base_uri
field is set to an empty string (""
), regardless of the actual base URI of the ERC721 contract.
The function returns the ERC721Metadata
struct with an incorrect base_uri
.
Manual review
To fix this issue, the base_uri
should be retrieved from the ERC721 contract, similar to how name
and symbol
are retrieved. Here is the recommended code change:
This change ensures that the base_uri
field in the ERC721Metadata
struct contains the correct value from the ERC721 contract, providing complete and accurate metadata.
URI is not lost on the origin chain and it can be modified with `ERC721UriImpl`. As explained in the TODO below, that’s a design choice and it will be implemented as a future feature. https://github.com/Cyfrin/2024-07-ark-project/blob/main/apps/blockchain/ethereum/src/Bridge.sol#L206 `ERC721Bridgable` is out of scope.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.