0
0
Blockchain / Solidityprogramming~10 mins

Token metadata and URI in Blockchain / Solidity - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare the token URI variable.

Blockchain / Solidity
string private [1];
Drag options to blanks, or click blank then click option'
Auri
Bmetadata
CtokenURI
DtokenId
Attempts:
3 left
💡 Hint
Common Mistakes
Using tokenId as the URI variable name
Using metadata which is too generic
Using tokenURI which is usually a function, not a variable
2fill in blank
medium

Complete the function signature to return the token URI.

Blockchain / Solidity
function [1](uint256 tokenId) public view returns (string memory) {
Drag options to blanks, or click blank then click option'
AgetTokenURI
BtokenURI
Curi
DmetadataURI
Attempts:
3 left
💡 Hint
Common Mistakes
Using getTokenURI which is not standard
Using uri which is usually a variable
Using metadataURI which is uncommon
3fill in blank
hard

Fix the error in the return statement to correctly return the token URI.

Blockchain / Solidity
return [1][tokenId];
Drag options to blanks, or click blank then click option'
Auri
BtokenURI
Cmetadata
DtokenId
Attempts:
3 left
💡 Hint
Common Mistakes
Returning tokenURI which is a function
Returning tokenId which is a number, not a URI
Returning metadata which is undefined
4fill in blank
hard

Fill both blanks to declare and initialize the mapping for token URIs.

Blockchain / Solidity
mapping(uint256 => [1]) private [2];
Drag options to blanks, or click blank then click option'
Astring
Buint256
Curi
DtokenURI
Attempts:
3 left
💡 Hint
Common Mistakes
Using uint256 as the value type
Using tokenURI as the mapping name
Using uint256 as the value type instead of string
5fill in blank
hard

Fill all three blanks to set the token URI in the function.

Blockchain / Solidity
function setTokenURI(uint256 tokenId, [1] memory [2]) public {
    [3][tokenId] = [2];
}
Drag options to blanks, or click blank then click option'
Astring
Buri
DtokenURI
Attempts:
3 left
💡 Hint
Common Mistakes
Using tokenURI as parameter name
Using uint256 as parameter type
Using different names for parameter and mapping