Metadata Functions

Metadata Functions

These functions involve getting and setting metadata. For more information about metadata, see what is a metadata file?

Read Functions

baseURI

The baseURI function gives you the beginning part of a metadata link. The baseURI is used to save gas/space. The longer the baseURI is relative to the songURI, the more gas is saved. You want the paths to be short and the baseURI to contain the manifest tx_id to save the most gas writing on chain.

baseURI + Contract Path = Contract Metadata

baseURI + Song Path = Token Metadata

contractURI

From IERC721J. The contractURI function returns the contract metadata link. This URL is made with the baseURI and the contract metadata path which creates the finished link.

songURI

From IERC721J. The songURI function takes a songId and generation as input and returns the song metadata link.

tokenURI

From IERC721Metadata. The tokenURI function takes a tokenID as an input and returns the token metadata link. This link is made with the Base URI combined with the songURI. The songURI is the path for the metadata with the songID and rarityID of that tokenID.

Write Functions

  • setBaseURI - Sets the baseURI. Triggers the BaseURIChange event.

  • setContractURI - Sets the contractURI. Triggers the ContractURIChange event.

  • setSongURI - Sets the songURI for one song. Triggers the NewSongURI event.

  • setSongURIs - Sets the songURIs for many rarities of one song. The songID stays the same but it accepts an array of rarities. Triggers the NewSongURI event.

  • setManySongURIs - Sets the songURIS for many rarities of many songs. This takes an array of songIDs and an array of rarities. Triggers the NewSongURI event.

Last updated