diff --git a/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibleERC20.sol b/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibleERC20.sol index 64b3bd287..a4c2eb361 100644 --- a/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibleERC20.sol +++ b/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibleERC20.sol @@ -38,6 +38,7 @@ interface ILSP7CompatibleERC20 is ILSP7DigitalAsset { * @param to The address receiving tokens. * @param amount The amount of tokens to transfer. + * * @return `true` on successful transfer. */ function transfer(address to, uint256 amount) external returns (bool); diff --git a/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol b/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol index ee9525d77..0356132bb 100644 --- a/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +++ b/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol @@ -48,6 +48,7 @@ abstract contract LSP7CappedSupply is LSP7DigitalAsset { /** * @notice The maximum supply amount of tokens allowed to exist is `_tokenSupplyCap`. + * * @dev Get the maximum number of tokens that can exist to circulate. Once {totalSupply} reaches * reaches {totalSuuplyCap}, it is not possible to mint more tokens. * diff --git a/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol b/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol index 93767a32a..234577d4d 100644 --- a/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +++ b/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol @@ -11,7 +11,7 @@ import { } from "../LSP7DigitalAssetInitAbstract.sol"; /** - * @dev LSP7 extension, mintable. + * @dev LSP7DigitalAsset deployable preset contract (inheritable proxy version) with a public {mint} function callable only by the contract {owner}. */ abstract contract LSP7MintableInitAbstract is LSP7DigitalAssetInitAbstract, diff --git a/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol b/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol index 71a6d4057..e5b32faf4 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol @@ -15,11 +15,14 @@ bytes4 constant _INTERFACEID_ERC721METADATA = 0x5b5e139f; */ interface ILSP8CompatibleERC721 is ILSP8IdentifiableDigitalAsset { /** - * @notice To provide compatibility with indexing ERC721 events. - * @dev Emitted when `tokenId` token is transferred from `from` to `to`. - * @param from The sending address - * @param to The receiving address - * @param tokenId The tokenId to transfer + * @notice ERC721 `Transfer` compatible event emitted. Successfully transferred tokenId `tokenId` from `from` to `to`. + * + * @dev ERC721 `Transfer` event emitted when `tokenId` token is transferred from `from` to `to`. + * To provide compatibility with indexing ERC721 events. + * + * @param from The sending address. + * @param to The receiving address. + * @param tokenId The tokenId to transfer. */ event Transfer( address indexed from, @@ -28,21 +31,30 @@ interface ILSP8CompatibleERC721 is ILSP8IdentifiableDigitalAsset { ); /** - * @notice To provide compatibility with indexing ERC721 events. - * @dev Emitted when `owner` enables `approved` for `tokenId`. - * @param owner The address of the owner of the `tokenId` - * @param approved The address set as operator - * @param tokenId The approved tokenId + * @notice ERC721 `Approval` compatible event emitted. Successfully approved operator `operator` to operate on tokenId `tokenId` on behalf of token owner `owner`. + * + * @dev ERC721 `Approval` event emitted when `owner` enables `operator` for `tokenId`. + * To provide compatibility with indexing ERC721 events. + * + * @param owner The address of the owner of the `tokenId`. + * @param operator The address set as operator. + * @param tokenId The approved tokenId. */ event Approval( address indexed owner, - address indexed approved, + address indexed operator, uint256 indexed tokenId ); /** - * @dev This emits when an operator is enabled or disabled for an owner. - * The operator can manage all NFTs of the owner. + * @notice ERC721 `ApprovalForAll` compatible event emitted. Successfully set "approved for all" status to `approved` for operator `operator` for token owner `owner`. + * + * @dev ERC721 `ApprovalForAll` event emitted when an `operator` is enabled or disabled for an owner + * to transfer any of its tokenIds. The operator can manage all NFTs of the owner. + * + * @param owner The address of the owner of tokenIds. + * @param operator The address set as operator. + * @param approved If `operator` is approved for all NFTs or not. */ event ApprovalForAll( address indexed owner, @@ -51,18 +63,24 @@ interface ILSP8CompatibleERC721 is ILSP8IdentifiableDigitalAsset { ); /** - * @dev Compatible with ERC721 transferFrom. - * @param from The sending address - * @param to The receiving address - * @param tokenId The tokenId to transfer + * @notice Calling `transferFrom` function on `ILSP8CompatibleERC721` contract. Transferring tokenId `tokenId` from address `from` to address `to`. + * + * @dev Transfer functions from the ERC721 standard interface. + * + * @param from The sending address. + * @param to The receiving address. + * @param tokenId The tokenId to transfer. */ function transferFrom(address from, address to, uint256 tokenId) external; /** - * @dev Compatible with ERC721 transferFrom. - * @param from The sending address - * @param to The receiving address - * @param tokenId The tokenId to transfer + * @notice Calling `safeTransferFrom` function on `ILSP8CompatibleERC721` contract. Transferring tokenId `tokenId` from address `from` to address `to`. + * + * @dev Safe Transfer function without optional data from the ERC721 standard interface. + * + * @param from The sending address. + * @param to The receiving address. + * @param tokenId The tokenId to transfer. */ function safeTransferFrom( address from, @@ -71,11 +89,14 @@ interface ILSP8CompatibleERC721 is ILSP8IdentifiableDigitalAsset { ) external; /** - * @dev Compatible with ERC721 safeTransferFrom. - * @param from The sending address - * @param to The receiving address - * @param tokenId The tokenId to transfer - * @param data The data to be sent with the transfer + * @notice Calling `safeTransferFrom` function with `data` on `ILSP8CompatibleERC721` contract. Transferring tokenId `tokenId` from address `from` to address `to`. + * + * @dev Safe Transfer function with optional data from the ERC721 standard interface. + * + * @param from The sending address. + * @param to The receiving address. + * @param tokenId The tokenId to transfer. + * @param data The data to be sent with the transfer. */ function safeTransferFrom( address from, @@ -85,38 +106,55 @@ interface ILSP8CompatibleERC721 is ILSP8IdentifiableDigitalAsset { ) external; /** + * @notice Retrieving the address that own tokenId `tokenId`. + * * @dev Compatible with ERC721 ownerOf. - * @param tokenId The tokenId to query - * @return The owner of the tokenId + * + * @param tokenId The tokenId to query. + * @return The owner of the tokenId. */ function ownerOf(uint256 tokenId) external view returns (address); /** - * @dev Compatible with ERC721 approve. - * @param operator The address to approve for `tokenId` - * @param tokenId The tokenId to approve + * @notice Calling `approve` function on `ILSP8CompatibleERC721` contract. Approving operator at address `operator` to transfer tokenId `tokenId` on behalf of its owner. + * + * @dev Approval function compatible with ERC721 `approve(address,uint256)`. + * + * @param operator The address to approve for `tokenId`. + * @param tokenId The tokenId to approve. */ function approve(address operator, uint256 tokenId) external; /** - * @notice Enable or disable approval for a third party ("operator") to manage all of `msg.sender`'s assets - * @dev Emits the ApprovalForAll event. The contract MUST allow multiple operators per owner. - * @param _operator Address to add to the set of authorized operators - * @param _approved True if the operator is approved, false to revoke approval + * @notice Setting the "approval for all" status of operator `_operator` to `_approved` to allow it to transfer any tokenIds on behalf of `msg.sender`. + * + * @dev Enable or disable approval for a third party ("operator") to manage all of `msg.sender`'s assets. The contract MUST allow multiple operators per owner. + * + * @param _operator Address to add to the set of authorized operators. + * @param _approved True if the operator is approved, false to revoke approval. + * + * @custom:events {ApprovalForAll} event */ function setApprovalForAll(address _operator, bool _approved) external; /** + * @notice Retrieving the address other than the token owner that is approved to transfer tokenId `tokenId` on behalf of its owner. + * * @dev Compatible with ERC721 getApproved. - * @param tokenId The tokenId to query - * @return The address of the operator for `tokenId` + * + * @param tokenId The tokenId to query. + * @return The address of the operator for `tokenId`. */ function getApproved(uint256 tokenId) external view returns (address); /* + * @notice Checking if address `operator` is approved to transfer any tokenId owned by address `owner`. + * * @dev Compatible with ERC721 isApprovedForAll. - * @param owner The tokenOwner address to query - * @param operator The operator address to query + * + * @param owner The tokenOwner address to query. + * @param operator The operator address to query. + * * @return Returns if the `operator` is allowed to manage all of the assets of `owner` */ function isApprovedForAll( @@ -125,9 +163,13 @@ interface ILSP8CompatibleERC721 is ILSP8IdentifiableDigitalAsset { ) external view returns (bool); /* + * @notice Retrieving the token URI of tokenId `tokenId`. + * * @dev Compatible with ERC721Metadata tokenURI. - * @param tokenId The tokenId to query - * @return The token URI + * + * @param tokenId The tokenId to query. + * + * @return The token URI. */ function tokenURI(uint256 tokenId) external returns (string memory); } diff --git a/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol b/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol index b3c79db01..de28b0b02 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol @@ -9,11 +9,19 @@ import { import {LSP8NotTokenOperator} from "../LSP8Errors.sol"; /** - * @dev LSP8 extension (standard version) that allows token holders to destroy both + * @dev LSP8 token extension that allows token holders to destroy both * their own tokens and those that they have an allowance for as an operator. */ abstract contract LSP8Burnable is LSP8IdentifiableDigitalAsset { - function burn(bytes32 tokenId, bytes memory data) public virtual { + /** + * @notice Burning tokenId `tokenId`. This tokenId will not be recoverable! (additional data sent: `data`). + * + * @dev See internal {_burn} function for details. + * + * @param tokenId The tokenId to burn. + * @param data Any extra data to be sent alongside burning the tokenId. + */ + function burn(bytes32 tokenId, bytes memory data) public { if (!_isOperatorOrOwner(msg.sender, tokenId)) { revert LSP8NotTokenOperator(tokenId, msg.sender); } diff --git a/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol b/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol index 49e68092b..8cf3336ed 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol @@ -8,19 +8,35 @@ import { } from "../LSP8IdentifiableDigitalAsset.sol"; /** - * @dev LSP8 extension, adds token supply cap. + * @dev LSP8 token extension to add a max token supply cap. */ abstract contract LSP8CappedSupply is LSP8IdentifiableDigitalAsset { // --- Errors + + /** + * @notice The `tokenSupplyCap` must be set and cannot be `0`. + * @dev Reverts when setting `0` for the {tokenSupplyCap}. The max token supply MUST be set to a number greater than 0. + */ error LSP8CappedSupplyRequired(); + + /** + * @notice Cannot mint anymore as total supply reached the maximum cap. + * @dev Reverts when trying to mint tokens but the {totalSupply} has reached the maximum {tokenSupplyCap}. + */ error LSP8CappedSupplyCannotMintOverCap(); // --- Storage uint256 private immutable _tokenSupplyCap; /** - * @notice Sets the token max supply - * @param tokenSupplyCap_ The Token max supply + * @notice Deploying a `LSP8CappedSupply` token contract with max token supply cap set to `tokenSupplyCap_`. + * @dev Deploy a `LSP8CappedSupply` token contract and set the maximum token supply token cap up to which + * it is not possible to mint more tokens. + * + * @param tokenSupplyCap_ The maximum token supply. + * + * @custom:requirements + * - `tokenSupplyCap_` MUST NOT be 0. */ constructor(uint256 tokenSupplyCap_) { if (tokenSupplyCap_ == 0) { @@ -33,8 +49,12 @@ abstract contract LSP8CappedSupply is LSP8IdentifiableDigitalAsset { // --- Token queries /** - * @dev Returns the number of tokens that can be minted. - * @return The token max supply + * @notice The maximum supply amount of tokens allowed to exist is `_tokenSupplyCap`. + * + * @dev Get the maximum number of tokens that can exist to circulate. Once {totalSupply} reaches + * reaches {totalSuuplyCap}, it is not possible to mint more tokens. + * + * @return The maximum number of tokens that can exist in the contract. */ function tokenSupplyCap() public view virtual returns (uint256) { return _tokenSupplyCap; @@ -43,15 +63,13 @@ abstract contract LSP8CappedSupply is LSP8IdentifiableDigitalAsset { // --- Transfer functionality /** - * @dev Mints `tokenId` and transfers it to `to`. - * - * Requirements: + * @dev Same as {_mint} but allows to mint only if newly minted `tokenId` does not increase the {totalSupply} + * over the {tokenSupplyCap}. + * after a new `tokenId` has of tokens have been minted. * - * - `tokenSupplyCap() - totalSupply()` must be greater than zero. - * - `tokenId` must not exist. + * @custom:requirements + * - {totalSupply} + 1 must not be greater than the {tokenSupplyCap} when calling this function. * - `to` cannot be the zero address. - * - * Emits a {Transfer} event. */ function _mint( address to, diff --git a/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol b/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol index 0ee0506e1..026ed2227 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol @@ -8,18 +8,37 @@ import { } from "../LSP8IdentifiableDigitalAssetInitAbstract.sol"; /** - * @dev LSP8 extension, adds token supply cap. + * @dev LSP8 token extension to add a max token supply cap. */ abstract contract LSP8CappedSupplyInitAbstract is LSP8IdentifiableDigitalAssetInitAbstract { // --- Errors + + /** + * @notice The `tokenSupplyCap` must be set and cannot be `0`. + * @dev Reverts when setting `0` for the {tokenSupplyCap}. The max token supply MUST be set to a number greater than 0. + */ error LSP8CappedSupplyRequired(); + + /** + * @notice Cannot mint anymore as total supply reached the maximum cap. + * @dev Reverts when trying to mint tokens but the {totalSupply} has reached the maximum {tokenSupplyCap}. + */ error LSP8CappedSupplyCannotMintOverCap(); // --- Storage uint256 private _tokenSupplyCap; + /** + * @dev Initialize a `LSP8CappedSupplyInitAbstract` token contract and set the maximum token supply token cap up to which + * it is not possible to mint more tokens. + * + * @param tokenSupplyCap_ The maximum token supply. + * + * @custom:requirements + * - `tokenSupplyCap_` MUST NOT be 0. + */ function _initialize( uint256 tokenSupplyCap_ ) internal virtual onlyInitializing { @@ -33,8 +52,12 @@ abstract contract LSP8CappedSupplyInitAbstract is // --- Token queries /** - * @dev Returns the number of tokens that can be minted. - * @return The token max supply + * @notice The maximum supply amount of tokens allowed to exist is `_tokenSupplyCap`. + * + * @dev Get the maximum number of tokens that can exist to circulate. Once {totalSupply} reaches + * reaches {totalSuuplyCap}, it is not possible to mint more tokens. + * + * @return The maximum number of tokens that can exist in the contract. */ function tokenSupplyCap() public view virtual returns (uint256) { return _tokenSupplyCap; @@ -43,15 +66,13 @@ abstract contract LSP8CappedSupplyInitAbstract is // --- Transfer functionality /** - * @dev Mints `tokenId` and transfers it to `to`. - * - * Requirements: + * @dev Same as {_mint} but allows to mint only if newly minted `tokenId` does not increase the {totalSupply} + * over the {tokenSupplyCap}. + * after a new `tokenId` has of tokens have been minted. * - * - `tokenSupplyCap() - totalSupply()` must be greater than zero. - * - `tokenId` must not exist. + * @custom:requirements + * - {totalSupply} + 1 must not be greater than the {tokenSupplyCap} when calling this function. * - `to` cannot be the zero address. - * - * Emits a {Transfer} event. */ function _mint( address to, diff --git a/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol b/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol index c950f7e27..8dc8cdf56 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol @@ -53,16 +53,17 @@ abstract contract LSP8CompatibleERC721 is using EnumerableSet for EnumerableSet.AddressSet; /** - * Mapping from owner to operator approvals - * @dev for backward compatibility with ERC721 + * @dev Mapping from owner to operator approvals for backward compatibility with ERC721 */ mapping(address => mapping(address => bool)) private _operatorApprovals; /** - * @notice Sets the name, the symbol and the owner of the token - * @param name_ The name of the token - * @param symbol_ The symbol of the token - * @param newOwner_ The owner of the token + * @notice Deploying a `LSP8CompatibleERC721` token contract with: token name = `name_`, token symbol = `symbol_`, and + * address `newOwner_` as the token contract owner. + * + * @param name_ The name of the token. + * @param symbol_ The symbol of the token. + * @param newOwner_ The owner of the token contract. */ constructor( string memory name_, @@ -71,7 +72,7 @@ abstract contract LSP8CompatibleERC721 is ) LSP8IdentifiableDigitalAsset(name_, symbol_, newOwner_) {} /** - * @dev See {IERC165-supportsInterface}. + * @inheritdoc LSP8IdentifiableDigitalAsset */ function supportsInterface( bytes4 interfaceId @@ -158,7 +159,7 @@ abstract contract LSP8CompatibleERC721 is } /** - * @dev See _setApprovalForAll + * @dev See {_setApprovalForAll} */ function setApprovalForAll(address operator, bool approved) public virtual { _setApprovalForAll(msg.sender, operator, approved); @@ -166,8 +167,8 @@ abstract contract LSP8CompatibleERC721 is /** * @inheritdoc ILSP8CompatibleERC721 - * @dev Compatible with ERC721 transferFrom. - * Using allowNonLSP1Recipient=true so that EOA and any contract may receive the tokenId. + * + * @custom:info This function sets the `allowNonLSP1Recipient` parameter to `true` so that EOAs and any contract can receive the `tokenId`. */ function transferFrom( address from, @@ -179,8 +180,8 @@ abstract contract LSP8CompatibleERC721 is /** * @inheritdoc ILSP8CompatibleERC721 - * @dev Compatible with ERC721 safeTransferFrom (without optional data). - * Using allowNonLSP1Recipient=false so that no EOA and only contracts supporting LSP1 interface may receive the tokenId. + * + * @custom:info This function sets the `allowNonLSP1Recipient` parameter to `true` so that EOAs and any contract can receive the `tokenId`. */ function safeTransferFrom( address from, @@ -190,9 +191,10 @@ abstract contract LSP8CompatibleERC721 is _safeTransfer(from, to, tokenId, ""); } - /* - * @dev Compatible with ERC721 safeTransferFrom (with optional data). - * Using allowNonLSP1Recipient=false so that no EOA and only contracts supporting LSP1 interface may receive the tokenId. + /** + * @inheritdoc ILSP8CompatibleERC721 + * + * @custom:info This function sets the `allowNonLSP1Recipient` parameter to `true` so that EOAs and any contract can receive the `tokenId`. */ function safeTransferFrom( address from, @@ -207,6 +209,10 @@ abstract contract LSP8CompatibleERC721 is /** * @inheritdoc ILSP8IdentifiableDigitalAsset + * + * @custom:events + * - LSP7 {AuthorizedOperator} event. + * - ERC721 {Approval} event. */ function authorizeOperator( address operator, @@ -223,6 +229,13 @@ abstract contract LSP8CompatibleERC721 is emit Approval(tokenOwnerOf(tokenId), operator, uint256(tokenId)); } + /** + * @inheritdoc LSP8IdentifiableDigitalAssetCore + * + * @custom:events + * - LSP8 {Transfer} event. + * - ERC721 {Transfer} event. + */ function _transfer( address from, address to, @@ -243,6 +256,11 @@ abstract contract LSP8CompatibleERC721 is super._transfer(from, to, tokenId, allowNonLSP1Recipient, data); } + /** + * @dev Transfer the `tokenId` from `from` to `to` and check if the `to` recipient address is + * a contract that implements the `IERC721Received` interface and return the right magic value. + * See {_checkOnERC721Received} for more infos. + */ function _safeTransfer( address from, address to, @@ -256,6 +274,13 @@ abstract contract LSP8CompatibleERC721 is ); } + /** + * @inheritdoc LSP8IdentifiableDigitalAssetCore + * + * @custom:events + * - LSP8 {Transfer} event with `address(0)` as `from`. + * - ERC721 {Transfer} event with `address(0)` as `from`. + */ function _mint( address to, bytes32 tokenId, @@ -266,6 +291,13 @@ abstract contract LSP8CompatibleERC721 is super._mint(to, tokenId, allowNonLSP1Recipient, data); } + /** + * @inheritdoc LSP8IdentifiableDigitalAssetCore + * + * @custom:events + * - LSP8 {Transfer} event with `address(0)` as the `to` address. + * - ERC721 {Transfer} event with `address(0)` as the `to` address. + */ function _burn( bytes32 tokenId, bytes memory data @@ -279,7 +311,7 @@ abstract contract LSP8CompatibleERC721 is /** * @dev Approve `operator` to operate on all tokens of `tokensOwner` * - * Emits an {ApprovalForAll} event. + * @custom:events {ApprovalForAll} event. */ function _setApprovalForAll( address tokensOwner, @@ -295,14 +327,14 @@ abstract contract LSP8CompatibleERC721 is } /** - * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. + * @dev Internal function to invoke `IERC721Receiver.onERC721Received(...)` function on a target address. * The call is not executed if the target address is not a contract. * - * @param from address representing the previous owner of the given token ID - * @param to target address that will receive the token - * @param tokenId uint256 ID of the token to be transferred - * @param data bytes optional data to send along with the call - * @return bool whether the call correctly returned the expected magic value + * @param from address representing the previous owner of the given `tokenId`. + * @param to target address that will receive the token. + * @param tokenId uint256 ID of the token to be transferred. + * @param data bytes optional data to send along with the call. + * @return bool whether the call correctly returned the expected magic value. */ function _checkOnERC721Received( address from, @@ -338,6 +370,9 @@ abstract contract LSP8CompatibleERC721 is } } + /** + * @inheritdoc LSP4DigitalAssetMetadata + */ function _setData( bytes32 key, bytes memory value diff --git a/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol b/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol index ae3f45a4a..db79c1e70 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol @@ -53,11 +53,19 @@ abstract contract LSP8CompatibleERC721InitAbstract is using EnumerableSet for EnumerableSet.AddressSet; /** - * Mapping from owner to operator approvals - * @dev for backward compatibility with ERC721 + * @dev Mapping from owner to operator approvals for backward compatibility with ERC721 */ mapping(address => mapping(address => bool)) private _operatorApprovals; + /** + * @notice Initialize a `LSP8CompatibleERC721InitAbstract` token contract with: token name = `name_`, token symbol = `symbol_`, and + * address `newOwner_` as the token contract owner. + * + * @param name_ The name of the token. + * @param symbol_ The symbol of the token. + * @param newOwner_ The owner of the token contract. + */ + function _initialize( string memory name_, string memory symbol_, @@ -71,7 +79,7 @@ abstract contract LSP8CompatibleERC721InitAbstract is } /** - * @dev See {IERC165-supportsInterface}. + * @inheritdoc LSP8IdentifiableDigitalAssetInitAbstract */ function supportsInterface( bytes4 interfaceId @@ -88,7 +96,7 @@ abstract contract LSP8CompatibleERC721InitAbstract is super.supportsInterface(interfaceId); } - /* + /** * @inheritdoc ILSP8CompatibleERC721 */ function tokenURI( @@ -158,7 +166,7 @@ abstract contract LSP8CompatibleERC721InitAbstract is } /** - * @dev See _setApprovalForAll + * @dev See {_setApprovalForAll} */ function setApprovalForAll(address operator, bool approved) public virtual { _setApprovalForAll(msg.sender, operator, approved); @@ -166,8 +174,8 @@ abstract contract LSP8CompatibleERC721InitAbstract is /** * @inheritdoc ILSP8CompatibleERC721 - * @dev Compatible with ERC721 transferFrom. - * Using allowNonLSP1Recipient=true so that EOA and any contract may receive the tokenId. + * + * @custom:info This function sets the `allowNonLSP1Recipient` parameter to `true` so that EOAs and any contract can receive the `tokenId`. */ function transferFrom( address from, @@ -179,8 +187,8 @@ abstract contract LSP8CompatibleERC721InitAbstract is /** * @inheritdoc ILSP8CompatibleERC721 - * @dev Compatible with ERC721 safeTransferFrom (without optional data). - * Using allowNonLSP1Recipient=false so that no EOA and only contracts supporting LSP1 interface may receive the tokenId. + * + * @custom:info This function sets the `allowNonLSP1Recipient` parameter to `true` so that EOAs and any contract can receive the `tokenId`. */ function safeTransferFrom( address from, @@ -190,9 +198,10 @@ abstract contract LSP8CompatibleERC721InitAbstract is _safeTransfer(from, to, tokenId, ""); } - /* - * @dev Compatible with ERC721 safeTransferFrom (with optional data). - * Using allowNonLSP1Recipient=false so that no EOA and only contracts supporting LSP1 interface may receive the tokenId. + /** + * @inheritdoc ILSP8CompatibleERC721 + * + * @custom:info This function sets the `allowNonLSP1Recipient` parameter to `true` so that EOAs and any contract can receive the `tokenId`. */ function safeTransferFrom( address from, @@ -207,6 +216,10 @@ abstract contract LSP8CompatibleERC721InitAbstract is /** * @inheritdoc ILSP8IdentifiableDigitalAsset + * + * @custom:events + * - LSP7 {AuthorizedOperator} event. + * - ERC721 {Approval} event. */ function authorizeOperator( address operator, @@ -223,6 +236,13 @@ abstract contract LSP8CompatibleERC721InitAbstract is emit Approval(tokenOwnerOf(tokenId), operator, uint256(tokenId)); } + /** + * @inheritdoc LSP8IdentifiableDigitalAssetCore + * + * @custom:events + * - LSP8 {Transfer} event. + * - ERC721 {Transfer} event. + */ function _transfer( address from, address to, @@ -243,6 +263,11 @@ abstract contract LSP8CompatibleERC721InitAbstract is super._transfer(from, to, tokenId, allowNonLSP1Recipient, data); } + /** + * @dev Transfer the `tokenId` from `from` to `to` and check if the `to` recipient address is + * a contract that implements the `IERC721Received` interface and return the right magic value. + * See {_checkOnERC721Received} for more infos. + */ function _safeTransfer( address from, address to, @@ -256,6 +281,13 @@ abstract contract LSP8CompatibleERC721InitAbstract is ); } + /** + * @inheritdoc LSP8IdentifiableDigitalAssetCore + * + * @custom:events + * - LSP8 {Transfer} event with `address(0)` as `from`. + * - ERC721 {Transfer} event with `address(0)` as `from`. + */ function _mint( address to, bytes32 tokenId, @@ -266,6 +298,13 @@ abstract contract LSP8CompatibleERC721InitAbstract is super._mint(to, tokenId, allowNonLSP1Recipient, data); } + /** + * @inheritdoc LSP8IdentifiableDigitalAssetCore + * + * @custom:events + * - LSP8 {Transfer} event with `address(0)` as the `to` address. + * - ERC721 {Transfer} event with `address(0)` as the `to` address. + */ function _burn( bytes32 tokenId, bytes memory data @@ -277,9 +316,9 @@ abstract contract LSP8CompatibleERC721InitAbstract is } /** - * @dev Approve `operator` to operate on all of `owner` tokens + * @dev Approve `operator` to operate on all tokens of `tokensOwner` * - * Emits an {ApprovalForAll} event. + * @custom:events {ApprovalForAll} event. */ function _setApprovalForAll( address tokensOwner, @@ -295,14 +334,14 @@ abstract contract LSP8CompatibleERC721InitAbstract is } /** - * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. + * @dev Internal function to invoke `IERC721Receiver.onERC721Received(...)` function on a target address. * The call is not executed if the target address is not a contract. * - * @param from address representing the previous owner of the given token ID - * @param to target address that will receive the token - * @param tokenId uint256 ID of the token to be transferred - * @param data bytes optional data to send along with the call - * @return bool whether the call correctly returned the expected magic value + * @param from address representing the previous owner of the given `tokenId`. + * @param to target address that will receive the token. + * @param tokenId uint256 ID of the token to be transferred. + * @param data bytes optional data to send along with the call. + * @return bool whether the call correctly returned the expected magic value. */ function _checkOnERC721Received( address from, @@ -338,6 +377,9 @@ abstract contract LSP8CompatibleERC721InitAbstract is } } + /** + * @inheritdoc LSP4DigitalAssetMetadataInitAbstract + */ function _setData( bytes32 key, bytes memory value diff --git a/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol b/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol index 4f40eb9a3..2e100bb13 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol @@ -11,7 +11,9 @@ import { } from "../LSP8IdentifiableDigitalAssetCore.sol"; /** - * @dev LSP8 extension. + * @dev LSP8 extension that enables to enumerate over all the `tokenIds` ever minted. + * + * @custom:warning Note that in this extension contract, any `tokenId` that been burnt is removed from the set of the enumerable tokenIds. */ abstract contract LSP8Enumerable is LSP8IdentifiableDigitalAsset { // Mapping from token index to token id @@ -21,23 +23,37 @@ abstract contract LSP8Enumerable is LSP8IdentifiableDigitalAsset { mapping(bytes32 => uint256) private _tokenIndex; /** - * @dev Returns a token id at index. See totalSupply() to get total number of minted tokens. - * @return TokenId or 0x00 if no token exist at the index `index` + * @notice Retrieving the `tokenId` for `msg.sender` located in its list at index number `index`. + * + * @dev Returns a token id at index. See {totalSupply} to get total number of minted tokens. + * @param index The index to search to search in the enumerable mapping. + * @return TokenId or `bytes32(0)` if no tokenId exist at `index`. */ function tokenAt(uint256 index) public view returns (bytes32) { return _indexToken[index]; } + /** + * @inheritdoc LSP8IdentifiableDigitalAssetCore + * + * @param from The address sending the `tokenId` (`address(0)` when `tokenId` is being minted). + * @param to The address receiving the `tokenId` (`address(0)` when `tokenId` is being burnt). + * @param tokenId The bytes32 identifier of the token being transferred. + */ function _beforeTokenTransfer( address from, address to, bytes32 tokenId ) internal virtual override(LSP8IdentifiableDigitalAssetCore) { + // `tokenId` being minted if (from == address(0)) { uint256 index = totalSupply(); _indexToken[index] = tokenId; _tokenIndex[tokenId] = index; - } else if (to == address(0)) { + } + + // `tokenId` being burnt + if (to == address(0)) { uint256 lastIndex = totalSupply() - 1; uint256 index = _tokenIndex[tokenId]; if (index < lastIndex) { @@ -48,6 +64,7 @@ abstract contract LSP8Enumerable is LSP8IdentifiableDigitalAsset { delete _indexToken[lastIndex]; delete _tokenIndex[tokenId]; } + super._beforeTokenTransfer(from, to, tokenId); } } diff --git a/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol b/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol index d025fdd47..c4513bb93 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol @@ -23,13 +23,23 @@ abstract contract LSP8EnumerableInitAbstract is mapping(bytes32 => uint256) private _tokenIndex; /** - * @dev Returns a token id at index. See totalSupply() to get total number of minted tokens. - * @return TokenId or 0x00 if no token exist at the index `index` + * @notice Retrieving the `tokenId` for `msg.sender` located in its list at index number `index`. + * + * @dev Returns a token id at index. See {totalSupply} to get total number of minted tokens. + * @param index The index to search to search in the enumerable mapping. + * @return TokenId or `bytes32(0)` if no tokenId exist at `index`. */ function tokenAt(uint256 index) public view returns (bytes32) { return _indexToken[index]; } + /** + * @inheritdoc LSP8IdentifiableDigitalAssetCore + * + * @param from The address sending the `tokenId` (`address(0)` when `tokenId` is being minted). + * @param to The address receiving the `tokenId` (`address(0)` when `tokenId` is being burnt). + * @param tokenId The bytes32 identifier of the token being transferred. + */ function _beforeTokenTransfer( address from, address to, diff --git a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol index a853428ea..872b06593 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol @@ -3,13 +3,34 @@ pragma solidity ^0.8.12; import {LSP8CompatibleERC721} from "../extensions/LSP8CompatibleERC721.sol"; +/** + * @title LSP8CompatibleERC721Mintable deployable preset contract with a public {mint} function callable only by the contract {owner}. + */ contract LSP8CompatibleERC721Mintable is LSP8CompatibleERC721 { + /** + * @notice Deploying a `LSP8CompatibleERC721Mintable` token contract with: token name = `name_`, token symbol = `symbol_`, and + * address `newOwner_` as the token contract owner. + * + * @param name_ The name of the token. + * @param symbol_ The symbol of the token. + * @param newOwner_ The owner of the token contract. + */ constructor( string memory name_, string memory symbol_, address newOwner_ ) LSP8CompatibleERC721(name_, symbol_, newOwner_) {} + /** + * @notice Minting tokenId `tokenId` for address `to` with the additional data `data` (Note: allow non-LSP1 recipient is set to `allowNonLSP1Recipient`). + * + * @dev Public {_mint} function only callable by the {owner}. + * + * @param to The address that will receive the minted `tokenId`. + * @param tokenId The tokenId to mint. + * @param allowNonLSP1Recipient Set to `false` to ensure that you are minting for a recipient that implements LSP1, `false` otherwise for forcing the minting. + * @param data Any addition data to be sent alongside the minting. + */ function mint( address to, bytes32 tokenId, diff --git a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol index 291710a0a..9bb1b63ab 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol @@ -6,6 +6,9 @@ import { LSP8CompatibleERC721MintableInitAbstract } from "./LSP8CompatibleERC721MintableInitAbstract.sol"; +/** + * @title LSP8CompatibleERC721MintableInit deployable preset contract (proxy version) with a public mint function callable only by the contract {owner} + */ contract LSP8CompatibleERC721MintableInit is LSP8CompatibleERC721MintableInitAbstract { @@ -17,10 +20,12 @@ contract LSP8CompatibleERC721MintableInit is } /** - * @notice Sets the name, the symbol and the owner of the token - * @param name_ The name of the token - * @param symbol_ The symbol of the token - * @param newOwner_ The owner of the token + * @notice Initializing a `LSP8CompatibleERC721MintableInit` token contract with: token name = `name_`, token symbol = `symbol_`, and + * address `newOwner_` as the token contract owner. + * + * @param name_ The name of the token. + * @param symbol_ The symbol of the token. + * @param newOwner_ The owner of the token contract. */ function initialize( string memory name_, diff --git a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol index 8d631d582..697d1bfb9 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol @@ -6,6 +6,9 @@ import { LSP8CompatibleERC721InitAbstract } from "../extensions/LSP8CompatibleERC721InitAbstract.sol"; +/** + * @title LSP8CompatibleERC721MintableInitAbstract preset contract (inheritable proxy version) with a public mint function callable only by the contract {owner} + */ contract LSP8CompatibleERC721MintableInitAbstract is LSP8CompatibleERC721InitAbstract { @@ -20,6 +23,16 @@ contract LSP8CompatibleERC721MintableInitAbstract is LSP8CompatibleERC721InitAbstract._initialize(name_, symbol_, newOwner_); } + /** + * @notice Minting tokenId `tokenId` for address `to` with the additional data `data` (Note: allow non-LSP1 recipient is set to `allowNonLSP1Recipient`). + * + * @dev Public {_mint} function only callable by the {owner}. + * + * @param to The address that will receive the minted `tokenId`. + * @param tokenId The tokenId to mint. + * @param allowNonLSP1Recipient Set to `false` to ensure that you are minting for a recipient that implements LSP1, `false` otherwise for forcing the minting. + * @param data Any addition data to be sent alongside the minting. + */ function mint( address to, bytes32 tokenId, diff --git a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol index 81bc1c7e0..43ac8e0a0 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol @@ -11,14 +11,16 @@ import { } from "../LSP8IdentifiableDigitalAsset.sol"; /** - * @dev LSP8 extension. + * @title LSP8IdentifiableDigitalAsset deployable preset contract with a public {mint} function callable only by the contract {owner}. */ contract LSP8Mintable is LSP8IdentifiableDigitalAsset, ILSP8Mintable { /** - * @notice Sets the token-Metadata and register LSP8InterfaceId - * @param name_ The name of the token - * @param symbol_ The symbol of the token - * @param newOwner_ The owner of the the token-Metadata + * @notice Deploying a `LSP8Mintable` token contract with: token name = `name_`, token symbol = `symbol_`, and + * address `newOwner_` as the token contract owner. + * + * @param name_ The name of the token. + * @param symbol_ The symbol of the token. + * @param newOwner_ The owner of the token contract. */ constructor( string memory name_, @@ -27,7 +29,14 @@ contract LSP8Mintable is LSP8IdentifiableDigitalAsset, ILSP8Mintable { ) LSP8IdentifiableDigitalAsset(name_, symbol_, newOwner_) {} /** - * @inheritdoc ILSP8Mintable + * @notice Minting tokenId `tokenId` for address `to` with the additional data `data` (Note: allow non-LSP1 recipient is set to `allowNonLSP1Recipient`). + * + * @dev Public {_mint} function only callable by the {owner}. + * + * @param to The address that will receive the minted `tokenId`. + * @param tokenId The tokenId to mint. + * @param allowNonLSP1Recipient Set to `false` to ensure that you are minting for a recipient that implements LSP1, `false` otherwise for forcing the minting. + * @param data Any addition data to be sent alongside the minting. */ function mint( address to, diff --git a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol index eca65381a..749ced640 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol @@ -6,7 +6,7 @@ pragma solidity ^0.8.4; import {LSP8MintableInitAbstract} from "./LSP8MintableInitAbstract.sol"; /** - * @dev LSP8 extension. + * @dev LSP8IdentifiableDigitalAsset deployable preset contract (proxy version) with a public {mint} function callable only by the contract {owner}. */ contract LSP8MintableInit is LSP8MintableInitAbstract { /** @@ -17,10 +17,12 @@ contract LSP8MintableInit is LSP8MintableInitAbstract { } /** - * @notice Sets the token-Metadata and register LSP8InterfaceId - * @param name_ The name of the token - * @param symbol_ The symbol of the token - * @param newOwner_ The owner of the the token-Metadata + * @notice Initializing a `LSP8MintableInit` token contract with: token name = `name_`, token symbol = `symbol_`, and + * address `newOwner_` as the token contract owner. + * + * @param name_ The name of the token. + * @param symbol_ The symbol of the token. + * @param newOwner_ The owner of the token contract. */ function initialize( string memory name_, diff --git a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol index 0ee648944..4e614fc0d 100644 --- a/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +++ b/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol @@ -10,12 +10,20 @@ import { } from "../LSP8IdentifiableDigitalAssetInitAbstract.sol"; /** - * @dev LSP8 extension. + * @dev LSP8IdentifiableDigitalAsset deployable preset contract (inheritable proxy version) with a public {mint} function callable only by the contract {owner}. */ abstract contract LSP8MintableInitAbstract is LSP8IdentifiableDigitalAssetInitAbstract, ILSP8Mintable { + /** + * @notice Initialize a `LSP7MintableInitAbstract` token contract with: token name = `name_`, token symbol = `symbol_`, and + * address `newOwner_` as the token contract owner. + * + * @param name_ The name of the token. + * @param symbol_ The symbol of the token. + * @param newOwner_ The owner of the token contract. + */ function _initialize( string memory name_, string memory symbol_, @@ -29,7 +37,14 @@ abstract contract LSP8MintableInitAbstract is } /** - * @inheritdoc ILSP8Mintable + * @notice Minting tokenId `tokenId` for address `to` with the additional data `data` (Note: allow non-LSP1 recipient is set to `allowNonLSP1Recipient`). + * + * @dev Public {_mint} function only callable by the {owner}. + * + * @param to The address that will receive the minted `tokenId`. + * @param tokenId The tokenId to mint. + * @param allowNonLSP1Recipient Set to `false` to ensure that you are minting for a recipient that implements LSP1, `false` otherwise for forcing the minting. + * @param data Any addition data to be sent alongside the minting. */ function mint( address to, diff --git a/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md b/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md new file mode 100644 index 000000000..3131adbfd --- /dev/null +++ b/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md @@ -0,0 +1,1369 @@ + + + +# LSP8Burnable + +:::info Standard Specifications + +[`LSP-8-IdentifiableDigitalAsset`](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md) + +::: +:::info Solidity implementation + +[`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) + +::: + +LSP8 token extension that allows token holders to destroy both their own tokens and those that they have an allowance for as an operator. + +## Public Methods + +Public methods are accessible externally from users, allowing interaction with this function from dApps or other smart contracts. +When marked as 'public', a method can be called both externally and internally, on the other hand, when marked as 'external', a method can only be called externally. + +### authorizeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizeoperator) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Function signature: `authorizeOperator(address,bytes32)` +- Function selector: `0xcf5182ba` + +::: + +```solidity +function authorizeOperator( + address operator, + bytes32 tokenId +) external nonpayable; +``` + +Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ---------------------------------------- | +| `operator` | `address` | The address to authorize as an operator. | +| `tokenId` | `bytes32` | The token ID operator has access to.. | + +
+ +### balanceOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#balanceof) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Function signature: `balanceOf(address)` +- Function selector: `0x70a08231` + +::: + +```solidity +function balanceOf(address tokenOwner) external view returns (uint256); +``` + +Get the number of token IDs owned by `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------------------- | +| `tokenOwner` | `address` | The address to query \* | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------------------- | +| `0` | `uint256` | The total number of token IDs that `tokenOwner` owns. | + +
+ +### burn + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#burn) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Function signature: `burn(bytes32,bytes)` +- Function selector: `0x6c79b70b` + +::: + +```solidity +function burn(bytes32 tokenId, bytes data) external nonpayable; +``` + +_Burning tokenId `tokenId`. This tokenId will not be recoverable! (additional data sent: `data`)._ + +See internal [`_burn`](#_burn) function for details. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------------------------- | +| `tokenId` | `bytes32` | The tokenId to burn. | +| `data` | `bytes` | Any extra data to be sent alongside burning the tokenId. | + +
+ +### getData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdata) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_Gets singular data at a given `dataKey`_ + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ------------------------------- | +| `dataKey` | `bytes32` | The key which value to retrieve | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | -------------------------- | +| `dataValue` | `bytes` | The data stored at the key | + +
+ +### getDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatch) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Gets array of data for multiple given keys_ + +#### Parameters + +| Name | Type | Description | +| ---------- | :---------: | ------------------------------------------ | +| `dataKeys` | `bytes32[]` | The array of keys which values to retrieve | + +#### Returns + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------- | +| `dataValues` | `bytes[]` | The array of data stored at multiple keys | + +
+ +### getOperatorsOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getoperatorsof) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Function signature: `getOperatorsOf(bytes32)` +- Function selector: `0x49a6078d` + +::: + +```solidity +function getOperatorsOf(bytes32 tokenId) external view returns (address[]); +``` + +Returns all `operator` addresses that are allowed to transfer or burn a specific `tokenId` on behalf of its owner. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------- | +| `tokenId` | `bytes32` | The token ID to get the operators for. | + +#### Returns + +| Name | Type | Description | +| ---- | :---------: | ------------------------------------------------------------------------------------------------------------ | +| `0` | `address[]` | An array of operators allowed to transfer or burn a specific `tokenId`. Requirements - `tokenId` must exist. | + +
+ +### isOperatorFor + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#isoperatorfor) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Function signature: `isOperatorFor(address,bytes32)` +- Function selector: `0x2a3654a4` + +::: + +```solidity +function isOperatorFor( + address operator, + bytes32 tokenId +) external view returns (bool); +``` + +Returns whether `operator` address is an operator for a given `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------- | +| `operator` | `address` | The address to query operator status for. | +| `tokenId` | `bytes32` | The token ID to check if `operator` is allowed to operate on. | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | --------------------------------------------------------------------- | +| `0` | `bool` | `true` if `operator` is an operator for `tokenId`, `false` otherwise. | + +
+ +### owner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#owner) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Function signature: `owner()` +- Function selector: `0x8da5cb5b` + +::: + +```solidity +function owner() external view returns (address); +``` + +Returns the address of the current owner. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `address` | - | + +
+ +### renounceOwnership + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#renounceownership) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Function signature: `renounceOwnership()` +- Function selector: `0x715018a6` + +::: + +```solidity +function renounceOwnership() external nonpayable; +``` + +Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner. + +
+ +### revokeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokeoperator) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Function signature: `revokeOperator(address,bytes32)` +- Function selector: `0x0b0c6d82` + +::: + +```solidity +function revokeOperator(address operator, bytes32 tokenId) external nonpayable; +``` + +Remove access of `operator` for a given `tokenId`, disallowing it to transfer `tokenId` on behalf of its owner. See also [`isOperatorFor`](#isoperatorfor). + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ---------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `tokenId` | `bytes32` | The tokenId `operator` is revoked from operating on. | + +
+ +### setData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdata) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +```solidity +function setData(bytes32 dataKey, bytes dataValue) external payable; +``` + +_Sets singular data for a given `dataKey`_ + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `dataKey` | `bytes32` | The key to retrieve stored value | +| `dataValue` | `bytes` | The value to set SHOULD only be callable by the owner of the contract set via ERC173 The function is marked as payable to enable flexibility on child contracts If the function is not intended to receive value, an additional check should be implemented to check that value equal 0. Emits a {DataChanged} event. | + +
+ +### setDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatch) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +```solidity +function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable; +``` + +Sets array of data for multiple given `dataKeys` SHOULD only be callable by the owner of the contract set via ERC173 The function is marked as payable to enable flexibility on child contracts If the function is not intended to receive value, an additional check should be implemented to check that value equal + +0. Emits a [`DataChanged`](#datachanged) event. + +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ---------------------------------------- | +| `dataKeys` | `bytes32[]` | The array of data keys for values to set | +| `dataValues` | `bytes[]` | The array of values to set | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#supportsinterface) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas. + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ----------- | +| `interfaceId` | `bytes4` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +
+ +### tokenIdsOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenidsof) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Function signature: `tokenIdsOf(address)` +- Function selector: `0xa3b261f2` + +::: + +```solidity +function tokenIdsOf(address tokenOwner) external view returns (bytes32[]); +``` + +Returns the list of token IDs that the `tokenOwner` address owns. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ---------------------------------------------------------- | +| `tokenOwner` | `address` | The address that we want to get the list of token IDs for. | + +#### Returns + +| Name | Type | Description | +| ---- | :---------: | ------------------------------------------------------- | +| `0` | `bytes32[]` | An array of `bytes32[] tokenIds` owned by `tokenOwner`. | + +
+ +### tokenOwnerOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenownerof) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Function signature: `tokenOwnerOf(bytes32)` +- Function selector: `0x217b2270` + +::: + +```solidity +function tokenOwnerOf(bytes32 tokenId) external view returns (address); +``` + +Returns the list of `tokenIds` for the `tokenOwner` address. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------------- | +| `tokenId` | `bytes32` | tokenOwner The address to query owned tokens | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------- | +| `0` | `address` | The owner address of the given `tokenId`. | + +
+ +### totalSupply + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#totalsupply) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Function signature: `totalSupply()` +- Function selector: `0x18160ddd` + +::: + +```solidity +function totalSupply() external view returns (uint256); +``` + +Returns the number of existing tokens that have been minted in this contract. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------ | +| `0` | `uint256` | The number of existing tokens. | + +
+ +### transfer + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Function signature: `transfer(address,address,bytes32,bool,bytes)` +- Function selector: `0x511b6952` + +::: + +```solidity +function transfer( + address from, + address to, + bytes32 tokenId, + bool allowNonLSP1Recipient, + bytes data +) external nonpayable; +``` + +Transfer a given `tokenId` token from the `from` address to the `to` address. If operators are set for a specific `tokenId`, all the operators are revoked after the tokenId have been transferred. The `allowNonLSP1Recipient` parameter MUST be set to `true` when transferring tokens to Externally Owned Accounts (EOAs) or contracts that do not implement the LSP1 standard. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The address that owns the given `tokenId`. | +| `to` | `address` | The address that will receive the `tokenId`. | +| `tokenId` | `bytes32` | The token ID to transfer. | +| `allowNonLSP1Recipient` | `bool` | When set to `true`, the `to` address CAN be any addres. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard. | +| `data` | `bytes` | Any additional data the caller wants included in the emitted event, and sent in the hooks of the `from` and `to` addresses. | + +
+ +### transferBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferbatch) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Function signature: `transferBatch(address[],address[],bytes32[],bool[],bytes[])` +- Function selector: `0x7e87632c` + +::: + +```solidity +function transferBatch( + address[] from, + address[] to, + bytes32[] tokenId, + bool[] allowNonLSP1Recipient, + bytes[] data +) external nonpayable; +``` + +Transfers multiple tokens at once based on the arrays of `from`, `to` and `tokenId`. If any transfer fails, the whole call will revert. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :---------: | ----------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address[]` | An array of sending addresses. | +| `to` | `address[]` | An array of recipient addresses. | +| `tokenId` | `bytes32[]` | An array of token IDs to transfer. | +| `allowNonLSP1Recipient` | `bool[]` | When set to `true`, `to` may be any address. When set to `false`, `to` must be a contract that supports the LSP1 standard and not revert. | +| `data` | `bytes[]` | Any additional data the caller wants included in the emitted event, and sent in the hooks to the `from` and `to` addresses. | + +
+ +### transferOwnership + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferownership) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Function signature: `transferOwnership(address)` +- Function selector: `0xf2fde38b` + +::: + +```solidity +function transferOwnership(address newOwner) external nonpayable; +``` + +Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `newOwner` | `address` | - | + +
+ +## Internal Methods + +Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. + +Internal functions cannot be called externally, whether from other smart contracts, dApp interfaces, or backend services. Their restricted accessibility ensures that they remain exclusively available within the context of the current contract, promoting controlled and encapsulated usage of these internal utilities. + +### \_checkOwner + +```solidity +function _checkOwner() internal view; +``` + +Throws if the sender is not the owner. + +
+ +### \_setOwner + +```solidity +function _setOwner(address newOwner) internal nonpayable; +``` + +Changes the owner if `newOwner` and oldOwner are different +This pattern is useful in inheritance. + +
+ +### \_getData + +```solidity +function _getData(bytes32 dataKey) internal view returns (bytes dataValue); +``` + +
+ +### \_setData + +```solidity +function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; +``` + +Save gas by emitting the [`DataChanged`](#datachanged) event with only the first 256 bytes of dataValue + +
+ +### \_isOperatorOrOwner + +```solidity +function _isOperatorOrOwner( + address caller, + bytes32 tokenId +) internal view returns (bool); +``` + +verifies if the `caller` is operator or owner for the `tokenId` + +#### Returns + +| Name | Type | Description | +| ---- | :----: | -------------------------------------------- | +| `0` | `bool` | true if `caller` is either operator or owner | + +
+ +### \_revokeOperator + +```solidity +function _revokeOperator( + address operator, + address tokenOwner, + bytes32 tokenId +) internal nonpayable; +``` + +removes `operator` from the list of operators for the `tokenId` + +
+ +### \_clearOperators + +```solidity +function _clearOperators( + address tokenOwner, + bytes32 tokenId +) internal nonpayable; +``` + +revoke all the current operators for a specific `tokenId` token which belongs to `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ------------------------------------------------- | +| `tokenOwner` | `address` | The address that is the owner of the `tokenId`. | +| `tokenId` | `bytes32` | The token to remove the associated operators for. | + +
+ +### \_exists + +```solidity +function _exists(bytes32 tokenId) internal view returns (bool); +``` + +Returns whether `tokenId` exists. +Tokens start existing when they are minted ([`_mint`](#_mint)), and stop existing when they are burned ([`_burn`](#_burn)). + +
+ +### \_existsOrError + +```solidity +function _existsOrError(bytes32 tokenId) internal view; +``` + +When `tokenId` does not exist then revert with an error. + +
+ +### \_mint + +```solidity +function _mint( + address to, + bytes32 tokenId, + bool allowNonLSP1Recipient, + bytes data +) internal nonpayable; +``` + +Create `tokenId` by minting it and transfers it to `to`. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event with `address(0)` as `from` address. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------------------------------------------------------------------------------------- | +| `to` | `address` | @param tokenId The token ID to create (= mint). | +| `tokenId` | `bytes32` | The token ID to create (= mint). | +| `allowNonLSP1Recipient` | `bool` | When set to `true`, `to` may be any address. When set to `false`, `to` must be a contract that supports the LSP1 standard. | +| `data` | `bytes` | Any additional data the caller wants included in the emitted event, and sent in the hook of the `to` address. | + +
+ +### \_burn + +:::tip Hint + +In dApps, you can know which addresses are burning tokens by listening for the `Transfer` event and filter with the zero address as `to`. + +::: + +```solidity +function _burn(bytes32 tokenId, bytes data) internal nonpayable; +``` + +Burn a specific `tokenId`, removing the `tokenId` from the [`tokenIdsOf`](#tokenidsof) the caller and decreasing its [`balanceOf`](#balanceof) by -1. +This will also clear all the operators allowed to transfer the `tokenId`. +The owner of the `tokenId` will be notified about the `tokenId` being transferred through its LSP1 [`universalReceiver`](#universalreceiver) +function, if it is a contract that supports the LSP1 interface. Its [`universalReceiver`](#universalreceiver) function will receive +all the parameters in the calldata packed encoded. +Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before burning `tokenId` and updating the balances. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event with `address(0)` as the `to` address. + +
+ +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------------------------------------------------------------------------------------------------------------- | +| `tokenId` | `bytes32` | The token to burn. | +| `data` | `bytes` | Any additional data the caller wants included in the emitted event, and sent in the LSP1 hook on the token owner's address. | + +
+ +### \_transfer + +:::danger + +This internal function does not check if the sender is authorized or not to operate on the `tokenId`. + +::: + +```solidity +function _transfer( + address from, + address to, + bytes32 tokenId, + bool allowNonLSP1Recipient, + bytes data +) internal nonpayable; +``` + +Change the owner of the `tokenId` from `from` to `to`. +Both the sender and recipient will be notified of the `tokenId` being transferred through their LSP1 [`universalReceiver`](#universalreceiver) +function, if they are contracts that support the LSP1 interface. Their `universalReceiver` function will receive +all the parameters in the calldata packed encoded. +Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before changing the owner of `tokenId`. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The sender address. | +| `to` | `address` | @param tokenId The token to transfer. | +| `tokenId` | `bytes32` | The token to transfer. | +| `allowNonLSP1Recipient` | `bool` | When set to `true`, `to` may be any address. When set to `false`, `to` must be a contract that supports the LSP1 standard. | +| `data` | `bytes` | Additional data the caller wants included in the emitted event, and sent in the hooks to `from` and `to` addresses. | + +
+ +### \_beforeTokenTransfer + +```solidity +function _beforeTokenTransfer( + address from, + address to, + bytes32 tokenId +) internal nonpayable; +``` + +Hook that is called before any token transfer, including minting and burning. + +- Allows to run custom logic before updating balances and notifiying sender/recipient by overriding this function. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------- | +| `from` | `address` | The sender address | +| `to` | `address` | @param tokenId The tokenId to transfer | +| `tokenId` | `bytes32` | The tokenId to transfer | + +
+ +### \_notifyTokenSender + +```solidity +function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; +``` + +An attempt is made to notify the token sender about the `tokenId` changing owners using +LSP1 interface. + +
+ +### \_notifyTokenReceiver + +```solidity +function _notifyTokenReceiver( + address to, + bool allowNonLSP1Recipient, + bytes lsp1Data +) internal nonpayable; +``` + +An attempt is made to notify the token receiver about the `tokenId` changing owners +using LSP1 interface. When allowNonLSP1Recipient is FALSE the token receiver MUST support LSP1. +The receiver may revert when the token being sent is not wanted. + +
+ +## Events + +### AuthorizedOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizedoperator) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Event signature: `AuthorizedOperator(address,address,bytes32)` +- Event topic hash: `0x34b797fc5a526f7bf1d2b5de25f6564fd85ae364e3ee939aee7c1ac27871a988` + +::: + +```solidity +event AuthorizedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId); +``` + +Emitted when `tokenOwner` enables `operator` to transfer or burn the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | -------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address authorized as an operator. | +| `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | +| `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` address has access on behalf of `tokenOwner`. | + +
+ +### DataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_Emitted when data at a key is changed_ + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ------------------------------------ | +| `dataKey` **`indexed`** | `bytes32` | The data key which data value is set | +| `dataValue` | `bytes` | The data value to set | + +
+ +### OwnershipTransferred + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Event signature: `OwnershipTransferred(address,address)` +- Event topic hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` + +::: + +```solidity +event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); +``` + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ----------- | +| `previousOwner` **`indexed`** | `address` | - | +| `newOwner` **`indexed`** | `address` | - | + +
+ +### RevokedOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokedoperator) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Event signature: `RevokedOperator(address,address,bytes32)` +- Event topic hash: `0x17d5389f6ab6adb2647dfa0aa365c323d37adacc30b33a65310b6158ce1373d5` + +::: + +```solidity +event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId); +``` + +Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | --------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from the operator array ({getOperatorsOf}). | +| `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | +| `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` is revoked from operating on. | + +
+ +### Transfer + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Event signature: `Transfer(address,address,address,bytes32,bool,bytes)` +- Event topic hash: `0xb333c813a7426a7a11e2b190cad52c44119421594b47f6f32ace6d8c7207b2bf` + +::: + +```solidity +event Transfer(address operator, address indexed from, address indexed to, bytes32 indexed tokenId, bool allowNonLSP1Recipient, bytes data); +``` + +Emitted when `tokenId` token is transferred from the `from` to the `to` address. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ---------------------------------------------------------------------------------------------------------------------------------- | +| `operator` | `address` | The address of operator that sent the `tokenId` | +| `from` **`indexed`** | `address` | The previous owner of the `tokenId` | +| `to` **`indexed`** | `address` | The new owner of `tokenId` | +| `tokenId` **`indexed`** | `bytes32` | The tokenId that was transferred | +| `allowNonLSP1Recipient` | `bool` | If the token transfer enforces the `to` recipient address to be a contract that implements the LSP1 standard or not. | +| `data` | `bytes` | Any additional data the caller included by the caller during the transfer, and sent in the hooks to the `from` and `to` addresses. | + +
+ +## Errors + +### ERC725Y_DataKeysValuesEmptyArray + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +reverts when one of the array parameter provided to `setDataBatch` is an empty array + +
+ +### ERC725Y_DataKeysValuesLengthMismatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +reverts when there is not the same number of elements in the lists of data keys and data values when calling setDataBatch. + +
+ +### ERC725Y_MsgValueDisallowed + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_msgvaluedisallowed) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +reverts when sending value to the `setData(..)` functions + +
+ +### LSP4TokenNameNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokennamenoteditable) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Error signature: `LSP4TokenNameNotEditable()` +- Error hash: `0x85c169bd` + +::: + +```solidity +error LSP4TokenNameNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +
+ +### LSP4TokenSymbolNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokensymbolnoteditable) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Error signature: `LSP4TokenSymbolNotEditable()` +- Error hash: `0x76755b38` + +::: + +```solidity +error LSP4TokenSymbolNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +
+ +### LSP8CannotSendToAddressZero + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotsendtoaddresszero) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Error signature: `LSP8CannotSendToAddressZero()` +- Error hash: `0x24ecef4d` + +::: + +```solidity +error LSP8CannotSendToAddressZero(); +``` + +reverts when trying to send token to the zero address. + +
+ +### LSP8CannotSendToSelf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotsendtoself) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Error signature: `LSP8CannotSendToSelf()` +- Error hash: `0x5d67d6c1` + +::: + +```solidity +error LSP8CannotSendToSelf(); +``` + +reverts when specifying the same address for `from` and `to` in a token transfer. + +
+ +### LSP8CannotUseAddressZeroAsOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotuseaddresszeroasoperator) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Error signature: `LSP8CannotUseAddressZeroAsOperator()` +- Error hash: `0x9577b8b3` + +::: + +```solidity +error LSP8CannotUseAddressZeroAsOperator(); +``` + +reverts when trying to set the zero address as an operator. + +
+ +### LSP8InvalidTransferBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8invalidtransferbatch) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Error signature: `LSP8InvalidTransferBatch()` +- Error hash: `0x93a83119` + +::: + +```solidity +error LSP8InvalidTransferBatch(); +``` + +reverts when the parameters used for `transferBatch` have different lengths. + +
+ +### LSP8NonExistentTokenId + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistenttokenid) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Error signature: `LSP8NonExistentTokenId(bytes32)` +- Error hash: `0xae8f9a36` + +::: + +```solidity +error LSP8NonExistentTokenId(bytes32 tokenId); +``` + +reverts when `tokenId` has not been minted. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------- | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8NonExistingOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistingoperator) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Error signature: `LSP8NonExistingOperator(address,bytes32)` +- Error hash: `0x4aa31a8c` + +::: + +```solidity +error LSP8NonExistingOperator(address operator, bytes32 tokenId); +``` + +reverts when `operator` is not an operator for the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8NotTokenOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenoperator) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Error signature: `LSP8NotTokenOperator(bytes32,address)` +- Error hash: `0x1294d2a9` + +::: + +```solidity +error LSP8NotTokenOperator(bytes32 tokenId, address caller); +``` + +reverts when `caller` is not an allowed operator for `tokenId`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------- | +| `tokenId` | `bytes32` | - | +| `caller` | `address` | - | + +
+ +### LSP8NotTokenOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenowner) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Error signature: `LSP8NotTokenOwner(address,bytes32,address)` +- Error hash: `0x5b271ea2` + +::: + +```solidity +error LSP8NotTokenOwner(address tokenOwner, bytes32 tokenId, address caller); +``` + +reverts when `caller` is not the `tokenOwner` of the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `tokenOwner` | `address` | - | +| `tokenId` | `bytes32` | - | +| `caller` | `address` | - | + +
+ +### LSP8NotifyTokenReceiverContractMissingLSP1Interface + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceivercontractmissinglsp1interface) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Error signature: `LSP8NotifyTokenReceiverContractMissingLSP1Interface(address)` +- Error hash: `0x4349776d` + +::: + +```solidity +error LSP8NotifyTokenReceiverContractMissingLSP1Interface( + address tokenReceiver +); +``` + +reverts if the `tokenReceiver` does not implement LSP1 when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8NotifyTokenReceiverIsEOA + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceiveriseoa) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Error signature: `LSP8NotifyTokenReceiverIsEOA(address)` +- Error hash: `0x03173137` + +::: + +```solidity +error LSP8NotifyTokenReceiverIsEOA(address tokenReceiver); +``` + +reverts if the `tokenReceiver` is an EOA when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8OperatorAlreadyAuthorized + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8operatoralreadyauthorized) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Error signature: `LSP8OperatorAlreadyAuthorized(address,bytes32)` +- Error hash: `0xa7626b68` + +::: + +```solidity +error LSP8OperatorAlreadyAuthorized(address operator, bytes32 tokenId); +``` + +reverts when `operator` is already authorized for the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8TokenOwnerCannotBeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenownercannotbeoperator) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Error signature: `LSP8TokenOwnerCannotBeOperator()` +- Error hash: `0x89fdad62` + +::: + +```solidity +error LSP8TokenOwnerCannotBeOperator(); +``` + +reverts when trying to authorize or revoke the token's owner as an operator. + +
diff --git a/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md b/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md new file mode 100644 index 000000000..cced87c15 --- /dev/null +++ b/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md @@ -0,0 +1,1395 @@ + + + +# LSP8CappedSupply + +:::info Standard Specifications + +[`LSP-8-IdentifiableDigitalAsset`](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md) + +::: +:::info Solidity implementation + +[`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) + +::: + +LSP8 token extension to add a max token supply cap. + +## Public Methods + +Public methods are accessible externally from users, allowing interaction with this function from dApps or other smart contracts. +When marked as 'public', a method can be called both externally and internally, on the other hand, when marked as 'external', a method can only be called externally. + +### authorizeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizeoperator) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Function signature: `authorizeOperator(address,bytes32)` +- Function selector: `0xcf5182ba` + +::: + +```solidity +function authorizeOperator( + address operator, + bytes32 tokenId +) external nonpayable; +``` + +Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ---------------------------------------- | +| `operator` | `address` | The address to authorize as an operator. | +| `tokenId` | `bytes32` | The token ID operator has access to.. | + +
+ +### balanceOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#balanceof) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Function signature: `balanceOf(address)` +- Function selector: `0x70a08231` + +::: + +```solidity +function balanceOf(address tokenOwner) external view returns (uint256); +``` + +Get the number of token IDs owned by `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------------------- | +| `tokenOwner` | `address` | The address to query \* | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------------------- | +| `0` | `uint256` | The total number of token IDs that `tokenOwner` owns. | + +
+ +### getData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdata) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_Gets singular data at a given `dataKey`_ + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ------------------------------- | +| `dataKey` | `bytes32` | The key which value to retrieve | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | -------------------------- | +| `dataValue` | `bytes` | The data stored at the key | + +
+ +### getDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatch) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Gets array of data for multiple given keys_ + +#### Parameters + +| Name | Type | Description | +| ---------- | :---------: | ------------------------------------------ | +| `dataKeys` | `bytes32[]` | The array of keys which values to retrieve | + +#### Returns + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------- | +| `dataValues` | `bytes[]` | The array of data stored at multiple keys | + +
+ +### getOperatorsOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getoperatorsof) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Function signature: `getOperatorsOf(bytes32)` +- Function selector: `0x49a6078d` + +::: + +```solidity +function getOperatorsOf(bytes32 tokenId) external view returns (address[]); +``` + +Returns all `operator` addresses that are allowed to transfer or burn a specific `tokenId` on behalf of its owner. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------- | +| `tokenId` | `bytes32` | The token ID to get the operators for. | + +#### Returns + +| Name | Type | Description | +| ---- | :---------: | ------------------------------------------------------------------------------------------------------------ | +| `0` | `address[]` | An array of operators allowed to transfer or burn a specific `tokenId`. Requirements - `tokenId` must exist. | + +
+ +### isOperatorFor + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#isoperatorfor) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Function signature: `isOperatorFor(address,bytes32)` +- Function selector: `0x2a3654a4` + +::: + +```solidity +function isOperatorFor( + address operator, + bytes32 tokenId +) external view returns (bool); +``` + +Returns whether `operator` address is an operator for a given `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------- | +| `operator` | `address` | The address to query operator status for. | +| `tokenId` | `bytes32` | The token ID to check if `operator` is allowed to operate on. | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | --------------------------------------------------------------------- | +| `0` | `bool` | `true` if `operator` is an operator for `tokenId`, `false` otherwise. | + +
+ +### owner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#owner) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Function signature: `owner()` +- Function selector: `0x8da5cb5b` + +::: + +```solidity +function owner() external view returns (address); +``` + +Returns the address of the current owner. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `address` | - | + +
+ +### renounceOwnership + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#renounceownership) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Function signature: `renounceOwnership()` +- Function selector: `0x715018a6` + +::: + +```solidity +function renounceOwnership() external nonpayable; +``` + +Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner. + +
+ +### revokeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokeoperator) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Function signature: `revokeOperator(address,bytes32)` +- Function selector: `0x0b0c6d82` + +::: + +```solidity +function revokeOperator(address operator, bytes32 tokenId) external nonpayable; +``` + +Remove access of `operator` for a given `tokenId`, disallowing it to transfer `tokenId` on behalf of its owner. See also [`isOperatorFor`](#isoperatorfor). + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ---------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `tokenId` | `bytes32` | The tokenId `operator` is revoked from operating on. | + +
+ +### setData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdata) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +```solidity +function setData(bytes32 dataKey, bytes dataValue) external payable; +``` + +_Sets singular data for a given `dataKey`_ + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `dataKey` | `bytes32` | The key to retrieve stored value | +| `dataValue` | `bytes` | The value to set SHOULD only be callable by the owner of the contract set via ERC173 The function is marked as payable to enable flexibility on child contracts If the function is not intended to receive value, an additional check should be implemented to check that value equal 0. Emits a {DataChanged} event. | + +
+ +### setDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatch) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +```solidity +function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable; +``` + +Sets array of data for multiple given `dataKeys` SHOULD only be callable by the owner of the contract set via ERC173 The function is marked as payable to enable flexibility on child contracts If the function is not intended to receive value, an additional check should be implemented to check that value equal + +0. Emits a [`DataChanged`](#datachanged) event. + +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ---------------------------------------- | +| `dataKeys` | `bytes32[]` | The array of data keys for values to set | +| `dataValues` | `bytes[]` | The array of values to set | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#supportsinterface) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas. + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ----------- | +| `interfaceId` | `bytes4` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +
+ +### tokenIdsOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenidsof) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Function signature: `tokenIdsOf(address)` +- Function selector: `0xa3b261f2` + +::: + +```solidity +function tokenIdsOf(address tokenOwner) external view returns (bytes32[]); +``` + +Returns the list of token IDs that the `tokenOwner` address owns. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ---------------------------------------------------------- | +| `tokenOwner` | `address` | The address that we want to get the list of token IDs for. | + +#### Returns + +| Name | Type | Description | +| ---- | :---------: | ------------------------------------------------------- | +| `0` | `bytes32[]` | An array of `bytes32[] tokenIds` owned by `tokenOwner`. | + +
+ +### tokenOwnerOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenownerof) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Function signature: `tokenOwnerOf(bytes32)` +- Function selector: `0x217b2270` + +::: + +```solidity +function tokenOwnerOf(bytes32 tokenId) external view returns (address); +``` + +Returns the list of `tokenIds` for the `tokenOwner` address. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------------- | +| `tokenId` | `bytes32` | tokenOwner The address to query owned tokens | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------- | +| `0` | `address` | The owner address of the given `tokenId`. | + +
+ +### tokenSupplyCap + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokensupplycap) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Function signature: `tokenSupplyCap()` +- Function selector: `0x52058d8a` + +::: + +```solidity +function tokenSupplyCap() external view returns (uint256); +``` + +_The maximum supply amount of tokens allowed to exist is `_tokenSupplyCap`._ + +Get the maximum number of tokens that can exist to circulate. Once [`totalSupply`](#totalsupply) reaches reaches [`totalSuuplyCap`](#totalsuuplycap), it is not possible to mint more tokens. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------------------------ | +| `0` | `uint256` | The maximum number of tokens that can exist in the contract. | + +
+ +### totalSupply + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#totalsupply) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Function signature: `totalSupply()` +- Function selector: `0x18160ddd` + +::: + +```solidity +function totalSupply() external view returns (uint256); +``` + +Returns the number of existing tokens that have been minted in this contract. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------ | +| `0` | `uint256` | The number of existing tokens. | + +
+ +### transfer + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Function signature: `transfer(address,address,bytes32,bool,bytes)` +- Function selector: `0x511b6952` + +::: + +```solidity +function transfer( + address from, + address to, + bytes32 tokenId, + bool allowNonLSP1Recipient, + bytes data +) external nonpayable; +``` + +Transfer a given `tokenId` token from the `from` address to the `to` address. If operators are set for a specific `tokenId`, all the operators are revoked after the tokenId have been transferred. The `allowNonLSP1Recipient` parameter MUST be set to `true` when transferring tokens to Externally Owned Accounts (EOAs) or contracts that do not implement the LSP1 standard. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The address that owns the given `tokenId`. | +| `to` | `address` | The address that will receive the `tokenId`. | +| `tokenId` | `bytes32` | The token ID to transfer. | +| `allowNonLSP1Recipient` | `bool` | When set to `true`, the `to` address CAN be any addres. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard. | +| `data` | `bytes` | Any additional data the caller wants included in the emitted event, and sent in the hooks of the `from` and `to` addresses. | + +
+ +### transferBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferbatch) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Function signature: `transferBatch(address[],address[],bytes32[],bool[],bytes[])` +- Function selector: `0x7e87632c` + +::: + +```solidity +function transferBatch( + address[] from, + address[] to, + bytes32[] tokenId, + bool[] allowNonLSP1Recipient, + bytes[] data +) external nonpayable; +``` + +Transfers multiple tokens at once based on the arrays of `from`, `to` and `tokenId`. If any transfer fails, the whole call will revert. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :---------: | ----------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address[]` | An array of sending addresses. | +| `to` | `address[]` | An array of recipient addresses. | +| `tokenId` | `bytes32[]` | An array of token IDs to transfer. | +| `allowNonLSP1Recipient` | `bool[]` | When set to `true`, `to` may be any address. When set to `false`, `to` must be a contract that supports the LSP1 standard and not revert. | +| `data` | `bytes[]` | Any additional data the caller wants included in the emitted event, and sent in the hooks to the `from` and `to` addresses. | + +
+ +### transferOwnership + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferownership) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Function signature: `transferOwnership(address)` +- Function selector: `0xf2fde38b` + +::: + +```solidity +function transferOwnership(address newOwner) external nonpayable; +``` + +Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `newOwner` | `address` | - | + +
+ +## Internal Methods + +Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. + +Internal functions cannot be called externally, whether from other smart contracts, dApp interfaces, or backend services. Their restricted accessibility ensures that they remain exclusively available within the context of the current contract, promoting controlled and encapsulated usage of these internal utilities. + +### \_checkOwner + +```solidity +function _checkOwner() internal view; +``` + +Throws if the sender is not the owner. + +
+ +### \_setOwner + +```solidity +function _setOwner(address newOwner) internal nonpayable; +``` + +Changes the owner if `newOwner` and oldOwner are different +This pattern is useful in inheritance. + +
+ +### \_getData + +```solidity +function _getData(bytes32 dataKey) internal view returns (bytes dataValue); +``` + +
+ +### \_setData + +```solidity +function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; +``` + +Save gas by emitting the [`DataChanged`](#datachanged) event with only the first 256 bytes of dataValue + +
+ +### \_isOperatorOrOwner + +```solidity +function _isOperatorOrOwner( + address caller, + bytes32 tokenId +) internal view returns (bool); +``` + +verifies if the `caller` is operator or owner for the `tokenId` + +#### Returns + +| Name | Type | Description | +| ---- | :----: | -------------------------------------------- | +| `0` | `bool` | true if `caller` is either operator or owner | + +
+ +### \_revokeOperator + +```solidity +function _revokeOperator( + address operator, + address tokenOwner, + bytes32 tokenId +) internal nonpayable; +``` + +removes `operator` from the list of operators for the `tokenId` + +
+ +### \_clearOperators + +```solidity +function _clearOperators( + address tokenOwner, + bytes32 tokenId +) internal nonpayable; +``` + +revoke all the current operators for a specific `tokenId` token which belongs to `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ------------------------------------------------- | +| `tokenOwner` | `address` | The address that is the owner of the `tokenId`. | +| `tokenId` | `bytes32` | The token to remove the associated operators for. | + +
+ +### \_exists + +```solidity +function _exists(bytes32 tokenId) internal view returns (bool); +``` + +Returns whether `tokenId` exists. +Tokens start existing when they are minted ([`_mint`](#_mint)), and stop existing when they are burned ([`_burn`](#_burn)). + +
+ +### \_existsOrError + +```solidity +function _existsOrError(bytes32 tokenId) internal view; +``` + +When `tokenId` does not exist then revert with an error. + +
+ +### \_mint + +```solidity +function _mint( + address to, + bytes32 tokenId, + bool allowNonLSP1Recipient, + bytes data +) internal nonpayable; +``` + +Same as [`_mint`](#_mint) but allows to mint only if newly minted `tokenId` does not increase the [`totalSupply`](#totalsupply) +over the [`tokenSupplyCap`](#tokensupplycap). +after a new `tokenId` has of tokens have been minted. + +
+ +### \_burn + +:::tip Hint + +In dApps, you can know which addresses are burning tokens by listening for the `Transfer` event and filter with the zero address as `to`. + +::: + +```solidity +function _burn(bytes32 tokenId, bytes data) internal nonpayable; +``` + +Burn a specific `tokenId`, removing the `tokenId` from the [`tokenIdsOf`](#tokenidsof) the caller and decreasing its [`balanceOf`](#balanceof) by -1. +This will also clear all the operators allowed to transfer the `tokenId`. +The owner of the `tokenId` will be notified about the `tokenId` being transferred through its LSP1 [`universalReceiver`](#universalreceiver) +function, if it is a contract that supports the LSP1 interface. Its [`universalReceiver`](#universalreceiver) function will receive +all the parameters in the calldata packed encoded. +Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before burning `tokenId` and updating the balances. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event with `address(0)` as the `to` address. + +
+ +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------------------------------------------------------------------------------------------------------------- | +| `tokenId` | `bytes32` | The token to burn. | +| `data` | `bytes` | Any additional data the caller wants included in the emitted event, and sent in the LSP1 hook on the token owner's address. | + +
+ +### \_transfer + +:::danger + +This internal function does not check if the sender is authorized or not to operate on the `tokenId`. + +::: + +```solidity +function _transfer( + address from, + address to, + bytes32 tokenId, + bool allowNonLSP1Recipient, + bytes data +) internal nonpayable; +``` + +Change the owner of the `tokenId` from `from` to `to`. +Both the sender and recipient will be notified of the `tokenId` being transferred through their LSP1 [`universalReceiver`](#universalreceiver) +function, if they are contracts that support the LSP1 interface. Their `universalReceiver` function will receive +all the parameters in the calldata packed encoded. +Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before changing the owner of `tokenId`. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The sender address. | +| `to` | `address` | @param tokenId The token to transfer. | +| `tokenId` | `bytes32` | The token to transfer. | +| `allowNonLSP1Recipient` | `bool` | When set to `true`, `to` may be any address. When set to `false`, `to` must be a contract that supports the LSP1 standard. | +| `data` | `bytes` | Additional data the caller wants included in the emitted event, and sent in the hooks to `from` and `to` addresses. | + +
+ +### \_beforeTokenTransfer + +```solidity +function _beforeTokenTransfer( + address from, + address to, + bytes32 tokenId +) internal nonpayable; +``` + +Hook that is called before any token transfer, including minting and burning. + +- Allows to run custom logic before updating balances and notifiying sender/recipient by overriding this function. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------- | +| `from` | `address` | The sender address | +| `to` | `address` | @param tokenId The tokenId to transfer | +| `tokenId` | `bytes32` | The tokenId to transfer | + +
+ +### \_notifyTokenSender + +```solidity +function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; +``` + +An attempt is made to notify the token sender about the `tokenId` changing owners using +LSP1 interface. + +
+ +### \_notifyTokenReceiver + +```solidity +function _notifyTokenReceiver( + address to, + bool allowNonLSP1Recipient, + bytes lsp1Data +) internal nonpayable; +``` + +An attempt is made to notify the token receiver about the `tokenId` changing owners +using LSP1 interface. When allowNonLSP1Recipient is FALSE the token receiver MUST support LSP1. +The receiver may revert when the token being sent is not wanted. + +
+ +## Events + +### AuthorizedOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizedoperator) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Event signature: `AuthorizedOperator(address,address,bytes32)` +- Event topic hash: `0x34b797fc5a526f7bf1d2b5de25f6564fd85ae364e3ee939aee7c1ac27871a988` + +::: + +```solidity +event AuthorizedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId); +``` + +Emitted when `tokenOwner` enables `operator` to transfer or burn the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | -------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address authorized as an operator. | +| `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | +| `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` address has access on behalf of `tokenOwner`. | + +
+ +### DataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_Emitted when data at a key is changed_ + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ------------------------------------ | +| `dataKey` **`indexed`** | `bytes32` | The data key which data value is set | +| `dataValue` | `bytes` | The data value to set | + +
+ +### OwnershipTransferred + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Event signature: `OwnershipTransferred(address,address)` +- Event topic hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` + +::: + +```solidity +event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); +``` + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ----------- | +| `previousOwner` **`indexed`** | `address` | - | +| `newOwner` **`indexed`** | `address` | - | + +
+ +### RevokedOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokedoperator) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Event signature: `RevokedOperator(address,address,bytes32)` +- Event topic hash: `0x17d5389f6ab6adb2647dfa0aa365c323d37adacc30b33a65310b6158ce1373d5` + +::: + +```solidity +event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId); +``` + +Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | --------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from the operator array ({getOperatorsOf}). | +| `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | +| `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` is revoked from operating on. | + +
+ +### Transfer + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Event signature: `Transfer(address,address,address,bytes32,bool,bytes)` +- Event topic hash: `0xb333c813a7426a7a11e2b190cad52c44119421594b47f6f32ace6d8c7207b2bf` + +::: + +```solidity +event Transfer(address operator, address indexed from, address indexed to, bytes32 indexed tokenId, bool allowNonLSP1Recipient, bytes data); +``` + +Emitted when `tokenId` token is transferred from the `from` to the `to` address. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ---------------------------------------------------------------------------------------------------------------------------------- | +| `operator` | `address` | The address of operator that sent the `tokenId` | +| `from` **`indexed`** | `address` | The previous owner of the `tokenId` | +| `to` **`indexed`** | `address` | The new owner of `tokenId` | +| `tokenId` **`indexed`** | `bytes32` | The tokenId that was transferred | +| `allowNonLSP1Recipient` | `bool` | If the token transfer enforces the `to` recipient address to be a contract that implements the LSP1 standard or not. | +| `data` | `bytes` | Any additional data the caller included by the caller during the transfer, and sent in the hooks to the `from` and `to` addresses. | + +
+ +## Errors + +### ERC725Y_DataKeysValuesEmptyArray + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +reverts when one of the array parameter provided to `setDataBatch` is an empty array + +
+ +### ERC725Y_DataKeysValuesLengthMismatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +reverts when there is not the same number of elements in the lists of data keys and data values when calling setDataBatch. + +
+ +### ERC725Y_MsgValueDisallowed + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_msgvaluedisallowed) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +reverts when sending value to the `setData(..)` functions + +
+ +### LSP4TokenNameNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokennamenoteditable) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `LSP4TokenNameNotEditable()` +- Error hash: `0x85c169bd` + +::: + +```solidity +error LSP4TokenNameNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +
+ +### LSP4TokenSymbolNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokensymbolnoteditable) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `LSP4TokenSymbolNotEditable()` +- Error hash: `0x76755b38` + +::: + +```solidity +error LSP4TokenSymbolNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +
+ +### LSP8CannotSendToAddressZero + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotsendtoaddresszero) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `LSP8CannotSendToAddressZero()` +- Error hash: `0x24ecef4d` + +::: + +```solidity +error LSP8CannotSendToAddressZero(); +``` + +reverts when trying to send token to the zero address. + +
+ +### LSP8CannotSendToSelf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotsendtoself) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `LSP8CannotSendToSelf()` +- Error hash: `0x5d67d6c1` + +::: + +```solidity +error LSP8CannotSendToSelf(); +``` + +reverts when specifying the same address for `from` and `to` in a token transfer. + +
+ +### LSP8CannotUseAddressZeroAsOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotuseaddresszeroasoperator) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `LSP8CannotUseAddressZeroAsOperator()` +- Error hash: `0x9577b8b3` + +::: + +```solidity +error LSP8CannotUseAddressZeroAsOperator(); +``` + +reverts when trying to set the zero address as an operator. + +
+ +### LSP8CappedSupplyCannotMintOverCap + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cappedsupplycannotmintovercap) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `LSP8CappedSupplyCannotMintOverCap()` +- Error hash: `0xe8ba2291` + +::: + +```solidity +error LSP8CappedSupplyCannotMintOverCap(); +``` + +_Cannot mint anymore as total supply reached the maximum cap._ + +Reverts when trying to mint tokens but the [`totalSupply`](#totalsupply) has reached the maximum [`tokenSupplyCap`](#tokensupplycap). + +
+ +### LSP8CappedSupplyRequired + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cappedsupplyrequired) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `LSP8CappedSupplyRequired()` +- Error hash: `0x38d9fc30` + +::: + +```solidity +error LSP8CappedSupplyRequired(); +``` + +_The `tokenSupplyCap` must be set and cannot be `0`._ + +Reverts when setting `0` for the [`tokenSupplyCap`](#tokensupplycap). The max token supply MUST be set to a number greater than 0. + +
+ +### LSP8InvalidTransferBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8invalidtransferbatch) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `LSP8InvalidTransferBatch()` +- Error hash: `0x93a83119` + +::: + +```solidity +error LSP8InvalidTransferBatch(); +``` + +reverts when the parameters used for `transferBatch` have different lengths. + +
+ +### LSP8NonExistentTokenId + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistenttokenid) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `LSP8NonExistentTokenId(bytes32)` +- Error hash: `0xae8f9a36` + +::: + +```solidity +error LSP8NonExistentTokenId(bytes32 tokenId); +``` + +reverts when `tokenId` has not been minted. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------- | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8NonExistingOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistingoperator) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `LSP8NonExistingOperator(address,bytes32)` +- Error hash: `0x4aa31a8c` + +::: + +```solidity +error LSP8NonExistingOperator(address operator, bytes32 tokenId); +``` + +reverts when `operator` is not an operator for the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8NotTokenOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenoperator) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `LSP8NotTokenOperator(bytes32,address)` +- Error hash: `0x1294d2a9` + +::: + +```solidity +error LSP8NotTokenOperator(bytes32 tokenId, address caller); +``` + +reverts when `caller` is not an allowed operator for `tokenId`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------- | +| `tokenId` | `bytes32` | - | +| `caller` | `address` | - | + +
+ +### LSP8NotTokenOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenowner) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `LSP8NotTokenOwner(address,bytes32,address)` +- Error hash: `0x5b271ea2` + +::: + +```solidity +error LSP8NotTokenOwner(address tokenOwner, bytes32 tokenId, address caller); +``` + +reverts when `caller` is not the `tokenOwner` of the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `tokenOwner` | `address` | - | +| `tokenId` | `bytes32` | - | +| `caller` | `address` | - | + +
+ +### LSP8NotifyTokenReceiverContractMissingLSP1Interface + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceivercontractmissinglsp1interface) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `LSP8NotifyTokenReceiverContractMissingLSP1Interface(address)` +- Error hash: `0x4349776d` + +::: + +```solidity +error LSP8NotifyTokenReceiverContractMissingLSP1Interface( + address tokenReceiver +); +``` + +reverts if the `tokenReceiver` does not implement LSP1 when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8NotifyTokenReceiverIsEOA + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceiveriseoa) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `LSP8NotifyTokenReceiverIsEOA(address)` +- Error hash: `0x03173137` + +::: + +```solidity +error LSP8NotifyTokenReceiverIsEOA(address tokenReceiver); +``` + +reverts if the `tokenReceiver` is an EOA when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8OperatorAlreadyAuthorized + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8operatoralreadyauthorized) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `LSP8OperatorAlreadyAuthorized(address,bytes32)` +- Error hash: `0xa7626b68` + +::: + +```solidity +error LSP8OperatorAlreadyAuthorized(address operator, bytes32 tokenId); +``` + +reverts when `operator` is already authorized for the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8TokenOwnerCannotBeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenownercannotbeoperator) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `LSP8TokenOwnerCannotBeOperator()` +- Error hash: `0x89fdad62` + +::: + +```solidity +error LSP8TokenOwnerCannotBeOperator(); +``` + +reverts when trying to authorize or revoke the token's owner as an operator. + +
diff --git a/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.md b/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.md new file mode 100644 index 000000000..b5942022e --- /dev/null +++ b/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.md @@ -0,0 +1,1721 @@ + + + +# LSP8CompatibleERC721 + +:::info Standard Specifications + +[`LSP-8-IdentifiableDigitalAsset`](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md) + +::: +:::info Solidity implementation + +[`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) + +::: + +LSP8 extension, for compatibility for clients / tools that expect ERC721. + +## Public Methods + +Public methods are accessible externally from users, allowing interaction with this function from dApps or other smart contracts. +When marked as 'public', a method can be called both externally and internally, on the other hand, when marked as 'external', a method can only be called externally. + +### approve + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#approve) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `approve(address,uint256)` +- Function selector: `0x095ea7b3` + +::: + +```solidity +function approve(address operator, uint256 tokenId) external nonpayable; +``` + +_Calling `approve` function on `ILSP8CompatibleERC721` contract. Approving operator at address `operator` to transfer tokenId `tokenId` on behalf of its owner._ + +Approval function compatible with ERC721 `approve(address,uint256)`. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------- | +| `operator` | `address` | The address to approve for `tokenId`. | +| `tokenId` | `uint256` | The tokenId to approve. | + +
+ +### authorizeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizeoperator) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `authorizeOperator(address,bytes32)` +- Function selector: `0xcf5182ba` + +::: + +```solidity +function authorizeOperator( + address operator, + bytes32 tokenId +) external nonpayable; +``` + +Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). + +
+ +**Emitted events:** + +- LSP7 [`AuthorizedOperator`](#authorizedoperator) event. +- ERC721 [`Approval`](#approval) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ---------------------------------------- | +| `operator` | `address` | The address to authorize as an operator. | +| `tokenId` | `bytes32` | The token ID operator has access to.. | + +
+ +### balanceOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#balanceof) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `balanceOf(address)` +- Function selector: `0x70a08231` + +::: + +```solidity +function balanceOf(address tokenOwner) external view returns (uint256); +``` + +Get the number of token IDs owned by `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------------------- | +| `tokenOwner` | `address` | The address to query \* | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------------------- | +| `0` | `uint256` | The total number of token IDs that `tokenOwner` owns. | + +
+ +### getApproved + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getapproved) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `getApproved(uint256)` +- Function selector: `0x081812fc` + +::: + +```solidity +function getApproved(uint256 tokenId) external view returns (address); +``` + +_Retrieving the address other than the token owner that is approved to transfer tokenId `tokenId` on behalf of its owner._ + +Compatible with ERC721 getApproved. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------- | +| `tokenId` | `uint256` | The tokenId to query. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------ | +| `0` | `address` | The address of the operator for `tokenId`. | + +
+ +### getData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdata) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_Gets singular data at a given `dataKey`_ + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ------------------------------- | +| `dataKey` | `bytes32` | The key which value to retrieve | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | -------------------------- | +| `dataValue` | `bytes` | The data stored at the key | + +
+ +### getDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatch) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Gets array of data for multiple given keys_ + +#### Parameters + +| Name | Type | Description | +| ---------- | :---------: | ------------------------------------------ | +| `dataKeys` | `bytes32[]` | The array of keys which values to retrieve | + +#### Returns + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------- | +| `dataValues` | `bytes[]` | The array of data stored at multiple keys | + +
+ +### getOperatorsOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getoperatorsof) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `getOperatorsOf(bytes32)` +- Function selector: `0x49a6078d` + +::: + +```solidity +function getOperatorsOf(bytes32 tokenId) external view returns (address[]); +``` + +Returns all `operator` addresses that are allowed to transfer or burn a specific `tokenId` on behalf of its owner. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------- | +| `tokenId` | `bytes32` | The token ID to get the operators for. | + +#### Returns + +| Name | Type | Description | +| ---- | :---------: | ------------------------------------------------------------------------------------------------------------ | +| `0` | `address[]` | An array of operators allowed to transfer or burn a specific `tokenId`. Requirements - `tokenId` must exist. | + +
+ +### isApprovedForAll + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#isapprovedforall) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `isApprovedForAll(address,address)` +- Function selector: `0xe985e9c5` + +::: + +```solidity +function isApprovedForAll( + address tokenOwner, + address operator +) external view returns (bool); +``` + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `tokenOwner` | `address` | - | +| `operator` | `address` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +
+ +### isOperatorFor + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#isoperatorfor) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `isOperatorFor(address,bytes32)` +- Function selector: `0x2a3654a4` + +::: + +```solidity +function isOperatorFor( + address operator, + bytes32 tokenId +) external view returns (bool); +``` + +Returns whether `operator` address is an operator for a given `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------- | +| `operator` | `address` | The address to query operator status for. | +| `tokenId` | `bytes32` | The token ID to check if `operator` is allowed to operate on. | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | --------------------------------------------------------------------- | +| `0` | `bool` | `true` if `operator` is an operator for `tokenId`, `false` otherwise. | + +
+ +### name + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#name) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `name()` +- Function selector: `0x06fdde03` + +::: + +```solidity +function name() external view returns (string); +``` + +Returns the name of the token. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | --------------------- | +| `0` | `string` | The name of the token | + +
+ +### owner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#owner) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `owner()` +- Function selector: `0x8da5cb5b` + +::: + +```solidity +function owner() external view returns (address); +``` + +Returns the address of the current owner. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `address` | - | + +
+ +### ownerOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownerof) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `ownerOf(uint256)` +- Function selector: `0x6352211e` + +::: + +```solidity +function ownerOf(uint256 tokenId) external view returns (address); +``` + +_Retrieving the address that own tokenId `tokenId`._ + +Compatible with ERC721 ownerOf. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------- | +| `tokenId` | `uint256` | The tokenId to query. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------- | +| `0` | `address` | The owner of the tokenId. | + +
+ +### renounceOwnership + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#renounceownership) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `renounceOwnership()` +- Function selector: `0x715018a6` + +::: + +```solidity +function renounceOwnership() external nonpayable; +``` + +Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner. + +
+ +### revokeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokeoperator) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `revokeOperator(address,bytes32)` +- Function selector: `0x0b0c6d82` + +::: + +```solidity +function revokeOperator(address operator, bytes32 tokenId) external nonpayable; +``` + +Remove access of `operator` for a given `tokenId`, disallowing it to transfer `tokenId` on behalf of its owner. See also [`isOperatorFor`](#isoperatorfor). + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ---------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `tokenId` | `bytes32` | The tokenId `operator` is revoked from operating on. | + +
+ +### safeTransferFrom + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#safetransferfrom) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `safeTransferFrom(address,address,uint256)` +- Function selector: `0x42842e0e` + +::: + +:::info + +This function sets the `allowNonLSP1Recipient` parameter to `true` so that EOAs and any contract can receive the `tokenId`. + +::: + +```solidity +function safeTransferFrom( + address from, + address to, + uint256 tokenId +) external nonpayable; +``` + +_Calling `safeTransferFrom` function on `ILSP8CompatibleERC721` contract. Transferring tokenId `tokenId` from address `from` to address `to`._ + +Safe Transfer function without optional data from the ERC721 standard interface. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ------------------------ | +| `from` | `address` | The sending address. | +| `to` | `address` | The receiving address. | +| `tokenId` | `uint256` | The tokenId to transfer. | + +
+ +### safeTransferFrom + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#safetransferfrom) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `safeTransferFrom(address,address,uint256,bytes)` +- Function selector: `0xb88d4fde` + +::: + +:::info + +This function sets the `allowNonLSP1Recipient` parameter to `true` so that EOAs and any contract can receive the `tokenId`. + +::: + +```solidity +function safeTransferFrom( + address from, + address to, + uint256 tokenId, + bytes data +) external nonpayable; +``` + +_Calling `safeTransferFrom` function with `data` on `ILSP8CompatibleERC721` contract. Transferring tokenId `tokenId` from address `from` to address `to`._ + +Safe Transfer function with optional data from the ERC721 standard interface. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------- | +| `from` | `address` | The sending address. | +| `to` | `address` | The receiving address. | +| `tokenId` | `uint256` | The tokenId to transfer. | +| `data` | `bytes` | The data to be sent with the transfer. | + +
+ +### setApprovalForAll + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setapprovalforall) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `setApprovalForAll(address,bool)` +- Function selector: `0xa22cb465` + +::: + +```solidity +function setApprovalForAll(address operator, bool approved) external nonpayable; +``` + +See [`_setApprovalForAll`](#_setapprovalforall) + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | +| `approved` | `bool` | - | + +
+ +### setData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdata) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +```solidity +function setData(bytes32 dataKey, bytes dataValue) external payable; +``` + +_Sets singular data for a given `dataKey`_ + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `dataKey` | `bytes32` | The key to retrieve stored value | +| `dataValue` | `bytes` | The value to set SHOULD only be callable by the owner of the contract set via ERC173 The function is marked as payable to enable flexibility on child contracts If the function is not intended to receive value, an additional check should be implemented to check that value equal 0. Emits a {DataChanged} event. | + +
+ +### setDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatch) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +```solidity +function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable; +``` + +Sets array of data for multiple given `dataKeys` SHOULD only be callable by the owner of the contract set via ERC173 The function is marked as payable to enable flexibility on child contracts If the function is not intended to receive value, an additional check should be implemented to check that value equal + +0. Emits a [`DataChanged`](#datachanged) event. + +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ---------------------------------------- | +| `dataKeys` | `bytes32[]` | The array of data keys for values to set | +| `dataValues` | `bytes[]` | The array of values to set | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#supportsinterface) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas. + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ----------- | +| `interfaceId` | `bytes4` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +
+ +### symbol + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#symbol) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `symbol()` +- Function selector: `0x95d89b41` + +::: + +```solidity +function symbol() external view returns (string); +``` + +Returns the symbol of the token, usually a shorter version of the name. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | ----------------------- | +| `0` | `string` | The symbol of the token | + +
+ +### tokenIdsOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenidsof) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `tokenIdsOf(address)` +- Function selector: `0xa3b261f2` + +::: + +```solidity +function tokenIdsOf(address tokenOwner) external view returns (bytes32[]); +``` + +Returns the list of token IDs that the `tokenOwner` address owns. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ---------------------------------------------------------- | +| `tokenOwner` | `address` | The address that we want to get the list of token IDs for. | + +#### Returns + +| Name | Type | Description | +| ---- | :---------: | ------------------------------------------------------- | +| `0` | `bytes32[]` | An array of `bytes32[] tokenIds` owned by `tokenOwner`. | + +
+ +### tokenOwnerOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenownerof) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `tokenOwnerOf(bytes32)` +- Function selector: `0x217b2270` + +::: + +```solidity +function tokenOwnerOf(bytes32 tokenId) external view returns (address); +``` + +Returns the list of `tokenIds` for the `tokenOwner` address. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------------- | +| `tokenId` | `bytes32` | tokenOwner The address to query owned tokens | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------- | +| `0` | `address` | The owner address of the given `tokenId`. | + +
+ +### tokenURI + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#)) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `)` +- Function selector: `0x59d76dc3` + +::: + +```solidity +function tokenURI(uint256) external view returns (string); +``` + +#### Parameters + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `_0` | `uint256` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :------: | ----------- | +| `0` | `string` | - | + +
+ +### totalSupply + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#totalsupply) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `totalSupply()` +- Function selector: `0x18160ddd` + +::: + +```solidity +function totalSupply() external view returns (uint256); +``` + +Returns the number of existing tokens that have been minted in this contract. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------ | +| `0` | `uint256` | The number of existing tokens. | + +
+ +### transfer + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `transfer(address,address,bytes32,bool,bytes)` +- Function selector: `0x511b6952` + +::: + +```solidity +function transfer( + address from, + address to, + bytes32 tokenId, + bool allowNonLSP1Recipient, + bytes data +) external nonpayable; +``` + +Transfer a given `tokenId` token from the `from` address to the `to` address. If operators are set for a specific `tokenId`, all the operators are revoked after the tokenId have been transferred. The `allowNonLSP1Recipient` parameter MUST be set to `true` when transferring tokens to Externally Owned Accounts (EOAs) or contracts that do not implement the LSP1 standard. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The address that owns the given `tokenId`. | +| `to` | `address` | The address that will receive the `tokenId`. | +| `tokenId` | `bytes32` | The token ID to transfer. | +| `allowNonLSP1Recipient` | `bool` | When set to `true`, the `to` address CAN be any addres. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard. | +| `data` | `bytes` | Any additional data the caller wants included in the emitted event, and sent in the hooks of the `from` and `to` addresses. | + +
+ +### transferBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferbatch) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `transferBatch(address[],address[],bytes32[],bool[],bytes[])` +- Function selector: `0x7e87632c` + +::: + +```solidity +function transferBatch( + address[] from, + address[] to, + bytes32[] tokenId, + bool[] allowNonLSP1Recipient, + bytes[] data +) external nonpayable; +``` + +Transfers multiple tokens at once based on the arrays of `from`, `to` and `tokenId`. If any transfer fails, the whole call will revert. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :---------: | ----------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address[]` | An array of sending addresses. | +| `to` | `address[]` | An array of recipient addresses. | +| `tokenId` | `bytes32[]` | An array of token IDs to transfer. | +| `allowNonLSP1Recipient` | `bool[]` | When set to `true`, `to` may be any address. When set to `false`, `to` must be a contract that supports the LSP1 standard and not revert. | +| `data` | `bytes[]` | Any additional data the caller wants included in the emitted event, and sent in the hooks to the `from` and `to` addresses. | + +
+ +### transferFrom + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferfrom) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `transferFrom(address,address,uint256)` +- Function selector: `0x23b872dd` + +::: + +:::info + +This function sets the `allowNonLSP1Recipient` parameter to `true` so that EOAs and any contract can receive the `tokenId`. + +::: + +```solidity +function transferFrom( + address from, + address to, + uint256 tokenId +) external nonpayable; +``` + +_Calling `transferFrom` function on `ILSP8CompatibleERC721` contract. Transferring tokenId `tokenId` from address `from` to address `to`._ + +Transfer functions from the ERC721 standard interface. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ------------------------ | +| `from` | `address` | The sending address. | +| `to` | `address` | The receiving address. | +| `tokenId` | `uint256` | The tokenId to transfer. | + +
+ +### transferOwnership + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferownership) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `transferOwnership(address)` +- Function selector: `0xf2fde38b` + +::: + +```solidity +function transferOwnership(address newOwner) external nonpayable; +``` + +Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `newOwner` | `address` | - | + +
+ +## Internal Methods + +Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. + +Internal functions cannot be called externally, whether from other smart contracts, dApp interfaces, or backend services. Their restricted accessibility ensures that they remain exclusively available within the context of the current contract, promoting controlled and encapsulated usage of these internal utilities. + +### \_checkOwner + +```solidity +function _checkOwner() internal view; +``` + +Throws if the sender is not the owner. + +
+ +### \_setOwner + +```solidity +function _setOwner(address newOwner) internal nonpayable; +``` + +Changes the owner if `newOwner` and oldOwner are different +This pattern is useful in inheritance. + +
+ +### \_getData + +```solidity +function _getData(bytes32 dataKey) internal view returns (bytes dataValue); +``` + +
+ +### \_setData + +```solidity +function _setData(bytes32 key, bytes value) internal nonpayable; +``` + +
+ +### \_isOperatorOrOwner + +```solidity +function _isOperatorOrOwner( + address caller, + bytes32 tokenId +) internal view returns (bool); +``` + +verifies if the `caller` is operator or owner for the `tokenId` + +#### Returns + +| Name | Type | Description | +| ---- | :----: | -------------------------------------------- | +| `0` | `bool` | true if `caller` is either operator or owner | + +
+ +### \_revokeOperator + +```solidity +function _revokeOperator( + address operator, + address tokenOwner, + bytes32 tokenId +) internal nonpayable; +``` + +removes `operator` from the list of operators for the `tokenId` + +
+ +### \_clearOperators + +```solidity +function _clearOperators( + address tokenOwner, + bytes32 tokenId +) internal nonpayable; +``` + +revoke all the current operators for a specific `tokenId` token which belongs to `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ------------------------------------------------- | +| `tokenOwner` | `address` | The address that is the owner of the `tokenId`. | +| `tokenId` | `bytes32` | The token to remove the associated operators for. | + +
+ +### \_exists + +```solidity +function _exists(bytes32 tokenId) internal view returns (bool); +``` + +Returns whether `tokenId` exists. +Tokens start existing when they are minted ([`_mint`](#_mint)), and stop existing when they are burned ([`_burn`](#_burn)). + +
+ +### \_existsOrError + +```solidity +function _existsOrError(bytes32 tokenId) internal view; +``` + +When `tokenId` does not exist then revert with an error. + +
+ +### \_mint + +```solidity +function _mint( + address to, + bytes32 tokenId, + bool allowNonLSP1Recipient, + bytes data +) internal nonpayable; +``` + +
+ +### \_burn + +```solidity +function _burn(bytes32 tokenId, bytes data) internal nonpayable; +``` + +
+ +### \_transfer + +```solidity +function _transfer( + address from, + address to, + bytes32 tokenId, + bool allowNonLSP1Recipient, + bytes data +) internal nonpayable; +``` + +
+ +### \_beforeTokenTransfer + +```solidity +function _beforeTokenTransfer( + address from, + address to, + bytes32 tokenId +) internal nonpayable; +``` + +Hook that is called before any token transfer, including minting and burning. + +- Allows to run custom logic before updating balances and notifiying sender/recipient by overriding this function. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------- | +| `from` | `address` | The sender address | +| `to` | `address` | @param tokenId The tokenId to transfer | +| `tokenId` | `bytes32` | The tokenId to transfer | + +
+ +### \_notifyTokenSender + +```solidity +function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; +``` + +An attempt is made to notify the token sender about the `tokenId` changing owners using +LSP1 interface. + +
+ +### \_notifyTokenReceiver + +```solidity +function _notifyTokenReceiver( + address to, + bool allowNonLSP1Recipient, + bytes lsp1Data +) internal nonpayable; +``` + +An attempt is made to notify the token receiver about the `tokenId` changing owners +using LSP1 interface. When allowNonLSP1Recipient is FALSE the token receiver MUST support LSP1. +The receiver may revert when the token being sent is not wanted. + +
+ +### \_safeTransfer + +```solidity +function _safeTransfer( + address from, + address to, + uint256 tokenId, + bytes data +) internal nonpayable; +``` + +Transfer the `tokenId` from `from` to `to` and check if the `to` recipient address is +a contract that implements the `IERC721Received` interface and return the right magic value. +See [`_checkOnERC721Received`](#_checkonerc721received) for more infos. + +
+ +### \_setApprovalForAll + +```solidity +function _setApprovalForAll( + address tokensOwner, + address operator, + bool approved +) internal nonpayable; +``` + +Approve `operator` to operate on all tokens of `tokensOwner` + +
+ +**Emitted events:** + +- [`ApprovalForAll`](#approvalforall) event. + +
+ +
+ +## Events + +### Approval + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#approval) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Event signature: `Approval(address,address,uint256)` +- Event topic hash: `0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925` + +::: + +```solidity +event Approval(address indexed owner, address indexed operator, uint256 indexed tokenId); +``` + +_ERC721 `Approval` compatible event emitted. Successfully approved operator `operator` to operate on tokenId `tokenId` on behalf of token owner `owner`._ + +ERC721 `Approval` event emitted when `owner` enables `operator` for `tokenId`. To provide compatibility with indexing ERC721 events. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ------------------------------------------ | +| `owner` **`indexed`** | `address` | The address of the owner of the `tokenId`. | +| `operator` **`indexed`** | `address` | The address set as operator. | +| `tokenId` **`indexed`** | `uint256` | The approved tokenId. | + +
+ +### ApprovalForAll + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#approvalforall) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Event signature: `ApprovalForAll(address,address,bool)` +- Event topic hash: `0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31` + +::: + +```solidity +event ApprovalForAll(address indexed owner, address indexed operator, bool approved); +``` + +_ERC721 `ApprovalForAll` compatible event emitted. Successfully set "approved for all" status to `approved` for operator `operator` for token owner `owner`._ + +ERC721 `ApprovalForAll` event emitted when an `operator` is enabled or disabled for an owner to transfer any of its tokenIds. The operator can manage all NFTs of the owner. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ---------------------------------------------- | +| `owner` **`indexed`** | `address` | The address of the owner of tokenIds. | +| `operator` **`indexed`** | `address` | The address set as operator. | +| `approved` | `bool` | If `operator` is approved for all NFTs or not. | + +
+ +### AuthorizedOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizedoperator) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Event signature: `AuthorizedOperator(address,address,bytes32)` +- Event topic hash: `0x34b797fc5a526f7bf1d2b5de25f6564fd85ae364e3ee939aee7c1ac27871a988` + +::: + +```solidity +event AuthorizedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId); +``` + +Emitted when `tokenOwner` enables `operator` to transfer or burn the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | -------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address authorized as an operator. | +| `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | +| `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` address has access on behalf of `tokenOwner`. | + +
+ +### DataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_Emitted when data at a key is changed_ + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ------------------------------------ | +| `dataKey` **`indexed`** | `bytes32` | The data key which data value is set | +| `dataValue` | `bytes` | The data value to set | + +
+ +### OwnershipTransferred + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Event signature: `OwnershipTransferred(address,address)` +- Event topic hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` + +::: + +```solidity +event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); +``` + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ----------- | +| `previousOwner` **`indexed`** | `address` | - | +| `newOwner` **`indexed`** | `address` | - | + +
+ +### RevokedOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokedoperator) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Event signature: `RevokedOperator(address,address,bytes32)` +- Event topic hash: `0x17d5389f6ab6adb2647dfa0aa365c323d37adacc30b33a65310b6158ce1373d5` + +::: + +```solidity +event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId); +``` + +Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | --------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from the operator array ({getOperatorsOf}). | +| `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | +| `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` is revoked from operating on. | + +
+ +### Transfer + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Event signature: `Transfer(address,address,address,bytes32,bool,bytes)` +- Event topic hash: `0xb333c813a7426a7a11e2b190cad52c44119421594b47f6f32ace6d8c7207b2bf` + +::: + +```solidity +event Transfer(address operator, address indexed from, address indexed to, bytes32 indexed tokenId, bool allowNonLSP1Recipient, bytes data); +``` + +_ERC721 `Transfer` compatible event emitted. Successfully transferred tokenId `tokenId` from `from` to `to`._ + +Emitted when `tokenId` token is transferred from the `from` to the `to` address. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ---------------------------------------------------------------------------------------------------------------------------------- | +| `operator` | `address` | The address of operator that sent the `tokenId` | +| `from` **`indexed`** | `address` | The previous owner of the `tokenId` | +| `to` **`indexed`** | `address` | The new owner of `tokenId` | +| `tokenId` **`indexed`** | `bytes32` | The tokenId that was transferred | +| `allowNonLSP1Recipient` | `bool` | If the token transfer enforces the `to` recipient address to be a contract that implements the LSP1 standard or not. | +| `data` | `bytes` | Any additional data the caller included by the caller during the transfer, and sent in the hooks to the `from` and `to` addresses. | + +
+ +## Errors + +### ERC725Y_DataKeysValuesEmptyArray + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +reverts when one of the array parameter provided to `setDataBatch` is an empty array + +
+ +### ERC725Y_DataKeysValuesLengthMismatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +reverts when there is not the same number of elements in the lists of data keys and data values when calling setDataBatch. + +
+ +### ERC725Y_MsgValueDisallowed + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_msgvaluedisallowed) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +reverts when sending value to the `setData(..)` functions + +
+ +### LSP4TokenNameNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokennamenoteditable) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Error signature: `LSP4TokenNameNotEditable()` +- Error hash: `0x85c169bd` + +::: + +```solidity +error LSP4TokenNameNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +
+ +### LSP4TokenSymbolNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokensymbolnoteditable) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Error signature: `LSP4TokenSymbolNotEditable()` +- Error hash: `0x76755b38` + +::: + +```solidity +error LSP4TokenSymbolNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +
+ +### LSP8CannotSendToAddressZero + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotsendtoaddresszero) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Error signature: `LSP8CannotSendToAddressZero()` +- Error hash: `0x24ecef4d` + +::: + +```solidity +error LSP8CannotSendToAddressZero(); +``` + +reverts when trying to send token to the zero address. + +
+ +### LSP8CannotSendToSelf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotsendtoself) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Error signature: `LSP8CannotSendToSelf()` +- Error hash: `0x5d67d6c1` + +::: + +```solidity +error LSP8CannotSendToSelf(); +``` + +reverts when specifying the same address for `from` and `to` in a token transfer. + +
+ +### LSP8CannotUseAddressZeroAsOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotuseaddresszeroasoperator) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Error signature: `LSP8CannotUseAddressZeroAsOperator()` +- Error hash: `0x9577b8b3` + +::: + +```solidity +error LSP8CannotUseAddressZeroAsOperator(); +``` + +reverts when trying to set the zero address as an operator. + +
+ +### LSP8InvalidTransferBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8invalidtransferbatch) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Error signature: `LSP8InvalidTransferBatch()` +- Error hash: `0x93a83119` + +::: + +```solidity +error LSP8InvalidTransferBatch(); +``` + +reverts when the parameters used for `transferBatch` have different lengths. + +
+ +### LSP8NonExistentTokenId + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistenttokenid) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Error signature: `LSP8NonExistentTokenId(bytes32)` +- Error hash: `0xae8f9a36` + +::: + +```solidity +error LSP8NonExistentTokenId(bytes32 tokenId); +``` + +reverts when `tokenId` has not been minted. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------- | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8NonExistingOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistingoperator) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Error signature: `LSP8NonExistingOperator(address,bytes32)` +- Error hash: `0x4aa31a8c` + +::: + +```solidity +error LSP8NonExistingOperator(address operator, bytes32 tokenId); +``` + +reverts when `operator` is not an operator for the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8NotTokenOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenoperator) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Error signature: `LSP8NotTokenOperator(bytes32,address)` +- Error hash: `0x1294d2a9` + +::: + +```solidity +error LSP8NotTokenOperator(bytes32 tokenId, address caller); +``` + +reverts when `caller` is not an allowed operator for `tokenId`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------- | +| `tokenId` | `bytes32` | - | +| `caller` | `address` | - | + +
+ +### LSP8NotTokenOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenowner) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Error signature: `LSP8NotTokenOwner(address,bytes32,address)` +- Error hash: `0x5b271ea2` + +::: + +```solidity +error LSP8NotTokenOwner(address tokenOwner, bytes32 tokenId, address caller); +``` + +reverts when `caller` is not the `tokenOwner` of the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `tokenOwner` | `address` | - | +| `tokenId` | `bytes32` | - | +| `caller` | `address` | - | + +
+ +### LSP8NotifyTokenReceiverContractMissingLSP1Interface + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceivercontractmissinglsp1interface) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Error signature: `LSP8NotifyTokenReceiverContractMissingLSP1Interface(address)` +- Error hash: `0x4349776d` + +::: + +```solidity +error LSP8NotifyTokenReceiverContractMissingLSP1Interface( + address tokenReceiver +); +``` + +reverts if the `tokenReceiver` does not implement LSP1 when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8NotifyTokenReceiverIsEOA + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceiveriseoa) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Error signature: `LSP8NotifyTokenReceiverIsEOA(address)` +- Error hash: `0x03173137` + +::: + +```solidity +error LSP8NotifyTokenReceiverIsEOA(address tokenReceiver); +``` + +reverts if the `tokenReceiver` is an EOA when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8OperatorAlreadyAuthorized + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8operatoralreadyauthorized) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Error signature: `LSP8OperatorAlreadyAuthorized(address,bytes32)` +- Error hash: `0xa7626b68` + +::: + +```solidity +error LSP8OperatorAlreadyAuthorized(address operator, bytes32 tokenId); +``` + +reverts when `operator` is already authorized for the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8TokenOwnerCannotBeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenownercannotbeoperator) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Error signature: `LSP8TokenOwnerCannotBeOperator()` +- Error hash: `0x89fdad62` + +::: + +```solidity +error LSP8TokenOwnerCannotBeOperator(); +``` + +reverts when trying to authorize or revoke the token's owner as an operator. + +
diff --git a/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md b/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md new file mode 100644 index 000000000..f4909c784 --- /dev/null +++ b/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md @@ -0,0 +1,1370 @@ + + + +# LSP8Enumerable + +:::info Standard Specifications + +[`LSP-8-IdentifiableDigitalAsset`](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md) + +::: +:::info Solidity implementation + +[`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) + +::: + +LSP8 extension that enables to enumerate over all the `tokenIds` ever minted. + +## Public Methods + +Public methods are accessible externally from users, allowing interaction with this function from dApps or other smart contracts. +When marked as 'public', a method can be called both externally and internally, on the other hand, when marked as 'external', a method can only be called externally. + +### authorizeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizeoperator) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Function signature: `authorizeOperator(address,bytes32)` +- Function selector: `0xcf5182ba` + +::: + +```solidity +function authorizeOperator( + address operator, + bytes32 tokenId +) external nonpayable; +``` + +Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ---------------------------------------- | +| `operator` | `address` | The address to authorize as an operator. | +| `tokenId` | `bytes32` | The token ID operator has access to.. | + +
+ +### balanceOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#balanceof) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Function signature: `balanceOf(address)` +- Function selector: `0x70a08231` + +::: + +```solidity +function balanceOf(address tokenOwner) external view returns (uint256); +``` + +Get the number of token IDs owned by `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------------------- | +| `tokenOwner` | `address` | The address to query \* | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------------------- | +| `0` | `uint256` | The total number of token IDs that `tokenOwner` owns. | + +
+ +### getData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdata) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_Gets singular data at a given `dataKey`_ + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ------------------------------- | +| `dataKey` | `bytes32` | The key which value to retrieve | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | -------------------------- | +| `dataValue` | `bytes` | The data stored at the key | + +
+ +### getDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatch) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Gets array of data for multiple given keys_ + +#### Parameters + +| Name | Type | Description | +| ---------- | :---------: | ------------------------------------------ | +| `dataKeys` | `bytes32[]` | The array of keys which values to retrieve | + +#### Returns + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------- | +| `dataValues` | `bytes[]` | The array of data stored at multiple keys | + +
+ +### getOperatorsOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getoperatorsof) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Function signature: `getOperatorsOf(bytes32)` +- Function selector: `0x49a6078d` + +::: + +```solidity +function getOperatorsOf(bytes32 tokenId) external view returns (address[]); +``` + +Returns all `operator` addresses that are allowed to transfer or burn a specific `tokenId` on behalf of its owner. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------- | +| `tokenId` | `bytes32` | The token ID to get the operators for. | + +#### Returns + +| Name | Type | Description | +| ---- | :---------: | ------------------------------------------------------------------------------------------------------------ | +| `0` | `address[]` | An array of operators allowed to transfer or burn a specific `tokenId`. Requirements - `tokenId` must exist. | + +
+ +### isOperatorFor + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#isoperatorfor) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Function signature: `isOperatorFor(address,bytes32)` +- Function selector: `0x2a3654a4` + +::: + +```solidity +function isOperatorFor( + address operator, + bytes32 tokenId +) external view returns (bool); +``` + +Returns whether `operator` address is an operator for a given `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------- | +| `operator` | `address` | The address to query operator status for. | +| `tokenId` | `bytes32` | The token ID to check if `operator` is allowed to operate on. | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | --------------------------------------------------------------------- | +| `0` | `bool` | `true` if `operator` is an operator for `tokenId`, `false` otherwise. | + +
+ +### owner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#owner) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Function signature: `owner()` +- Function selector: `0x8da5cb5b` + +::: + +```solidity +function owner() external view returns (address); +``` + +Returns the address of the current owner. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `address` | - | + +
+ +### renounceOwnership + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#renounceownership) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Function signature: `renounceOwnership()` +- Function selector: `0x715018a6` + +::: + +```solidity +function renounceOwnership() external nonpayable; +``` + +Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner. + +
+ +### revokeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokeoperator) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Function signature: `revokeOperator(address,bytes32)` +- Function selector: `0x0b0c6d82` + +::: + +```solidity +function revokeOperator(address operator, bytes32 tokenId) external nonpayable; +``` + +Remove access of `operator` for a given `tokenId`, disallowing it to transfer `tokenId` on behalf of its owner. See also [`isOperatorFor`](#isoperatorfor). + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ---------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `tokenId` | `bytes32` | The tokenId `operator` is revoked from operating on. | + +
+ +### setData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdata) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +```solidity +function setData(bytes32 dataKey, bytes dataValue) external payable; +``` + +_Sets singular data for a given `dataKey`_ + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `dataKey` | `bytes32` | The key to retrieve stored value | +| `dataValue` | `bytes` | The value to set SHOULD only be callable by the owner of the contract set via ERC173 The function is marked as payable to enable flexibility on child contracts If the function is not intended to receive value, an additional check should be implemented to check that value equal 0. Emits a {DataChanged} event. | + +
+ +### setDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatch) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +```solidity +function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable; +``` + +Sets array of data for multiple given `dataKeys` SHOULD only be callable by the owner of the contract set via ERC173 The function is marked as payable to enable flexibility on child contracts If the function is not intended to receive value, an additional check should be implemented to check that value equal + +0. Emits a [`DataChanged`](#datachanged) event. + +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ---------------------------------------- | +| `dataKeys` | `bytes32[]` | The array of data keys for values to set | +| `dataValues` | `bytes[]` | The array of values to set | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#supportsinterface) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas. + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ----------- | +| `interfaceId` | `bytes4` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +
+ +### tokenAt + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenat) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Function signature: `tokenAt(uint256)` +- Function selector: `0x92a91a3a` + +::: + +```solidity +function tokenAt(uint256 index) external view returns (bytes32); +``` + +_Retrieving the `tokenId` for `msg.sender` located in its list at index number `index`._ + +Returns a token id at index. See [`totalSupply`](#totalsupply) to get total number of minted tokens. + +#### Parameters + +| Name | Type | Description | +| ------- | :-------: | -------------------------------------------------------- | +| `index` | `uint256` | The index to search to search in the enumerable mapping. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------------------- | +| `0` | `bytes32` | TokenId or `bytes32(0)` if no tokenId exist at `index`. | + +
+ +### tokenIdsOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenidsof) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Function signature: `tokenIdsOf(address)` +- Function selector: `0xa3b261f2` + +::: + +```solidity +function tokenIdsOf(address tokenOwner) external view returns (bytes32[]); +``` + +Returns the list of token IDs that the `tokenOwner` address owns. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ---------------------------------------------------------- | +| `tokenOwner` | `address` | The address that we want to get the list of token IDs for. | + +#### Returns + +| Name | Type | Description | +| ---- | :---------: | ------------------------------------------------------- | +| `0` | `bytes32[]` | An array of `bytes32[] tokenIds` owned by `tokenOwner`. | + +
+ +### tokenOwnerOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenownerof) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Function signature: `tokenOwnerOf(bytes32)` +- Function selector: `0x217b2270` + +::: + +```solidity +function tokenOwnerOf(bytes32 tokenId) external view returns (address); +``` + +Returns the list of `tokenIds` for the `tokenOwner` address. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------------- | +| `tokenId` | `bytes32` | tokenOwner The address to query owned tokens | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------- | +| `0` | `address` | The owner address of the given `tokenId`. | + +
+ +### totalSupply + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#totalsupply) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Function signature: `totalSupply()` +- Function selector: `0x18160ddd` + +::: + +```solidity +function totalSupply() external view returns (uint256); +``` + +Returns the number of existing tokens that have been minted in this contract. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------ | +| `0` | `uint256` | The number of existing tokens. | + +
+ +### transfer + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Function signature: `transfer(address,address,bytes32,bool,bytes)` +- Function selector: `0x511b6952` + +::: + +```solidity +function transfer( + address from, + address to, + bytes32 tokenId, + bool allowNonLSP1Recipient, + bytes data +) external nonpayable; +``` + +Transfer a given `tokenId` token from the `from` address to the `to` address. If operators are set for a specific `tokenId`, all the operators are revoked after the tokenId have been transferred. The `allowNonLSP1Recipient` parameter MUST be set to `true` when transferring tokens to Externally Owned Accounts (EOAs) or contracts that do not implement the LSP1 standard. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The address that owns the given `tokenId`. | +| `to` | `address` | The address that will receive the `tokenId`. | +| `tokenId` | `bytes32` | The token ID to transfer. | +| `allowNonLSP1Recipient` | `bool` | When set to `true`, the `to` address CAN be any addres. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard. | +| `data` | `bytes` | Any additional data the caller wants included in the emitted event, and sent in the hooks of the `from` and `to` addresses. | + +
+ +### transferBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferbatch) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Function signature: `transferBatch(address[],address[],bytes32[],bool[],bytes[])` +- Function selector: `0x7e87632c` + +::: + +```solidity +function transferBatch( + address[] from, + address[] to, + bytes32[] tokenId, + bool[] allowNonLSP1Recipient, + bytes[] data +) external nonpayable; +``` + +Transfers multiple tokens at once based on the arrays of `from`, `to` and `tokenId`. If any transfer fails, the whole call will revert. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :---------: | ----------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address[]` | An array of sending addresses. | +| `to` | `address[]` | An array of recipient addresses. | +| `tokenId` | `bytes32[]` | An array of token IDs to transfer. | +| `allowNonLSP1Recipient` | `bool[]` | When set to `true`, `to` may be any address. When set to `false`, `to` must be a contract that supports the LSP1 standard and not revert. | +| `data` | `bytes[]` | Any additional data the caller wants included in the emitted event, and sent in the hooks to the `from` and `to` addresses. | + +
+ +### transferOwnership + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferownership) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Function signature: `transferOwnership(address)` +- Function selector: `0xf2fde38b` + +::: + +```solidity +function transferOwnership(address newOwner) external nonpayable; +``` + +Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `newOwner` | `address` | - | + +
+ +## Internal Methods + +Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. + +Internal functions cannot be called externally, whether from other smart contracts, dApp interfaces, or backend services. Their restricted accessibility ensures that they remain exclusively available within the context of the current contract, promoting controlled and encapsulated usage of these internal utilities. + +### \_checkOwner + +```solidity +function _checkOwner() internal view; +``` + +Throws if the sender is not the owner. + +
+ +### \_setOwner + +```solidity +function _setOwner(address newOwner) internal nonpayable; +``` + +Changes the owner if `newOwner` and oldOwner are different +This pattern is useful in inheritance. + +
+ +### \_getData + +```solidity +function _getData(bytes32 dataKey) internal view returns (bytes dataValue); +``` + +
+ +### \_setData + +```solidity +function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; +``` + +Save gas by emitting the [`DataChanged`](#datachanged) event with only the first 256 bytes of dataValue + +
+ +### \_isOperatorOrOwner + +```solidity +function _isOperatorOrOwner( + address caller, + bytes32 tokenId +) internal view returns (bool); +``` + +verifies if the `caller` is operator or owner for the `tokenId` + +#### Returns + +| Name | Type | Description | +| ---- | :----: | -------------------------------------------- | +| `0` | `bool` | true if `caller` is either operator or owner | + +
+ +### \_revokeOperator + +```solidity +function _revokeOperator( + address operator, + address tokenOwner, + bytes32 tokenId +) internal nonpayable; +``` + +removes `operator` from the list of operators for the `tokenId` + +
+ +### \_clearOperators + +```solidity +function _clearOperators( + address tokenOwner, + bytes32 tokenId +) internal nonpayable; +``` + +revoke all the current operators for a specific `tokenId` token which belongs to `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ------------------------------------------------- | +| `tokenOwner` | `address` | The address that is the owner of the `tokenId`. | +| `tokenId` | `bytes32` | The token to remove the associated operators for. | + +
+ +### \_exists + +```solidity +function _exists(bytes32 tokenId) internal view returns (bool); +``` + +Returns whether `tokenId` exists. +Tokens start existing when they are minted ([`_mint`](#_mint)), and stop existing when they are burned ([`_burn`](#_burn)). + +
+ +### \_existsOrError + +```solidity +function _existsOrError(bytes32 tokenId) internal view; +``` + +When `tokenId` does not exist then revert with an error. + +
+ +### \_mint + +```solidity +function _mint( + address to, + bytes32 tokenId, + bool allowNonLSP1Recipient, + bytes data +) internal nonpayable; +``` + +Create `tokenId` by minting it and transfers it to `to`. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event with `address(0)` as `from` address. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------------------------------------------------------------------------------------- | +| `to` | `address` | @param tokenId The token ID to create (= mint). | +| `tokenId` | `bytes32` | The token ID to create (= mint). | +| `allowNonLSP1Recipient` | `bool` | When set to `true`, `to` may be any address. When set to `false`, `to` must be a contract that supports the LSP1 standard. | +| `data` | `bytes` | Any additional data the caller wants included in the emitted event, and sent in the hook of the `to` address. | + +
+ +### \_burn + +:::tip Hint + +In dApps, you can know which addresses are burning tokens by listening for the `Transfer` event and filter with the zero address as `to`. + +::: + +```solidity +function _burn(bytes32 tokenId, bytes data) internal nonpayable; +``` + +Burn a specific `tokenId`, removing the `tokenId` from the [`tokenIdsOf`](#tokenidsof) the caller and decreasing its [`balanceOf`](#balanceof) by -1. +This will also clear all the operators allowed to transfer the `tokenId`. +The owner of the `tokenId` will be notified about the `tokenId` being transferred through its LSP1 [`universalReceiver`](#universalreceiver) +function, if it is a contract that supports the LSP1 interface. Its [`universalReceiver`](#universalreceiver) function will receive +all the parameters in the calldata packed encoded. +Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before burning `tokenId` and updating the balances. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event with `address(0)` as the `to` address. + +
+ +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------------------------------------------------------------------------------------------------------------- | +| `tokenId` | `bytes32` | The token to burn. | +| `data` | `bytes` | Any additional data the caller wants included in the emitted event, and sent in the LSP1 hook on the token owner's address. | + +
+ +### \_transfer + +:::danger + +This internal function does not check if the sender is authorized or not to operate on the `tokenId`. + +::: + +```solidity +function _transfer( + address from, + address to, + bytes32 tokenId, + bool allowNonLSP1Recipient, + bytes data +) internal nonpayable; +``` + +Change the owner of the `tokenId` from `from` to `to`. +Both the sender and recipient will be notified of the `tokenId` being transferred through their LSP1 [`universalReceiver`](#universalreceiver) +function, if they are contracts that support the LSP1 interface. Their `universalReceiver` function will receive +all the parameters in the calldata packed encoded. +Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before changing the owner of `tokenId`. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The sender address. | +| `to` | `address` | @param tokenId The token to transfer. | +| `tokenId` | `bytes32` | The token to transfer. | +| `allowNonLSP1Recipient` | `bool` | When set to `true`, `to` may be any address. When set to `false`, `to` must be a contract that supports the LSP1 standard. | +| `data` | `bytes` | Additional data the caller wants included in the emitted event, and sent in the hooks to `from` and `to` addresses. | + +
+ +### \_beforeTokenTransfer + +```solidity +function _beforeTokenTransfer( + address from, + address to, + bytes32 tokenId +) internal nonpayable; +``` + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------------------------------------------------- | +| `from` | `address` | The address sending the `tokenId` (`address(0)` when `tokenId` is being minted). | +| `to` | `address` | @param tokenId The bytes32 identifier of the token being transferred. | +| `tokenId` | `bytes32` | The bytes32 identifier of the token being transferred. | + +
+ +### \_notifyTokenSender + +```solidity +function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; +``` + +An attempt is made to notify the token sender about the `tokenId` changing owners using +LSP1 interface. + +
+ +### \_notifyTokenReceiver + +```solidity +function _notifyTokenReceiver( + address to, + bool allowNonLSP1Recipient, + bytes lsp1Data +) internal nonpayable; +``` + +An attempt is made to notify the token receiver about the `tokenId` changing owners +using LSP1 interface. When allowNonLSP1Recipient is FALSE the token receiver MUST support LSP1. +The receiver may revert when the token being sent is not wanted. + +
+ +## Events + +### AuthorizedOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizedoperator) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Event signature: `AuthorizedOperator(address,address,bytes32)` +- Event topic hash: `0x34b797fc5a526f7bf1d2b5de25f6564fd85ae364e3ee939aee7c1ac27871a988` + +::: + +```solidity +event AuthorizedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId); +``` + +Emitted when `tokenOwner` enables `operator` to transfer or burn the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | -------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address authorized as an operator. | +| `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | +| `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` address has access on behalf of `tokenOwner`. | + +
+ +### DataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_Emitted when data at a key is changed_ + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ------------------------------------ | +| `dataKey` **`indexed`** | `bytes32` | The data key which data value is set | +| `dataValue` | `bytes` | The data value to set | + +
+ +### OwnershipTransferred + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Event signature: `OwnershipTransferred(address,address)` +- Event topic hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` + +::: + +```solidity +event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); +``` + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ----------- | +| `previousOwner` **`indexed`** | `address` | - | +| `newOwner` **`indexed`** | `address` | - | + +
+ +### RevokedOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokedoperator) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Event signature: `RevokedOperator(address,address,bytes32)` +- Event topic hash: `0x17d5389f6ab6adb2647dfa0aa365c323d37adacc30b33a65310b6158ce1373d5` + +::: + +```solidity +event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId); +``` + +Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | --------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from the operator array ({getOperatorsOf}). | +| `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | +| `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` is revoked from operating on. | + +
+ +### Transfer + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Event signature: `Transfer(address,address,address,bytes32,bool,bytes)` +- Event topic hash: `0xb333c813a7426a7a11e2b190cad52c44119421594b47f6f32ace6d8c7207b2bf` + +::: + +```solidity +event Transfer(address operator, address indexed from, address indexed to, bytes32 indexed tokenId, bool allowNonLSP1Recipient, bytes data); +``` + +Emitted when `tokenId` token is transferred from the `from` to the `to` address. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ---------------------------------------------------------------------------------------------------------------------------------- | +| `operator` | `address` | The address of operator that sent the `tokenId` | +| `from` **`indexed`** | `address` | The previous owner of the `tokenId` | +| `to` **`indexed`** | `address` | The new owner of `tokenId` | +| `tokenId` **`indexed`** | `bytes32` | The tokenId that was transferred | +| `allowNonLSP1Recipient` | `bool` | If the token transfer enforces the `to` recipient address to be a contract that implements the LSP1 standard or not. | +| `data` | `bytes` | Any additional data the caller included by the caller during the transfer, and sent in the hooks to the `from` and `to` addresses. | + +
+ +## Errors + +### ERC725Y_DataKeysValuesEmptyArray + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +reverts when one of the array parameter provided to `setDataBatch` is an empty array + +
+ +### ERC725Y_DataKeysValuesLengthMismatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +reverts when there is not the same number of elements in the lists of data keys and data values when calling setDataBatch. + +
+ +### ERC725Y_MsgValueDisallowed + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_msgvaluedisallowed) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +reverts when sending value to the `setData(..)` functions + +
+ +### LSP4TokenNameNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokennamenoteditable) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Error signature: `LSP4TokenNameNotEditable()` +- Error hash: `0x85c169bd` + +::: + +```solidity +error LSP4TokenNameNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +
+ +### LSP4TokenSymbolNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokensymbolnoteditable) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Error signature: `LSP4TokenSymbolNotEditable()` +- Error hash: `0x76755b38` + +::: + +```solidity +error LSP4TokenSymbolNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +
+ +### LSP8CannotSendToAddressZero + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotsendtoaddresszero) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Error signature: `LSP8CannotSendToAddressZero()` +- Error hash: `0x24ecef4d` + +::: + +```solidity +error LSP8CannotSendToAddressZero(); +``` + +reverts when trying to send token to the zero address. + +
+ +### LSP8CannotSendToSelf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotsendtoself) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Error signature: `LSP8CannotSendToSelf()` +- Error hash: `0x5d67d6c1` + +::: + +```solidity +error LSP8CannotSendToSelf(); +``` + +reverts when specifying the same address for `from` and `to` in a token transfer. + +
+ +### LSP8CannotUseAddressZeroAsOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotuseaddresszeroasoperator) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Error signature: `LSP8CannotUseAddressZeroAsOperator()` +- Error hash: `0x9577b8b3` + +::: + +```solidity +error LSP8CannotUseAddressZeroAsOperator(); +``` + +reverts when trying to set the zero address as an operator. + +
+ +### LSP8InvalidTransferBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8invalidtransferbatch) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Error signature: `LSP8InvalidTransferBatch()` +- Error hash: `0x93a83119` + +::: + +```solidity +error LSP8InvalidTransferBatch(); +``` + +reverts when the parameters used for `transferBatch` have different lengths. + +
+ +### LSP8NonExistentTokenId + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistenttokenid) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Error signature: `LSP8NonExistentTokenId(bytes32)` +- Error hash: `0xae8f9a36` + +::: + +```solidity +error LSP8NonExistentTokenId(bytes32 tokenId); +``` + +reverts when `tokenId` has not been minted. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------- | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8NonExistingOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistingoperator) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Error signature: `LSP8NonExistingOperator(address,bytes32)` +- Error hash: `0x4aa31a8c` + +::: + +```solidity +error LSP8NonExistingOperator(address operator, bytes32 tokenId); +``` + +reverts when `operator` is not an operator for the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8NotTokenOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenoperator) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Error signature: `LSP8NotTokenOperator(bytes32,address)` +- Error hash: `0x1294d2a9` + +::: + +```solidity +error LSP8NotTokenOperator(bytes32 tokenId, address caller); +``` + +reverts when `caller` is not an allowed operator for `tokenId`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------- | +| `tokenId` | `bytes32` | - | +| `caller` | `address` | - | + +
+ +### LSP8NotTokenOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenowner) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Error signature: `LSP8NotTokenOwner(address,bytes32,address)` +- Error hash: `0x5b271ea2` + +::: + +```solidity +error LSP8NotTokenOwner(address tokenOwner, bytes32 tokenId, address caller); +``` + +reverts when `caller` is not the `tokenOwner` of the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `tokenOwner` | `address` | - | +| `tokenId` | `bytes32` | - | +| `caller` | `address` | - | + +
+ +### LSP8NotifyTokenReceiverContractMissingLSP1Interface + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceivercontractmissinglsp1interface) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Error signature: `LSP8NotifyTokenReceiverContractMissingLSP1Interface(address)` +- Error hash: `0x4349776d` + +::: + +```solidity +error LSP8NotifyTokenReceiverContractMissingLSP1Interface( + address tokenReceiver +); +``` + +reverts if the `tokenReceiver` does not implement LSP1 when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8NotifyTokenReceiverIsEOA + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceiveriseoa) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Error signature: `LSP8NotifyTokenReceiverIsEOA(address)` +- Error hash: `0x03173137` + +::: + +```solidity +error LSP8NotifyTokenReceiverIsEOA(address tokenReceiver); +``` + +reverts if the `tokenReceiver` is an EOA when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8OperatorAlreadyAuthorized + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8operatoralreadyauthorized) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Error signature: `LSP8OperatorAlreadyAuthorized(address,bytes32)` +- Error hash: `0xa7626b68` + +::: + +```solidity +error LSP8OperatorAlreadyAuthorized(address operator, bytes32 tokenId); +``` + +reverts when `operator` is already authorized for the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8TokenOwnerCannotBeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenownercannotbeoperator) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Error signature: `LSP8TokenOwnerCannotBeOperator()` +- Error hash: `0x89fdad62` + +::: + +```solidity +error LSP8TokenOwnerCannotBeOperator(); +``` + +reverts when trying to authorize or revoke the token's owner as an operator. + +
diff --git a/docs/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.md b/docs/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.md new file mode 100644 index 000000000..48128ab87 --- /dev/null +++ b/docs/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.md @@ -0,0 +1,1806 @@ + + + +# LSP8CompatibleERC721Mintable + +:::info Standard Specifications + +[`LSP-8-IdentifiableDigitalAsset`](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md) + +::: +:::info Solidity implementation + +[`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) + +::: + +> LSP8CompatibleERC721Mintable deployable preset contract with a public {mint} function callable only by the contract {owner}. + +## Public Methods + +Public methods are accessible externally from users, allowing interaction with this function from dApps or other smart contracts. +When marked as 'public', a method can be called both externally and internally, on the other hand, when marked as 'external', a method can only be called externally. + +### constructor + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#constructor) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) + +::: + +```solidity +constructor(string name_, string symbol_, address newOwner_); +``` + +_Deploying a `LSP8CompatibleERC721Mintable` token contract with: token name = `name_`, token symbol = `symbol_`, and address `newOwner_` as the token contract owner._ + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | -------------------------------- | +| `name_` | `string` | The name of the token. | +| `symbol_` | `string` | The symbol of the token. | +| `newOwner_` | `address` | The owner of the token contract. | + +
+ +### approve + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#approve) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `approve(address,uint256)` +- Function selector: `0x095ea7b3` + +::: + +```solidity +function approve(address operator, uint256 tokenId) external nonpayable; +``` + +_Calling `approve` function on `ILSP8CompatibleERC721` contract. Approving operator at address `operator` to transfer tokenId `tokenId` on behalf of its owner._ + +Approval function compatible with ERC721 `approve(address,uint256)`. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------- | +| `operator` | `address` | The address to approve for `tokenId`. | +| `tokenId` | `uint256` | The tokenId to approve. | + +
+ +### authorizeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizeoperator) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `authorizeOperator(address,bytes32)` +- Function selector: `0xcf5182ba` + +::: + +```solidity +function authorizeOperator( + address operator, + bytes32 tokenId +) external nonpayable; +``` + +Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). + +
+ +**Emitted events:** + +- LSP7 [`AuthorizedOperator`](#authorizedoperator) event. +- ERC721 [`Approval`](#approval) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ---------------------------------------- | +| `operator` | `address` | The address to authorize as an operator. | +| `tokenId` | `bytes32` | The token ID operator has access to.. | + +
+ +### balanceOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#balanceof) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `balanceOf(address)` +- Function selector: `0x70a08231` + +::: + +```solidity +function balanceOf(address tokenOwner) external view returns (uint256); +``` + +Get the number of token IDs owned by `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------------------- | +| `tokenOwner` | `address` | The address to query \* | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------------------- | +| `0` | `uint256` | The total number of token IDs that `tokenOwner` owns. | + +
+ +### getApproved + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getapproved) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `getApproved(uint256)` +- Function selector: `0x081812fc` + +::: + +```solidity +function getApproved(uint256 tokenId) external view returns (address); +``` + +_Retrieving the address other than the token owner that is approved to transfer tokenId `tokenId` on behalf of its owner._ + +Compatible with ERC721 getApproved. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------- | +| `tokenId` | `uint256` | The tokenId to query. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------ | +| `0` | `address` | The address of the operator for `tokenId`. | + +
+ +### getData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdata) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_Gets singular data at a given `dataKey`_ + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ------------------------------- | +| `dataKey` | `bytes32` | The key which value to retrieve | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | -------------------------- | +| `dataValue` | `bytes` | The data stored at the key | + +
+ +### getDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatch) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Gets array of data for multiple given keys_ + +#### Parameters + +| Name | Type | Description | +| ---------- | :---------: | ------------------------------------------ | +| `dataKeys` | `bytes32[]` | The array of keys which values to retrieve | + +#### Returns + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------- | +| `dataValues` | `bytes[]` | The array of data stored at multiple keys | + +
+ +### getOperatorsOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getoperatorsof) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `getOperatorsOf(bytes32)` +- Function selector: `0x49a6078d` + +::: + +```solidity +function getOperatorsOf(bytes32 tokenId) external view returns (address[]); +``` + +Returns all `operator` addresses that are allowed to transfer or burn a specific `tokenId` on behalf of its owner. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------- | +| `tokenId` | `bytes32` | The token ID to get the operators for. | + +#### Returns + +| Name | Type | Description | +| ---- | :---------: | ------------------------------------------------------------------------------------------------------------ | +| `0` | `address[]` | An array of operators allowed to transfer or burn a specific `tokenId`. Requirements - `tokenId` must exist. | + +
+ +### isApprovedForAll + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#isapprovedforall) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `isApprovedForAll(address,address)` +- Function selector: `0xe985e9c5` + +::: + +```solidity +function isApprovedForAll( + address tokenOwner, + address operator +) external view returns (bool); +``` + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `tokenOwner` | `address` | - | +| `operator` | `address` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +
+ +### isOperatorFor + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#isoperatorfor) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `isOperatorFor(address,bytes32)` +- Function selector: `0x2a3654a4` + +::: + +```solidity +function isOperatorFor( + address operator, + bytes32 tokenId +) external view returns (bool); +``` + +Returns whether `operator` address is an operator for a given `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------- | +| `operator` | `address` | The address to query operator status for. | +| `tokenId` | `bytes32` | The token ID to check if `operator` is allowed to operate on. | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | --------------------------------------------------------------------- | +| `0` | `bool` | `true` if `operator` is an operator for `tokenId`, `false` otherwise. | + +
+ +### mint + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#mint) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `mint(address,bytes32,bool,bytes)` +- Function selector: `0xaf255b61` + +::: + +```solidity +function mint( + address to, + bytes32 tokenId, + bool allowNonLSP1Recipient, + bytes data +) external nonpayable; +``` + +_Minting tokenId `tokenId` for address `to` with the additional data `data` (Note: allow non-LSP1 recipient is set to `allowNonLSP1Recipient`)._ + +Public [`_mint`](#_mint) function only callable by the [`owner`](#owner). + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ------------------------------------------------------------------------------------------------------------------------------ | +| `to` | `address` | The address that will receive the minted `tokenId`. | +| `tokenId` | `bytes32` | The tokenId to mint. | +| `allowNonLSP1Recipient` | `bool` | Set to `false` to ensure that you are minting for a recipient that implements LSP1, `false` otherwise for forcing the minting. | +| `data` | `bytes` | Any addition data to be sent alongside the minting. | + +
+ +### name + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#name) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `name()` +- Function selector: `0x06fdde03` + +::: + +```solidity +function name() external view returns (string); +``` + +Returns the name of the token. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | --------------------- | +| `0` | `string` | The name of the token | + +
+ +### owner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#owner) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `owner()` +- Function selector: `0x8da5cb5b` + +::: + +```solidity +function owner() external view returns (address); +``` + +Returns the address of the current owner. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `address` | - | + +
+ +### ownerOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownerof) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `ownerOf(uint256)` +- Function selector: `0x6352211e` + +::: + +```solidity +function ownerOf(uint256 tokenId) external view returns (address); +``` + +_Retrieving the address that own tokenId `tokenId`._ + +Compatible with ERC721 ownerOf. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------- | +| `tokenId` | `uint256` | The tokenId to query. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------- | +| `0` | `address` | The owner of the tokenId. | + +
+ +### renounceOwnership + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#renounceownership) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `renounceOwnership()` +- Function selector: `0x715018a6` + +::: + +```solidity +function renounceOwnership() external nonpayable; +``` + +Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner. + +
+ +### revokeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokeoperator) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `revokeOperator(address,bytes32)` +- Function selector: `0x0b0c6d82` + +::: + +```solidity +function revokeOperator(address operator, bytes32 tokenId) external nonpayable; +``` + +Remove access of `operator` for a given `tokenId`, disallowing it to transfer `tokenId` on behalf of its owner. See also [`isOperatorFor`](#isoperatorfor). + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ---------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `tokenId` | `bytes32` | The tokenId `operator` is revoked from operating on. | + +
+ +### safeTransferFrom + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#safetransferfrom) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `safeTransferFrom(address,address,uint256)` +- Function selector: `0x42842e0e` + +::: + +:::info + +This function sets the `allowNonLSP1Recipient` parameter to `true` so that EOAs and any contract can receive the `tokenId`. + +::: + +```solidity +function safeTransferFrom( + address from, + address to, + uint256 tokenId +) external nonpayable; +``` + +_Calling `safeTransferFrom` function on `ILSP8CompatibleERC721` contract. Transferring tokenId `tokenId` from address `from` to address `to`._ + +Safe Transfer function without optional data from the ERC721 standard interface. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ------------------------ | +| `from` | `address` | The sending address. | +| `to` | `address` | The receiving address. | +| `tokenId` | `uint256` | The tokenId to transfer. | + +
+ +### safeTransferFrom + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#safetransferfrom) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `safeTransferFrom(address,address,uint256,bytes)` +- Function selector: `0xb88d4fde` + +::: + +:::info + +This function sets the `allowNonLSP1Recipient` parameter to `true` so that EOAs and any contract can receive the `tokenId`. + +::: + +```solidity +function safeTransferFrom( + address from, + address to, + uint256 tokenId, + bytes data +) external nonpayable; +``` + +_Calling `safeTransferFrom` function with `data` on `ILSP8CompatibleERC721` contract. Transferring tokenId `tokenId` from address `from` to address `to`._ + +Safe Transfer function with optional data from the ERC721 standard interface. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------- | +| `from` | `address` | The sending address. | +| `to` | `address` | The receiving address. | +| `tokenId` | `uint256` | The tokenId to transfer. | +| `data` | `bytes` | The data to be sent with the transfer. | + +
+ +### setApprovalForAll + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setapprovalforall) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `setApprovalForAll(address,bool)` +- Function selector: `0xa22cb465` + +::: + +```solidity +function setApprovalForAll(address operator, bool approved) external nonpayable; +``` + +See [`_setApprovalForAll`](#_setapprovalforall) + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | +| `approved` | `bool` | - | + +
+ +### setData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdata) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +```solidity +function setData(bytes32 dataKey, bytes dataValue) external payable; +``` + +_Sets singular data for a given `dataKey`_ + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `dataKey` | `bytes32` | The key to retrieve stored value | +| `dataValue` | `bytes` | The value to set SHOULD only be callable by the owner of the contract set via ERC173 The function is marked as payable to enable flexibility on child contracts If the function is not intended to receive value, an additional check should be implemented to check that value equal 0. Emits a {DataChanged} event. | + +
+ +### setDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatch) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +```solidity +function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable; +``` + +Sets array of data for multiple given `dataKeys` SHOULD only be callable by the owner of the contract set via ERC173 The function is marked as payable to enable flexibility on child contracts If the function is not intended to receive value, an additional check should be implemented to check that value equal + +0. Emits a [`DataChanged`](#datachanged) event. + +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ---------------------------------------- | +| `dataKeys` | `bytes32[]` | The array of data keys for values to set | +| `dataValues` | `bytes[]` | The array of values to set | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#supportsinterface) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas. + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ----------- | +| `interfaceId` | `bytes4` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +
+ +### symbol + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#symbol) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `symbol()` +- Function selector: `0x95d89b41` + +::: + +```solidity +function symbol() external view returns (string); +``` + +Returns the symbol of the token, usually a shorter version of the name. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | ----------------------- | +| `0` | `string` | The symbol of the token | + +
+ +### tokenIdsOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenidsof) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `tokenIdsOf(address)` +- Function selector: `0xa3b261f2` + +::: + +```solidity +function tokenIdsOf(address tokenOwner) external view returns (bytes32[]); +``` + +Returns the list of token IDs that the `tokenOwner` address owns. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ---------------------------------------------------------- | +| `tokenOwner` | `address` | The address that we want to get the list of token IDs for. | + +#### Returns + +| Name | Type | Description | +| ---- | :---------: | ------------------------------------------------------- | +| `0` | `bytes32[]` | An array of `bytes32[] tokenIds` owned by `tokenOwner`. | + +
+ +### tokenOwnerOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenownerof) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `tokenOwnerOf(bytes32)` +- Function selector: `0x217b2270` + +::: + +```solidity +function tokenOwnerOf(bytes32 tokenId) external view returns (address); +``` + +Returns the list of `tokenIds` for the `tokenOwner` address. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------------- | +| `tokenId` | `bytes32` | tokenOwner The address to query owned tokens | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------- | +| `0` | `address` | The owner address of the given `tokenId`. | + +
+ +### tokenURI + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#)) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `)` +- Function selector: `0x59d76dc3` + +::: + +```solidity +function tokenURI(uint256) external view returns (string); +``` + +#### Parameters + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `_0` | `uint256` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :------: | ----------- | +| `0` | `string` | - | + +
+ +### totalSupply + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#totalsupply) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `totalSupply()` +- Function selector: `0x18160ddd` + +::: + +```solidity +function totalSupply() external view returns (uint256); +``` + +Returns the number of existing tokens that have been minted in this contract. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------ | +| `0` | `uint256` | The number of existing tokens. | + +
+ +### transfer + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `transfer(address,address,bytes32,bool,bytes)` +- Function selector: `0x511b6952` + +::: + +```solidity +function transfer( + address from, + address to, + bytes32 tokenId, + bool allowNonLSP1Recipient, + bytes data +) external nonpayable; +``` + +Transfer a given `tokenId` token from the `from` address to the `to` address. If operators are set for a specific `tokenId`, all the operators are revoked after the tokenId have been transferred. The `allowNonLSP1Recipient` parameter MUST be set to `true` when transferring tokens to Externally Owned Accounts (EOAs) or contracts that do not implement the LSP1 standard. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The address that owns the given `tokenId`. | +| `to` | `address` | The address that will receive the `tokenId`. | +| `tokenId` | `bytes32` | The token ID to transfer. | +| `allowNonLSP1Recipient` | `bool` | When set to `true`, the `to` address CAN be any addres. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard. | +| `data` | `bytes` | Any additional data the caller wants included in the emitted event, and sent in the hooks of the `from` and `to` addresses. | + +
+ +### transferBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferbatch) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `transferBatch(address[],address[],bytes32[],bool[],bytes[])` +- Function selector: `0x7e87632c` + +::: + +```solidity +function transferBatch( + address[] from, + address[] to, + bytes32[] tokenId, + bool[] allowNonLSP1Recipient, + bytes[] data +) external nonpayable; +``` + +Transfers multiple tokens at once based on the arrays of `from`, `to` and `tokenId`. If any transfer fails, the whole call will revert. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :---------: | ----------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address[]` | An array of sending addresses. | +| `to` | `address[]` | An array of recipient addresses. | +| `tokenId` | `bytes32[]` | An array of token IDs to transfer. | +| `allowNonLSP1Recipient` | `bool[]` | When set to `true`, `to` may be any address. When set to `false`, `to` must be a contract that supports the LSP1 standard and not revert. | +| `data` | `bytes[]` | Any additional data the caller wants included in the emitted event, and sent in the hooks to the `from` and `to` addresses. | + +
+ +### transferFrom + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferfrom) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `transferFrom(address,address,uint256)` +- Function selector: `0x23b872dd` + +::: + +:::info + +This function sets the `allowNonLSP1Recipient` parameter to `true` so that EOAs and any contract can receive the `tokenId`. + +::: + +```solidity +function transferFrom( + address from, + address to, + uint256 tokenId +) external nonpayable; +``` + +_Calling `transferFrom` function on `ILSP8CompatibleERC721` contract. Transferring tokenId `tokenId` from address `from` to address `to`._ + +Transfer functions from the ERC721 standard interface. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ------------------------ | +| `from` | `address` | The sending address. | +| `to` | `address` | The receiving address. | +| `tokenId` | `uint256` | The tokenId to transfer. | + +
+ +### transferOwnership + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferownership) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `transferOwnership(address)` +- Function selector: `0xf2fde38b` + +::: + +```solidity +function transferOwnership(address newOwner) external nonpayable; +``` + +Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `newOwner` | `address` | - | + +
+ +## Internal Methods + +Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. + +Internal functions cannot be called externally, whether from other smart contracts, dApp interfaces, or backend services. Their restricted accessibility ensures that they remain exclusively available within the context of the current contract, promoting controlled and encapsulated usage of these internal utilities. + +### \_checkOwner + +```solidity +function _checkOwner() internal view; +``` + +Throws if the sender is not the owner. + +
+ +### \_setOwner + +```solidity +function _setOwner(address newOwner) internal nonpayable; +``` + +Changes the owner if `newOwner` and oldOwner are different +This pattern is useful in inheritance. + +
+ +### \_getData + +```solidity +function _getData(bytes32 dataKey) internal view returns (bytes dataValue); +``` + +
+ +### \_setData + +```solidity +function _setData(bytes32 key, bytes value) internal nonpayable; +``` + +
+ +### \_isOperatorOrOwner + +```solidity +function _isOperatorOrOwner( + address caller, + bytes32 tokenId +) internal view returns (bool); +``` + +verifies if the `caller` is operator or owner for the `tokenId` + +#### Returns + +| Name | Type | Description | +| ---- | :----: | -------------------------------------------- | +| `0` | `bool` | true if `caller` is either operator or owner | + +
+ +### \_revokeOperator + +```solidity +function _revokeOperator( + address operator, + address tokenOwner, + bytes32 tokenId +) internal nonpayable; +``` + +removes `operator` from the list of operators for the `tokenId` + +
+ +### \_clearOperators + +```solidity +function _clearOperators( + address tokenOwner, + bytes32 tokenId +) internal nonpayable; +``` + +revoke all the current operators for a specific `tokenId` token which belongs to `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ------------------------------------------------- | +| `tokenOwner` | `address` | The address that is the owner of the `tokenId`. | +| `tokenId` | `bytes32` | The token to remove the associated operators for. | + +
+ +### \_exists + +```solidity +function _exists(bytes32 tokenId) internal view returns (bool); +``` + +Returns whether `tokenId` exists. +Tokens start existing when they are minted ([`_mint`](#_mint)), and stop existing when they are burned ([`_burn`](#_burn)). + +
+ +### \_existsOrError + +```solidity +function _existsOrError(bytes32 tokenId) internal view; +``` + +When `tokenId` does not exist then revert with an error. + +
+ +### \_mint + +```solidity +function _mint( + address to, + bytes32 tokenId, + bool allowNonLSP1Recipient, + bytes data +) internal nonpayable; +``` + +
+ +### \_burn + +```solidity +function _burn(bytes32 tokenId, bytes data) internal nonpayable; +``` + +
+ +### \_transfer + +```solidity +function _transfer( + address from, + address to, + bytes32 tokenId, + bool allowNonLSP1Recipient, + bytes data +) internal nonpayable; +``` + +
+ +### \_beforeTokenTransfer + +```solidity +function _beforeTokenTransfer( + address from, + address to, + bytes32 tokenId +) internal nonpayable; +``` + +Hook that is called before any token transfer, including minting and burning. + +- Allows to run custom logic before updating balances and notifiying sender/recipient by overriding this function. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------- | +| `from` | `address` | The sender address | +| `to` | `address` | @param tokenId The tokenId to transfer | +| `tokenId` | `bytes32` | The tokenId to transfer | + +
+ +### \_notifyTokenSender + +```solidity +function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; +``` + +An attempt is made to notify the token sender about the `tokenId` changing owners using +LSP1 interface. + +
+ +### \_notifyTokenReceiver + +```solidity +function _notifyTokenReceiver( + address to, + bool allowNonLSP1Recipient, + bytes lsp1Data +) internal nonpayable; +``` + +An attempt is made to notify the token receiver about the `tokenId` changing owners +using LSP1 interface. When allowNonLSP1Recipient is FALSE the token receiver MUST support LSP1. +The receiver may revert when the token being sent is not wanted. + +
+ +### \_safeTransfer + +```solidity +function _safeTransfer( + address from, + address to, + uint256 tokenId, + bytes data +) internal nonpayable; +``` + +Transfer the `tokenId` from `from` to `to` and check if the `to` recipient address is +a contract that implements the `IERC721Received` interface and return the right magic value. +See [`_checkOnERC721Received`](#_checkonerc721received) for more infos. + +
+ +### \_setApprovalForAll + +```solidity +function _setApprovalForAll( + address tokensOwner, + address operator, + bool approved +) internal nonpayable; +``` + +Approve `operator` to operate on all tokens of `tokensOwner` + +
+ +**Emitted events:** + +- [`ApprovalForAll`](#approvalforall) event. + +
+ +
+ +## Events + +### Approval + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#approval) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Event signature: `Approval(address,address,uint256)` +- Event topic hash: `0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925` + +::: + +```solidity +event Approval(address indexed owner, address indexed operator, uint256 indexed tokenId); +``` + +_ERC721 `Approval` compatible event emitted. Successfully approved operator `operator` to operate on tokenId `tokenId` on behalf of token owner `owner`._ + +ERC721 `Approval` event emitted when `owner` enables `operator` for `tokenId`. To provide compatibility with indexing ERC721 events. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ------------------------------------------ | +| `owner` **`indexed`** | `address` | The address of the owner of the `tokenId`. | +| `operator` **`indexed`** | `address` | The address set as operator. | +| `tokenId` **`indexed`** | `uint256` | The approved tokenId. | + +
+ +### ApprovalForAll + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#approvalforall) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Event signature: `ApprovalForAll(address,address,bool)` +- Event topic hash: `0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31` + +::: + +```solidity +event ApprovalForAll(address indexed owner, address indexed operator, bool approved); +``` + +_ERC721 `ApprovalForAll` compatible event emitted. Successfully set "approved for all" status to `approved` for operator `operator` for token owner `owner`._ + +ERC721 `ApprovalForAll` event emitted when an `operator` is enabled or disabled for an owner to transfer any of its tokenIds. The operator can manage all NFTs of the owner. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ---------------------------------------------- | +| `owner` **`indexed`** | `address` | The address of the owner of tokenIds. | +| `operator` **`indexed`** | `address` | The address set as operator. | +| `approved` | `bool` | If `operator` is approved for all NFTs or not. | + +
+ +### AuthorizedOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizedoperator) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Event signature: `AuthorizedOperator(address,address,bytes32)` +- Event topic hash: `0x34b797fc5a526f7bf1d2b5de25f6564fd85ae364e3ee939aee7c1ac27871a988` + +::: + +```solidity +event AuthorizedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId); +``` + +Emitted when `tokenOwner` enables `operator` to transfer or burn the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | -------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address authorized as an operator. | +| `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | +| `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` address has access on behalf of `tokenOwner`. | + +
+ +### DataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_Emitted when data at a key is changed_ + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ------------------------------------ | +| `dataKey` **`indexed`** | `bytes32` | The data key which data value is set | +| `dataValue` | `bytes` | The data value to set | + +
+ +### OwnershipTransferred + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Event signature: `OwnershipTransferred(address,address)` +- Event topic hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` + +::: + +```solidity +event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); +``` + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ----------- | +| `previousOwner` **`indexed`** | `address` | - | +| `newOwner` **`indexed`** | `address` | - | + +
+ +### RevokedOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokedoperator) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Event signature: `RevokedOperator(address,address,bytes32)` +- Event topic hash: `0x17d5389f6ab6adb2647dfa0aa365c323d37adacc30b33a65310b6158ce1373d5` + +::: + +```solidity +event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId); +``` + +Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | --------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from the operator array ({getOperatorsOf}). | +| `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | +| `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` is revoked from operating on. | + +
+ +### Transfer + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Event signature: `Transfer(address,address,address,bytes32,bool,bytes)` +- Event topic hash: `0xb333c813a7426a7a11e2b190cad52c44119421594b47f6f32ace6d8c7207b2bf` + +::: + +```solidity +event Transfer(address operator, address indexed from, address indexed to, bytes32 indexed tokenId, bool allowNonLSP1Recipient, bytes data); +``` + +_ERC721 `Transfer` compatible event emitted. Successfully transferred tokenId `tokenId` from `from` to `to`._ + +Emitted when `tokenId` token is transferred from the `from` to the `to` address. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ---------------------------------------------------------------------------------------------------------------------------------- | +| `operator` | `address` | The address of operator that sent the `tokenId` | +| `from` **`indexed`** | `address` | The previous owner of the `tokenId` | +| `to` **`indexed`** | `address` | The new owner of `tokenId` | +| `tokenId` **`indexed`** | `bytes32` | The tokenId that was transferred | +| `allowNonLSP1Recipient` | `bool` | If the token transfer enforces the `to` recipient address to be a contract that implements the LSP1 standard or not. | +| `data` | `bytes` | Any additional data the caller included by the caller during the transfer, and sent in the hooks to the `from` and `to` addresses. | + +
+ +## Errors + +### ERC725Y_DataKeysValuesEmptyArray + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +reverts when one of the array parameter provided to `setDataBatch` is an empty array + +
+ +### ERC725Y_DataKeysValuesLengthMismatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +reverts when there is not the same number of elements in the lists of data keys and data values when calling setDataBatch. + +
+ +### ERC725Y_MsgValueDisallowed + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_msgvaluedisallowed) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +reverts when sending value to the `setData(..)` functions + +
+ +### LSP4TokenNameNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokennamenoteditable) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `LSP4TokenNameNotEditable()` +- Error hash: `0x85c169bd` + +::: + +```solidity +error LSP4TokenNameNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +
+ +### LSP4TokenSymbolNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokensymbolnoteditable) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `LSP4TokenSymbolNotEditable()` +- Error hash: `0x76755b38` + +::: + +```solidity +error LSP4TokenSymbolNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +
+ +### LSP8CannotSendToAddressZero + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotsendtoaddresszero) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `LSP8CannotSendToAddressZero()` +- Error hash: `0x24ecef4d` + +::: + +```solidity +error LSP8CannotSendToAddressZero(); +``` + +reverts when trying to send token to the zero address. + +
+ +### LSP8CannotSendToSelf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotsendtoself) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `LSP8CannotSendToSelf()` +- Error hash: `0x5d67d6c1` + +::: + +```solidity +error LSP8CannotSendToSelf(); +``` + +reverts when specifying the same address for `from` and `to` in a token transfer. + +
+ +### LSP8CannotUseAddressZeroAsOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotuseaddresszeroasoperator) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `LSP8CannotUseAddressZeroAsOperator()` +- Error hash: `0x9577b8b3` + +::: + +```solidity +error LSP8CannotUseAddressZeroAsOperator(); +``` + +reverts when trying to set the zero address as an operator. + +
+ +### LSP8InvalidTransferBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8invalidtransferbatch) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `LSP8InvalidTransferBatch()` +- Error hash: `0x93a83119` + +::: + +```solidity +error LSP8InvalidTransferBatch(); +``` + +reverts when the parameters used for `transferBatch` have different lengths. + +
+ +### LSP8NonExistentTokenId + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistenttokenid) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `LSP8NonExistentTokenId(bytes32)` +- Error hash: `0xae8f9a36` + +::: + +```solidity +error LSP8NonExistentTokenId(bytes32 tokenId); +``` + +reverts when `tokenId` has not been minted. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------- | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8NonExistingOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistingoperator) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `LSP8NonExistingOperator(address,bytes32)` +- Error hash: `0x4aa31a8c` + +::: + +```solidity +error LSP8NonExistingOperator(address operator, bytes32 tokenId); +``` + +reverts when `operator` is not an operator for the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8NotTokenOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenoperator) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `LSP8NotTokenOperator(bytes32,address)` +- Error hash: `0x1294d2a9` + +::: + +```solidity +error LSP8NotTokenOperator(bytes32 tokenId, address caller); +``` + +reverts when `caller` is not an allowed operator for `tokenId`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------- | +| `tokenId` | `bytes32` | - | +| `caller` | `address` | - | + +
+ +### LSP8NotTokenOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenowner) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `LSP8NotTokenOwner(address,bytes32,address)` +- Error hash: `0x5b271ea2` + +::: + +```solidity +error LSP8NotTokenOwner(address tokenOwner, bytes32 tokenId, address caller); +``` + +reverts when `caller` is not the `tokenOwner` of the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `tokenOwner` | `address` | - | +| `tokenId` | `bytes32` | - | +| `caller` | `address` | - | + +
+ +### LSP8NotifyTokenReceiverContractMissingLSP1Interface + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceivercontractmissinglsp1interface) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `LSP8NotifyTokenReceiverContractMissingLSP1Interface(address)` +- Error hash: `0x4349776d` + +::: + +```solidity +error LSP8NotifyTokenReceiverContractMissingLSP1Interface( + address tokenReceiver +); +``` + +reverts if the `tokenReceiver` does not implement LSP1 when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8NotifyTokenReceiverIsEOA + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceiveriseoa) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `LSP8NotifyTokenReceiverIsEOA(address)` +- Error hash: `0x03173137` + +::: + +```solidity +error LSP8NotifyTokenReceiverIsEOA(address tokenReceiver); +``` + +reverts if the `tokenReceiver` is an EOA when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8OperatorAlreadyAuthorized + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8operatoralreadyauthorized) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `LSP8OperatorAlreadyAuthorized(address,bytes32)` +- Error hash: `0xa7626b68` + +::: + +```solidity +error LSP8OperatorAlreadyAuthorized(address operator, bytes32 tokenId); +``` + +reverts when `operator` is already authorized for the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8TokenIdAlreadyMinted + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidalreadyminted) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `LSP8TokenIdAlreadyMinted(bytes32)` +- Error hash: `0x34c7b511` + +::: + +```solidity +error LSP8TokenIdAlreadyMinted(bytes32 tokenId); +``` + +reverts when `tokenId` has already been minted. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------- | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8TokenOwnerCannotBeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenownercannotbeoperator) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `LSP8TokenOwnerCannotBeOperator()` +- Error hash: `0x89fdad62` + +::: + +```solidity +error LSP8TokenOwnerCannotBeOperator(); +``` + +reverts when trying to authorize or revoke the token's owner as an operator. + +
diff --git a/docs/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md b/docs/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md new file mode 100644 index 000000000..8ef3c08c8 --- /dev/null +++ b/docs/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md @@ -0,0 +1,1426 @@ + + + +# LSP8Mintable + +:::info Standard Specifications + +[`LSP-8-IdentifiableDigitalAsset`](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md) + +::: +:::info Solidity implementation + +[`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) + +::: + +> LSP8IdentifiableDigitalAsset deployable preset contract with a public {mint} function callable only by the contract {owner}. + +## Public Methods + +Public methods are accessible externally from users, allowing interaction with this function from dApps or other smart contracts. +When marked as 'public', a method can be called both externally and internally, on the other hand, when marked as 'external', a method can only be called externally. + +### constructor + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#constructor) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) + +::: + +```solidity +constructor(string name_, string symbol_, address newOwner_); +``` + +_Deploying a `LSP8Mintable` token contract with: token name = `name_`, token symbol = `symbol_`, and address `newOwner_` as the token contract owner._ + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | -------------------------------- | +| `name_` | `string` | The name of the token. | +| `symbol_` | `string` | The symbol of the token. | +| `newOwner_` | `address` | The owner of the token contract. | + +
+ +### authorizeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizeoperator) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Function signature: `authorizeOperator(address,bytes32)` +- Function selector: `0xcf5182ba` + +::: + +```solidity +function authorizeOperator( + address operator, + bytes32 tokenId +) external nonpayable; +``` + +Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ---------------------------------------- | +| `operator` | `address` | The address to authorize as an operator. | +| `tokenId` | `bytes32` | The token ID operator has access to.. | + +
+ +### balanceOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#balanceof) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Function signature: `balanceOf(address)` +- Function selector: `0x70a08231` + +::: + +```solidity +function balanceOf(address tokenOwner) external view returns (uint256); +``` + +Get the number of token IDs owned by `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------------------- | +| `tokenOwner` | `address` | The address to query \* | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------------------- | +| `0` | `uint256` | The total number of token IDs that `tokenOwner` owns. | + +
+ +### getData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdata) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_Gets singular data at a given `dataKey`_ + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ------------------------------- | +| `dataKey` | `bytes32` | The key which value to retrieve | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | -------------------------- | +| `dataValue` | `bytes` | The data stored at the key | + +
+ +### getDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatch) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Gets array of data for multiple given keys_ + +#### Parameters + +| Name | Type | Description | +| ---------- | :---------: | ------------------------------------------ | +| `dataKeys` | `bytes32[]` | The array of keys which values to retrieve | + +#### Returns + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------- | +| `dataValues` | `bytes[]` | The array of data stored at multiple keys | + +
+ +### getOperatorsOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getoperatorsof) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Function signature: `getOperatorsOf(bytes32)` +- Function selector: `0x49a6078d` + +::: + +```solidity +function getOperatorsOf(bytes32 tokenId) external view returns (address[]); +``` + +Returns all `operator` addresses that are allowed to transfer or burn a specific `tokenId` on behalf of its owner. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------- | +| `tokenId` | `bytes32` | The token ID to get the operators for. | + +#### Returns + +| Name | Type | Description | +| ---- | :---------: | ------------------------------------------------------------------------------------------------------------ | +| `0` | `address[]` | An array of operators allowed to transfer or burn a specific `tokenId`. Requirements - `tokenId` must exist. | + +
+ +### isOperatorFor + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#isoperatorfor) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Function signature: `isOperatorFor(address,bytes32)` +- Function selector: `0x2a3654a4` + +::: + +```solidity +function isOperatorFor( + address operator, + bytes32 tokenId +) external view returns (bool); +``` + +Returns whether `operator` address is an operator for a given `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------- | +| `operator` | `address` | The address to query operator status for. | +| `tokenId` | `bytes32` | The token ID to check if `operator` is allowed to operate on. | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | --------------------------------------------------------------------- | +| `0` | `bool` | `true` if `operator` is an operator for `tokenId`, `false` otherwise. | + +
+ +### mint + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#mint) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Function signature: `mint(address,bytes32,bool,bytes)` +- Function selector: `0xaf255b61` + +::: + +```solidity +function mint( + address to, + bytes32 tokenId, + bool allowNonLSP1Recipient, + bytes data +) external nonpayable; +``` + +_Minting tokenId `tokenId` for address `to` with the additional data `data` (Note: allow non-LSP1 recipient is set to `allowNonLSP1Recipient`)._ + +Public [`_mint`](#_mint) function only callable by the [`owner`](#owner). + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ------------------------------------------------------------------------------------------------------------------------------ | +| `to` | `address` | The address that will receive the minted `tokenId`. | +| `tokenId` | `bytes32` | The tokenId to mint. | +| `allowNonLSP1Recipient` | `bool` | Set to `false` to ensure that you are minting for a recipient that implements LSP1, `false` otherwise for forcing the minting. | +| `data` | `bytes` | Any addition data to be sent alongside the minting. | + +
+ +### owner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#owner) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Function signature: `owner()` +- Function selector: `0x8da5cb5b` + +::: + +```solidity +function owner() external view returns (address); +``` + +Returns the address of the current owner. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `address` | - | + +
+ +### renounceOwnership + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#renounceownership) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Function signature: `renounceOwnership()` +- Function selector: `0x715018a6` + +::: + +```solidity +function renounceOwnership() external nonpayable; +``` + +Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner. + +
+ +### revokeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokeoperator) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Function signature: `revokeOperator(address,bytes32)` +- Function selector: `0x0b0c6d82` + +::: + +```solidity +function revokeOperator(address operator, bytes32 tokenId) external nonpayable; +``` + +Remove access of `operator` for a given `tokenId`, disallowing it to transfer `tokenId` on behalf of its owner. See also [`isOperatorFor`](#isoperatorfor). + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ---------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `tokenId` | `bytes32` | The tokenId `operator` is revoked from operating on. | + +
+ +### setData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdata) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +```solidity +function setData(bytes32 dataKey, bytes dataValue) external payable; +``` + +_Sets singular data for a given `dataKey`_ + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `dataKey` | `bytes32` | The key to retrieve stored value | +| `dataValue` | `bytes` | The value to set SHOULD only be callable by the owner of the contract set via ERC173 The function is marked as payable to enable flexibility on child contracts If the function is not intended to receive value, an additional check should be implemented to check that value equal 0. Emits a {DataChanged} event. | + +
+ +### setDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatch) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +```solidity +function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable; +``` + +Sets array of data for multiple given `dataKeys` SHOULD only be callable by the owner of the contract set via ERC173 The function is marked as payable to enable flexibility on child contracts If the function is not intended to receive value, an additional check should be implemented to check that value equal + +0. Emits a [`DataChanged`](#datachanged) event. + +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ---------------------------------------- | +| `dataKeys` | `bytes32[]` | The array of data keys for values to set | +| `dataValues` | `bytes[]` | The array of values to set | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#supportsinterface) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +Returns true if this contract implements the interface defined by `interfaceId`. See the corresponding https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] to learn more about how these ids are created. This function call must use less than 30 000 gas. + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ----------- | +| `interfaceId` | `bytes4` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +
+ +### tokenIdsOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenidsof) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Function signature: `tokenIdsOf(address)` +- Function selector: `0xa3b261f2` + +::: + +```solidity +function tokenIdsOf(address tokenOwner) external view returns (bytes32[]); +``` + +Returns the list of token IDs that the `tokenOwner` address owns. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ---------------------------------------------------------- | +| `tokenOwner` | `address` | The address that we want to get the list of token IDs for. | + +#### Returns + +| Name | Type | Description | +| ---- | :---------: | ------------------------------------------------------- | +| `0` | `bytes32[]` | An array of `bytes32[] tokenIds` owned by `tokenOwner`. | + +
+ +### tokenOwnerOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenownerof) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Function signature: `tokenOwnerOf(bytes32)` +- Function selector: `0x217b2270` + +::: + +```solidity +function tokenOwnerOf(bytes32 tokenId) external view returns (address); +``` + +Returns the list of `tokenIds` for the `tokenOwner` address. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------------- | +| `tokenId` | `bytes32` | tokenOwner The address to query owned tokens | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------- | +| `0` | `address` | The owner address of the given `tokenId`. | + +
+ +### totalSupply + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#totalsupply) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Function signature: `totalSupply()` +- Function selector: `0x18160ddd` + +::: + +```solidity +function totalSupply() external view returns (uint256); +``` + +Returns the number of existing tokens that have been minted in this contract. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------ | +| `0` | `uint256` | The number of existing tokens. | + +
+ +### transfer + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Function signature: `transfer(address,address,bytes32,bool,bytes)` +- Function selector: `0x511b6952` + +::: + +```solidity +function transfer( + address from, + address to, + bytes32 tokenId, + bool allowNonLSP1Recipient, + bytes data +) external nonpayable; +``` + +Transfer a given `tokenId` token from the `from` address to the `to` address. If operators are set for a specific `tokenId`, all the operators are revoked after the tokenId have been transferred. The `allowNonLSP1Recipient` parameter MUST be set to `true` when transferring tokens to Externally Owned Accounts (EOAs) or contracts that do not implement the LSP1 standard. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The address that owns the given `tokenId`. | +| `to` | `address` | The address that will receive the `tokenId`. | +| `tokenId` | `bytes32` | The token ID to transfer. | +| `allowNonLSP1Recipient` | `bool` | When set to `true`, the `to` address CAN be any addres. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard. | +| `data` | `bytes` | Any additional data the caller wants included in the emitted event, and sent in the hooks of the `from` and `to` addresses. | + +
+ +### transferBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferbatch) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Function signature: `transferBatch(address[],address[],bytes32[],bool[],bytes[])` +- Function selector: `0x7e87632c` + +::: + +```solidity +function transferBatch( + address[] from, + address[] to, + bytes32[] tokenId, + bool[] allowNonLSP1Recipient, + bytes[] data +) external nonpayable; +``` + +Transfers multiple tokens at once based on the arrays of `from`, `to` and `tokenId`. If any transfer fails, the whole call will revert. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :---------: | ----------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address[]` | An array of sending addresses. | +| `to` | `address[]` | An array of recipient addresses. | +| `tokenId` | `bytes32[]` | An array of token IDs to transfer. | +| `allowNonLSP1Recipient` | `bool[]` | When set to `true`, `to` may be any address. When set to `false`, `to` must be a contract that supports the LSP1 standard and not revert. | +| `data` | `bytes[]` | Any additional data the caller wants included in the emitted event, and sent in the hooks to the `from` and `to` addresses. | + +
+ +### transferOwnership + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferownership) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Function signature: `transferOwnership(address)` +- Function selector: `0xf2fde38b` + +::: + +```solidity +function transferOwnership(address newOwner) external nonpayable; +``` + +Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `newOwner` | `address` | - | + +
+ +## Internal Methods + +Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. + +Internal functions cannot be called externally, whether from other smart contracts, dApp interfaces, or backend services. Their restricted accessibility ensures that they remain exclusively available within the context of the current contract, promoting controlled and encapsulated usage of these internal utilities. + +### \_checkOwner + +```solidity +function _checkOwner() internal view; +``` + +Throws if the sender is not the owner. + +
+ +### \_setOwner + +```solidity +function _setOwner(address newOwner) internal nonpayable; +``` + +Changes the owner if `newOwner` and oldOwner are different +This pattern is useful in inheritance. + +
+ +### \_getData + +```solidity +function _getData(bytes32 dataKey) internal view returns (bytes dataValue); +``` + +
+ +### \_setData + +```solidity +function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; +``` + +Save gas by emitting the [`DataChanged`](#datachanged) event with only the first 256 bytes of dataValue + +
+ +### \_isOperatorOrOwner + +```solidity +function _isOperatorOrOwner( + address caller, + bytes32 tokenId +) internal view returns (bool); +``` + +verifies if the `caller` is operator or owner for the `tokenId` + +#### Returns + +| Name | Type | Description | +| ---- | :----: | -------------------------------------------- | +| `0` | `bool` | true if `caller` is either operator or owner | + +
+ +### \_revokeOperator + +```solidity +function _revokeOperator( + address operator, + address tokenOwner, + bytes32 tokenId +) internal nonpayable; +``` + +removes `operator` from the list of operators for the `tokenId` + +
+ +### \_clearOperators + +```solidity +function _clearOperators( + address tokenOwner, + bytes32 tokenId +) internal nonpayable; +``` + +revoke all the current operators for a specific `tokenId` token which belongs to `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ------------------------------------------------- | +| `tokenOwner` | `address` | The address that is the owner of the `tokenId`. | +| `tokenId` | `bytes32` | The token to remove the associated operators for. | + +
+ +### \_exists + +```solidity +function _exists(bytes32 tokenId) internal view returns (bool); +``` + +Returns whether `tokenId` exists. +Tokens start existing when they are minted ([`_mint`](#_mint)), and stop existing when they are burned ([`_burn`](#_burn)). + +
+ +### \_existsOrError + +```solidity +function _existsOrError(bytes32 tokenId) internal view; +``` + +When `tokenId` does not exist then revert with an error. + +
+ +### \_mint + +```solidity +function _mint( + address to, + bytes32 tokenId, + bool allowNonLSP1Recipient, + bytes data +) internal nonpayable; +``` + +Create `tokenId` by minting it and transfers it to `to`. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event with `address(0)` as `from` address. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------------------------------------------------------------------------------------- | +| `to` | `address` | @param tokenId The token ID to create (= mint). | +| `tokenId` | `bytes32` | The token ID to create (= mint). | +| `allowNonLSP1Recipient` | `bool` | When set to `true`, `to` may be any address. When set to `false`, `to` must be a contract that supports the LSP1 standard. | +| `data` | `bytes` | Any additional data the caller wants included in the emitted event, and sent in the hook of the `to` address. | + +
+ +### \_burn + +:::tip Hint + +In dApps, you can know which addresses are burning tokens by listening for the `Transfer` event and filter with the zero address as `to`. + +::: + +```solidity +function _burn(bytes32 tokenId, bytes data) internal nonpayable; +``` + +Burn a specific `tokenId`, removing the `tokenId` from the [`tokenIdsOf`](#tokenidsof) the caller and decreasing its [`balanceOf`](#balanceof) by -1. +This will also clear all the operators allowed to transfer the `tokenId`. +The owner of the `tokenId` will be notified about the `tokenId` being transferred through its LSP1 [`universalReceiver`](#universalreceiver) +function, if it is a contract that supports the LSP1 interface. Its [`universalReceiver`](#universalreceiver) function will receive +all the parameters in the calldata packed encoded. +Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before burning `tokenId` and updating the balances. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event with `address(0)` as the `to` address. + +
+ +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------------------------------------------------------------------------------------------------------------- | +| `tokenId` | `bytes32` | The token to burn. | +| `data` | `bytes` | Any additional data the caller wants included in the emitted event, and sent in the LSP1 hook on the token owner's address. | + +
+ +### \_transfer + +:::danger + +This internal function does not check if the sender is authorized or not to operate on the `tokenId`. + +::: + +```solidity +function _transfer( + address from, + address to, + bytes32 tokenId, + bool allowNonLSP1Recipient, + bytes data +) internal nonpayable; +``` + +Change the owner of the `tokenId` from `from` to `to`. +Both the sender and recipient will be notified of the `tokenId` being transferred through their LSP1 [`universalReceiver`](#universalreceiver) +function, if they are contracts that support the LSP1 interface. Their `universalReceiver` function will receive +all the parameters in the calldata packed encoded. +Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before changing the owner of `tokenId`. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The sender address. | +| `to` | `address` | @param tokenId The token to transfer. | +| `tokenId` | `bytes32` | The token to transfer. | +| `allowNonLSP1Recipient` | `bool` | When set to `true`, `to` may be any address. When set to `false`, `to` must be a contract that supports the LSP1 standard. | +| `data` | `bytes` | Additional data the caller wants included in the emitted event, and sent in the hooks to `from` and `to` addresses. | + +
+ +### \_beforeTokenTransfer + +```solidity +function _beforeTokenTransfer( + address from, + address to, + bytes32 tokenId +) internal nonpayable; +``` + +Hook that is called before any token transfer, including minting and burning. + +- Allows to run custom logic before updating balances and notifiying sender/recipient by overriding this function. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------- | +| `from` | `address` | The sender address | +| `to` | `address` | @param tokenId The tokenId to transfer | +| `tokenId` | `bytes32` | The tokenId to transfer | + +
+ +### \_notifyTokenSender + +```solidity +function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; +``` + +An attempt is made to notify the token sender about the `tokenId` changing owners using +LSP1 interface. + +
+ +### \_notifyTokenReceiver + +```solidity +function _notifyTokenReceiver( + address to, + bool allowNonLSP1Recipient, + bytes lsp1Data +) internal nonpayable; +``` + +An attempt is made to notify the token receiver about the `tokenId` changing owners +using LSP1 interface. When allowNonLSP1Recipient is FALSE the token receiver MUST support LSP1. +The receiver may revert when the token being sent is not wanted. + +
+ +## Events + +### AuthorizedOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizedoperator) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Event signature: `AuthorizedOperator(address,address,bytes32)` +- Event topic hash: `0x34b797fc5a526f7bf1d2b5de25f6564fd85ae364e3ee939aee7c1ac27871a988` + +::: + +```solidity +event AuthorizedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId); +``` + +Emitted when `tokenOwner` enables `operator` to transfer or burn the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | -------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address authorized as an operator. | +| `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | +| `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` address has access on behalf of `tokenOwner`. | + +
+ +### DataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_Emitted when data at a key is changed_ + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ------------------------------------ | +| `dataKey` **`indexed`** | `bytes32` | The data key which data value is set | +| `dataValue` | `bytes` | The data value to set | + +
+ +### OwnershipTransferred + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Event signature: `OwnershipTransferred(address,address)` +- Event topic hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` + +::: + +```solidity +event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); +``` + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ----------- | +| `previousOwner` **`indexed`** | `address` | - | +| `newOwner` **`indexed`** | `address` | - | + +
+ +### RevokedOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokedoperator) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Event signature: `RevokedOperator(address,address,bytes32)` +- Event topic hash: `0x17d5389f6ab6adb2647dfa0aa365c323d37adacc30b33a65310b6158ce1373d5` + +::: + +```solidity +event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId); +``` + +Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | --------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from the operator array ({getOperatorsOf}). | +| `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | +| `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` is revoked from operating on. | + +
+ +### Transfer + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Event signature: `Transfer(address,address,address,bytes32,bool,bytes)` +- Event topic hash: `0xb333c813a7426a7a11e2b190cad52c44119421594b47f6f32ace6d8c7207b2bf` + +::: + +```solidity +event Transfer(address operator, address indexed from, address indexed to, bytes32 indexed tokenId, bool allowNonLSP1Recipient, bytes data); +``` + +Emitted when `tokenId` token is transferred from the `from` to the `to` address. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ---------------------------------------------------------------------------------------------------------------------------------- | +| `operator` | `address` | The address of operator that sent the `tokenId` | +| `from` **`indexed`** | `address` | The previous owner of the `tokenId` | +| `to` **`indexed`** | `address` | The new owner of `tokenId` | +| `tokenId` **`indexed`** | `bytes32` | The tokenId that was transferred | +| `allowNonLSP1Recipient` | `bool` | If the token transfer enforces the `to` recipient address to be a contract that implements the LSP1 standard or not. | +| `data` | `bytes` | Any additional data the caller included by the caller during the transfer, and sent in the hooks to the `from` and `to` addresses. | + +
+ +## Errors + +### ERC725Y_DataKeysValuesEmptyArray + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +reverts when one of the array parameter provided to `setDataBatch` is an empty array + +
+ +### ERC725Y_DataKeysValuesLengthMismatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +reverts when there is not the same number of elements in the lists of data keys and data values when calling setDataBatch. + +
+ +### ERC725Y_MsgValueDisallowed + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_msgvaluedisallowed) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +reverts when sending value to the `setData(..)` functions + +
+ +### LSP4TokenNameNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokennamenoteditable) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `LSP4TokenNameNotEditable()` +- Error hash: `0x85c169bd` + +::: + +```solidity +error LSP4TokenNameNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +
+ +### LSP4TokenSymbolNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokensymbolnoteditable) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `LSP4TokenSymbolNotEditable()` +- Error hash: `0x76755b38` + +::: + +```solidity +error LSP4TokenSymbolNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. + +
+ +### LSP8CannotSendToAddressZero + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotsendtoaddresszero) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `LSP8CannotSendToAddressZero()` +- Error hash: `0x24ecef4d` + +::: + +```solidity +error LSP8CannotSendToAddressZero(); +``` + +reverts when trying to send token to the zero address. + +
+ +### LSP8CannotSendToSelf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotsendtoself) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `LSP8CannotSendToSelf()` +- Error hash: `0x5d67d6c1` + +::: + +```solidity +error LSP8CannotSendToSelf(); +``` + +reverts when specifying the same address for `from` and `to` in a token transfer. + +
+ +### LSP8CannotUseAddressZeroAsOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotuseaddresszeroasoperator) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `LSP8CannotUseAddressZeroAsOperator()` +- Error hash: `0x9577b8b3` + +::: + +```solidity +error LSP8CannotUseAddressZeroAsOperator(); +``` + +reverts when trying to set the zero address as an operator. + +
+ +### LSP8InvalidTransferBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8invalidtransferbatch) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `LSP8InvalidTransferBatch()` +- Error hash: `0x93a83119` + +::: + +```solidity +error LSP8InvalidTransferBatch(); +``` + +reverts when the parameters used for `transferBatch` have different lengths. + +
+ +### LSP8NonExistentTokenId + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistenttokenid) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `LSP8NonExistentTokenId(bytes32)` +- Error hash: `0xae8f9a36` + +::: + +```solidity +error LSP8NonExistentTokenId(bytes32 tokenId); +``` + +reverts when `tokenId` has not been minted. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------- | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8NonExistingOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistingoperator) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `LSP8NonExistingOperator(address,bytes32)` +- Error hash: `0x4aa31a8c` + +::: + +```solidity +error LSP8NonExistingOperator(address operator, bytes32 tokenId); +``` + +reverts when `operator` is not an operator for the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8NotTokenOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenoperator) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `LSP8NotTokenOperator(bytes32,address)` +- Error hash: `0x1294d2a9` + +::: + +```solidity +error LSP8NotTokenOperator(bytes32 tokenId, address caller); +``` + +reverts when `caller` is not an allowed operator for `tokenId`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------- | +| `tokenId` | `bytes32` | - | +| `caller` | `address` | - | + +
+ +### LSP8NotTokenOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenowner) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `LSP8NotTokenOwner(address,bytes32,address)` +- Error hash: `0x5b271ea2` + +::: + +```solidity +error LSP8NotTokenOwner(address tokenOwner, bytes32 tokenId, address caller); +``` + +reverts when `caller` is not the `tokenOwner` of the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `tokenOwner` | `address` | - | +| `tokenId` | `bytes32` | - | +| `caller` | `address` | - | + +
+ +### LSP8NotifyTokenReceiverContractMissingLSP1Interface + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceivercontractmissinglsp1interface) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `LSP8NotifyTokenReceiverContractMissingLSP1Interface(address)` +- Error hash: `0x4349776d` + +::: + +```solidity +error LSP8NotifyTokenReceiverContractMissingLSP1Interface( + address tokenReceiver +); +``` + +reverts if the `tokenReceiver` does not implement LSP1 when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8NotifyTokenReceiverIsEOA + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceiveriseoa) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `LSP8NotifyTokenReceiverIsEOA(address)` +- Error hash: `0x03173137` + +::: + +```solidity +error LSP8NotifyTokenReceiverIsEOA(address tokenReceiver); +``` + +reverts if the `tokenReceiver` is an EOA when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8OperatorAlreadyAuthorized + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8operatoralreadyauthorized) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `LSP8OperatorAlreadyAuthorized(address,bytes32)` +- Error hash: `0xa7626b68` + +::: + +```solidity +error LSP8OperatorAlreadyAuthorized(address operator, bytes32 tokenId); +``` + +reverts when `operator` is already authorized for the `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8TokenIdAlreadyMinted + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidalreadyminted) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `LSP8TokenIdAlreadyMinted(bytes32)` +- Error hash: `0x34c7b511` + +::: + +```solidity +error LSP8TokenIdAlreadyMinted(bytes32 tokenId); +``` + +reverts when `tokenId` has already been minted. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------- | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8TokenOwnerCannotBeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenownercannotbeoperator) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `LSP8TokenOwnerCannotBeOperator()` +- Error hash: `0x89fdad62` + +::: + +```solidity +error LSP8TokenOwnerCannotBeOperator(); +``` + +reverts when trying to authorize or revoke the token's owner as an operator. + +