Request form
Cookbook may introduce a token in the future. Share and contribute to be eligible for future airdrops.
close icon
relevant tag icon
Thirdweb Edition Contract (ERC1155)
copy icon
thirdweb
โ€ข version 1.0.0
ERC1155
NFT
Royalties
Audited

Thirdweb Edition Contract (ERC1155)

Audited

The Edition contract is best used when you want to release many NFTs based on the same asset, but you don't want to "drop" or "release" them for your community to claim. Unlike the Edition Drop contract, the Edition contract does not lazy mint your NFTs. Instead, NFTs are minted immediately when they are added to the collection. This means you can still transfer the NFTs or sell them on a Marketplace and perform any other actions you would expect to do with an NFT. For advanced use-cases, the Edition also has signature-based minting capabilities.

*Visit desktop site to download or deploy

Version

1.0.0

Creator

thirdweb

Recent Use

๐Ÿž 0x77eA downloaded

Last Publish

10/23/2022
Any contract you deploy is yours.
Fully owned and controlled by your wallet.
Documentation
Source Code
initialize(address,string,string,string,address,address,uint128,uint128,address) :
This function is the initializer for the TokenERC1155 contract. It sets up the contract's name, symbol, contractURI, trustedForwarders, primarySaleRecipient, royaltyRecipient, royaltyBps, platformFeeBps, and platformFeeRecipient. It also sets up the DEFAULT_ADMIN_ROLE, MINTER_ROLE, TRANSFER_ROLE, and TRANSFER_ROLE roles with the defaultAdmin address as the owner. Finally, it sets up the ReentrancyGuard, EIP712, ERC2771Context, and ERC1155 contracts. (autogenerated documentation)
contractType() :
This function returns a bytes32 value that represents the type of the contract. It does this by simply returning the value of the MODULE_TYPE constant, which is set when the contract is deployed. (autogenerated documentation)
contractVersion() :
This function is a getter function that returns the version of the contract. It is a pure function, meaning that it does not modify the state of the contract and does not interact with the blockchain. It simply returns the value of the constant variable VERSION, which is a uint8 (unsigned 8-bit integer) that stores the version of the contract. (autogenerated documentation)
owner() :
This function returns the address of the owner of the contract. It does this by checking if the owner has the default admin role, and if so, returning the owner's address. If the owner does not have the default admin role, it returns a zero address. (autogenerated documentation)
verify() :
This function verifies a MintRequest and its associated signature. It does this by using the recoverAddress function to recover the address of the signer from the request and signature. It then checks if the request has not already been minted and if the signer has the MINTER_ROLE. If both of these conditions are met, it returns true and the address of the signer. (autogenerated documentation)
uri(uint256) :
This function returns the URI associated with a given token ID. It works by taking in a uint256 _tokenId as an argument and then returning the string memory associated with that token ID from the _tokenURI mapping. (autogenerated documentation)
mintTo(address,uint256,string,uint256) :
This function is used to mint a new token to a specified address. It takes in four parameters: the address to mint the token to, the token ID, a URI string, and the amount of the token to mint. If the token ID is set to the maximum value of a uint256, then the function will assign the next available token ID to the token. Otherwise, it will check to make sure that the token ID is valid and then assign it to the token. Finally, it will call the _mintTo function to mint the token to the specified address. (autogenerated documentation)
royaltyInfo(uint256,uint256) :
This function calculates the royalty amount for a given tokenId and salePrice. It does this by first retrieving the recipient address and royalty rate (in basis points) for the tokenId from the getRoyaltyInfoForToken function. It then calculates the royalty amount by multiplying the salePrice by the royalty rate and dividing it by the maximum basis points (MAX_BPS). The recipient address and royalty amount are then returned. (autogenerated documentation)
mintWithSignature() :
This function is used to mint tokens with a signature. It takes two parameters, a MintRequest and a signature. It verifies the request and signature, and then assigns a token ID to the request. If a royalty recipient is specified, the royalty information is stored in the royaltyInfoForToken mapping. The function then calls the _mintTo function to mint the tokens to the specified recipient, and collects the price for the request. Finally, it emits an event to indicate that the tokens have been minted with a signature. (autogenerated documentation)
setPrimarySaleRecipient(address) :
This function sets the primary sale recipient address for the contract. It can only be called by the default admin role, and it updates the primarySaleRecipient variable with the address passed in as an argument. It also emits an event to notify that the primary sale recipient has been updated. (autogenerated documentation)
setDefaultRoyaltyInfo(address,uint256) :
This function sets the default royalty recipient and royalty rate for the contract. It can only be called by the DEFAULT_ADMIN_ROLE, and requires that the royalty rate is less than or equal to the MAX_BPS. If these conditions are met, the royaltyRecipient and royaltyBps variables are set to the provided values, and an event is emitted to notify of the change. (autogenerated documentation)
setRoyaltyInfoForToken(uint256,address,uint256) :
This function sets the royalty information for a given token. It takes in three parameters: the token ID, the recipient address, and the royalty rate in basis points (bps). The function requires that the royalty rate is less than or equal to the maximum allowed royalty rate (MAX_BPS). If this requirement is met, the function stores the royalty information in the royaltyInfoForToken mapping. Finally, the function emits an event to signal that the royalty information has been set. (autogenerated documentation)
setPlatformFeeInfo(address,uint256) :
This function sets the platform fee recipient and the platform fee rate (in basis points) for the contract. It can only be called by the default admin role. The platform fee rate must be less than or equal to the maximum basis points (MAX_BPS) set in the contract. If the platform fee rate is successfully set, an event is emitted to notify the other contract participants. (autogenerated documentation)
setOwner(address) :
This function sets a new owner for the contract. It requires that the new owner has the DEFAULT_ADMIN_ROLE, and emits an event OwnerUpdated with the previous and new owner addresses. (autogenerated documentation)
setContractURI(string) :
This function sets the contractURI variable to the value of the _uri parameter. It can only be called by an account with the DEFAULT_ADMIN_ROLE. This allows the contract to store a URI that can be used to access additional information about the contract. (autogenerated documentation)
getPlatformFeeInfo() :
This function returns the address of the platform fee recipient and the platform fee rate (in basis points) for the contract. The platform fee rate is a percentage of the total amount of a transaction that is charged as a fee. The platform fee recipient is the address that will receive the fee. (autogenerated documentation)
getDefaultRoyaltyInfo() :
This function is used to retrieve the default royalty information for a particular contract. It returns a tuple containing the address of the royalty recipient and the royalty rate (in basis points). The royalty rate is a 16-bit unsigned integer, which is equivalent to a percentage rate between 0 and 65535. (autogenerated documentation)
getRoyaltyInfoForToken(uint256) :
This function retrieves the royalty information for a given token ID. It takes in a uint256 _tokenId as an argument and returns a tuple containing the address of the royalty recipient and the royalty rate in basis points (bps). If the royalty recipient for the given token ID is not set, the function will return the default royalty recipient and royalty rate set in the contract. (autogenerated documentation)
_mintTo(address,string,uint256,uint256) :
This function is used to mint a new token to a specified address. It takes in four parameters: the address to mint the token to, the token URI, the token ID, and the amount of tokens to mint. It first checks if the token URI is empty, and if it is, it requires that the URI provided is not empty. It then calls the _mint function to mint the token to the specified address, and emits an event to indicate that the tokens have been minted. (autogenerated documentation)
recoverAddress() :
This function is used to recover the address of the signer of a given request. It does this by hashing the request data using the keccak256 algorithm, encoding the request data, and then using the recover() function to recover the address of the signer from the provided signature. (autogenerated documentation)
_encodeRequest() :
This function encodes a MintRequest struct into a bytes memory array. The MintRequest struct contains information about a token minting request, such as the recipient, royalty recipient, royalty rate, token ID, URI, quantity, price per token, currency, validity start and end timestamps, and a unique identifier. The function encodes this data into a bytes memory array using the ABI encoding function. The data is encoded in the same order as the fields in the struct, and the URI is hashed using the keccak256 function. (autogenerated documentation)
verifyRequest() :
This function verifies a MintRequest, which is a request to mint a certain amount of tokens to a certain address. It checks that the request is valid (i.e. the signature is valid, the request is not expired, the recipient is defined, and the quantity is greater than 0). If the request is valid, it sets the minted flag for the request's UID to true and returns the address of the signer. (autogenerated documentation)
collectPrice() :
This function collects the price for a MintRequest. It first checks that the price per token is not zero, then calculates the total price and the platform fees. If the currency is the native token, it requires that the msg.value is equal to the total price. Otherwise, it requires that the msg.value is zero. It then transfers the platform fees to the platform fee recipient and the total price minus the platform fees to the primary sale recipient or the specified sale recipient. (autogenerated documentation)
burn(address,uint256,uint256) :
This function allows an account to burn a specific amount of a specific token. It requires that the caller is either the owner of the account or has been approved by the owner to burn the token. The function then calls the _burn() function, which will reduce the balance of the account for the specified token by the specified amount. (autogenerated documentation)
burnBatch(address,uint256[],uint256[]) :
This function allows the owner of a contract or an approved user to burn a batch of tokens. It takes in three parameters: an address of the account, an array of ids of the tokens to be burned, and an array of values of the tokens to be burned. The function then calls the _burnBatch() function, which is responsible for burning the tokens. The _burnBatch() function checks that the caller is either the owner of the contract or an approved user, and then burns the tokens. (autogenerated documentation)
_beforeTokenTransfer(address,address,address,uint256[],uint256[]) :
This function is an override of the _beforeTokenTransfer function in the ERC20 contract. It is used to check that the transfer of tokens is allowed. It checks that the operator, from, and to addresses have the TRANSFER_ROLE, and that the total supply of tokens is updated when tokens are transferred from or to address(0). (autogenerated documentation)
supportsInterface(bytes4) :
This function is used to check if a contract supports a given interface. It takes a bytes4 interfaceId as an argument and returns a boolean value indicating whether the contract supports the interface or not. The function first checks if the interface is supported by the parent contract, then checks if the interface is IERC1155Upgradeable or IERC2981Upgradeable. If either of these interfaces is supported, the function returns true, otherwise it returns false. (autogenerated documentation)
_msgSender() :
This function is used to retrieve the address of the sender of the current message. It works by calling the _msgSender() function from the ERC2771ContextUpgradeable contract, which returns the address of the sender. (autogenerated documentation)
_msgData() :
This function is used to retrieve the data associated with a given message call. It works by calling the _msgData() function from the ERC2771ContextUpgradeable contract, which returns the data associated with the message call as a byte array. (autogenerated documentation)

Get Cookin'
share iconShare

copy iconDownload Source
copy iconnpx cookbookdev i thirdweb-edition
copy icon

Recent Use

๐Ÿž 0x77eA downloaded

Last Publish

10/23/2022

Version

1.0.0

Creator

thirdweb

Cookbook is free.
Any contract you deploy is yours.
Your contract is owned and controlled by you.