Other

IERC2981.sol

Read more

IERC2981 details one function called royaltyInfo.

You tell it the token id and how much the sale was, and it tells you what address you send the royalties to and how much the royalties amount to.

    function royaltyInfo(
        uint256 _tokenId,
        uint256 _salePrice
    ) external view returns (
        address receiver,
        uint256 royaltyAmount
    );

The way I implement this is calculating the royaltyAmount with a variable called royaltyBPS which I can view with the function royaltyBPS() and setRoyalty(). This takes a number of basis points that will become the royaltyBPS value. I calculate the receiver address by checking if there's a split address linked to the songId of the inputted tokenId.

IERC721.sol

IERC721 details 3 events and 9 functions.

The events are:

  • Transfer

  • Approval

  • ApprovalForAll

The functions are:

  • balanceOf

  • ownerOf

  • safeTransferFrom (with and without calldata)

  • transferFrom

  • approve

  • setApprovalForAll

  • getApproved

  • isApprovedForAll

Read more here.

IERC721Metadata.sol

IERC721Metadata details 3 functions.

The functions are:

  • name

  • symbol

  • tokenURI

Read more here.

IERC721Enumerable.sol

IERC721Enumerable details 3 functions.

The functions are:

  • totalSupply

  • tokenOfOwnerByIndex

  • tokenByIndex

Read more here.

IERC721Receiver.sol

IERC721Receiver details 1 function

That function is called:

  • onERC721Received

Read more here.

IERC165.sol

IERC165 details 1 function

That function is called:

  • supportsInterface - Returns true if this contract implements the interface defined by interfaceId

Read more here.

Last updated