0
0
Blockchain / Solidityprogramming~10 mins

ERC-721 NFT standard 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 ERC-721 interface.

Blockchain / Solidity
interface IERC721 is IERC165 {
    function [1](address owner) external view returns (uint256);
}
Drag options to blanks, or click blank then click option'
Abalance_of
Bbalanceof
CbalanceOf
Dbalance
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect function names like 'balance' or 'balance_of'.
Misspelling the function name with wrong capitalization.
2fill in blank
medium

Complete the code to emit the Transfer event when an NFT is transferred.

Blockchain / Solidity
event Transfer(address indexed from, address indexed to, uint256 indexed [1]);
Drag options to blanks, or click blank then click option'
AtokenId
Bid
CnftId
DassetId
Attempts:
3 left
💡 Hint
Common Mistakes
Using generic or incorrect parameter names like 'id' or 'nftId'.
Omitting the 'indexed' keyword which is required for event filtering.
3fill in blank
hard

Fix the error in the function signature for safeTransferFrom with data parameter.

Blockchain / Solidity
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata [1]) external;
Drag options to blanks, or click blank then click option'
Apayload
BextraData
Cinfo
Ddata
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect parameter names like 'extraData' or 'payload'.
Omitting the 'calldata' keyword for the bytes parameter.
4fill in blank
hard

Fill both blanks to complete the mapping declaration for token owners and balances.

Blockchain / Solidity
mapping(uint256 => address) private [1];
mapping(address => uint256) private [2];
Drag options to blanks, or click blank then click option'
A_owners
B_balances
Cowners
Dbalances
Attempts:
3 left
💡 Hint
Common Mistakes
Using variable names without underscores.
Swapping the two mappings' variable names.
5fill in blank
hard

Fill all three blanks to complete the function that checks if an address is approved or owner of a token.

Blockchain / Solidity
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view returns (bool) {
    address owner = [1](tokenId);
    return (spender == owner || spender == [2](tokenId) || isApprovedForAll(owner, [3]));
}
Drag options to blanks, or click blank then click option'
AownerOf
BgetApproved
Cowner
Dspender
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect function names like 'owner' instead of 'ownerOf'.
Confusing the parameters in the isApprovedForAll call.
Using wrong variable names for the spender.