Extensions
Writing Extensions
Any contract written in solidity on the Ethereum network can be registered as an extension to a base Creator Contract. The extension will only be recognized by your Creator Contract for the purpose of overriding various functions by implementing specific interfaces.
Override TokenURI Functionality
To override Token URI functionality implement interface ICreatorExtensionTokenURI. This is applicable to both ERC721 and ERC1155 contracts:
interface ICreatorExtensionTokenURI is IERC165 {
/**
* Get the uri for a given creator/tokenId
*/
function tokenURI(address creator, uint256 tokenId) external view returns (string memory);
}Receive a Burn Callback
To receive an onBurn callback (pre-burn hook) whenever a token the extension created is burned implement either the IERC721CreatorExtensionBurnable or IERC1155CreatorExtensionBurnable interface. Whenever a token created by the extension is burned using the Creator Core's burn function, this hook will fire.
ERC721
interface IERC721CreatorExtensionBurnable is IERC165 {
/**
* @dev callback handler for burn events
*/
function onBurn(address owner, uint256 tokenId) external;
}ERC1155
Receive a Transfer Callback
To receive a transfer callback (pre-transfer hook) whenever a token the extension created is transferred implement either the IERC721CreatorExtensionApproveTransfer or IERC1155CreatorExtensionApproveTransfer interface. Whenever a token created by the extension is transferred using the Creator Core's transfer function this hook will fire.
ERC721
ERC1155
Suggested implementation for extensions with a transfer callback
Overriding Royalties
To override Token URI functionality implement interface ICreatorExtensionRoyalties. This is applicable to both ERC721 and ERC1155 contracts:
Adding and Removing Extensions
Once deployed on the Ethereum network, extensions can be added or removed using the registerExtension and unregisterExtension functions. An extension can also be blacklisted via the blacklistExtension function, preventing future registrations of the address and destroying all references to metadata associate with tokens created by the extension.
For detailed extensions functions information see Extensions Functions.
Last updated

