Transient Labs Creator Contracts
A repository for Transient Labs Creator Contracts
Deployments
See https://docs.transientlabs.xyz/tl-creator-contracts/implementation for latest deployments
Core Features
Ownership & Access
We have implemented the OwnableAccessControlUpgradeable
contract from tl-sol-tools and have created custom admin and mint contract priviledges. Admins are able to perform actions on behalf of the creator (contract owner). Approved mint contracts are allowed to mint NFTs or metadata (ERC7160TL).
Creator Royalties
EIP-2981 is used as it is the on-chain royalty specification used to return a royalty payout address and the royalty amount to pay based on the sale price.
For each contract, there is a default royalty specification set that can be altered if needed. There are also individual token overrides in case of collaboration or anything like that.
BlockList
A feature that allows creators to block operators, such as marketplaces, from getting approved on the contract. setApprovalForAll
and approve
will fail for any blocked addresses.
Story Inscriptions
The ability to add human provenance to the blockchain to fully tell the story behind a token. See more here
NFT Delegation Integration
There are NFT delegation protocols in use today, such as delegate.xyz, and more coming. Our creator contrats (ERC-721 based) have the ability to integrate with a delegation registry that aggregates and checks against popular delegation protocols. Right now, that is just delegate.xyz, but can expand to include others as well.
We only use NFT delegation for NFT ownership utility that does not affect ownership. So this means that NFT delegation is not used for transfers and approvals. It is used for features like
- story inscriptions
- multi-metadata pinning & unpinning
- Synergy metadata updates
ERC721TL
Our core ERC-721 creator contract.
Synergy
This mechanism protects collectors from having token metadata changed on them unexpectedly. Artists need to be able to update metadata in certain situations, but collectors should have a right to review these changes after they have bought the piece. This is what Synergy allows; the collector must sign a transaction allowing the metadata to be updated.
Airdrops
Allows creators to airdrop tokens to a list of addresses.
Batch Minting
Allows creators to cheaply batch mint tokens to their wallet.
Testing shows our implementation is market leading: view here
ERC7160TL
Our implementation of ERC-7160. This brings multiple pieces of metadata to NFTs and allows token holders to pin or unpin metadata as they please. Only the contract owner/admin have the ability to add metadata for a token.
Airdrops
Allows creators to airdrop tokens to a list of addresses.
Batch Minting
Allows creators to cheaply batch mint tokens to their wallet.
Testing shows our implementation is market leading: view here
Doppelganger
An implementation of ERC-7160 but with a focus on editions. Rather than have multiple pieces of metadata per token, like in ERC7160TL, there is a contract-wide metadata array from which token holders can choose to pin. This allows for immense flexibility and gas efficiency for ERC-721 editions.
It shares similar features with ERC7160TL
.
Collector's Choice
A variant of Doppelganger that allows the creator to set a cutoff time, after which, all pinning and unpinning actions by token holders are blocked. This essentially freezes the metadata and can be use for interesting gameification.
Shatter
Allows a 1/1 token to be shattered into many tokens, that can either be an edition or more 1/1 tokens. Later, all the tokens can be fused back into the 1/1 if the tokens are all owned by the same address.
Shares many similar features to ERC721TL
.
Proxy Deployments
We use immutable ERC-1167 proxies for creators to deploy contracts in a cheap and immutable way. ERC-1967 proxies can also be used.
Running Tests
- Install foundry
- Run
make install
ormake update
- Run
forge test
(optionally can adjust the fuzz runs via the flag--fuzz-runs <number>
)
Building InitCode for the TL Universal Deployer
- Navigate the the contract type you want to deploy
- Look at the initialize function to see the function signature
- Run
cast calldata "<function-signature-here>" <constructor-args-here>
Example: cast calldata "initialize(string,string,string,address,uint256,address,address[],bool,address)" "The Enchanted Hour" "RK" "" 0x77B35947d508012589a91CA4c9d168824376Cc7D 1000 0x77B35947d508012589a91CA4c9d168824376Cc7D "[]" true 0x77B35947d508012589a91CA4c9d168824376Cc7D
See more about cast calldata here.
Disclaimer
This codebase is provided on an "as is" and "as available" basis.
We do not give any warranties and will not be liable for any loss incurred through any use of this codebase.
License
This code is copyright Transient Labs, Inc 2023 and is licensed under the MIT license.
Contents
ERC1155TL
Inherits: ERC1155Upgradeable, EIP2981TLUpgradeable, OwnableAccessControlUpgradeable, ICreatorBase, IERC1155TL, IStory
Author: transientlabs.xyz
Sovereign ERC-1155 Creator Contract with Story Inscriptions
State Variables
VERSION
String representation for address
string public constant VERSION = "3.0.1";
ADMIN_ROLE
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
APPROVED_MINT_CONTRACT
bytes32 public constant APPROVED_MINT_CONTRACT = keccak256("APPROVED_MINT_CONTRACT");
_counter
uint256 private _counter;
name
string public name;
symbol
string public symbol;
storyEnabled
bool public storyEnabled;
blocklistRegistry
IBlockListRegistry public blocklistRegistry;
_tokens
mapping(uint256 => Token) private _tokens;
Functions
constructor
constructor(bool disable);
Parameters
Name | Type | Description |
---|---|---|
disable | bool | Boolean to disable initialization for the implementation contract |
initialize
tx.origin
is used in the events here as these can be deployed via contract factories and we want to capture the true sender
function initialize(
string memory name_,
string memory symbol_,
string memory personalization,
address defaultRoyaltyRecipient,
uint256 defaultRoyaltyPercentage,
address initOwner,
address[] memory admins,
bool enableStory,
address initBlockListRegistry
) external initializer;
Parameters
Name | Type | Description |
---|---|---|
name_ | string | The name of the 721 contract |
symbol_ | string | The symbol of the 721 contract |
personalization | string | A string to emit as a collection story. Can be ASCII art or something else that is a personalization of the contract. |
defaultRoyaltyRecipient | address | The default address for royalty payments |
defaultRoyaltyPercentage | uint256 | The default royalty percentage of basis points (out of 10,000) |
initOwner | address | The owner of the contract |
admins | address[] | Array of admin addresses to add to the contract |
enableStory | bool | A bool deciding whether to add story fuctionality or not |
initBlockListRegistry | address | Address of the blocklist registry to use |
totalSupply
Function to get total supply minted so far
function totalSupply() external view returns (uint256);
getTokenDetails
Function to get token creation details
function getTokenDetails(uint256 tokenId) external view returns (Token memory);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to lookup |
setApprovedMintContracts
Function to set approved mint contracts
Access to owner or admin
function setApprovedMintContracts(address[] calldata minters, bool status) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
minters | address[] | Array of minters to grant approval to |
status | bool | Status for the minters |
createToken
Function to create a token that can be minted to creator or airdropped
Requires owner or admin
function createToken(string calldata newUri, address[] calldata addresses, uint256[] calldata amounts)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newUri | string | The uri for the token to create |
addresses | address[] | The addresses to mint the new token to |
amounts | uint256[] | The amount of the new token to mint to each address |
createToken
Function to create a token that can be minted to creator or airdropped
Requires owner or admin
function createToken(
string calldata newUri,
address[] calldata addresses,
uint256[] calldata amounts,
address royaltyAddress,
uint256 royaltyPercent
) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newUri | string | The uri for the token to create |
addresses | address[] | The addresses to mint the new token to |
amounts | uint256[] | The amount of the new token to mint to each address |
royaltyAddress | address | |
royaltyPercent | uint256 |
batchCreateToken
function to batch create tokens that can be minted to creator or airdropped
requires owner or admin
function batchCreateToken(string[] calldata newUris, address[][] calldata addresses, uint256[][] calldata amounts)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newUris | string[] | the uris for the tokens to create |
addresses | address[][] | 2d dynamic array holding the addresses to mint the new tokens to |
amounts | uint256[][] | 2d dynamic array holding the amounts of the new tokens to mint to each address |
batchCreateToken
function to batch create tokens that can be minted to creator or airdropped
requires owner or admin
function batchCreateToken(
string[] calldata newUris,
address[][] calldata addresses,
uint256[][] calldata amounts,
address[] calldata royaltyAddresses,
uint256[] calldata royaltyPercents
) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newUris | string[] | the uris for the tokens to create |
addresses | address[][] | 2d dynamic array holding the addresses to mint the new tokens to |
amounts | uint256[][] | 2d dynamic array holding the amounts of the new tokens to mint to each address |
royaltyAddresses | address[] | |
royaltyPercents | uint256[] |
mintToken
Function to mint existing token to recipients
Requires owner or admin
function mintToken(uint256 tokenId, address[] calldata addresses, uint256[] calldata amounts)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to mint |
addresses | address[] | The addresses to mint to |
amounts | uint256[] | Amounts of the token to mint to each address |
externalMint
External mint function
Requires caller to be an approved mint contract
function externalMint(uint256 tokenId, address[] calldata addresses, uint256[] calldata amounts)
external
onlyRole(APPROVED_MINT_CONTRACT);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to mint |
addresses | address[] | The addresses to mint to |
amounts | uint256[] | Amounts of the token to mint to each address |
burn
Function to burn tokens from an account
Msg.sender must be token owner or operator
function burn(address from, uint256[] calldata tokenIds, uint256[] calldata amounts) external;
Parameters
Name | Type | Description |
---|---|---|
from | address | Address to burn from |
tokenIds | uint256[] | Array of tokens to burn |
amounts | uint256[] | Amount of each token to burn |
setDefaultRoyalty
Function to set the default royalty specification
Requires owner or admin
function setDefaultRoyalty(address newRecipient, uint256 newPercentage) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newRecipient | address | The new royalty payout address |
newPercentage | uint256 | The new royalty percentage in basis (out of 10,000) |
setTokenRoyalty
Function to override a token's royalty info
Requires owner or admin
function setTokenRoyalty(uint256 tokenId, address newRecipient, uint256 newPercentage)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to override royalty for |
newRecipient | address | The new royalty payout address for the token id |
newPercentage | uint256 | The new royalty percentage in basis (out of 10,000) for the token id |
setTokenUri
Function to set a token uri
Requires owner or admin
function setTokenUri(uint256 tokenId, string calldata newUri) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to mint |
newUri | string | The new token uri |
uri
function uri(uint256 tokenId) public view override(ERC1155Upgradeable) returns (string memory);
addCollectionStory
Function to let the creator add a story to the collection they have created
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times the creator may write a story.
function addCollectionStory(string calldata, string calldata story) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
<none> | string | |
story | string | The story written and attached to the token id |
addCreatorStory
Function to let the creator add a story to any token they have created
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times the creator may write a story.
function addCreatorStory(uint256 tokenId, string calldata, string calldata story)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to which the story is attached |
<none> | string | |
story | string | The story written and attached to the token id |
addStory
Function to let collectors add a story to any token they own
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times a collector may write a story.
function addStory(uint256 tokenId, string calldata, string calldata story) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to which the story is attached |
<none> | string | |
story | string | The story written and attached to the token id |
setStoryStatus
Function to enable or disable collector story inscriptions
Requires owner or admin
function setStoryStatus(bool status) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
status | bool | The status to set for collector story inscriptions |
setBlockListRegistry
Function to change the blocklist registry
Access to owner or admin
function setBlockListRegistry(address newBlockListRegistry) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newBlockListRegistry | address | The new blocklist registry |
setApprovalForAll
function setApprovalForAll(address operator, bool approved) public override(ERC1155Upgradeable);
tlNftDelegationRegistry
Function to get the delegation registry
function tlNftDelegationRegistry() external pure returns (ITLNftDelegationRegistry);
setNftDelegationRegistry
Function to change the TL NFT delegation registry
Access to owner or admin
function setNftDelegationRegistry(address) external pure;
Parameters
Name | Type | Description |
---|---|---|
<none> | address |
supportsInterface
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC1155Upgradeable, EIP2981TLUpgradeable)
returns (bool);
_exists
Private helper function to verify a token exists
function _exists(uint256 tokenId) private view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to check existence for |
_createToken
Private helper function to create a new token
function _createToken(string memory newUri, address[] memory addresses, uint256[] memory amounts)
private
returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
newUri | string | The uri for the token to create |
addresses | address[] | The addresses to mint the new token to |
amounts | uint256[] | The amount of the new token to mint to each address |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | uint256 Token id created |
_mintToken
Private helper function
function _mintToken(uint256 tokenId, address[] calldata addresses, uint256[] calldata amounts) private;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to mint |
addresses | address[] | The addresses to mint to |
amounts | uint256[] | Amounts of the token to mint to each address |
_isOperatorBlocked
function _isOperatorBlocked(address operator) internal view returns (bool);
Errors
EmptyTokenURI
Token uri is an empty string
error EmptyTokenURI();
BatchSizeTooSmall
Batch size too small
error BatchSizeTooSmall();
MintToZeroAddresses
Mint to zero addresses
error MintToZeroAddresses();
ArrayLengthMismatch
Array length mismatch
error ArrayLengthMismatch();
CallerNotTokenOwner
Token not owned by the owner of the contract
error CallerNotTokenOwner();
CallerNotApprovedOrOwner
Caller is not approved or owner
error CallerNotApprovedOrOwner();
TokenDoesntExist
Token does not exist
error TokenDoesntExist();
BurnZeroTokens
Burning zero tokens
error BurnZeroTokens();
OperatorBlocked
Operator for token approvals blocked
error OperatorBlocked();
StoryNotEnabled
Story not enabled for collectors
error StoryNotEnabled();
IERC1155TL
Author: transientlabs.xyz
Interface for ERC1155TL
Interface id = 0x452d5a4a
Functions
getTokenDetails
Function to get token creation details
function getTokenDetails(uint256 tokenId) external view returns (Token memory);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to lookup |
createToken
Function to create a token that can be minted to creator or airdropped
Requires owner or admin
function createToken(string calldata newUri, address[] calldata addresses, uint256[] calldata amounts) external;
Parameters
Name | Type | Description |
---|---|---|
newUri | string | The uri for the token to create |
addresses | address[] | The addresses to mint the new token to |
amounts | uint256[] | The amount of the new token to mint to each address |
createToken
Function to create a token that can be minted to creator or airdropped
Overloaded function where you can set the token royalty config in this tx
Requires owner or admin
function createToken(
string calldata newUri,
address[] calldata addresses,
uint256[] calldata amounts,
address royaltyAddress,
uint256 royaltyPercent
) external;
Parameters
Name | Type | Description |
---|---|---|
newUri | string | The uri for the token to create |
addresses | address[] | The addresses to mint the new token to |
amounts | uint256[] | The amount of the new token to mint to each address |
royaltyAddress | address | Royalty payout address for the created token |
royaltyPercent | uint256 | Royalty percentage for this token |
batchCreateToken
function to batch create tokens that can be minted to creator or airdropped
requires owner or admin
function batchCreateToken(string[] calldata newUris, address[][] calldata addresses, uint256[][] calldata amounts)
external;
Parameters
Name | Type | Description |
---|---|---|
newUris | string[] | the uris for the tokens to create |
addresses | address[][] | 2d dynamic array holding the addresses to mint the new tokens to |
amounts | uint256[][] | 2d dynamic array holding the amounts of the new tokens to mint to each address |
batchCreateToken
Function to batch create tokens that can be minted to creator or airdropped
Overloaded function where you can set the token royalty config in this tx
Requires owner or admin
function batchCreateToken(
string[] calldata newUris,
address[][] calldata addresses,
uint256[][] calldata amounts,
address[] calldata royaltyAddresses,
uint256[] calldata royaltyPercents
) external;
Parameters
Name | Type | Description |
---|---|---|
newUris | string[] | Rhe uris for the tokens to create |
addresses | address[][] | 2d dynamic array holding the addresses to mint the new tokens to |
amounts | uint256[][] | 2d dynamic array holding the amounts of the new tokens to mint to each address |
royaltyAddresses | address[] | Royalty payout addresses for the tokens |
royaltyPercents | uint256[] | Royalty payout percents for the tokens |
mintToken
Function to mint existing token to recipients
Requires owner or admin
function mintToken(uint256 tokenId, address[] calldata addresses, uint256[] calldata amounts) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to mint |
addresses | address[] | The addresses to mint to |
amounts | uint256[] | Amounts of the token to mint to each address |
externalMint
External mint function
Requires caller to be an approved mint contract
function externalMint(uint256 tokenId, address[] calldata addresses, uint256[] calldata amounts) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to mint |
addresses | address[] | The addresses to mint to |
amounts | uint256[] | Amounts of the token to mint to each address |
burn
Function to burn tokens from an account
Msg.sender must be token owner or operator
If this function is called from another contract as part of a burn/redeem, the contract must ensure that no amount is '0' or if it is, that it isn't a vulnerability.
function burn(address from, uint256[] calldata tokenIds, uint256[] calldata amounts) external;
Parameters
Name | Type | Description |
---|---|---|
from | address | Address to burn from |
tokenIds | uint256[] | Array of tokens to burn |
amounts | uint256[] | Amount of each token to burn |
setTokenUri
Function to set a token uri
Requires owner or admin
function setTokenUri(uint256 tokenId, string calldata newUri) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to mint |
newUri | string | The new token uri |
Structs
Token
Struct defining a token
struct Token {
bool created;
string uri;
}
Contents
Contents
CollectorsChoice
Inherits: ERC721Upgradeable, EIP2981TLUpgradeable, OwnableAccessControlUpgradeable, ICreatorBase, IERC721TL, IStory, IERC4906, IERC7160
Author: transientlabs.xyz
Sovereign ERC-7160 Editions with a metadata lock timer (Collectors Choice) Creator Contract with Story Inscriptions
When unpinned, the latest metadata added for a token is returned from tokenURI
and tokenURIs
State Variables
VERSION
String representation of uint256
String representation for address
string public constant VERSION = "3.0.1";
ADMIN_ROLE
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
APPROVED_MINT_CONTRACT
bytes32 public constant APPROVED_MINT_CONTRACT = keccak256("APPROVED_MINT_CONTRACT");
_counter
uint256 private _counter;
storyEnabled
bool public storyEnabled;
tlNftDelegationRegistry
ITLNftDelegationRegistry public tlNftDelegationRegistry;
blocklistRegistry
IBlockListRegistry public blocklistRegistry;
cutoffTime
uint256 public cutoffTime;
_burned
mapping(uint256 => bool) private _burned;
_multiMetadatas
mapping(uint256 => MultiMetadata) private _multiMetadatas;
_tokenUris
string[] private _tokenUris;
_batchMints
BatchMint[] private _batchMints;
Functions
constructor
constructor(bool disable);
Parameters
Name | Type | Description |
---|---|---|
disable | bool | Boolean to disable initialization for the implementation contract |
initialize
tx.origin
is used in the events here as these can be deployed via contract factories and we want to capture the true sender
function initialize(
string memory name,
string memory symbol,
string memory personalization,
address defaultRoyaltyRecipient,
uint256 defaultRoyaltyPercentage,
address initOwner,
address[] memory admins,
bool enableStory,
address initBlockListRegistry,
address initNftDelegationRegistry
) external initializer;
Parameters
Name | Type | Description |
---|---|---|
name | string | The name of the 721 contract |
symbol | string | The symbol of the 721 contract |
personalization | string | A string to emit as a collection story. Can be ASCII art or something else that is a personalization of the contract. |
defaultRoyaltyRecipient | address | The default address for royalty payments |
defaultRoyaltyPercentage | uint256 | The default royalty percentage of basis points (out of 10,000) |
initOwner | address | The owner of the contract |
admins | address[] | Array of admin addresses to add to the contract |
enableStory | bool | A bool deciding whether to add story fuctionality or not |
initBlockListRegistry | address | Address of the blocklist registry to use |
initNftDelegationRegistry | address | Address of the TL nft delegation registry to use |
totalSupply
Function to get total supply minted so far
function totalSupply() external view returns (uint256);
setApprovedMintContracts
Function to set approved mint contracts
Access to owner or admin
function setApprovedMintContracts(address[] calldata minters, bool status) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
minters | address[] | Array of minters to grant approval to |
status | bool | Status for the minters |
mint
Function to mint a single token
cannot mint unless at least one token uri has been added to the array
function mint(address recipient, string calldata) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
<none> | string |
mint
Function to mint a single token
cannot mint unless at least one token uri has been added to the array
function mint(address recipient, string calldata, address royaltyAddress, uint256 royaltyPercent)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
<none> | string | |
royaltyAddress | address | |
royaltyPercent | uint256 |
batchMint
Function to batch mint tokens
cannot mint unless at least one token uri has been added to the array
function batchMint(address recipient, uint128 numTokens, string calldata) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
numTokens | uint128 | Number of tokens in the batch mint |
<none> | string |
airdrop
Function to airdrop tokens to addresses
cannot mint unless at least one token uri has been added to the array
function airdrop(address[] calldata addresses, string calldata) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
addresses | address[] | Dynamic array of addresses to mint to |
<none> | string |
externalMint
Function to allow an approved mint contract to mint
cannot mint unless at least one token uri has been added to the array
function externalMint(address recipient, string calldata) external onlyRole(APPROVED_MINT_CONTRACT);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
<none> | string |
burn
Function to burn a token
Caller must be approved or owner of the token
function burn(uint256 tokenId) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to burn |
setDefaultRoyalty
Function to set the default royalty specification
Requires owner or admin
function setDefaultRoyalty(address newRecipient, uint256 newPercentage) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newRecipient | address | The new royalty payout address |
newPercentage | uint256 | The new royalty percentage in basis (out of 10,000) |
setTokenRoyalty
Function to override a token's royalty info
Requires owner or admin
function setTokenRoyalty(uint256 tokenId, address newRecipient, uint256 newPercentage)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to override royalty for |
newRecipient | address | The new royalty payout address for the token id |
newPercentage | uint256 | The new royalty percentage in basis (out of 10,000) for the token id |
setCutoffTime
Function to set the cutoff time for the contract
Must be called by the contract owner oor admin
function setCutoffTime(uint256 time) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
time | uint256 | The cutoff time |
addTokenUris
Function to add token uris
Must be called by contract owner, admin, or approved mint contract
function addTokenUris(string[] calldata tokenUris) external;
Parameters
Name | Type | Description |
---|---|---|
tokenUris | string[] | Array of token uris to add |
tokenURIs
Get all token uris associated with a particular token
If a token uri is pinned, the index returned SHOULD be the index in the string array
function tokenURIs(uint256 tokenId) external view returns (uint256 index, string[] memory uris, bool pinned);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The identifier for the nft |
Returns
Name | Type | Description |
---|---|---|
index | uint256 | An unisgned integer that specifies which uri is pinned for a token (or the default uri if unpinned) |
uris | string[] | A string array of all uris associated with a token |
pinned | bool | A boolean showing if the token has pinned metadata or not |
pinTokenURI
Pin a specific token uri for a particular token
This call MUST revert if the token does not exist
function pinTokenURI(uint256 tokenId, uint256 index) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The identifier of the nft |
index | uint256 | The index in the string array returned from the tokenURIs function that should be pinned for the token |
unpinTokenURI
Unpin metadata for a particular token
This call MUST revert if the token does not exist
function unpinTokenURI(uint256 tokenId) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The identifier of the nft |
hasPinnedTokenURI
Check on-chain if a token id has a pinned uri or not
This call MUST revert if the token does not exist
function hasPinnedTokenURI(uint256 tokenId) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The identifier of the nft |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | pinned A bool specifying if a token has metadata pinned or not |
tokenURI
function tokenURI(uint256 tokenId) public view override(ERC721Upgradeable) returns (string memory uri);
addCollectionStory
Function to let the creator add a story to the collection they have created
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times the creator may write a story.
function addCollectionStory(string calldata, string calldata story) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
<none> | string | |
story | string | The story written and attached to the token id |
addCreatorStory
Function to let the creator add a story to any token they have created
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times the creator may write a story.
function addCreatorStory(uint256 tokenId, string calldata, string calldata story)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to which the story is attached |
<none> | string | |
story | string | The story written and attached to the token id |
addStory
Function to let collectors add a story to any token they own
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times a collector may write a story.
function addStory(uint256 tokenId, string calldata, string calldata story) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to which the story is attached |
<none> | string | |
story | string | The story written and attached to the token id |
setStoryStatus
Function to enable or disable collector story inscriptions
Requires owner or admin
function setStoryStatus(bool status) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
status | bool | The status to set for collector story inscriptions |
setBlockListRegistry
Function to change the blocklist registry
Access to owner or admin
function setBlockListRegistry(address newBlockListRegistry) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newBlockListRegistry | address | The new blocklist registry |
approve
function approve(address to, uint256 tokenId) public override(ERC721Upgradeable, IERC721);
setApprovalForAll
function setApprovalForAll(address operator, bool approved) public override(ERC721Upgradeable, IERC721);
setNftDelegationRegistry
Function to change the TL NFT delegation registry
Access to owner or admin
function setNftDelegationRegistry(address newNftDelegationRegistry) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newNftDelegationRegistry | address | The new blocklist registry |
supportsInterface
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721Upgradeable, EIP2981TLUpgradeable, IERC165)
returns (bool);
_getBatchInfo
Function to get batch mint info
function _getBatchInfo(uint256 tokenId) internal view returns (address);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | Token id to look up for batch mint info |
Returns
Name | Type | Description |
---|---|---|
<none> | address | adress The token owner |
_ownerOf
Function to override { ERC721Upgradeable._ownerOf } to allow for batch minting
function _ownerOf(uint256 tokenId) internal view override(ERC721Upgradeable) returns (address);
_exists
Function to check if a token exists
function _exists(uint256 tokenId) internal view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to check |
_isTokenOwnerOrDelegate
Function to get if msg.sender is the token owner or delegated owner
function _isTokenOwnerOrDelegate(uint256 tokenId) internal view returns (bool);
_isOperatorBlocked
function _isOperatorBlocked(address operator) internal view returns (bool);
Events
CutoffTimeSet
Cutoff Time Set
event CutoffTimeSet(address indexed sender, uint256 indexed time);
Errors
EmptyTokenURIs
No token uris added yet
error EmptyTokenURIs();
MintToZeroAddress
Mint to zero address
error MintToZeroAddress();
BatchSizeTooSmall
Batch size too small
error BatchSizeTooSmall();
AirdropTooFewAddresses
Airdrop to too few addresses
error AirdropTooFewAddresses();
CallerNotApprovedOrOwner
Caller is not approved or owner
error CallerNotApprovedOrOwner();
TokenDoesntExist
Token does not exist
error TokenDoesntExist();
InvalidTokenURIIndex
Index given for ERC-7160 is invalid
error InvalidTokenURIIndex();
NotOwnerAdminOrMintContract
Not owner, admin, or mint contract
error NotOwnerAdminOrMintContract();
CallerNotTokenOwnerOrDelegate
Caller is not the owner or delegate of the owner of the specific token
error CallerNotTokenOwnerOrDelegate();
OperatorBlocked
Operator for token approvals blocked
error OperatorBlocked();
StoryNotEnabled
Story not enabled for collectors
error StoryNotEnabled();
CutoffTimeAlreadySet
Cutoff time set and can't set again
error CutoffTimeAlreadySet();
PastCutoffTime
Past cutoff time
error PastCutoffTime();
Structs
BatchMint
Struct defining a batch mint
struct BatchMint {
address creator;
uint256 fromTokenId;
uint256 toTokenId;
}
MultiMetadata
Struct for holding values used in ERC-7160
struct MultiMetadata {
bool pinned;
uint256 index;
}
Doppelganger
Inherits: ERC721Upgradeable, EIP2981TLUpgradeable, OwnableAccessControlUpgradeable, ICreatorBase, IERC721TL, IStory, IERC4906, IERC7160
Author: transientlabs.xyz
Sovereign ERC-7160 Editions (Doppelganger) Creator Contract with Story Inscriptions
When unpinned, the latest metadata added for a token is returned from tokenURI
and tokenURIs
State Variables
VERSION
String representation of uint256
String representation for address
string public constant VERSION = "3.0.1";
ADMIN_ROLE
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
APPROVED_MINT_CONTRACT
bytes32 public constant APPROVED_MINT_CONTRACT = keccak256("APPROVED_MINT_CONTRACT");
_counter
uint256 private _counter;
storyEnabled
bool public storyEnabled;
tlNftDelegationRegistry
ITLNftDelegationRegistry public tlNftDelegationRegistry;
blocklistRegistry
IBlockListRegistry public blocklistRegistry;
_burned
mapping(uint256 => bool) private _burned;
_multiMetadatas
mapping(uint256 => MultiMetadata) private _multiMetadatas;
_tokenUris
string[] private _tokenUris;
_batchMints
BatchMint[] private _batchMints;
Functions
constructor
constructor(bool disable);
Parameters
Name | Type | Description |
---|---|---|
disable | bool | Boolean to disable initialization for the implementation contract |
initialize
tx.origin
is used in the events here as these can be deployed via contract factories and we want to capture the true sender
function initialize(
string memory name,
string memory symbol,
string memory personalization,
address defaultRoyaltyRecipient,
uint256 defaultRoyaltyPercentage,
address initOwner,
address[] memory admins,
bool enableStory,
address initBlockListRegistry,
address initNftDelegationRegistry
) external initializer;
Parameters
Name | Type | Description |
---|---|---|
name | string | The name of the 721 contract |
symbol | string | The symbol of the 721 contract |
personalization | string | A string to emit as a collection story. Can be ASCII art or something else that is a personalization of the contract. |
defaultRoyaltyRecipient | address | The default address for royalty payments |
defaultRoyaltyPercentage | uint256 | The default royalty percentage of basis points (out of 10,000) |
initOwner | address | The owner of the contract |
admins | address[] | Array of admin addresses to add to the contract |
enableStory | bool | A bool deciding whether to add story fuctionality or not |
initBlockListRegistry | address | Address of the blocklist registry to use |
initNftDelegationRegistry | address | Address of the TL nft delegation registry to use |
totalSupply
Function to get total supply minted so far
function totalSupply() external view returns (uint256);
setApprovedMintContracts
Function to set approved mint contracts
Access to owner or admin
function setApprovedMintContracts(address[] calldata minters, bool status) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
minters | address[] | Array of minters to grant approval to |
status | bool | Status for the minters |
mint
Function to mint a single token
cannot mint unless at least one token uri has been added to the array
function mint(address recipient, string calldata) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
<none> | string |
mint
Function to mint a single token
cannot mint unless at least one token uri has been added to the array
function mint(address recipient, string calldata, address royaltyAddress, uint256 royaltyPercent)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
<none> | string | |
royaltyAddress | address | |
royaltyPercent | uint256 |
batchMint
Function to batch mint tokens
cannot mint unless at least one token uri has been added to the array
function batchMint(address recipient, uint128 numTokens, string calldata) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
numTokens | uint128 | Number of tokens in the batch mint |
<none> | string |
airdrop
Function to airdrop tokens to addresses
cannot mint unless at least one token uri has been added to the array
function airdrop(address[] calldata addresses, string calldata) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
addresses | address[] | Dynamic array of addresses to mint to |
<none> | string |
externalMint
Function to allow an approved mint contract to mint
cannot mint unless at least one token uri has been added to the array
function externalMint(address recipient, string calldata) external onlyRole(APPROVED_MINT_CONTRACT);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
<none> | string |
burn
Function to burn a token
Caller must be approved or owner of the token
function burn(uint256 tokenId) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to burn |
setDefaultRoyalty
Function to set the default royalty specification
Requires owner or admin
function setDefaultRoyalty(address newRecipient, uint256 newPercentage) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newRecipient | address | The new royalty payout address |
newPercentage | uint256 | The new royalty percentage in basis (out of 10,000) |
setTokenRoyalty
Function to override a token's royalty info
Requires owner or admin
function setTokenRoyalty(uint256 tokenId, address newRecipient, uint256 newPercentage)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to override royalty for |
newRecipient | address | The new royalty payout address for the token id |
newPercentage | uint256 | The new royalty percentage in basis (out of 10,000) for the token id |
addTokenUris
Function to add token uris
Must be called by contract owner, admin, or approved mint contract
function addTokenUris(string[] calldata tokenUris) external;
Parameters
Name | Type | Description |
---|---|---|
tokenUris | string[] | Array of token uris to add |
tokenURIs
Get all token uris associated with a particular token
If a token uri is pinned, the index returned SHOULD be the index in the string array
function tokenURIs(uint256 tokenId) external view returns (uint256 index, string[] memory uris, bool pinned);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The identifier for the nft |
Returns
Name | Type | Description |
---|---|---|
index | uint256 | An unisgned integer that specifies which uri is pinned for a token (or the default uri if unpinned) |
uris | string[] | A string array of all uris associated with a token |
pinned | bool | A boolean showing if the token has pinned metadata or not |
pinTokenURI
Pin a specific token uri for a particular token
This call MUST revert if the token does not exist
function pinTokenURI(uint256 tokenId, uint256 index) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The identifier of the nft |
index | uint256 | The index in the string array returned from the tokenURIs function that should be pinned for the token |
unpinTokenURI
Unpin metadata for a particular token
This call MUST revert if the token does not exist
function unpinTokenURI(uint256 tokenId) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The identifier of the nft |
hasPinnedTokenURI
Check on-chain if a token id has a pinned uri or not
This call MUST revert if the token does not exist
function hasPinnedTokenURI(uint256 tokenId) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The identifier of the nft |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | pinned A bool specifying if a token has metadata pinned or not |
tokenURI
function tokenURI(uint256 tokenId) public view override(ERC721Upgradeable) returns (string memory uri);
addCollectionStory
Function to let the creator add a story to the collection they have created
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times the creator may write a story.
function addCollectionStory(string calldata, string calldata story) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
<none> | string | |
story | string | The story written and attached to the token id |
addCreatorStory
Function to let the creator add a story to any token they have created
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times the creator may write a story.
function addCreatorStory(uint256 tokenId, string calldata, string calldata story)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to which the story is attached |
<none> | string | |
story | string | The story written and attached to the token id |
addStory
Function to let collectors add a story to any token they own
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times a collector may write a story.
function addStory(uint256 tokenId, string calldata, string calldata story) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to which the story is attached |
<none> | string | |
story | string | The story written and attached to the token id |
setStoryStatus
Function to enable or disable collector story inscriptions
Requires owner or admin
function setStoryStatus(bool status) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
status | bool | The status to set for collector story inscriptions |
setBlockListRegistry
Function to change the blocklist registry
Access to owner or admin
function setBlockListRegistry(address newBlockListRegistry) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newBlockListRegistry | address | The new blocklist registry |
approve
function approve(address to, uint256 tokenId) public override(ERC721Upgradeable, IERC721);
setApprovalForAll
function setApprovalForAll(address operator, bool approved) public override(ERC721Upgradeable, IERC721);
setNftDelegationRegistry
Function to change the TL NFT delegation registry
Access to owner or admin
function setNftDelegationRegistry(address newNftDelegationRegistry) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newNftDelegationRegistry | address | The new blocklist registry |
supportsInterface
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721Upgradeable, EIP2981TLUpgradeable, IERC165)
returns (bool);
_getBatchInfo
Function to get batch mint info
function _getBatchInfo(uint256 tokenId) internal view returns (address);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | Token id to look up for batch mint info |
Returns
Name | Type | Description |
---|---|---|
<none> | address | adress The token owner |
_ownerOf
Function to override { ERC721Upgradeable._ownerOf } to allow for batch minting
function _ownerOf(uint256 tokenId) internal view override(ERC721Upgradeable) returns (address);
_exists
Function to check if a token exists
function _exists(uint256 tokenId) internal view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to check |
_isTokenOwnerOrDelegate
Function to get if msg.sender is the token owner or delegated owner
function _isTokenOwnerOrDelegate(uint256 tokenId) internal view returns (bool);
_isOperatorBlocked
function _isOperatorBlocked(address operator) internal view returns (bool);
Errors
EmptyTokenURIs
No token uris added yet
error EmptyTokenURIs();
MintToZeroAddress
Mint to zero address
error MintToZeroAddress();
BatchSizeTooSmall
Batch size too small
error BatchSizeTooSmall();
AirdropTooFewAddresses
Airdrop to too few addresses
error AirdropTooFewAddresses();
CallerNotApprovedOrOwner
Caller is not approved or owner
error CallerNotApprovedOrOwner();
TokenDoesntExist
Token does not exist
error TokenDoesntExist();
InvalidTokenURIIndex
Index given for ERC-7160 is invalid
error InvalidTokenURIIndex();
NotOwnerAdminOrMintContract
Not owner, admin, or mint contract
error NotOwnerAdminOrMintContract();
CallerNotTokenOwnerOrDelegate
Caller is not the owner or delegate of the owner of the specific token
error CallerNotTokenOwnerOrDelegate();
OperatorBlocked
Operator for token approvals blocked
error OperatorBlocked();
StoryNotEnabled
Story not enabled for collectors
error StoryNotEnabled();
Structs
BatchMint
Struct defining a batch mint
struct BatchMint {
address creator;
uint256 fromTokenId;
uint256 toTokenId;
}
MultiMetadata
Struct for holding values used in ERC-7160
struct MultiMetadata {
bool pinned;
uint256 index;
}
ERC7160TL
Inherits: ERC721Upgradeable, EIP2981TLUpgradeable, OwnableAccessControlUpgradeable, ICreatorBase, IERC721TL, IStory, IERC4906, IERC7160
Author: transientlabs.xyz
Sovereign ERC-7160 Creator Contract with Story Inscriptions
When unpinned, the latest metadata added for a token is returned from tokenURI
and tokenURIs
State Variables
VERSION
String representation of uint256
String representation for address
string public constant VERSION = "3.0.1";
ADMIN_ROLE
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
APPROVED_MINT_CONTRACT
bytes32 public constant APPROVED_MINT_CONTRACT = keccak256("APPROVED_MINT_CONTRACT");
_counter
uint256 private _counter;
storyEnabled
bool public storyEnabled;
tlNftDelegationRegistry
ITLNftDelegationRegistry public tlNftDelegationRegistry;
blocklistRegistry
IBlockListRegistry public blocklistRegistry;
_burned
mapping(uint256 => bool) private _burned;
_tokenUris
mapping(uint256 => string) private _tokenUris;
_multiMetadatas
mapping(uint256 => MultiMetadata) private _multiMetadatas;
_multiMetadataBaseUris
string[] private _multiMetadataBaseUris;
_batchMints
BatchMint[] private _batchMints;
Functions
constructor
constructor(bool disable);
Parameters
Name | Type | Description |
---|---|---|
disable | bool | Boolean to disable initialization for the implementation contract |
initialize
tx.origin
is used in the events here as these can be deployed via contract factories and we want to capture the true sender
function initialize(
string memory name,
string memory symbol,
string memory personalization,
address defaultRoyaltyRecipient,
uint256 defaultRoyaltyPercentage,
address initOwner,
address[] memory admins,
bool enableStory,
address initBlockListRegistry,
address initNftDelegationRegistry
) external initializer;
Parameters
Name | Type | Description |
---|---|---|
name | string | The name of the 721 contract |
symbol | string | The symbol of the 721 contract |
personalization | string | A string to emit as a collection story. Can be ASCII art or something else that is a personalization of the contract. |
defaultRoyaltyRecipient | address | The default address for royalty payments |
defaultRoyaltyPercentage | uint256 | The default royalty percentage of basis points (out of 10,000) |
initOwner | address | The owner of the contract |
admins | address[] | Array of admin addresses to add to the contract |
enableStory | bool | A bool deciding whether to add story fuctionality or not |
initBlockListRegistry | address | Address of the blocklist registry to use |
initNftDelegationRegistry | address | Address of the TL nft delegation registry to use |
totalSupply
Function to get total supply minted so far
function totalSupply() external view returns (uint256);
setApprovedMintContracts
Function to set approved mint contracts
Access to owner or admin
function setApprovedMintContracts(address[] calldata minters, bool status) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
minters | address[] | Array of minters to grant approval to |
status | bool | Status for the minters |
mint
Function to mint a single token
Requires owner or admin
function mint(address recipient, string calldata uri) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
uri | string | The token uri to mint |
mint
Function to mint a single token
Requires owner or admin
function mint(address recipient, string calldata uri, address royaltyAddress, uint256 royaltyPercent)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
uri | string | The token uri to mint |
royaltyAddress | address | |
royaltyPercent | uint256 |
batchMint
Function to batch mint tokens
Requires owner or admin
function batchMint(address recipient, uint128 numTokens, string calldata baseUri)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
numTokens | uint128 | Number of tokens in the batch mint |
baseUri | string | The base uri for the batch, expecting json to be in order, starting at file name 0, and SHOULD NOT have a trailing / |
airdrop
Function to airdrop tokens to addresses
Requires owner or admin
function airdrop(address[] calldata addresses, string calldata baseUri) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
addresses | address[] | Dynamic array of addresses to mint to |
baseUri | string | The base uri for the batch, expecting json to be in order, starting at file name 0, and SHOULD NOT have a trailing / |
externalMint
Function to allow an approved mint contract to mint
Requires the caller to be an approved mint contract
function externalMint(address recipient, string calldata uri) external onlyRole(APPROVED_MINT_CONTRACT);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
uri | string | The token uri to mint |
burn
Function to burn a token
Caller must be approved or owner of the token
function burn(uint256 tokenId) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to burn |
setDefaultRoyalty
Function to set the default royalty specification
Requires owner or admin
function setDefaultRoyalty(address newRecipient, uint256 newPercentage) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newRecipient | address | The new royalty payout address |
newPercentage | uint256 | The new royalty percentage in basis (out of 10,000) |
setTokenRoyalty
Function to override a token's royalty info
Requires owner or admin
function setTokenRoyalty(uint256 tokenId, address newRecipient, uint256 newPercentage)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to override royalty for |
newRecipient | address | The new royalty payout address for the token id |
newPercentage | uint256 | The new royalty percentage in basis (out of 10,000) for the token id |
addTokenUris
Function to add token uris
Written to take in many token ids and a base uri that contains metadata files with file names matching the index of each token id in the tokenIds
array (aka folderIndex)
No trailing slash on the base uri
Must be called by contract owner, admin, or approved mint contract
function addTokenUris(uint256[] calldata tokenIds, string calldata baseUri) external;
Parameters
Name | Type | Description |
---|---|---|
tokenIds | uint256[] | Array of token ids that get metadata added to them |
baseUri | string | The base uri of a folder containing metadata - file names start at 0 and increase monotonically |
tokenURIs
Get all token uris associated with a particular token
If a token uri is pinned, the index returned SHOULD be the index in the string array
function tokenURIs(uint256 tokenId) external view returns (uint256 index, string[] memory uris, bool pinned);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The identifier for the nft |
Returns
Name | Type | Description |
---|---|---|
index | uint256 | An unisgned integer that specifies which uri is pinned for a token (or the default uri if unpinned) |
uris | string[] | A string array of all uris associated with a token |
pinned | bool | A boolean showing if the token has pinned metadata or not |
pinTokenURI
Pin a specific token uri for a particular token
This call MUST revert if the token does not exist
function pinTokenURI(uint256 tokenId, uint256 index) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The identifier of the nft |
index | uint256 | The index in the string array returned from the tokenURIs function that should be pinned for the token |
unpinTokenURI
Unpin metadata for a particular token
This call MUST revert if the token does not exist
function unpinTokenURI(uint256 tokenId) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The identifier of the nft |
hasPinnedTokenURI
Check on-chain if a token id has a pinned uri or not
This call MUST revert if the token does not exist
function hasPinnedTokenURI(uint256 tokenId) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The identifier of the nft |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | pinned A bool specifying if a token has metadata pinned or not |
tokenURI
function tokenURI(uint256 tokenId) public view override(ERC721Upgradeable) returns (string memory uri);
addCollectionStory
Function to let the creator add a story to the collection they have created
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times the creator may write a story.
function addCollectionStory(string calldata, string calldata story) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
<none> | string | |
story | string | The story written and attached to the token id |
addCreatorStory
Function to let the creator add a story to any token they have created
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times the creator may write a story.
function addCreatorStory(uint256 tokenId, string calldata, string calldata story)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to which the story is attached |
<none> | string | |
story | string | The story written and attached to the token id |
addStory
Function to let collectors add a story to any token they own
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times a collector may write a story.
function addStory(uint256 tokenId, string calldata, string calldata story) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to which the story is attached |
<none> | string | |
story | string | The story written and attached to the token id |
setStoryStatus
Function to enable or disable collector story inscriptions
Requires owner or admin
function setStoryStatus(bool status) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
status | bool | The status to set for collector story inscriptions |
setBlockListRegistry
Function to change the blocklist registry
Access to owner or admin
function setBlockListRegistry(address newBlockListRegistry) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newBlockListRegistry | address | The new blocklist registry |
approve
function approve(address to, uint256 tokenId) public override(ERC721Upgradeable, IERC721);
setApprovalForAll
function setApprovalForAll(address operator, bool approved) public override(ERC721Upgradeable, IERC721);
setNftDelegationRegistry
Function to change the TL NFT delegation registry
Access to owner or admin
function setNftDelegationRegistry(address newNftDelegationRegistry) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newNftDelegationRegistry | address | The new blocklist registry |
supportsInterface
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721Upgradeable, EIP2981TLUpgradeable, IERC165)
returns (bool);
_getBatchInfo
Function to get batch mint info
function _getBatchInfo(uint256 tokenId) internal view returns (address, string memory);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | Token id to look up for batch mint info |
Returns
Name | Type | Description |
---|---|---|
<none> | address | adress The token owner |
<none> | string | string The uri for the tokenId |
_ownerOf
Function to override { ERC721Upgradeable._ownerOf } to allow for batch minting
function _ownerOf(uint256 tokenId) internal view override(ERC721Upgradeable) returns (address);
_getMintedMetadataUri
internal function to get original metadata uri from mint
function _getMintedMetadataUri(uint256 tokenId) internal view returns (string memory uri);
_getMultiMetadataUri
internal function to help get metadata from multi-metadata struct
function _getMultiMetadataUri(MultiMetadata memory multiMetadata, uint256 index)
internal
view
returns (string memory uri);
Parameters
Name | Type | Description |
---|---|---|
multiMetadata | MultiMetadata | The multimMtadata struct in memory |
index | uint256 | The index of the multiMetadataLoc |
_exists
Function to check if a token exists
function _exists(uint256 tokenId) internal view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to check |
_isTokenOwnerOrDelegate
Function to get if msg.sender is the token owner or delegated owner
function _isTokenOwnerOrDelegate(uint256 tokenId) internal view returns (bool);
_isOperatorBlocked
function _isOperatorBlocked(address operator) internal view returns (bool);
Errors
EmptyTokenURI
Token uri is an empty string
error EmptyTokenURI();
MintToZeroAddress
Mint to zero address
error MintToZeroAddress();
BatchSizeTooSmall
Batch size too small
error BatchSizeTooSmall();
AirdropTooFewAddresses
Airdrop to too few addresses
error AirdropTooFewAddresses();
CallerNotApprovedOrOwner
Caller is not approved or owner
error CallerNotApprovedOrOwner();
TokenDoesntExist
Token does not exist
error TokenDoesntExist();
InvalidTokenURIIndex
Index given for ERC-7160 is invalid
error InvalidTokenURIIndex();
NoTokensSpecified
No tokens in tokenIds array
error NoTokensSpecified();
NotOwnerAdminOrMintContract
Not owner, admin, or mint contract
error NotOwnerAdminOrMintContract();
CallerNotTokenOwnerOrDelegate
Caller is not the owner or delegate of the owner of the specific token
error CallerNotTokenOwnerOrDelegate();
OperatorBlocked
Operator for token approvals blocked
error OperatorBlocked();
StoryNotEnabled
Story not enabled for collectors
error StoryNotEnabled();
Structs
BatchMint
Struct defining a batch mint
struct BatchMint {
address creator;
uint256 fromTokenId;
uint256 toTokenId;
string baseUri;
}
MetadataLoc
Struct for specifying base uri index and folder index
struct MetadataLoc {
uint128 baseUriIndex;
uint128 folderIndex;
}
MultiMetadata
Struct for holding additional metadata used in ERC-7160
struct MultiMetadata {
bool pinned;
uint256 index;
MetadataLoc[] metadataLocs;
}
Contents
IShatter
Author: transientlabs.xyz
interface defining the Shatter standard Interface id = 0xf2528cbb
Functions
mint
Function for minting the 1/1
Requires contract owner or admin
Requires that shatters is equal to 0 -> meaning no piece has been minted
function mint(address recipient, string memory uri, uint128 min, uint128 max, uint256 time) external;
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The address to mint to token to |
uri | string | The base uri to be used for the shatter folder WITHOUT trailing "/" |
min | uint128 | The minimum number of shatters |
max | uint128 | The maximum number of shatters |
time | uint256 | Time after which shatter can occur |
shatter
function to shatter the 1/1 token
*care should be taken to ensure that the following conditions are met
- this function can only be called once
- msg.sender actually owns the 1/1 token
- the token has not been shattered yet
- block.timestamp is past the shatter time (if applicable)
- numShatters is an allowed value as set by the creator*
function shatter(uint128 numShatters) external;
Parameters
Name | Type | Description |
---|---|---|
numShatters | uint128 | is the total number of shatters to make |
fuse
function to fuse shatters back into a 1/1
*care should be taken to ensure that the following conditions are met
- this function can only be called once
- the 1/1 is actually shattered
- msg.sender actually owns all of the shatters*
function fuse() external;
Events
Shattered
event Shattered(address indexed user, uint256 indexed numShatters, uint256 indexed shatteredTime);
Fused
event Fused(address indexed user, uint256 indexed fuseTime);
Shatter
Inherits: ERC721Upgradeable, EIP2981TLUpgradeable, OwnableAccessControlUpgradeable, IShatter, ICreatorBase, ISynergy, IStory, IERC4906
Author: transientlabs.xyz
Sovereign Shatter Creator Contract with Synergy and Story Inscriptions
State Variables
VERSION
string representation of uint256
String representation for address
string public constant VERSION = "3.0.1";
ADMIN_ROLE
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
isShattered
bool public isShattered;
isFused
bool public isFused;
storyEnabled
bool public storyEnabled;
tlNftDelegationRegistry
ITLNftDelegationRegistry public tlNftDelegationRegistry;
blocklistRegistry
IBlockListRegistry public blocklistRegistry;
minShatters
uint128 public minShatters;
maxShatters
uint128 public maxShatters;
shatters
uint128 public shatters;
shatterTime
uint256 public shatterTime;
_shatterAddress
address private _shatterAddress;
_baseUri
string private _baseUri;
_proposedTokenUris
mapping(uint256 => string) private _proposedTokenUris;
_tokenUris
mapping(uint256 => string) private _tokenUris;
Functions
constructor
constructor(bool disable);
Parameters
Name | Type | Description |
---|---|---|
disable | bool | Boolean to disable initialization for the implementation contract |
initialize
tx.origin
is used in the events here as these can be deployed via contract factories and we want to capture the true sender
function initialize(
string memory name,
string memory symbol,
string memory personalization,
address defaultRoyaltyRecipient,
uint256 defaultRoyaltyPercentage,
address initOwner,
address[] memory admins,
bool enableStory,
address initBlockListRegistry,
address initNftDelegationRegistry
) external initializer;
Parameters
Name | Type | Description |
---|---|---|
name | string | The name of the 721 contract |
symbol | string | The symbol of the 721 contract |
personalization | string | A string to emit as a collection story. Can be ASCII art or something else that is a personalization of the contract. |
defaultRoyaltyRecipient | address | The default address for royalty payments |
defaultRoyaltyPercentage | uint256 | The default royalty percentage of basis points (out of 10,000) |
initOwner | address | The owner of the contract |
admins | address[] | Array of admin addresses to add to the contract |
enableStory | bool | A bool deciding whether to add story fuctionality or not |
initBlockListRegistry | address | Address of the blocklist registry to use |
initNftDelegationRegistry | address | Address of the TL nft delegation registry to use |
totalSupply
function to get total supply of tokens on the contract
function totalSupply() external view returns (uint256);
setApprovedMintContracts
Function to set approved mint contracts
Access to owner or admin
function setApprovedMintContracts(address[] calldata, bool) external pure;
Parameters
Name | Type | Description |
---|---|---|
<none> | address[] | |
<none> | bool |
mint
Function for minting the 1/1
Requires contract owner or admin
function mint(address recipient, string memory uri, uint128 min, uint128 max, uint256 time)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The address to mint to token to |
uri | string | The base uri to be used for the shatter folder WITHOUT trailing "/" |
min | uint128 | The minimum number of shatters |
max | uint128 | The maximum number of shatters |
time | uint256 | Time after which shatter can occur |
shatter
function to shatter the 1/1 token
*care should be taken to ensure that the following conditions are met
- this function can only be called once
- msg.sender actually owns the 1/1 token
- the token has not been shattered yet
- block.timestamp is past the shatter time (if applicable)
- numShatters is an allowed value as set by the creator*
function shatter(uint128 numShatters) external;
Parameters
Name | Type | Description |
---|---|---|
numShatters | uint128 | is the total number of shatters to make |
fuse
function to fuse shatters back into a 1/1
*care should be taken to ensure that the following conditions are met
- this function can only be called once
- the 1/1 is actually shattered
- msg.sender actually owns all of the shatters*
function fuse() external;
setDefaultRoyalty
function to set the default royalty specification
requires owner
function setDefaultRoyalty(address newRecipient, uint256 newPercentage) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newRecipient | address | the new royalty payout address |
newPercentage | uint256 | the new royalty percentage in basis (out of 10,000) |
setTokenRoyalty
function to override a token's royalty info
requires owner
function setTokenRoyalty(uint256 tokenId, address newRecipient, uint256 newPercentage)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | the token to override royalty for |
newRecipient | address | the new royalty payout address for the token id |
newPercentage | uint256 | the new royalty percentage in basis (out of 10,000) for the token id |
proposeNewTokenUri
function to propose a token uri update for a specific token
requires owner
if the owner of the contract is the owner of the token, the change takes hold right away
function proposeNewTokenUri(uint256 tokenId, string calldata newUri) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | the token to propose new metadata for |
newUri | string | the new token uri proposed |
acceptTokenUriUpdate
function to accept a proposed token uri update for a specific token
requires owner of the token to call the function
function acceptTokenUriUpdate(uint256 tokenId) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | the token to accept the metadata update for |
rejectTokenUriUpdate
function to reject a proposed token uri update for a specific token
requires owner of the token to call the function
function rejectTokenUriUpdate(uint256 tokenId) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | the token to reject the metadata update for |
tokenURI
function tokenURI(uint256 tokenId) public view override(ERC721Upgradeable) returns (string memory);
addCollectionStory
Function to let the creator add a story to the collection they have created
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times the creator may write a story.
function addCollectionStory(string calldata, string calldata story) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
<none> | string | |
story | string | The story written and attached to the token id |
addCreatorStory
Function to let the creator add a story to any token they have created
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times the creator may write a story.
function addCreatorStory(uint256 tokenId, string calldata, string calldata story)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to which the story is attached |
<none> | string | |
story | string | The story written and attached to the token id |
addStory
Function to let collectors add a story to any token they own
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times a collector may write a story.
function addStory(uint256 tokenId, string calldata, string calldata story) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to which the story is attached |
<none> | string | |
story | string | The story written and attached to the token id |
setStoryStatus
Function to enable or disable collector story inscriptions
Requires owner or admin
function setStoryStatus(bool status) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
status | bool | The status to set for collector story inscriptions |
setBlockListRegistry
Function to change the blocklist registry
Access to owner or admin
function setBlockListRegistry(address newBlockListRegistry) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newBlockListRegistry | address | The new blocklist registry |
approve
function approve(address to, uint256 tokenId) public override(ERC721Upgradeable, IERC721);
setApprovalForAll
function setApprovalForAll(address operator, bool approved) public override(ERC721Upgradeable, IERC721);
setNftDelegationRegistry
Function to change the TL NFT delegation registry
Access to owner or admin
function setNftDelegationRegistry(address newNftDelegationRegistry) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newNftDelegationRegistry | address | The new blocklist registry |
supportsInterface
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721Upgradeable, EIP2981TLUpgradeable, IERC165)
returns (bool);
_ownerOf
function to override { ERC721Upgradeable._ownerOf } to allow for batch minting/shatter
function _ownerOf(uint256 tokenId) internal view virtual override returns (address);
_exists
Function to check if a token exists
function _exists(uint256 tokenId) internal view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to check |
_isTokenOwnerOrDelegate
Function to get if msg.sender is the token owner or delegated owner
function _isTokenOwnerOrDelegate(uint256 tokenId) internal view returns (bool);
_isOperatorBlocked
function _isOperatorBlocked(address operator) internal view returns (bool);
Errors
EmptyTokenURI
token uri is an empty string
error EmptyTokenURI();
AlreadyMinted
already minted the first token and can't mint another token to this contract
error AlreadyMinted();
NotShattered
not shattered
error NotShattered();
IsShattered
token is shattered
error IsShattered();
IsFused
token is fused
error IsFused();
CallerNotTokenOwner
caller is not the owner of the specific token
error CallerNotTokenOwner();
CallerDoesNotOwnAllTokens
caller does not own all shatters for fusing
error CallerDoesNotOwnAllTokens();
InvalidNumShatters
number shatters requested is invalid
error InvalidNumShatters();
CallPriorToShatterTime
calling shatter prior to shatter time
error CallPriorToShatterTime();
NoTokenUriUpdateAvailable
no proposed token uri to change to
error NoTokenUriUpdateAvailable();
TokenDoesntExist
token does not exist
error TokenDoesntExist();
CallerNotTokenOwnerOrDelegate
Caller is not the owner or delegate of the owner of the specific token
error CallerNotTokenOwnerOrDelegate();
OperatorBlocked
Operator for token approvals blocked
error OperatorBlocked();
StoryNotEnabled
Story not enabled for collectors
error StoryNotEnabled();
Contents
ITRACE
Author: transientlabs.xyz
Interface for TRACE
Interface id = 0xcfec4f64
Functions
mint
Function to mint a single token
Requires owner or admin
function mint(address recipient, string calldata uri) external;
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
uri | string | The token uri to mint |
mint
Function to mint a single token with specific token royalty
Requires owner or admin
function mint(address recipient, string calldata uri, address royaltyAddress, uint256 royaltyPercent) external;
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
uri | string | The token uri to mint |
royaltyAddress | address | Royalty payout address for this new token |
royaltyPercent | uint256 | Royalty percentage for this new token |
airdrop
Function to airdrop tokens to addresses
Requires owner or admin
Utilizes batch mint token uri values to save some gas but still ultimately mints individual tokens to people
The baseUri
folder should have the same number of json files in it as addresses in addresses
The baseUri
folder should have files named without any file extension
function airdrop(address[] calldata addresses, string calldata baseUri) external;
Parameters
Name | Type | Description |
---|---|---|
addresses | address[] | Dynamic array of addresses to mint to |
baseUri | string | The base uri for the batch, expecting json to be in order, starting at file name 0, and SHOULD NOT have a trailing / |
externalMint
Function to allow an approved mint contract to mint
Requires the caller to be an approved mint contract
function externalMint(address recipient, string calldata uri) external;
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
uri | string | The token uri to mint |
transferToken
Function to transfer token to another wallet
Callable only by owner or admin
Useful if a chip fails or an alteration damages a chip in some way
function transferToken(address from, address to, uint256 tokenId) external;
Parameters
Name | Type | Description |
---|---|---|
from | address | The current owner of the token |
to | address | The recipient of the token |
tokenId | uint256 | The token to transfer |
setTracersRegistry
Function to set a new TRACERS registry
Callable only by owner or admin
function setTracersRegistry(address newTracersRegistry) external;
Parameters
Name | Type | Description |
---|---|---|
newTracersRegistry | address | The new TRACERS Registry |
addVerifiedStory
Function to write stories for tokens
Requires that the passed signature is signed by the token owner, which is the ARX Halo Chip (physical)
Uses EIP-712 for the signature
function addVerifiedStory(uint256[] calldata tokenIds, string[] calldata stories, bytes[] calldata signatures)
external;
Parameters
Name | Type | Description |
---|---|---|
tokenIds | uint256[] | The tokens to add a stories to |
stories | string[] | The story text |
signatures | bytes[] | The signtatures from the chip to verify physical presence |
setTokenUri
Function to update a token uri for a specific token
Requires owner or admin
function setTokenUri(uint256 tokenId, string calldata newUri) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to propose new metadata for |
newUri | string | The new token uri proposed |
Events
TRACERSRegistryUpdated
event TRACERSRegistryUpdated(
address indexed sender, address indexed oldTracersRegistry, address indexed newTracersRegistry
);
TRACE
Inherits: ERC721Upgradeable, OwnableAccessControlUpgradeable, EIP2981TLUpgradeable, EIP712Upgradeable, ICreatorBase, ITRACE, IStory, IERC4906
Author: transientlabs.xyz
Sovereign T.R.A.C.E. Creator Contract allowing for digital Certificates of Authenticity backed by the blockchain
State Variables
VERSION
String representation of uint256
String representation for address
string public constant VERSION = "3.0.1";
ADMIN_ROLE
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
APPROVED_MINT_CONTRACT
bytes32 public constant APPROVED_MINT_CONTRACT = keccak256("APPROVED_MINT_CONTRACT");
tracersRegistry
ITRACERSRegistry public tracersRegistry;
_counter
uint256 private _counter;
_tokenUris
mapping(uint256 => string) private _tokenUris;
_verifiedStoryHashUsed
mapping(bytes32 => bool) private _verifiedStoryHashUsed;
_batchMints
BatchMint[] private _batchMints;
Functions
constructor
constructor(bool disable);
Parameters
Name | Type | Description |
---|---|---|
disable | bool | Boolean to disable initialization for the implementation contract |
initialize
tx.origin
is used in the events here as these can be deployed via contract factories and we want to capture the true sender
function initialize(
string memory name,
string memory symbol,
string memory personalization,
address defaultRoyaltyRecipient,
uint256 defaultRoyaltyPercentage,
address initOwner,
address[] memory admins,
address defaultTracersRegistry
) external initializer;
Parameters
Name | Type | Description |
---|---|---|
name | string | The name of the contract |
symbol | string | The symbol of the contract |
personalization | string | A string to emit as a collection story. Can be ASCII art or something else that is a personalization of the contract. |
defaultRoyaltyRecipient | address | The default address for royalty payments |
defaultRoyaltyPercentage | uint256 | The default royalty percentage of basis points (out of 10,000) |
initOwner | address | The owner of the contract |
admins | address[] | Array of admin addresses to add to the contract |
defaultTracersRegistry | address | Address of the TRACERS registry to use |
totalSupply
Function to get total supply minted so far
function totalSupply() external view returns (uint256);
setApprovedMintContracts
Function to set approved mint contracts
Access to owner or admin
function setApprovedMintContracts(address[] calldata minters, bool status) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
minters | address[] | Array of minters to grant approval to |
status | bool | Status for the minters |
mint
Function to mint a single token
Requires owner or admin
function mint(address recipient, string calldata uri) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
uri | string | The token uri to mint |
mint
Function to mint a single token
Requires owner or admin
function mint(address recipient, string calldata uri, address royaltyAddress, uint256 royaltyPercent)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
uri | string | The token uri to mint |
royaltyAddress | address | |
royaltyPercent | uint256 |
airdrop
Function to airdrop tokens to addresses
Requires owner or admin
function airdrop(address[] calldata addresses, string calldata baseUri) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
addresses | address[] | Dynamic array of addresses to mint to |
baseUri | string | The base uri for the batch, expecting json to be in order, starting at file name 0, and SHOULD NOT have a trailing / |
externalMint
Function to allow an approved mint contract to mint
Requires the caller to be an approved mint contract
function externalMint(address recipient, string calldata uri) external onlyRole(APPROVED_MINT_CONTRACT);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
uri | string | The token uri to mint |
transferToken
Function to transfer token to another wallet
Callable only by owner or admin
function transferToken(address from, address to, uint256 tokenId) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
from | address | The current owner of the token |
to | address | The recipient of the token |
tokenId | uint256 | The token to transfer |
setTracersRegistry
Function to set a new TRACERS registry
Callable only by owner or admin
function setTracersRegistry(address newTracersRegistry) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newTracersRegistry | address | The new TRACERS Registry |
addVerifiedStory
Function to write stories for tokens
Requires that the passed signature is signed by the token owner, which is the ARX Halo Chip (physical)
function addVerifiedStory(uint256[] calldata tokenIds, string[] calldata stories, bytes[] calldata signatures)
external;
Parameters
Name | Type | Description |
---|---|---|
tokenIds | uint256[] | The tokens to add a stories to |
stories | string[] | The story text |
signatures | bytes[] | The signtatures from the chip to verify physical presence |
setDefaultRoyalty
Function to set the default royalty specification
Requires owner or admin
function setDefaultRoyalty(address newRecipient, uint256 newPercentage) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newRecipient | address | The new royalty payout address |
newPercentage | uint256 | The new royalty percentage in basis (out of 10,000) |
setTokenRoyalty
Function to override a token's royalty info
Requires owner or admin
function setTokenRoyalty(uint256 tokenId, address newRecipient, uint256 newPercentage)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to override royalty for |
newRecipient | address | The new royalty payout address for the token id |
newPercentage | uint256 | The new royalty percentage in basis (out of 10,000) for the token id |
setTokenUri
Function to update a token uri for a specific token
Requires owner or admin
function setTokenUri(uint256 tokenId, string calldata newUri) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to propose new metadata for |
newUri | string | The new token uri proposed |
tokenURI
function tokenURI(uint256 tokenId) public view override(ERC721Upgradeable) returns (string memory);
addCollectionStory
Function to let the creator add a story to the collection they have created
ignores the creator name to avoid sybil
function addCollectionStory(string calldata, string calldata story) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
<none> | string | |
story | string | The story written and attached to the token id |
addCreatorStory
Function to let the creator add a story to any token they have created
ignores the creator name to avoid sybil
function addCreatorStory(uint256 tokenId, string calldata, string calldata story)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to which the story is attached |
<none> | string | |
story | string | The story written and attached to the token id |
addStory
Function to let collectors add a story to any token they own
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times a collector may write a story.
function addStory(uint256, string calldata, string calldata) external pure;
Parameters
Name | Type | Description |
---|---|---|
<none> | uint256 | |
<none> | string | |
<none> | string |
setStoryStatus
Function to enable or disable collector story inscriptions
Requires owner or admin
function setStoryStatus(bool) external pure;
Parameters
Name | Type | Description |
---|---|---|
<none> | bool |
storyEnabled
Function to get the status of collector stories
function storyEnabled() external pure returns (bool);
Returns
Name | Type | Description |
---|---|---|
<none> | bool | bool Status of collector stories being enabled |
setBlockListRegistry
Function to change the blocklist registry
Access to owner or admin
function setBlockListRegistry(address) external pure;
Parameters
Name | Type | Description |
---|---|---|
<none> | address |
blocklistRegistry
Function to get the blocklist registry
function blocklistRegistry() external pure returns (IBlockListRegistry);
setNftDelegationRegistry
Function to change the TL NFT delegation registry
Access to owner or admin
function setNftDelegationRegistry(address) external pure;
Parameters
Name | Type | Description |
---|---|---|
<none> | address |
tlNftDelegationRegistry
Function to get the delegation registry
function tlNftDelegationRegistry() external pure returns (ITLNftDelegationRegistry);
supportsInterface
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721Upgradeable, EIP2981TLUpgradeable, IERC165)
returns (bool);
_getBatchInfo
function to get batch mint info
function _getBatchInfo(uint256 tokenId) internal view returns (string memory);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | token id to look up for batch mint info |
Returns
Name | Type | Description |
---|---|---|
<none> | string | string the uri for the tokenId |
_exists
Function to check if a token exists
function _exists(uint256 tokenId) internal view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to check |
_addVerifiedStory
Function to add a verified story in a reusable way
function _addVerifiedStory(uint256 tokenId, string memory story, bytes memory signature) internal;
_hashVerifiedStory
Function to hash the typed data
function _hashVerifiedStory(address nftContract, uint256 tokenId, string memory story)
internal
pure
returns (bytes32);
Errors
EmptyTokenURI
Token uri is an empty string
error EmptyTokenURI();
AirdropTooFewAddresses
Airdrop to too few addresses
error AirdropTooFewAddresses();
TokenDoesntExist
Token does not exist
error TokenDoesntExist();
VerifiedStoryAlreadyWritten
Verified story already written for token
error VerifiedStoryAlreadyWritten();
ArrayLengthMismatch
Array length mismatch
error ArrayLengthMismatch();
InvalidSignature
Invalid signature
error InvalidSignature();
Unauthorized
Unauthorized to add a verified story
error Unauthorized();
Structs
BatchMint
Struct defining a batch mint - used for airdrops
struct BatchMint {
uint256 fromTokenId;
uint256 toTokenId;
string baseUri;
}
VerifiedStory
Struct for verified story & signed EIP-712 message
struct VerifiedStory {
address nftContract;
uint256 tokenId;
string story;
}
ERC721TL
Inherits: ERC721Upgradeable, OwnableAccessControlUpgradeable, EIP2981TLUpgradeable, ICreatorBase, IERC721TL, ISynergy, IStory, IERC4906
Author: transientlabs.xyz
Sovereign ERC-721 Creator Contract with Synergy and Story Inscriptions
State Variables
VERSION
String representation of uint256
String representation for address
string public constant VERSION = "3.0.1";
ADMIN_ROLE
bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
APPROVED_MINT_CONTRACT
bytes32 public constant APPROVED_MINT_CONTRACT = keccak256("APPROVED_MINT_CONTRACT");
_counter
uint256 private _counter;
storyEnabled
bool public storyEnabled;
tlNftDelegationRegistry
ITLNftDelegationRegistry public tlNftDelegationRegistry;
blocklistRegistry
IBlockListRegistry public blocklistRegistry;
_burned
mapping(uint256 => bool) private _burned;
_proposedTokenUris
mapping(uint256 => string) private _proposedTokenUris;
_tokenUris
mapping(uint256 => string) private _tokenUris;
_batchMints
BatchMint[] private _batchMints;
Functions
constructor
constructor(bool disable);
Parameters
Name | Type | Description |
---|---|---|
disable | bool | Boolean to disable initialization for the implementation contract |
initialize
tx.origin
is used in the events here as these can be deployed via contract factories and we want to capture the true sender
function initialize(
string memory name,
string memory symbol,
string memory personalization,
address defaultRoyaltyRecipient,
uint256 defaultRoyaltyPercentage,
address initOwner,
address[] memory admins,
bool enableStory,
address initBlockListRegistry,
address initNftDelegationRegistry
) external initializer;
Parameters
Name | Type | Description |
---|---|---|
name | string | The name of the 721 contract |
symbol | string | The symbol of the 721 contract |
personalization | string | A string to emit as a collection story. Can be ASCII art or something else that is a personalization of the contract. |
defaultRoyaltyRecipient | address | The default address for royalty payments |
defaultRoyaltyPercentage | uint256 | The default royalty percentage of basis points (out of 10,000) |
initOwner | address | The owner of the contract |
admins | address[] | Array of admin addresses to add to the contract |
enableStory | bool | A bool deciding whether to add story fuctionality or not |
initBlockListRegistry | address | Address of the blocklist registry to use |
initNftDelegationRegistry | address | Address of the TL nft delegation registry to use |
totalSupply
Function to get total supply minted so far
function totalSupply() external view returns (uint256);
setApprovedMintContracts
Function to set approved mint contracts
Access to owner or admin
function setApprovedMintContracts(address[] calldata minters, bool status) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
minters | address[] | Array of minters to grant approval to |
status | bool | Status for the minters |
mint
Function to mint a single token
Requires owner or admin
function mint(address recipient, string calldata uri) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
uri | string | The token uri to mint |
mint
Function to mint a single token
Requires owner or admin
function mint(address recipient, string calldata uri, address royaltyAddress, uint256 royaltyPercent)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
uri | string | The token uri to mint |
royaltyAddress | address | |
royaltyPercent | uint256 |
batchMint
Function to batch mint tokens
Requires owner or admin
function batchMint(address recipient, uint128 numTokens, string calldata baseUri)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
numTokens | uint128 | Number of tokens in the batch mint |
baseUri | string | The base uri for the batch, expecting json to be in order, starting at file name 0, and SHOULD NOT have a trailing / |
airdrop
Function to airdrop tokens to addresses
Requires owner or admin
function airdrop(address[] calldata addresses, string calldata baseUri) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
addresses | address[] | Dynamic array of addresses to mint to |
baseUri | string | The base uri for the batch, expecting json to be in order, starting at file name 0, and SHOULD NOT have a trailing / |
externalMint
Function to allow an approved mint contract to mint
Requires the caller to be an approved mint contract
function externalMint(address recipient, string calldata uri) external onlyRole(APPROVED_MINT_CONTRACT);
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
uri | string | The token uri to mint |
burn
Function to burn a token
Caller must be approved or owner of the token
function burn(uint256 tokenId) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to burn |
setDefaultRoyalty
Function to set the default royalty specification
Requires owner or admin
function setDefaultRoyalty(address newRecipient, uint256 newPercentage) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newRecipient | address | The new royalty payout address |
newPercentage | uint256 | The new royalty percentage in basis (out of 10,000) |
setTokenRoyalty
Function to override a token's royalty info
Requires owner or admin
function setTokenRoyalty(uint256 tokenId, address newRecipient, uint256 newPercentage)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to override royalty for |
newRecipient | address | The new royalty payout address for the token id |
newPercentage | uint256 | The new royalty percentage in basis (out of 10,000) for the token id |
proposeNewTokenUri
Function to propose a token uri update for a specific token
Requires owner or admin
function proposeNewTokenUri(uint256 tokenId, string calldata newUri) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to propose new metadata for |
newUri | string | The new token uri proposed |
acceptTokenUriUpdate
Function to accept a proposed token uri update for a specific token
Requires owner of the token or delegate to call the function
function acceptTokenUriUpdate(uint256 tokenId) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to accept the metadata update for |
rejectTokenUriUpdate
Function to reject a proposed token uri update for a specific token
Requires owner of the token or delegate to call the function
function rejectTokenUriUpdate(uint256 tokenId) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to reject the metadata update for |
tokenURI
function tokenURI(uint256 tokenId) public view override(ERC721Upgradeable) returns (string memory);
addCollectionStory
Function to let the creator add a story to the collection they have created
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times the creator may write a story.
function addCollectionStory(string calldata, string calldata story) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
<none> | string | |
story | string | The story written and attached to the token id |
addCreatorStory
Function to let the creator add a story to any token they have created
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times the creator may write a story.
function addCreatorStory(uint256 tokenId, string calldata, string calldata story)
external
onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to which the story is attached |
<none> | string | |
story | string | The story written and attached to the token id |
addStory
Function to let collectors add a story to any token they own
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times a collector may write a story.
function addStory(uint256 tokenId, string calldata, string calldata story) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to which the story is attached |
<none> | string | |
story | string | The story written and attached to the token id |
setStoryStatus
Function to enable or disable collector story inscriptions
Requires owner or admin
function setStoryStatus(bool status) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
status | bool | The status to set for collector story inscriptions |
setBlockListRegistry
Function to change the blocklist registry
Access to owner or admin
function setBlockListRegistry(address newBlockListRegistry) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newBlockListRegistry | address | The new blocklist registry |
approve
function approve(address to, uint256 tokenId) public override(ERC721Upgradeable, IERC721);
setApprovalForAll
function setApprovalForAll(address operator, bool approved) public override(ERC721Upgradeable, IERC721);
setNftDelegationRegistry
Function to change the TL NFT delegation registry
Access to owner or admin
function setNftDelegationRegistry(address newNftDelegationRegistry) external onlyRoleOrOwner(ADMIN_ROLE);
Parameters
Name | Type | Description |
---|---|---|
newNftDelegationRegistry | address | The new blocklist registry |
supportsInterface
function supportsInterface(bytes4 interfaceId)
public
view
override(ERC721Upgradeable, EIP2981TLUpgradeable, IERC165)
returns (bool);
_getBatchInfo
Function to get batch mint info
function _getBatchInfo(uint256 tokenId) internal view returns (address, string memory);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | Token id to look up for batch mint info |
Returns
Name | Type | Description |
---|---|---|
<none> | address | adress The token owner |
<none> | string | string The uri for the tokenId |
_ownerOf
Function to override { ERC721Upgradeable._ownerOf } to allow for batch minting
function _ownerOf(uint256 tokenId) internal view override(ERC721Upgradeable) returns (address);
_exists
Function to check if a token exists
function _exists(uint256 tokenId) internal view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to check |
_isTokenOwnerOrDelegate
Function to get if msg.sender is the token owner or delegated owner
function _isTokenOwnerOrDelegate(uint256 tokenId) internal view returns (bool);
_isOperatorBlocked
function _isOperatorBlocked(address operator) internal view returns (bool);
Errors
EmptyTokenURI
Token uri is an empty string
error EmptyTokenURI();
MintToZeroAddress
Mint to zero address
error MintToZeroAddress();
BatchSizeTooSmall
Batch size too small
error BatchSizeTooSmall();
AirdropTooFewAddresses
Airdrop to too few addresses
error AirdropTooFewAddresses();
CallerNotTokenOwnerOrDelegate
Caller is not the owner or delegate of the owner of the specific token
error CallerNotTokenOwnerOrDelegate();
CallerNotApprovedOrOwner
Caller is not approved or owner
error CallerNotApprovedOrOwner();
TokenDoesntExist
Token does not exist
error TokenDoesntExist();
NoTokenUriUpdateAvailable
No proposed token uri to change to
error NoTokenUriUpdateAvailable();
OperatorBlocked
Operator for token approvals blocked
error OperatorBlocked();
StoryNotEnabled
Story not enabled for collectors
error StoryNotEnabled();
Structs
BatchMint
Struct defining a batch mint
struct BatchMint {
address creator;
uint256 fromTokenId;
uint256 toTokenId;
string baseUri;
}
IERC721TL
Author: transientlabs.xyz
Interface for ERC721TL
Interface id = 0xc74089ae
Functions
mint
Function to mint a single token
Requires owner or admin
function mint(address recipient, string calldata uri) external;
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
uri | string | The token uri to mint |
mint
Function to mint a single token with specific token royalty
Requires owner or admin
function mint(address recipient, string calldata uri, address royaltyAddress, uint256 royaltyPercent) external;
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
uri | string | The token uri to mint |
royaltyAddress | address | Royalty payout address for this new token |
royaltyPercent | uint256 | Royalty percentage for this new token |
batchMint
Function to batch mint tokens
Requires owner or admin
The baseUri
folder should have the same number of json files in it as numTokens
The baseUri
folder should have files named without any file extension
function batchMint(address recipient, uint128 numTokens, string calldata baseUri) external;
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
numTokens | uint128 | Number of tokens in the batch mint |
baseUri | string | The base uri for the batch, expecting json to be in order, starting at file name 0, and SHOULD NOT have a trailing / |
airdrop
Function to airdrop tokens to addresses
Requires owner or admin
Utilizes batch mint token uri values to save some gas but still ultimately mints individual tokens to people
The baseUri
folder should have the same number of json files in it as addresses in addresses
The baseUri
folder should have files named without any file extension
function airdrop(address[] calldata addresses, string calldata baseUri) external;
Parameters
Name | Type | Description |
---|---|---|
addresses | address[] | Dynamic array of addresses to mint to |
baseUri | string | The base uri for the batch, expecting json to be in order, starting at file name 0, and SHOULD NOT have a trailing / |
externalMint
Function to allow an approved mint contract to mint
Requires the caller to be an approved mint contract
function externalMint(address recipient, string calldata uri) external;
Parameters
Name | Type | Description |
---|---|---|
recipient | address | The recipient of the token - assumed as able to receive 721 tokens |
uri | string | The token uri to mint |
burn
Function to burn a token
Caller must be approved or owner of the token
function burn(uint256 tokenId) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to burn |
Contents
IBlockListRegistry
Author: transientlabs.xyz
Interface for the BlockListRegistry Contract
Functions
getBlockListStatus
Function to get blocklist status with True meaning that the operator is blocked
function getBlockListStatus(address operator) external view returns (bool);
Parameters
Name | Type | Description |
---|---|---|
operator | address | The operator in question to check against the blocklist |
setBlockListStatus
Function to set the block list status for multiple operators
Must be called by the blockList owner
function setBlockListStatus(address[] calldata operators, bool status) external;
Parameters
Name | Type | Description |
---|---|---|
operators | address[] | An address array of operators to set a status for |
status | bool | The status to set for all operators |
clearBlockList
Function to clear the block list status
Must be called by the blockList owner
function clearBlockList() external;
Events
BlockListStatusChange
event BlockListStatusChange(address indexed user, address indexed operator, bool indexed status);
BlockListCleared
event BlockListCleared(address indexed user);
ICreatorBase
Author: transientlabs.xyz
Base interface for creator contracts
Interface id = 0x1c8e024d
Functions
totalSupply
Function to get total supply minted so far
function totalSupply() external view returns (uint256);
setApprovedMintContracts
Function to set approved mint contracts
Access to owner or admin
function setApprovedMintContracts(address[] calldata minters, bool status) external;
Parameters
Name | Type | Description |
---|---|---|
minters | address[] | Array of minters to grant approval to |
status | bool | Status for the minters |
setBlockListRegistry
Function to change the blocklist registry
Access to owner or admin
function setBlockListRegistry(address newBlockListRegistry) external;
Parameters
Name | Type | Description |
---|---|---|
newBlockListRegistry | address | The new blocklist registry |
blocklistRegistry
Function to get the blocklist registry
function blocklistRegistry() external view returns (IBlockListRegistry);
setNftDelegationRegistry
Function to change the TL NFT delegation registry
Access to owner or admin
function setNftDelegationRegistry(address newNftDelegationRegistry) external;
Parameters
Name | Type | Description |
---|---|---|
newNftDelegationRegistry | address | The new blocklist registry |
tlNftDelegationRegistry
Function to get the delegation registry
function tlNftDelegationRegistry() external view returns (ITLNftDelegationRegistry);
setDefaultRoyalty
Function to set the default royalty specification
Requires owner or admin
function setDefaultRoyalty(address newRecipient, uint256 newPercentage) external;
Parameters
Name | Type | Description |
---|---|---|
newRecipient | address | The new royalty payout address |
newPercentage | uint256 | The new royalty percentage in basis (out of 10,000) |
setTokenRoyalty
Function to override a token's royalty info
Requires owner or admin
function setTokenRoyalty(uint256 tokenId, address newRecipient, uint256 newPercentage) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to override royalty for |
newRecipient | address | The new royalty payout address for the token id |
newPercentage | uint256 | The new royalty percentage in basis (out of 10,000) for the token id |
setStoryStatus
Function to enable or disable collector story inscriptions
Requires owner or admin
function setStoryStatus(bool status) external;
Parameters
Name | Type | Description |
---|---|---|
status | bool | The status to set for collector story inscriptions |
storyEnabled
Function to get the status of collector stories
function storyEnabled() external view returns (bool);
Returns
Name | Type | Description |
---|---|---|
<none> | bool | bool Status of collector stories being enabled |
Events
StoryStatusUpdate
Event for changing the story status
event StoryStatusUpdate(address indexed sender, bool indexed status);
BlockListRegistryUpdate
Event for changing the BlockList registry
event BlockListRegistryUpdate(
address indexed sender, address indexed prevBlockListRegistry, address indexed newBlockListRegistry
);
NftDelegationRegistryUpdate
Event for changing the NFT Delegation registry
event NftDelegationRegistryUpdate(
address indexed sender, address indexed prevNftDelegationRegistry, address indexed newNftDelegationRegistry
);
IERC7160
The ERC-165 identifier for this interface is 0x06e1bc5b.
Functions
tokenURIs
Get all token uris associated with a particular token
If a token uri is pinned, the index returned SHOULD be the index in the string array
This call MUST revert if the token does not exist
function tokenURIs(uint256 tokenId) external view returns (uint256 index, string[] memory uris, bool pinned);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The identifier for the nft |
Returns
Name | Type | Description |
---|---|---|
index | uint256 | An unisgned integer that specifies which uri is pinned for a token (or the default uri if unpinned) |
uris | string[] | A string array of all uris associated with a token |
pinned | bool | A boolean showing if the token has pinned metadata or not |
pinTokenURI
Pin a specific token uri for a particular token
This call MUST revert if the token does not exist
This call MUST emit a TokenUriPinned
event
This call MAY emit a MetadataUpdate
event from ERC-4096
function pinTokenURI(uint256 tokenId, uint256 index) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The identifier of the nft |
index | uint256 | The index in the string array returned from the tokenURIs function that should be pinned for the token |
unpinTokenURI
Unpin metadata for a particular token
This call MUST revert if the token does not exist
This call MUST emit a TokenUriUnpinned
event
This call MAY emit a MetadataUpdate
event from ERC-4096
It is up to the developer to define what this function does and is intentionally left open-ended
function unpinTokenURI(uint256 tokenId) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The identifier of the nft |
hasPinnedTokenURI
Check on-chain if a token id has a pinned uri or not
This call MUST revert if the token does not exist
Useful for on-chain mechanics that don't require the tokenURIs themselves
function hasPinnedTokenURI(uint256 tokenId) external view returns (bool pinned);
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The identifier of the nft |
Returns
Name | Type | Description |
---|---|---|
pinned | bool | A bool specifying if a token has metadata pinned or not |
Events
TokenUriPinned
This event emits when a token uri is pinned and is useful for indexing purposes.
event TokenUriPinned(uint256 indexed tokenId, uint256 indexed index);
TokenUriUnpinned
This event emits when a token uri is unpinned and is useful for indexing purposes.
event TokenUriUnpinned(uint256 indexed tokenId);
IStory
Author: transientlabs.xyz
Interface id: 0x2464f17b
Previous interface id that is still supported: 0x0d23ecb9
Functions
addCollectionStory
Function to let the creator add a story to the collection they have created
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times the creator may write a story.
This function MUST emit the CollectionStory event each time it is called
This function MUST implement logic to restrict access to only the creator
function addCollectionStory(string calldata creatorName, string calldata story) external;
Parameters
Name | Type | Description |
---|---|---|
creatorName | string | String representation of the creator's name |
story | string | The story written and attached to the token id |
addCreatorStory
Function to let the creator add a story to any token they have created
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times the creator may write a story.
This function MUST emit the CreatorStory event each time it is called
This function MUST implement logic to restrict access to only the creator
This function MUST revert if a story is written to a non-existent token
function addCreatorStory(uint256 tokenId, string calldata creatorName, string calldata story) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to which the story is attached |
creatorName | string | String representation of the creator's name |
story | string | The story written and attached to the token id |
addStory
Function to let collectors add a story to any token they own
Depending on the implementation, this function may be restricted in various ways, such as limiting the number of times a collector may write a story.
This function MUST emit the Story event each time it is called
This function MUST implement logic to restrict access to only the owner of the token
This function MUST revert if a story is written to a non-existent token
function addStory(uint256 tokenId, string calldata collectorName, string calldata story) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token id to which the story is attached |
collectorName | string | String representation of the collectors's name |
story | string | The story written and attached to the token id |
Events
CollectionStory
Event describing a collection story getting added to a contract
This event stories creator stories on chain in the event log that apply to an entire collection
event CollectionStory(address indexed creatorAddress, string creatorName, string story);
CreatorStory
Event describing a creator story getting added to a token
This events stores creator stories on chain in the event log
event CreatorStory(uint256 indexed tokenId, address indexed creatorAddress, string creatorName, string story);
Story
Event describing a collector story getting added to a token
This events stores collector stories on chain in the event log
event Story(uint256 indexed tokenId, address indexed collectorAddress, string collectorName, string story);
ISynergy
Author: transientlabs.xyz
Interface for Synergy
Interface id = 0x8193ebea
Functions
proposeNewTokenUri
Function to propose a token uri update for a specific token
Requires owner or admin
If the owner of the contract is the owner of the token, the change takes hold right away
MUST emit a MetadataUpdate
event if the owner of the token is the owner of the contract
MUST emit a SynergyStatusChange
event if the owner of the token is not the owner of the contract
function proposeNewTokenUri(uint256 tokenId, string calldata newUri) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to propose new metadata for |
newUri | string | The new token uri proposed |
acceptTokenUriUpdate
Function to accept a proposed token uri update for a specific token
Requires owner of the token or delegate to call the function
MUST emit a SynergyStatusChange
event
function acceptTokenUriUpdate(uint256 tokenId) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to accept the metadata update for |
rejectTokenUriUpdate
Function to reject a proposed token uri update for a specific token
Requires owner of the token or delegate to call the function
MUST emit a SynergyStatusChange
event
function rejectTokenUriUpdate(uint256 tokenId) external;
Parameters
Name | Type | Description |
---|---|---|
tokenId | uint256 | The token to reject the metadata update for |
Events
SynergyStatusChange
Event for changing the status of a proposed metadata update.
event SynergyStatusChange(address indexed from, uint256 indexed tokenId, SynergyAction indexed action, string uri);
Enums
SynergyAction
Enum defining Synergy actions
enum SynergyAction {
Created,
Accepted,
Rejected
}
ITLNftDelegationRegistry
Author: transientlabs.xyz
Interface for the TL NFT Delegation Registry
Functions
checkDelegateForERC721
Function to check if an address is delegated for a vault for an ERC-721 token
This function does not ensure the vault is the current owner of the token
This function SHOULD return True
if the delegate is delegated for the vault whether it's on the token level, contract level, or wallet level (all)
function checkDelegateForERC721(address delegate, address vault, address nftContract, uint256 tokenId)
external
view
returns (bool);
Parameters
Name | Type | Description |
---|---|---|
delegate | address | The address to check for delegation status |
vault | address | The vault address to check against |
nftContract | address | The nft contract address to check |
tokenId | uint256 | The token id to check against |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | bool True is delegated, False if not |
checkDelegateForERC1155
Function to check if an address is delegated for a vault for an ERC-1155 token
This function does not ensure the vault has a balance of the token in question
This function SHOULD return True
if the delegate is delegated for the vault whether it's on the token level, contract level, or wallet level (all)
function checkDelegateForERC1155(address delegate, address vault, address nftContract, uint256 tokenId)
external
view
returns (bool);
Parameters
Name | Type | Description |
---|---|---|
delegate | address | The address to check for delegation status |
vault | address | The vault address to check against |
nftContract | address | The nft contract address to check |
tokenId | uint256 | The token id to check against |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | bool True is delegated, False if not |
ITRACERSRegistry
Author: transientlabs.xyz
Interface for TRACE Registered Agents Registry
Functions
setRegisteredAgent
Function to add a global registered agent by the contract owner
This is a for a global registered agent so registeredAgent.numberOfStories
is ignored
MUST emit the event RegisteredAgentUpdate
function setRegisteredAgent(address registeredAgentAddress, RegisteredAgent memory registeredAgent) external;
Parameters
Name | Type | Description |
---|---|---|
registeredAgentAddress | address | The registered agent address |
registeredAgent | RegisteredAgent | The registered agent |
setRegisteredAgentOverride
Function to add a registered agent override by an nft contract owner or admin
MUST emit the event RegisteredAgentOverrideUpdate
function setRegisteredAgentOverride(
address nftContract,
address registeredAgentAddress,
RegisteredAgent calldata registeredAgent
) external;
Parameters
Name | Type | Description |
---|---|---|
nftContract | address | The nft contract |
registeredAgentAddress | address | The registered agent address |
registeredAgent | RegisteredAgent | The registered agent |
isRegisteredAgent
Function callable by an nft contract to check the registered agent
This MUST be called by the nft contract in order to check overrides properly
Adjusts overrides that are limited in the number of stories allowed, hence no view modifier
function isRegisteredAgent(address registeredAgentAddress) external returns (bool, string memory);
Parameters
Name | Type | Description |
---|---|---|
registeredAgentAddress | address | The registered agent address |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | bool Boolean indicating if the address is question is a registered agent or not |
<none> | string | string The name of the registered agent |
getRegisteredAgent
External view function to get a registered agent, returning an overrided agent for a contract if it exists
function getRegisteredAgent(address nftContract, address registeredAgentAddress)
external
view
returns (RegisteredAgent memory registeredAgent);
Parameters
Name | Type | Description |
---|---|---|
nftContract | address | The nft contract (set to the zero address if not looking for an override) |
registeredAgentAddress | address | The registered agent address |
Returns
Name | Type | Description |
---|---|---|
registeredAgent | RegisteredAgent | The registered agent struct |
Events
RegisteredAgentUpdate
event whenever a registered agent is added, removed, or updated
event RegisteredAgentUpdate(
address indexed sender, address indexed registeredAgentAddress, RegisteredAgent registeredAgent
);
RegisteredAgentOverrideUpdate
event whenever a registered agent override is added, removed, or updated
event RegisteredAgentOverrideUpdate(
address indexed sender,
address indexed nftContract,
address indexed indexedregisteredAgentAddress,
RegisteredAgent registeredAgent
);
Structs
RegisteredAgent
Struct defining a registered agent
struct RegisteredAgent {
bool isPermanent;
uint128 numberOfStories;
string name;
}