Skip to main content
Factory is the song registry and ERC-721 contract. The wallet calling mintSong becomes both the recorded creator and the first token owner.

Mint an original

Connect and read

Use publicClient, walletClient, account and evmContracts from Contracts stack. This ABI includes only the calls and event used below:
getSong returns fields in this order: licenseAmount, licensePrice, streamPrice, creator, remixable, isRemix, parentSongId, metadataUri. An original has isRemix = false and parentSongId = 0. The following call mints 20 licenses priced at 5 USDC each and a stored rate of 0.01 USDC. Set metadataUri to your final published URI:

Confirm the minted song

The transaction hash and song ID are different values. Decode the Factory’s SongMinted event from the successful receipt:
Read getSong(mintedId) and confirm its creator, URI, isRemix = false and parentSongId = 0 before recording it in your catalog. If receipt confirmation was interrupted, recover the saved hash before submitting another mint.

Reads and creator updates

To change prices, simulate the creator’s call, sign it and check the receipt:
For metadata, use parseAbi(['function updateMetadataUri(uint256 songId, string newMetadataUri)']), functionName: 'updateMetadataUri' and args: [mintedId, newMetadataUri] in the same sequence. Read the song again after either update. Transferring the token does not grant the new owner creator-only update permissions. Existing licenses survive a pricing change.

Events and errors

Watch SongMinted, LicenseConsumed, PricingUpdated and MetadataUriUpdated for song changes. ERC-721 transfers emit Transfer. Filter logs by the Factory address and identify mints by creator and metadata URI. SongNotFound, NotSongCreator, EmptyMetadataUri, SongNotRemixable and NoLicensesAvailable describe the common rejected calls. The Factory interface defines their full fields.
mintRemix(licenseAmount, licensePrice, streamPrice, parentSongId, remixer, metadataUri) and consumeLicense(songId, licensee) require an authorized consumer or administrator. Use Remix’s public calls for license purchases and variations.authorizeConsumer(consumer), revokeConsumer(consumer) and transferAdmin(newAdmin) require the administrator. isAuthorizedConsumer(consumer) and getAdmin() are public reads. These permissions are not required to integrate the public mint, license and variation calls.
Factory interface · Deployed Factory addresses