From 52aa8ea8cb8e85f2b366a3ff94948250673c2590 Mon Sep 17 00:00:00 2001 From: b00ste Date: Wed, 3 Apr 2024 14:34:05 +0300 Subject: [PATCH 1/2] refactoe: fix post-processing bash scripts --- packages/lsp-smart-contracts/dodoc/config.ts | 2 +- .../dodoc/postProcessingContracts.sh | 46 +++++++------------ .../dodoc/postProcessingLibraries.sh | 34 ++++++-------- 3 files changed, 31 insertions(+), 51 deletions(-) diff --git a/packages/lsp-smart-contracts/dodoc/config.ts b/packages/lsp-smart-contracts/dodoc/config.ts index 05c9ed3dd..808902f6a 100644 --- a/packages/lsp-smart-contracts/dodoc/config.ts +++ b/packages/lsp-smart-contracts/dodoc/config.ts @@ -398,7 +398,7 @@ const generateContractLink = (contractName: string) => { const lspN = contractName.match(/LSP\d+/); if (specs[contractName]) { - return specs[contractName]; + return specs[contractName].contractsLink; } else if (lspN && lspN[0] === 'LSP1') { return specs['LSP1UniversalReceiver'].contractsLink; } else if (lspN && lspN[0] === 'LSP2') { diff --git a/packages/lsp-smart-contracts/dodoc/postProcessingContracts.sh b/packages/lsp-smart-contracts/dodoc/postProcessingContracts.sh index 4a34a4563..9c1ae135d 100644 --- a/packages/lsp-smart-contracts/dodoc/postProcessingContracts.sh +++ b/packages/lsp-smart-contracts/dodoc/postProcessingContracts.sh @@ -15,9 +15,8 @@ for folder in ./docs/contracts/@lukso/*; do mkdir ./docs/contracts/LSP0ERC725Account/ cp -r \ - ./$folder/contracts/ \ + $folder/contracts/ \ ./docs/contracts/LSP0ERC725Account/ - rm -r ./$folder echo Contents from $folder/contracts have been moved ;; @@ -26,9 +25,8 @@ for folder in ./docs/contracts/@lukso/*; do mkdir ./docs/contracts/LSP14Ownable2Step/ cp -r \ - ./$folder/contracts/ \ + $folder/contracts/ \ ./docs/contracts/LSP14Ownable2Step/ - rm -r ./$folder echo Contents from $folder/contracts have been moved ;; @@ -37,9 +35,8 @@ for folder in ./docs/contracts/@lukso/*; do mkdir ./docs/contracts/LSP16UniversalFactory/ cp -r \ - ./$folder/contracts/ \ + $folder/contracts/ \ ./docs/contracts/LSP16UniversalFactory/ - rm -r ./$folder echo Contents from $folder/contracts have been moved ;; @@ -48,9 +45,8 @@ for folder in ./docs/contracts/@lukso/*; do mkdir ./docs/contracts/LSP17ContractExtension/ cp -r \ - ./$folder/contracts/ \ + $folder/contracts/ \ ./docs/contracts/LSP17ContractExtension/ - rm -r ./$folder echo Contents from $folder/contracts have been moved ;; @@ -59,9 +55,8 @@ for folder in ./docs/contracts/@lukso/*; do mkdir ./docs/contracts/LSP1UniversalReceiver/ cp -r \ - ./$folder/contracts/ \ + $folder/contracts/ \ ./docs/contracts/LSP1UniversalReceiver/ - rm -r ./$folder echo Contents from $folder/contracts have been moved ;; @@ -70,9 +65,8 @@ for folder in ./docs/contracts/@lukso/*; do mkdir ./docs/contracts/LSP20CallVerification/ cp -r \ - ./$folder/contracts/ \ + $folder/contracts/ \ ./docs/contracts/LSP20CallVerification/ - rm -r ./$folder echo Contents from $folder/contracts have been moved ;; @@ -81,9 +75,8 @@ for folder in ./docs/contracts/@lukso/*; do mkdir ./docs/contracts/LSP23LinkedContractsFactory/ cp -r \ - ./$folder/contracts/ \ + $folder/contracts/ \ ./docs/contracts/LSP23LinkedContractsFactory/ - rm -r ./$folder echo Contents from $folder/contracts have been moved ;; @@ -92,9 +85,8 @@ for folder in ./docs/contracts/@lukso/*; do mkdir ./docs/contracts/LSP25ExecuteRelayCall/ cp -r \ - ./$folder/contracts/ \ + $folder/contracts/ \ ./docs/contracts/LSP25ExecuteRelayCall/ - rm -r ./$folder echo Contents from $folder/contracts have been moved ;; @@ -103,9 +95,8 @@ for folder in ./docs/contracts/@lukso/*; do mkdir ./docs/contracts/LSP4DigitalAssetMetadata/ cp -r \ - ./$folder/contracts/ \ + $folder/contracts/ \ ./docs/contracts/LSP4DigitalAssetMetadata/ - rm -r ./$folder echo Contents from $folder/contracts have been moved ;; @@ -114,9 +105,8 @@ for folder in ./docs/contracts/@lukso/*; do mkdir ./docs/contracts/LSP6KeyManager/ cp -r \ - ./$folder/contracts/ \ + $folder/contracts/ \ ./docs/contracts/LSP6KeyManager/ - rm -r ./$folder echo Contents from $folder/contracts have been moved ;; @@ -125,9 +115,8 @@ for folder in ./docs/contracts/@lukso/*; do mkdir ./docs/contracts/LSP7DigitalAsset/ cp -r \ - ./$folder/contracts/ \ + $folder/contracts/ \ ./docs/contracts/LSP7DigitalAsset/ - rm -r ./$folder echo Contents from $folder/contracts have been moved ;; @@ -136,9 +125,8 @@ for folder in ./docs/contracts/@lukso/*; do mkdir ./docs/contracts/LSP8IdentifiableDigitalAsset/ cp -r \ - ./$folder/contracts/ \ + $folder/contracts/ \ ./docs/contracts/LSP8IdentifiableDigitalAsset/ - rm -r ./$folder echo Contents from $folder/contracts have been moved ;; @@ -147,9 +135,8 @@ for folder in ./docs/contracts/@lukso/*; do mkdir ./docs/contracts/LSP9Vault/ cp -r \ - ./$folder/contracts/ \ + $folder/contracts/ \ ./docs/contracts/LSP9Vault/ - rm -r ./$folder echo Contents from $folder/contracts have been moved ;; @@ -158,9 +145,8 @@ for folder in ./docs/contracts/@lukso/*; do mkdir ./docs/contracts/UniversalProfile/ cp -r \ - ./$folder/contracts/ \ + $folder/contracts/ \ ./docs/contracts/UniversalProfile/ - rm -r ./$folder echo Contents from $folder/contracts have been moved ;; @@ -171,6 +157,6 @@ for folder in ./docs/contracts/@lukso/*; do ;; esac +done - rm -rf ./docs/contracts/@lukso -done \ No newline at end of file +rm -rf ./docs/contracts/@lukso diff --git a/packages/lsp-smart-contracts/dodoc/postProcessingLibraries.sh b/packages/lsp-smart-contracts/dodoc/postProcessingLibraries.sh index e1a491c98..efeee68f6 100755 --- a/packages/lsp-smart-contracts/dodoc/postProcessingLibraries.sh +++ b/packages/lsp-smart-contracts/dodoc/postProcessingLibraries.sh @@ -15,66 +15,60 @@ for folder in ./docs/libraries/@lukso/*; do mkdir ./docs/libraries/LSP1UniversalReceiver/ cp -r \ - ./$folder/libraries/ \ + $folder/contracts/ \ ./docs/libraries/LSP1UniversalReceiver/ - rm -r ./$folder - echo Contents from $folder/libraries have been moved + echo Contents from $folder/contracts have been moved ;; lsp2) mkdir ./docs/libraries/LSP2ERC725YJSONSchema/ cp -r \ - ./$folder/libraries/ \ + $folder/contracts/ \ ./docs/libraries/LSP2ERC725YJSONSchema/ - rm -r ./$folder - echo Contents from $folder/libraries have been moved + echo Contents from $folder/contracts have been moved ;; lsp5) mkdir ./docs/libraries/LSP5ReceivedAssets/ cp -r \ - ./$folder/libraries/ \ + $folder/contracts/ \ ./docs/libraries/LSP5ReceivedAssets/ - rm -r ./$folder - echo Contents from $folder/libraries have been moved + echo Contents from $folder/contracts have been moved ;; lsp6) mkdir ./docs/libraries/LSP6KeyManager/ cp -r \ - ./$folder/libraries/ \ + $folder/contracts/ \ ./docs/libraries/LSP6KeyManager/ - rm -r ./$folder - echo Contents from $folder/libraries have been moved + echo Contents from $folder/contracts have been moved ;; lsp10) mkdir ./docs/libraries/LSP10ReceivedVaults/ cp -r \ - ./$folder/libraries/ \ + $folder/contracts/ \ ./docs/libraries/LSP10ReceivedVaults/ - rm -r ./$folder - echo Contents from $folder/libraries have been moved + echo Contents from $folder/contracts have been moved ;; lsp17contractextension) mkdir ./docs/libraries/LSP17ContractExtension/ cp -r \ - ./$folder/libraries/ \ + $folder/contracts/ \ ./docs/libraries/LSP17ContractExtension/ - rm -r ./$folder - echo Contents from $folder/libraries have been moved + echo Contents from $folder/contracts have been moved ;; *) @@ -83,6 +77,6 @@ for folder in ./docs/libraries/@lukso/*; do ;; esac +done - rm -rf ./docs/libraries/@lukso -done \ No newline at end of file +rm -rf ./docs/libraries/@lukso From 6856f5c2dd84781a68fccec6a369412e3a482828 Mon Sep 17 00:00:00 2001 From: b00ste Date: Wed, 3 Apr 2024 14:34:10 +0300 Subject: [PATCH 2/2] docs: fix docs --- .../smart-contracts/contracts/ERC725.md | 60 +- .../LSP0ERC725Account/LSP0ERC725Account.md | 98 +- .../LSP11BasicSocialRecovery.md | 74 +- .../LSP14Ownable2Step/LSP14Ownable2Step.md | 533 ++++ .../LSP16UniversalFactory.md | 435 ++++ .../LSP17ContractExtension/LSP17Extendable.md | 125 + .../LSP17ContractExtension/LSP17Extension.md | 117 + .../LSP1UniversalReceiverDelegateUP.md | 278 ++ .../LSP1UniversalReceiverDelegateVault.md | 235 ++ .../LSP20CallVerification.md | 61 + .../IPostDeploymentModule.md | 53 + .../LSP23LinkedContractsFactory.md | 403 +++ .../LSP25MultiChannelNonce.md | 147 ++ .../LSP4DigitalAssetMetadata.md | 574 +++++ .../LSP6KeyManager/LSP6KeyManager.md | 1969 ++++++++++++++ .../LSP7DigitalAsset/LSP7DigitalAsset.md | 1916 ++++++++++++++ .../extensions/LSP7Burnable.md | 1941 ++++++++++++++ .../extensions/LSP7CappedSupply.md | 1957 ++++++++++++++ .../LSP7DigitalAsset/presets/LSP7Mintable.md | 1980 ++++++++++++++ .../LSP8IdentifiableDigitalAsset.md | 2204 ++++++++++++++++ .../extensions/LSP8Burnable.md | 2230 ++++++++++++++++ .../extensions/LSP8CappedSupply.md | 2246 ++++++++++++++++ .../extensions/LSP8Enumerable.md | 2232 ++++++++++++++++ .../presets/LSP8Mintable.md | 2295 +++++++++++++++++ .../docs/contracts/LSP9Vault/LSP9Vault.md | 1807 +++++++++++++ .../UniversalProfile/UniversalProfile.md | 1869 ++++++++++++++ .../LSP10ReceivedVaults/LSP10Utils.md | 113 + .../LSP17ContractExtension/LSP17Utils.md | 38 + .../LSP1UniversalReceiver/LSP1Utils.md | 104 + .../LSP2ERC725YJSONSchema/LSP2Utils.md | 439 ++++ .../libraries/LSP5ReceivedAssets/LSP5Utils.md | 115 + .../libraries/LSP6KeyManager/LSP6Utils.md | 254 ++ 32 files changed, 28786 insertions(+), 116 deletions(-) create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP14Ownable2Step/LSP14Ownable2Step.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP16UniversalFactory/LSP16UniversalFactory.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP17ContractExtension/LSP17Extendable.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP17ContractExtension/LSP17Extension.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP20CallVerification/LSP20CallVerification.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP23LinkedContractsFactory/IPostDeploymentModule.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP23LinkedContractsFactory/LSP23LinkedContractsFactory.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP25ExecuteRelayCall/LSP25MultiChannelNonce.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP6KeyManager/LSP6KeyManager.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/LSP9Vault/LSP9Vault.md create mode 100644 packages/lsp-smart-contracts/docs/contracts/UniversalProfile/UniversalProfile.md create mode 100644 packages/lsp-smart-contracts/docs/libraries/LSP10ReceivedVaults/LSP10Utils.md create mode 100644 packages/lsp-smart-contracts/docs/libraries/LSP17ContractExtension/LSP17Utils.md create mode 100644 packages/lsp-smart-contracts/docs/libraries/LSP1UniversalReceiver/LSP1Utils.md create mode 100644 packages/lsp-smart-contracts/docs/libraries/LSP2ERC725YJSONSchema/LSP2Utils.md create mode 100644 packages/lsp-smart-contracts/docs/libraries/LSP5ReceivedAssets/LSP5Utils.md create mode 100644 packages/lsp-smart-contracts/docs/libraries/LSP6KeyManager/LSP6Utils.md diff --git a/packages/lsp-smart-contracts/docs/contracts/@erc725/smart-contracts/contracts/ERC725.md b/packages/lsp-smart-contracts/docs/contracts/@erc725/smart-contracts/contracts/ERC725.md index a4507722f..442380f1f 100644 --- a/packages/lsp-smart-contracts/docs/contracts/@erc725/smart-contracts/contracts/ERC725.md +++ b/packages/lsp-smart-contracts/docs/contracts/@erc725/smart-contracts/contracts/ERC725.md @@ -10,7 +10,7 @@ ::: :::info Solidity implementation -[`ERC725.sol`]([object Object]) +[`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) ::: @@ -28,7 +28,7 @@ When marked as 'public', a method can be called both externally and internally, :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#constructor) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) ::: @@ -61,7 +61,7 @@ Deploy a new ERC725 contract with the provided `initialOwner` as the contract [` :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#execute) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Function signature: `execute(uint256,address,uint256,bytes)` - Function selector: `0x44c028fe` @@ -128,7 +128,7 @@ Generic executor function to: :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#executebatch) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Function signature: `executeBatch(uint256[],address[],uint256[],bytes[])` - Function selector: `0x31858452` @@ -194,7 +194,7 @@ Batch executor function that behaves the same as [`execute`](#execute) but allow :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#getdata) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Function signature: `getData(bytes32)` - Function selector: `0x54f6127f` @@ -227,7 +227,7 @@ Get in the ERC725Y storage the bytes data stored at a specific data key `dataKey :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#getdatabatch) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Function signature: `getDataBatch(bytes32[])` - Function selector: `0xdedff9c6` @@ -262,7 +262,7 @@ Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#owner) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Function signature: `owner()` - Function selector: `0x8da5cb5b` @@ -287,7 +287,7 @@ Returns the address of the current owner. :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#renounceownership) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Function signature: `renounceOwnership()` - Function selector: `0x715018a6` @@ -306,7 +306,7 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#setdata) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Function signature: `setData(bytes32,bytes)` - Function selector: `0x7f23690c` @@ -356,7 +356,7 @@ Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#setdatabatch) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Function signature: `setDataBatch(bytes32[],bytes[])` - Function selector: `0x97902421` @@ -406,7 +406,7 @@ Batch data setting function that behaves the same as [`setData`](#setdata) but a :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#supportsinterface) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Function signature: `supportsInterface(bytes4)` - Function selector: `0x01ffc9a7` @@ -437,7 +437,7 @@ See [`IERC165-supportsInterface`](#ierc165-supportsinterface). :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#transferownership) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Function signature: `transferOwnership(address)` - Function selector: `0xf2fde38b` @@ -716,7 +716,7 @@ mapping(bytes32 => bytes) _store :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#contractcreated) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Event signature: `ContractCreated(uint256,address,uint256,bytes32)` - Event topic hash: `0xa1fb700aaee2ae4a2ff6f91ce7eba292f89c2f5488b8ec4c5c5c8150692595c3` @@ -751,7 +751,7 @@ Emitted when a new contract was created and deployed. :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#datachanged) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Event signature: `DataChanged(bytes32,bytes)` - Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` @@ -779,7 +779,7 @@ Emitted when data at a specific `dataKey` was changed to a new value `dataValue` :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#executed) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Event signature: `Executed(uint256,address,uint256,bytes4)` - Event topic hash: `0x4810874456b8e6487bd861375cf6abd8e1c8bb5858c8ce36a86a04dabfac199e` @@ -814,7 +814,7 @@ Emitted when calling an address `target` (EOA or contract) with `value`. :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#ownershiptransferred) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Event signature: `OwnershipTransferred(address,address)` - Event topic hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` @@ -843,7 +843,7 @@ event OwnershipTransferred( :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#erc725x_contractdeploymentfailed) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Error signature: `ERC725X_ContractDeploymentFailed()` - Error hash: `0x0b07489b` @@ -862,7 +862,7 @@ Reverts when contract deployment failed via [`execute`](#execute) or [`executeBa :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#erc725x_createoperationsrequireemptyrecipientaddress) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Error signature: `ERC725X_CreateOperationsRequireEmptyRecipientAddress()` - Error hash: `0x3041824a` @@ -881,7 +881,7 @@ Reverts when passing a `to` address that is not `address(0)` (= address zero) wh :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#erc725x_executeparametersemptyarray) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Error signature: `ERC725X_ExecuteParametersEmptyArray()` - Error hash: `0xe9ad2b5f` @@ -900,7 +900,7 @@ Reverts when one of the array parameter provided to the [`executeBatch`](#execut :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#erc725x_executeparameterslengthmismatch) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Error signature: `ERC725X_ExecuteParametersLengthMismatch()` - Error hash: `0x3ff55f4d` @@ -919,7 +919,7 @@ Reverts when there is not the same number of elements in the `operationTypes`, ` :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#erc725x_insufficientbalance) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Error signature: `ERC725X_InsufficientBalance(uint256,uint256)` - Error hash: `0x0df9a8f8` @@ -945,7 +945,7 @@ Reverts when trying to send more native tokens `value` than available in current :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#erc725x_msgvaluedisallowedindelegatecall) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Error signature: `ERC725X_MsgValueDisallowedInDelegateCall()` - Error hash: `0x5ac83135` @@ -964,7 +964,7 @@ Reverts when trying to send native tokens (`value` / `values[]` parameter of [`e :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#erc725x_msgvaluedisallowedinstaticcall) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Error signature: `ERC725X_MsgValueDisallowedInStaticCall()` - Error hash: `0x72f2bc6a` @@ -983,7 +983,7 @@ Reverts when trying to send native tokens (`value` / `values[]` parameter of [`e :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#erc725x_nocontractbytecodeprovided) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Error signature: `ERC725X_NoContractBytecodeProvided()` - Error hash: `0xb81cd8d9` @@ -1002,7 +1002,7 @@ Reverts when no contract bytecode was provided as parameter when trying to deplo :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#erc725x_unknownoperationtype) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Error signature: `ERC725X_UnknownOperationType(uint256)` - Error hash: `0x7583b3bc` @@ -1027,7 +1027,7 @@ Reverts when the `operationTypeProvided` is none of the default operation types :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#erc725y_datakeysvaluesemptyarray) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Error signature: `ERC725Y_DataKeysValuesEmptyArray()` - Error hash: `0x97da5f95` @@ -1046,7 +1046,7 @@ Reverts when one of the array parameter provided to [`setDataBatch`](#setdatabat :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#erc725y_datakeysvalueslengthmismatch) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` - Error hash: `0x3bcc8979` @@ -1065,7 +1065,7 @@ Reverts when there is not the same number of elements in the `datakeys` and `dat :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#erc725y_msgvaluedisallowed) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Error signature: `ERC725Y_MsgValueDisallowed()` - Error hash: `0xf36ba737` @@ -1084,7 +1084,7 @@ Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#set :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#ownablecallernottheowner) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Error signature: `OwnableCallerNotTheOwner(address)` - Error hash: `0xbf1169c5` @@ -1109,7 +1109,7 @@ Reverts when only the owner is allowed to call the function. :::note References - Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#ownablecannotsetzeroaddressasowner) -- Solidity implementation: [`ERC725.sol`]([object Object]) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) - Error signature: `OwnableCannotSetZeroAddressAsOwner()` - Error hash: `0x1ad8836c` diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP0ERC725Account/LSP0ERC725Account.md b/packages/lsp-smart-contracts/docs/contracts/LSP0ERC725Account/LSP0ERC725Account.md index b15230e2e..8ba13d64b 100644 --- a/packages/lsp-smart-contracts/docs/contracts/LSP0ERC725Account/LSP0ERC725Account.md +++ b/packages/lsp-smart-contracts/docs/contracts/LSP0ERC725Account/LSP0ERC725Account.md @@ -10,7 +10,7 @@ ::: :::info Solidity implementation -[`LSP0ERC725Account.sol`]([object Object]) +[`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) ::: @@ -44,7 +44,7 @@ When marked as 'public', a method can be called both externally and internally, :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#constructor) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) ::: @@ -82,7 +82,7 @@ Set `initialOwner` as the contract owner. :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#fallback) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) ::: @@ -132,7 +132,7 @@ This function is executed when: :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#receive) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) ::: @@ -168,7 +168,7 @@ Executed: :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#renounce_ownership_confirmation_delay) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Function signature: `RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY()` - Function selector: `0xead3fbdf` @@ -194,7 +194,7 @@ function RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY() :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#renounce_ownership_confirmation_period) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Function signature: `RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD()` - Function selector: `0x01bfba61` @@ -220,7 +220,7 @@ function RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD() :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#version) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Function signature: `VERSION()` - Function selector: `0xffa1ad74` @@ -245,7 +245,7 @@ _Contract version._ :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#acceptownership) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Function signature: `acceptOwnership()` - Function selector: `0x79ba5097` @@ -280,7 +280,7 @@ Transfer ownership of the contract from the current [`owner()`](#owner) to the [ :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#batchcalls) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Function signature: `batchCalls(bytes[])` - Function selector: `0x6963d438` @@ -319,7 +319,7 @@ Allows a caller to batch different function calls in one call. Perform a `delega :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#execute) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Function signature: `execute(uint256,address,uint256,bytes)` - Function selector: `0x44c028fe` @@ -387,7 +387,7 @@ Generic executor function to: :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#executebatch) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Function signature: `executeBatch(uint256[],address[],uint256[],bytes[])` - Function selector: `0x31858452` @@ -456,7 +456,7 @@ Batch executor function that behaves the same as [`execute`](#execute) but allow :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#getdata) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Function signature: `getData(bytes32)` - Function selector: `0x54f6127f` @@ -489,7 +489,7 @@ Get in the ERC725Y storage the bytes data stored at a specific data key `dataKey :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#getdatabatch) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Function signature: `getDataBatch(bytes32[])` - Function selector: `0xdedff9c6` @@ -524,7 +524,7 @@ Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#isvalidsignature) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Function signature: `isValidSignature(bytes32,bytes)` - Function selector: `0x1626ba7e` @@ -579,7 +579,7 @@ Handles two cases: :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#owner) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Function signature: `owner()` - Function selector: `0x8da5cb5b` @@ -604,7 +604,7 @@ Returns the address of the current owner. :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#pendingowner) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Function signature: `pendingOwner()` - Function selector: `0xe30c3978` @@ -635,7 +635,7 @@ The address that ownership of the contract is transferred to. This address may u :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#renounceownership) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Function signature: `renounceOwnership()` - Function selector: `0x715018a6` @@ -674,7 +674,7 @@ Renounce ownership of the contract in a 2-step process. :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#setdata) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Function signature: `setData(bytes32,bytes)` - Function selector: `0x7f23690c` @@ -719,7 +719,7 @@ Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#setdatabatch) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Function signature: `setDataBatch(bytes32[],bytes[])` - Function selector: `0x97902421` @@ -764,7 +764,7 @@ Batch data setting function that behaves the same as [`setData`](#setdata) but a :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#supportsinterface) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Function signature: `supportsInterface(bytes4)` - Function selector: `0x01ffc9a7` @@ -797,7 +797,7 @@ Achieves the goal of [ERC-165] to detect supported interfaces and [LSP-17-Contra :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#transferownership) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Function signature: `transferOwnership(address)` - Function selector: `0xf2fde38b` @@ -834,7 +834,7 @@ Initiate the process of transferring ownership of the contract by setting the ne :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#universalreceiver) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Function signature: `universalReceiver(bytes32,bytes)` - Function selector: `0x6bb56a14` @@ -1284,7 +1284,7 @@ function _revertWithLSP20DefaultError( :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#contractcreated) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Event signature: `ContractCreated(uint256,address,uint256,bytes32)` - Event topic hash: `0xa1fb700aaee2ae4a2ff6f91ce7eba292f89c2f5488b8ec4c5c5c8150692595c3` @@ -1319,7 +1319,7 @@ Emitted when a new contract was created and deployed. :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#datachanged) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Event signature: `DataChanged(bytes32,bytes)` - Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` @@ -1347,7 +1347,7 @@ Emitted when data at a specific `dataKey` was changed to a new value `dataValue` :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#executed) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Event signature: `Executed(uint256,address,uint256,bytes4)` - Event topic hash: `0x4810874456b8e6487bd861375cf6abd8e1c8bb5858c8ce36a86a04dabfac199e` @@ -1382,7 +1382,7 @@ Emitted when calling an address `target` (EOA or contract) with `value`. :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#ownershiprenounced) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Event signature: `OwnershipRenounced()` - Event topic hash: `0xd1f66c3d2bc1993a86be5e3d33709d98f0442381befcedd29f578b9b2506b1ce` @@ -1403,7 +1403,7 @@ Emitted when the ownership of the contract has been renounced. :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#ownershiptransferstarted) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Event signature: `OwnershipTransferStarted(address,address)` - Event topic hash: `0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700` @@ -1434,7 +1434,7 @@ Emitted when [`transferOwnership(..)`](#transferownership) was called and the fi :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#ownershiptransferred) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Event signature: `OwnershipTransferred(address,address)` - Event topic hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` @@ -1461,7 +1461,7 @@ event OwnershipTransferred( :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#renounceownershipstarted) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Event signature: `RenounceOwnershipStarted()` - Event topic hash: `0x81b7f830f1f0084db6497c486cbe6974c86488dcc4e3738eab94ab6d6b1653e7` @@ -1482,7 +1482,7 @@ Emitted when starting the [`renounceOwnership(..)`](#renounceownership) 2-step p :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#universalreceiver) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Event signature: `UniversalReceiver(address,uint256,bytes32,bytes,bytes)` - Event topic hash: `0x9c3ba68eb5742b8e3961aea0afc7371a71bf433c8a67a831803b64c064a178c2` @@ -1523,7 +1523,7 @@ Emitted when the [`universalReceiver`](#universalreceiver) function was called w :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#erc725x_contractdeploymentfailed) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Error signature: `ERC725X_ContractDeploymentFailed()` - Error hash: `0x0b07489b` @@ -1542,7 +1542,7 @@ Reverts when contract deployment failed via [`execute`](#execute) or [`executeBa :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#erc725x_createoperationsrequireemptyrecipientaddress) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Error signature: `ERC725X_CreateOperationsRequireEmptyRecipientAddress()` - Error hash: `0x3041824a` @@ -1561,7 +1561,7 @@ Reverts when passing a `to` address that is not `address(0)` (= address zero) wh :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#erc725x_executeparametersemptyarray) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Error signature: `ERC725X_ExecuteParametersEmptyArray()` - Error hash: `0xe9ad2b5f` @@ -1580,7 +1580,7 @@ Reverts when one of the array parameter provided to the [`executeBatch`](#execut :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#erc725x_executeparameterslengthmismatch) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Error signature: `ERC725X_ExecuteParametersLengthMismatch()` - Error hash: `0x3ff55f4d` @@ -1599,7 +1599,7 @@ Reverts when there is not the same number of elements in the `operationTypes`, ` :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#erc725x_insufficientbalance) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Error signature: `ERC725X_InsufficientBalance(uint256,uint256)` - Error hash: `0x0df9a8f8` @@ -1625,7 +1625,7 @@ Reverts when trying to send more native tokens `value` than available in current :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#erc725x_msgvaluedisallowedindelegatecall) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Error signature: `ERC725X_MsgValueDisallowedInDelegateCall()` - Error hash: `0x5ac83135` @@ -1644,7 +1644,7 @@ Reverts when trying to send native tokens (`value` / `values[]` parameter of [`e :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#erc725x_msgvaluedisallowedinstaticcall) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Error signature: `ERC725X_MsgValueDisallowedInStaticCall()` - Error hash: `0x72f2bc6a` @@ -1663,7 +1663,7 @@ Reverts when trying to send native tokens (`value` / `values[]` parameter of [`e :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#erc725x_nocontractbytecodeprovided) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Error signature: `ERC725X_NoContractBytecodeProvided()` - Error hash: `0xb81cd8d9` @@ -1682,7 +1682,7 @@ Reverts when no contract bytecode was provided as parameter when trying to deplo :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#erc725x_unknownoperationtype) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Error signature: `ERC725X_UnknownOperationType(uint256)` - Error hash: `0x7583b3bc` @@ -1707,7 +1707,7 @@ Reverts when the `operationTypeProvided` is none of the default operation types :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#erc725y_datakeysvaluesemptyarray) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Error signature: `ERC725Y_DataKeysValuesEmptyArray()` - Error hash: `0x97da5f95` @@ -1726,7 +1726,7 @@ Reverts when one of the array parameter provided to [`setDataBatch`](#setdatabat :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#erc725y_datakeysvalueslengthmismatch) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` - Error hash: `0x3bcc8979` @@ -1745,7 +1745,7 @@ Reverts when there is not the same number of elements in the `datakeys` and `dat :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#lsp14callernotpendingowner) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Error signature: `LSP14CallerNotPendingOwner(address)` - Error hash: `0x451e4528` @@ -1770,7 +1770,7 @@ Reverts when the `caller` that is trying to accept ownership of the contract is :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#lsp14cannottransferownershiptoself) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Error signature: `LSP14CannotTransferOwnershipToSelf()` - Error hash: `0xe052a6f8` @@ -1791,7 +1791,7 @@ Reverts when trying to transfer ownership to the `address(this)`. :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#lsp14mustacceptownershipinseparatetransaction) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Error signature: `LSP14MustAcceptOwnershipInSeparateTransaction()` - Error hash: `0x5758dd07` @@ -1812,7 +1812,7 @@ Reverts when pending owner accept ownership in the same transaction of transferr :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#lsp14notinrenounceownershipinterval) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Error signature: `LSP14NotInRenounceOwnershipInterval(uint256,uint256)` - Error hash: `0x1b080942` @@ -1843,7 +1843,7 @@ Reverts when trying to renounce ownership before the initial confirmation delay. :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#lsp20callverificationfailed) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Error signature: `LSP20CallVerificationFailed(bool,bytes4)` - Error hash: `0x9d6741e3` @@ -1869,7 +1869,7 @@ reverts when the call to the owner does not return the LSP20 success value :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#lsp20callingverifierfailed) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Error signature: `LSP20CallingVerifierFailed(bool)` - Error hash: `0x8c6a8ae3` @@ -1894,7 +1894,7 @@ reverts when the call to the owner fail with no revert reason :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#lsp20eoacannotverifycall) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Error signature: `LSP20EOACannotVerifyCall(address)` - Error hash: `0x0c392301` @@ -1919,7 +1919,7 @@ Reverts when the logic verifier is an Externally Owned Account (EOA) that cannot :::note References - Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#noextensionfoundforfunctionselector) -- Solidity implementation: [`LSP0ERC725Account.sol`]([object Object]) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp0-contracts/contracts/LSP0ERC725Account.sol) - Error signature: `NoExtensionFoundForFunctionSelector(bytes4)` - Error hash: `0xbb370b2b` diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.md b/packages/lsp-smart-contracts/docs/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.md index 96472255a..0bb2c8512 100644 --- a/packages/lsp-smart-contracts/docs/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.md +++ b/packages/lsp-smart-contracts/docs/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.md @@ -10,7 +10,7 @@ ::: :::info Solidity implementation -[`LSP11BasicSocialRecovery.sol`]([object Object]) +[`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) ::: @@ -28,7 +28,7 @@ When marked as 'public', a method can be called both externally and internally, :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#constructor) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) ::: @@ -52,7 +52,7 @@ _Sets the target and the owner addresses_ :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#addguardian) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Function signature: `addGuardian(address)` - Function selector: `0xa526d83b` @@ -77,7 +77,7 @@ Adds a guardian of the targetCan be called only by the owner :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#getguardianchoice) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Function signature: `getGuardianChoice(address)` - Function selector: `0xf6a22f02` @@ -108,7 +108,7 @@ Returns the address of a controller that a `guardian` selected for in order to r :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#getguardians) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Function signature: `getGuardians()` - Function selector: `0x0665f04b` @@ -133,7 +133,7 @@ Returns the addresses of all guardians The guardians will select an address to b :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#getguardiansthreshold) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Function signature: `getGuardiansThreshold()` - Function selector: `0x187c5348` @@ -158,7 +158,7 @@ Returns the guardian threshold The guardian threshold represents the minimum num :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#getrecoverycounter) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Function signature: `getRecoveryCounter()` - Function selector: `0xf79c8b77` @@ -183,7 +183,7 @@ Returns the current recovery counter When a recovery process is successfully fin :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#getrecoverysecrethash) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Function signature: `getRecoverySecretHash()` - Function selector: `0x8f9083bb` @@ -208,7 +208,7 @@ Returns the recovery secret hash :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#isguardian) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Function signature: `isGuardian(address)` - Function selector: `0x0c68ba21` @@ -239,7 +239,7 @@ Returns TRUE if the address provided is a guardian, FALSE otherwise :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#owner) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Function signature: `owner()` - Function selector: `0x8da5cb5b` @@ -264,7 +264,7 @@ Returns the address of the current owner. :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#recoverownership) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Function signature: `recoverOwnership(address,string,bytes32)` - Function selector: `0xae8481b2` @@ -299,7 +299,7 @@ Recovers the ownership permissions of an address in the linked target and increm :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#removeguardian) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Function signature: `removeGuardian(address)` - Function selector: `0x71404156` @@ -324,7 +324,7 @@ Removes a guardian of the targetCan be called only by the owner :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#renounceownership) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Function signature: `renounceOwnership()` - Function selector: `0x715018a6` @@ -343,7 +343,7 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#selectnewcontroller) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Function signature: `selectNewController(address)` - Function selector: `0xaa7806d6` @@ -370,7 +370,7 @@ select an address to be a potentiel controller address if he reaches the guardia :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#setguardiansthreshold) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Function signature: `setGuardiansThreshold(uint256)` - Function selector: `0x6bfed20b` @@ -395,7 +395,7 @@ Sets the minimum number of selection by the guardians required so that an addres :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#setrecoverysecrethash) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Function signature: `setRecoverySecretHash(bytes32)` - Function selector: `0xf799e38d` @@ -422,7 +422,7 @@ Throws if hash provided is bytes32(0) :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#supportsinterface) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Function signature: `supportsInterface(bytes4)` - Function selector: `0x01ffc9a7` @@ -453,7 +453,7 @@ See [`IERC165-supportsInterface`](#ierc165-supportsinterface). :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#target) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Function signature: `target()` - Function selector: `0xd4b83992` @@ -478,7 +478,7 @@ The address of an ERC725 contract where we want to recover and set permissions f :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#transferownership) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Function signature: `transferOwnership(address)` - Function selector: `0xf2fde38b` @@ -571,7 +571,7 @@ To avoid keeping unnecessary state :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#guardianadded) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Event signature: `GuardianAdded(address)` - Event topic hash: `0x038596bb31e2e7d3d9f184d4c98b310103f6d7f5830e5eec32bffe6f1728f969` @@ -596,7 +596,7 @@ _Emitted when setting a new guardian for the target_ :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#guardianremoved) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Event signature: `GuardianRemoved(address)` - Event topic hash: `0xb8107d0c6b40be480ce3172ee66ba6d64b71f6b1685a851340036e6e2e3e3c52` @@ -621,7 +621,7 @@ _Emitted when removing an existing guardian for the target_ :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#guardiansthresholdchanged) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Event signature: `GuardiansThresholdChanged(uint256)` - Event topic hash: `0x7146d20a2c7b7c75c203774c9f241b61698fac43a4a81ccd828f0d8162392790` @@ -646,7 +646,7 @@ _Emitted when changing the guardian threshold_ :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#ownershiptransferred) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Event signature: `OwnershipTransferred(address,address)` - Event topic hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` @@ -673,7 +673,7 @@ event OwnershipTransferred( :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#recoveryprocesssuccessful) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Event signature: `RecoveryProcessSuccessful(uint256,address,bytes32,address[])` - Event topic hash: `0xf4ff8803d6b43af46d48c200977209829c2f42f19f27eda1c89dbf26a28009cd` @@ -706,7 +706,7 @@ _Emitted when the recovery process is finished by the controller who reached the :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#secrethashchanged) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Event signature: `SecretHashChanged(bytes32)` - Event topic hash: `0x2e8c5419a62207ade549fe0b66c1c85c16f5e1ed654815dee3a3f3ac41770df3` @@ -731,7 +731,7 @@ _Emitted when changing the secret hash_ :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#selectednewcontroller) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Event signature: `SelectedNewController(uint256,address,address)` - Event topic hash: `0xe43f3c1093c69ab76b2cf6246090acb2f8eab7f19ba9942dfc8b8ec446e3a3de` @@ -764,7 +764,7 @@ _Emitted when a guardian select a new potentiel controller address for the targe :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#addresszeronotallowed) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Error signature: `AddressZeroNotAllowed()` - Error hash: `0x0855380c` @@ -783,7 +783,7 @@ reverts when the address zero calls `recoverOwnership(..)` function :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#callerisnotguardian) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Error signature: `CallerIsNotGuardian(address)` - Error hash: `0x5560e16d` @@ -808,7 +808,7 @@ reverts when the caller is not a guardian :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#guardianalreadyexist) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Error signature: `GuardianAlreadyExist(address)` - Error hash: `0xd52858db` @@ -833,7 +833,7 @@ reverts when adding an already existing guardian :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#guardiandonotexist) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Error signature: `GuardianDoNotExist(address)` - Error hash: `0x3d8e524e` @@ -858,7 +858,7 @@ reverts when removing a non-existing guardian :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#guardiansnumbercannotgobelowthreshold) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Error signature: `GuardiansNumberCannotGoBelowThreshold(uint256)` - Error hash: `0x27113777` @@ -883,7 +883,7 @@ reverts when removing a guardian and the threshold is equal to the number of gua :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#ownablecallernottheowner) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Error signature: `OwnableCallerNotTheOwner(address)` - Error hash: `0xbf1169c5` @@ -908,7 +908,7 @@ Reverts when only the owner is allowed to call the function. :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#ownablecannotsetzeroaddressasowner) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Error signature: `OwnableCannotSetZeroAddressAsOwner()` - Error hash: `0x1ad8836c` @@ -927,7 +927,7 @@ Reverts when trying to set `address(0)` as the contract owner when deploying the :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#secrethashcannotbezero) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Error signature: `SecretHashCannotBeZero()` - Error hash: `0x7f617002` @@ -946,7 +946,7 @@ reverts when the secret hash provided is equal to bytes32(0) :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#thresholdcannotbehigherthanguardiansnumber) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Error signature: `ThresholdCannotBeHigherThanGuardiansNumber(uint256,uint256)` - Error hash: `0xe3db80bd` @@ -975,7 +975,7 @@ reverts when setting the guardians threshold to a number higher than the guardia :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#thresholdnotreachedforrecoverer) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Error signature: `ThresholdNotReachedForRecoverer(address,uint256,uint256)` - Error hash: `0xf78f0507` @@ -1006,7 +1006,7 @@ reverts when `recoverOwnership(..)` is called with a recoverer that didn't reach :::note References - Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-11-BasicSocialRecovery.md#wrongplainsecret) -- Solidity implementation: [`LSP11BasicSocialRecovery.sol`]([object Object]) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp-smart-contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) - Error signature: `WrongPlainSecret()` - Error hash: `0x6fa723c3` diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP14Ownable2Step/LSP14Ownable2Step.md b/packages/lsp-smart-contracts/docs/contracts/LSP14Ownable2Step/LSP14Ownable2Step.md new file mode 100644 index 000000000..40475d06c --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP14Ownable2Step/LSP14Ownable2Step.md @@ -0,0 +1,533 @@ + + + +# LSP14Ownable2Step + +:::info Standard Specifications + +[`LSP-14-Ownable2Step`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-14-Ownable2Step.md) + +::: +:::info Solidity implementation + +[`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp14-contracts/contracts/LSP14Ownable2Step.sol) + +::: + +> LSP14Ownable2Step + +This contract is a modified version of the [`OwnableUnset.sol`] implementation, where transferring and renouncing ownership works as a 2-step process. This can be used as a confirmation mechanism to prevent potential mistakes when transferring ownership of the contract, where the control of the contract could be lost forever. (_e.g: providing the wrong address as a parameter to the function, transferring ownership to an EOA for which the user lost its private key, etc..._) + +## 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. + +### RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-14-Ownable2Step.md#renounce_ownership_confirmation_delay) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp14-contracts/contracts/LSP14Ownable2Step.sol) +- Function signature: `RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY()` +- Function selector: `0xead3fbdf` + +::: + +```solidity +function RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY() + external + view + returns (uint256); +``` + +The number of block that MUST pass before one is able to confirm renouncing ownership. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------- | +| `0` | `uint256` | Number of blocks. | + +
+ +### RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-14-Ownable2Step.md#renounce_ownership_confirmation_period) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp14-contracts/contracts/LSP14Ownable2Step.sol) +- Function signature: `RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD()` +- Function selector: `0x01bfba61` + +::: + +```solidity +function RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD() + external + view + returns (uint256); +``` + +The number of blocks during which one can renounce ownership. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------- | +| `0` | `uint256` | Number of blocks. | + +
+ +### acceptOwnership + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-14-Ownable2Step.md#acceptownership) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp14-contracts/contracts/LSP14Ownable2Step.sol) +- Function signature: `acceptOwnership()` +- Function selector: `0x79ba5097` + +::: + +```solidity +function acceptOwnership() external nonpayable; +``` + +_`msg.sender` is accepting ownership of contract: `address(this)`._ + +Transfer ownership of the contract from the current [`owner()`](#owner) to the [`pendingOwner()`](#pendingowner). Once this function is called: + +- The current [`owner()`](#owner) will lose access to the functions restricted to the [`owner()`](#owner) only. + +- The [`pendingOwner()`](#pendingowner) will gain access to the functions restricted to the [`owner()`](#owner) only. + +
+ +**Requirements:** + +- This function can only be called by the [`pendingOwner()`](#pendingowner). + +
+ +
+ +### owner + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-14-Ownable2Step.md#owner) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp14-contracts/contracts/LSP14Ownable2Step.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` | - | + +
+ +### pendingOwner + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-14-Ownable2Step.md#pendingowner) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp14-contracts/contracts/LSP14Ownable2Step.sol) +- Function signature: `pendingOwner()` +- Function selector: `0xe30c3978` + +::: + +:::info + +If no ownership transfer is in progress, the pendingOwner will be `address(0).`. + +::: + +```solidity +function pendingOwner() external view returns (address); +``` + +The address that ownership of the contract is transferred to. This address may use [`acceptOwnership()`](#acceptownership) to gain ownership of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `address` | - | + +
+ +### renounceOwnership + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-14-Ownable2Step.md#renounceownership) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp14-contracts/contracts/LSP14Ownable2Step.sol) +- Function signature: `renounceOwnership()` +- Function selector: `0x715018a6` + +::: + +:::danger + +Leaves the contract without an owner. Once ownership of the contract has been renounced, any function that is restricted to be called only by the owner will be permanently inaccessible, making these functions not callable anymore and unusable. + +::: + +```solidity +function renounceOwnership() external nonpayable; +``` + +_`msg.sender` is renouncing ownership of contract `address(this)`._ + +Renounce ownership of the contract in a 2-step process. + +1. The first call will initiate the process of renouncing ownership. + +2. The second call is used as a confirmation and will leave the contract without an owner. + +
+ +### transferOwnership + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-14-Ownable2Step.md#transferownership) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp14-contracts/contracts/LSP14Ownable2Step.sol) +- Function signature: `transferOwnership(address)` +- Function selector: `0xf2fde38b` + +::: + +```solidity +function transferOwnership(address newOwner) external nonpayable; +``` + +_Transfer ownership initiated by `newOwner`._ + +Initiate the process of transferring ownership of the contract by setting the new owner as the pending owner. If the new owner is a contract that supports + implements LSP1, this will also attempt to notify the new owner that ownership has been transferred to them by calling the [`universalReceiver()`](#universalreceiver) function on the `newOwner` contract. + +
+ +**Requirements:** + +- `newOwner` cannot accept ownership of the contract in the same transaction. (For instance, via a callback from its [`universalReceiver(...)`](#universalreceiver) function). + +
+ +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------------------------- | +| `newOwner` | `address` | The address of the new owner. | + +
+ +## 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. + +
+ +### \_transferOwnership + +```solidity +function _transferOwnership(address newOwner) internal nonpayable; +``` + +Set the pending owner of the contract and cancel any renounce ownership process that was previously started. + +
+ +**Requirements:** + +- `newOwner` cannot be the address of the contract itself. + +
+ +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------- | +| `newOwner` | `address` | The address of the new pending owner. | + +
+ +### \_acceptOwnership + +```solidity +function _acceptOwnership() internal nonpayable; +``` + +Set the pending owner of the contract as the new owner. + +
+ +### \_renounceOwnership + +```solidity +function _renounceOwnership() internal nonpayable; +``` + +Initiate or confirm the process of renouncing ownership after a specific delay of blocks have passed. + +
+ +## Events + +### OwnershipRenounced + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-14-Ownable2Step.md#ownershiprenounced) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp14-contracts/contracts/LSP14Ownable2Step.sol) +- Event signature: `OwnershipRenounced()` +- Event topic hash: `0xd1f66c3d2bc1993a86be5e3d33709d98f0442381befcedd29f578b9b2506b1ce` + +::: + +```solidity +event OwnershipRenounced(); +``` + +_Successfully renounced ownership of the contract. This contract is now owned by anyone, it's owner is `address(0)`._ + +Emitted when the ownership of the contract has been renounced. + +
+ +### OwnershipTransferStarted + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-14-Ownable2Step.md#ownershiptransferstarted) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp14-contracts/contracts/LSP14Ownable2Step.sol) +- Event signature: `OwnershipTransferStarted(address,address)` +- Event topic hash: `0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700` + +::: + +```solidity +event OwnershipTransferStarted( + address indexed previousOwner, + address indexed newOwner +); +``` + +_The transfer of ownership of the contract was initiated. Pending new owner set to: `newOwner`._ + +Emitted when [`transferOwnership(..)`](#transferownership) was called and the first step of transferring ownership completed successfully which leads to [`pendingOwner`](#pendingowner) being updated. + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ---------------------------------- | +| `previousOwner` **`indexed`** | `address` | The address of the previous owner. | +| `newOwner` **`indexed`** | `address` | The address of the new owner. | + +
+ +### OwnershipTransferred + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-14-Ownable2Step.md#ownershiptransferred) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp14-contracts/contracts/LSP14Ownable2Step.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` | - | + +
+ +### RenounceOwnershipStarted + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-14-Ownable2Step.md#renounceownershipstarted) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp14-contracts/contracts/LSP14Ownable2Step.sol) +- Event signature: `RenounceOwnershipStarted()` +- Event topic hash: `0x81b7f830f1f0084db6497c486cbe6974c86488dcc4e3738eab94ab6d6b1653e7` + +::: + +```solidity +event RenounceOwnershipStarted(); +``` + +_Ownership renouncement initiated._ + +Emitted when starting the [`renounceOwnership(..)`](#renounceownership) 2-step process. + +
+ +## Errors + +### LSP14CallerNotPendingOwner + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-14-Ownable2Step.md#lsp14callernotpendingowner) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp14-contracts/contracts/LSP14Ownable2Step.sol) +- Error signature: `LSP14CallerNotPendingOwner(address)` +- Error hash: `0x451e4528` + +::: + +```solidity +error LSP14CallerNotPendingOwner(address caller); +``` + +Reverts when the `caller` that is trying to accept ownership of the contract is not the pending owner. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------------- | +| `caller` | `address` | The address that tried to accept ownership. | + +
+ +### LSP14CannotTransferOwnershipToSelf + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-14-Ownable2Step.md#lsp14cannottransferownershiptoself) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp14-contracts/contracts/LSP14Ownable2Step.sol) +- Error signature: `LSP14CannotTransferOwnershipToSelf()` +- Error hash: `0xe052a6f8` + +::: + +```solidity +error LSP14CannotTransferOwnershipToSelf(); +``` + +_Cannot transfer ownership to the address of the contract itself._ + +Reverts when trying to transfer ownership to the `address(this)`. + +
+ +### LSP14MustAcceptOwnershipInSeparateTransaction + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-14-Ownable2Step.md#lsp14mustacceptownershipinseparatetransaction) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp14-contracts/contracts/LSP14Ownable2Step.sol) +- Error signature: `LSP14MustAcceptOwnershipInSeparateTransaction()` +- Error hash: `0x5758dd07` + +::: + +```solidity +error LSP14MustAcceptOwnershipInSeparateTransaction(); +``` + +_Cannot accept ownership in the same transaction with [`transferOwnership(...)`](#transferownership)._ + +Reverts when pending owner accept ownership in the same transaction of transferring ownership. + +
+ +### LSP14NotInRenounceOwnershipInterval + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-14-Ownable2Step.md#lsp14notinrenounceownershipinterval) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp14-contracts/contracts/LSP14Ownable2Step.sol) +- Error signature: `LSP14NotInRenounceOwnershipInterval(uint256,uint256)` +- Error hash: `0x1b080942` + +::: + +```solidity +error LSP14NotInRenounceOwnershipInterval( + uint256 renounceOwnershipStart, + uint256 renounceOwnershipEnd +); +``` + +_Cannot confirm ownership renouncement yet. The ownership renouncement is allowed from: `renounceOwnershipStart` until: `renounceOwnershipEnd`._ + +Reverts when trying to renounce ownership before the initial confirmation delay. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ----------------------------------------------------------------------- | +| `renounceOwnershipStart` | `uint256` | The start timestamp when one can confirm the renouncement of ownership. | +| `renounceOwnershipEnd` | `uint256` | The end timestamp when one can confirm the renouncement of ownership. | + +
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-14-Ownable2Step.md#ownablecallernottheowner) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp14-contracts/contracts/LSP14Ownable2Step.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP16UniversalFactory/LSP16UniversalFactory.md b/packages/lsp-smart-contracts/docs/contracts/LSP16UniversalFactory/LSP16UniversalFactory.md new file mode 100644 index 000000000..6e0bee380 --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP16UniversalFactory/LSP16UniversalFactory.md @@ -0,0 +1,435 @@ + + + +# LSP16UniversalFactory + +:::info Standard Specifications + +[`LSP-16-UniversalFactory`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-16-UniversalFactory.md) + +::: +:::info Solidity implementation + +[`LSP16UniversalFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp16-contracts/contracts/LSP16UniversalFactory.sol) + +::: + +> LSP16 Universal Factory + +Factory contract to deploy different types of contracts using the CREATE2 opcode standardized as LSP16 + +- UniversalFactory: https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-16-UniversalFactory.md The UniversalFactory will be deployed using Nick's Factory (0x4e59b44847b379578588920ca78fbf26c0b4956c) The deployed address can be found in the LSP16 specification. Please refer to the LSP16 Specification to obtain the exact creation bytecode and salt that should be used to produce the address of the UniversalFactory on different chains. This factory contract is designed to deploy contracts at the same address on multiple chains. The UniversalFactory can deploy 2 types of contracts: + +- non-initializable (normal deployment) + +- initializable (external call after deployment, e.g: proxy contracts) The `providedSalt` parameter given by the deployer is not used directly as the salt by the CREATE2 opcode. Instead, it is used along with these parameters: + +- `initializable` boolean + +- `initializeCalldata` (when the contract is initializable and `initializable` is set to `true`). These three parameters are concatenated together and hashed to generate the final salt for CREATE2. See [`generateSalt`](#generatesalt) function for more details. The constructor and `initializeCalldata` SHOULD NOT include any network-specific parameters (e.g: chain-id, a local token contract address), otherwise the deployed contract will not be recreated at the same address across different networks, thus defeating the purpose of the UniversalFactory. One way to solve this problem is to set an EOA owner in the `initializeCalldata`/constructor that can later call functions that set these parameters as variables in the contract. The UniversalFactory must be deployed at the same address on different chains to successfully deploy contracts at the same address across different chains. + +## 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. + +### computeAddress + +:::note References + +- Specification details: [**LSP-16-UniversalFactory**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-16-UniversalFactory.md#computeaddress) +- Solidity implementation: [`LSP16UniversalFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp16-contracts/contracts/LSP16UniversalFactory.sol) +- Function signature: `computeAddress(bytes32,bytes32,bool,bytes)` +- Function selector: `0x3b315680` + +::: + +```solidity +function computeAddress( + bytes32 creationBytecodeHash, + bytes32 providedSalt, + bool initializable, + bytes initializeCalldata +) external view returns (address); +``` + +Computes the address of a contract to be deployed using CREATE2, based on the input parameters. Any change in one of these parameters will result in a different address. When the `initializable` boolean is set to `false`, `initializeCalldata` will not affect the function output. + +#### Parameters + +| Name | Type | Description | +| ---------------------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------------------- | +| `creationBytecodeHash` | `bytes32` | The keccak256 hash of the creation bytecode to be deployed | +| `providedSalt` | `bytes32` | The salt provided by the deployer, which will be used to generate the final salt that will be used by the `CREATE2` opcode for contract deployment | +| `initializable` | `bool` | A boolean that indicates whether an external call should be made to initialize the contract after deployment | +| `initializeCalldata` | `bytes` | The calldata to be executed on the created contract if `initializable` is set to `true` | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------------- | +| `0` | `address` | The address where the contract will be deployed | + +
+ +### computeERC1167Address + +:::note References + +- Specification details: [**LSP-16-UniversalFactory**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-16-UniversalFactory.md#computeerc1167address) +- Solidity implementation: [`LSP16UniversalFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp16-contracts/contracts/LSP16UniversalFactory.sol) +- Function signature: `computeERC1167Address(address,bytes32,bool,bytes)` +- Function selector: `0xe888edcb` + +::: + +```solidity +function computeERC1167Address( + address implementationContract, + bytes32 providedSalt, + bool initializable, + bytes initializeCalldata +) external view returns (address); +``` + +Computes the address of an ERC1167 proxy contract based on the input parameters. Any change in one of these parameters will result in a different address. When the `initializable` boolean is set to `false`, `initializeCalldata` will not affect the function output. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | -------------------------------------------------------------------------------------------------------------------------------------------------- | +| `implementationContract` | `address` | The contract to create a clone of according to ERC1167 | +| `providedSalt` | `bytes32` | The salt provided by the deployer, which will be used to generate the final salt that will be used by the `CREATE2` opcode for contract deployment | +| `initializable` | `bool` | A boolean that indicates whether an external call should be made to initialize the proxy contract after deployment | +| `initializeCalldata` | `bytes` | The calldata to be executed on the created contract if `initializable` is set to `true` | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------------------------- | +| `0` | `address` | The address where the ERC1167 proxy contract will be deployed | + +
+ +### deployCreate2 + +:::note References + +- Specification details: [**LSP-16-UniversalFactory**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-16-UniversalFactory.md#deploycreate2) +- Solidity implementation: [`LSP16UniversalFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp16-contracts/contracts/LSP16UniversalFactory.sol) +- Function signature: `deployCreate2(bytes,bytes32)` +- Function selector: `0x26736355` + +::: + +```solidity +function deployCreate2( + bytes creationBytecode, + bytes32 providedSalt +) external payable returns (address); +``` + +_Deploys a smart contract._ + +Deploys a contract using the CREATE2 opcode. The address where the contract will be deployed can be known in advance via the [`computeAddress`](#computeaddress) function. This function deploys contracts without initialization (external call after deployment). The `providedSalt` parameter is not used directly as the salt by the CREATE2 opcode. Instead, it is hashed with keccak256: `keccak256(abi.encodePacked(false, providedSalt))`. See [`generateSalt`](#generatesalt) function for more details. Using the same `creationBytecode` and `providedSalt` multiple times will revert, as the contract cannot be deployed twice at the same address. If the constructor of the contract to deploy is payable, value can be sent to this function to fund the created contract. However, sending value to this function while the constructor is not payable will result in a revert. + +#### Parameters + +| Name | Type | Description | +| ------------------ | :-------: | -------------------------------------------------------------------------------------------------------------------------------------------------- | +| `creationBytecode` | `bytes` | The creation bytecode of the contract to be deployed | +| `providedSalt` | `bytes32` | The salt provided by the deployer, which will be used to generate the final salt that will be used by the `CREATE2` opcode for contract deployment | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------ | +| `0` | `address` | The address of the deployed contract | + +
+ +### deployCreate2AndInitialize + +:::note References + +- Specification details: [**LSP-16-UniversalFactory**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-16-UniversalFactory.md#deploycreate2andinitialize) +- Solidity implementation: [`LSP16UniversalFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp16-contracts/contracts/LSP16UniversalFactory.sol) +- Function signature: `deployCreate2AndInitialize(bytes,bytes32,bytes,uint256,uint256)` +- Function selector: `0xcdbd473a` + +::: + +```solidity +function deployCreate2AndInitialize( + bytes creationBytecode, + bytes32 providedSalt, + bytes initializeCalldata, + uint256 constructorMsgValue, + uint256 initializeCalldataMsgValue +) external payable returns (address); +``` + +_Deploys a smart contract and initializes it._ + +Deploys a contract using the CREATE2 opcode. The address where the contract will be deployed can be known in advance via the [`computeAddress`](#computeaddress) function. This function deploys contracts with initialization (external call after deployment). The `providedSalt` parameter is not used directly as the salt by the CREATE2 opcode. Instead, it is hashed with keccak256: `keccak256(abi.encodePacked(true, initializeCalldata, providedSalt))`. See [`generateSalt`](#generatesalt) function for more details. Using the same `creationBytecode`, `providedSalt` and `initializeCalldata` multiple times will revert, as the contract cannot be deployed twice at the same address. If the constructor or the initialize function of the contract to deploy is payable, value can be sent along with the deployment/initialization to fund the created contract. However, sending value to this function while the constructor/initialize function is not payable will result in a revert. Will revert if the `msg.value` sent to the function is not equal to the sum of `constructorMsgValue` and `initializeCalldataMsgValue`. + +#### Parameters + +| Name | Type | Description | +| ---------------------------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------------------- | +| `creationBytecode` | `bytes` | The creation bytecode of the contract to be deployed | +| `providedSalt` | `bytes32` | The salt provided by the deployer, which will be used to generate the final salt that will be used by the `CREATE2` opcode for contract deployment | +| `initializeCalldata` | `bytes` | The calldata to be executed on the created contract | +| `constructorMsgValue` | `uint256` | The value sent to the contract during deployment | +| `initializeCalldataMsgValue` | `uint256` | The value sent to the contract during initialization | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------ | +| `0` | `address` | The address of the deployed contract | + +
+ +### deployERC1167Proxy + +:::note References + +- Specification details: [**LSP-16-UniversalFactory**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-16-UniversalFactory.md#deployerc1167proxy) +- Solidity implementation: [`LSP16UniversalFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp16-contracts/contracts/LSP16UniversalFactory.sol) +- Function signature: `deployERC1167Proxy(address,bytes32)` +- Function selector: `0x49d8abed` + +::: + +```solidity +function deployERC1167Proxy( + address implementationContract, + bytes32 providedSalt +) external nonpayable returns (address); +``` + +_Deploys a proxy smart contract._ + +Deploys an ERC1167 minimal proxy contract using the CREATE2 opcode. The address where the contract will be deployed can be known in advance via the [`computeERC1167Address`](#computeerc1167address) function. This function deploys contracts without initialization (external call after deployment). The `providedSalt` parameter is not used directly as the salt by the CREATE2 opcode. Instead, it is hashed with keccak256: `keccak256(abi.encodePacked(false, providedSalt))`. See [`generateSalt`](#generatesalt) function for more details. Using the same `implementationContract` and `providedSalt` multiple times will revert, as the contract cannot be deployed twice at the same address. Sending value to the contract created is not possible since the constructor of the ERC1167 minimal proxy is not payable. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | -------------------------------------------------------------------------------------------------------------------------------------------------- | +| `implementationContract` | `address` | The contract address to use as the base implementation behind the proxy that will be deployed | +| `providedSalt` | `bytes32` | The salt provided by the deployer, which will be used to generate the final salt that will be used by the `CREATE2` opcode for contract deployment | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------- | +| `0` | `address` | The address of the minimal proxy deployed | + +
+ +### deployERC1167ProxyAndInitialize + +:::note References + +- Specification details: [**LSP-16-UniversalFactory**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-16-UniversalFactory.md#deployerc1167proxyandinitialize) +- Solidity implementation: [`LSP16UniversalFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp16-contracts/contracts/LSP16UniversalFactory.sol) +- Function signature: `deployERC1167ProxyAndInitialize(address,bytes32,bytes)` +- Function selector: `0x5340165f` + +::: + +```solidity +function deployERC1167ProxyAndInitialize( + address implementationContract, + bytes32 providedSalt, + bytes initializeCalldata +) external payable returns (address); +``` + +_Deploys a proxy smart contract and initializes it._ + +Deploys an ERC1167 minimal proxy contract using the CREATE2 opcode. The address where the contract will be deployed can be known in advance via the [`computeERC1167Address`](#computeerc1167address) function. This function deploys contracts with initialization (external call after deployment). The `providedSalt` parameter is not used directly as the salt by the CREATE2 opcode. Instead, it is hashed with keccak256: `keccak256(abi.encodePacked(true, initializeCalldata, providedSalt))`. See [`generateSalt`](#generatesalt) function for more details. Using the same `implementationContract`, `providedSalt` and `initializeCalldata` multiple times will revert, as the contract cannot be deployed twice at the same address. If the initialize function of the contract to deploy is payable, value can be sent along to fund the created contract while initializing. However, sending value to this function while the initialize function is not payable will result in a revert. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | -------------------------------------------------------------------------------------------------------------------------------------------------- | +| `implementationContract` | `address` | The contract address to use as the base implementation behind the proxy that will be deployed | +| `providedSalt` | `bytes32` | The salt provided by the deployer, which will be used to generate the final salt that will be used by the `CREATE2` opcode for contract deployment | +| `initializeCalldata` | `bytes` | The calldata to be executed on the created contract | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------- | +| `0` | `address` | The address of the minimal proxy deployed | + +
+ +### generateSalt + +:::note References + +- Specification details: [**LSP-16-UniversalFactory**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-16-UniversalFactory.md#generatesalt) +- Solidity implementation: [`LSP16UniversalFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp16-contracts/contracts/LSP16UniversalFactory.sol) +- Function signature: `generateSalt(bytes32,bool,bytes)` +- Function selector: `0x1a17ccbf` + +::: + +```solidity +function generateSalt( + bytes32 providedSalt, + bool initializable, + bytes initializeCalldata +) external pure returns (bytes32); +``` + +Generates the salt used to deploy the contract by hashing the following parameters (concatenated together) with keccak256: + +1. the `providedSalt` + +2. the `initializable` boolean + +3. the `initializeCalldata`, only if the contract is initializable (the `initializable` boolean is set to `true`) + +- The `providedSalt` parameter is not used directly as the salt by the CREATE2 opcode. Instead, it is used along with these parameters: + +1. `initializable` boolean + +2. `initializeCalldata` (when the contract is initializable and `initializable` is set to `true`). + +- This approach ensures that in order to reproduce an initializable contract at the same address on another chain, not only the `providedSalt` is required to be the same, but also the initialize parameters within the `initializeCalldata` must also be the same. This maintains consistent deployment behaviour. Users are required to initialize contracts with the same parameters across different chains to ensure contracts are deployed at the same address across different chains. + +1. Example (for initializable contracts) + +- For an existing contract A on chain 1 owned by X, to replicate the same contract at the same address with the same owner X on chain 2, the salt used to generate the address should include the initializeCalldata that assigns X as the owner of contract A. + +- For instance, if another user, Y, tries to deploy the contract at the same address on chain 2 using the same providedSalt, but with a different initializeCalldata to make Y the owner instead of X, the generated address would be different, preventing Y from deploying the contract with different ownership at the same address. + +- However, for non-initializable contracts, if the constructor has arguments that specify the deployment behavior, they will be included in the creation bytecode. Any change in the constructor arguments will lead to a different contract's creation bytecode which will result in a different address on other chains. + +2. Example (for non-initializable contracts) + +- If a contract is deployed with specific constructor arguments on chain 1, these arguments are embedded within the creation bytecode. For instance, if contract B is deployed with a specific `tokenName` and `tokenSymbol` on chain 1, and a user wants to deploy the same contract with the same `tokenName` and `tokenSymbol` on chain 2, they must use the same constructor arguments to produce the same creation bytecode. This ensures that the same deployment behaviour is maintained across different chains, as long as the same creation bytecode is used. + +- If another user Z, tries to deploy the same contract B at the same address on chain 2 using the same `providedSalt` but different constructor arguments (a different `tokenName` and/or `tokenSymbol`), the generated address will be different. This prevents user Z from deploying the contract with different constructor arguments at the same address on chain 2. + +- The providedSalt was hashed to produce the salt used by CREATE2 opcode to prevent users from deploying initializable contracts using non-initializable functions such as [`deployCreate2`](#deploycreate2) without having the initialization call. + +- In other words, if the providedSalt was not hashed and was used as it is as the salt by the CREATE2 opcode, malicious users can check the generated salt used for the already deployed initializable contract on chain 1, and deploy the contract from [`deployCreate2`](#deploycreate2) function on chain 2, with passing the generated salt of the deployed contract as providedSalt that will produce the same address but without the initialization, where the malicious user can initialize after. + +#### Parameters + +| Name | Type | Description | +| -------------------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------------------- | +| `providedSalt` | `bytes32` | The salt provided by the deployer, which will be used to generate the final salt that will be used by the `CREATE2` opcode for contract deployment | +| `initializable` | `bool` | The Boolean that specifies if the contract must be initialized or not | +| `initializeCalldata` | `bytes` | The calldata to be executed on the created contract if `initializable` is set to `true` | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------------------------ | +| `0` | `bytes32` | The generated salt which will be used for CREATE2 deployment | + +
+ +## 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. + +### \_verifyCallResult + +```solidity +function _verifyCallResult(bool success, bytes returndata) internal pure; +``` + +Verifies that the contract created was initialized correctly. +Bubble the revert reason if present, revert with `ContractInitializationFailed` otherwise. + +
+ +## Events + +### ContractCreated + +:::note References + +- Specification details: [**LSP-16-UniversalFactory**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-16-UniversalFactory.md#contractcreated) +- Solidity implementation: [`LSP16UniversalFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp16-contracts/contracts/LSP16UniversalFactory.sol) +- Event signature: `ContractCreated(address,bytes32,bytes32,bool,bytes)` +- Event topic hash: `0x8872a323d65599f01bf90dc61c94b4e0cc8e2347d6af4122fccc3e112ee34a84` + +::: + +```solidity +event ContractCreated( + address indexed createdContract, + bytes32 indexed providedSalt, + bytes32 generatedSalt, + bool indexed initialized, + bytes initializeCalldata +); +``` + +_Contract created. Contract address: `createdContract`._ + +Emitted whenever a contract is created. + +#### Parameters + +| Name | Type | Description | +| ------------------------------- | :-------: | --------------------------------------------------------------------------------------------------------------------------------------------------- | +| `createdContract` **`indexed`** | `address` | The address of the contract created. | +| `providedSalt` **`indexed`** | `bytes32` | The salt provided by the deployer, which will be used to generate the final salt that will be used by the `CREATE2` opcode for contract deployment. | +| `generatedSalt` | `bytes32` | The salt used by the `CREATE2` opcode for contract deployment. | +| `initialized` **`indexed`** | `bool` | The Boolean that specifies if the contract must be initialized or not. | +| `initializeCalldata` | `bytes` | The bytes provided as initializeCalldata (Empty string when `initialized` is set to false). | + +
+ +## Errors + +### ContractInitializationFailed + +:::note References + +- Specification details: [**LSP-16-UniversalFactory**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-16-UniversalFactory.md#contractinitializationfailed) +- Solidity implementation: [`LSP16UniversalFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp16-contracts/contracts/LSP16UniversalFactory.sol) +- Error signature: `ContractInitializationFailed()` +- Error hash: `0xc1ee8543` + +::: + +```solidity +error ContractInitializationFailed(); +``` + +_Couldn't initialize the contract._ + +Reverts when there is no revert reason bubbled up by the created contract when initializing + +
+ +### InvalidValueSum + +:::note References + +- Specification details: [**LSP-16-UniversalFactory**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-16-UniversalFactory.md#invalidvaluesum) +- Solidity implementation: [`LSP16UniversalFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp16-contracts/contracts/LSP16UniversalFactory.sol) +- Error signature: `InvalidValueSum()` +- Error hash: `0x2fd9ca91` + +::: + +```solidity +error InvalidValueSum(); +``` + +Reverts when `msg.value` sent to [`deployCreate2AndInitialize(..)`](#deploycreate2andinitialize) function is not equal to the sum of the `initializeCalldataMsgValue` and `constructorMsgValue` + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP17ContractExtension/LSP17Extendable.md b/packages/lsp-smart-contracts/docs/contracts/LSP17ContractExtension/LSP17Extendable.md new file mode 100644 index 000000000..35b71173d --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP17ContractExtension/LSP17Extendable.md @@ -0,0 +1,125 @@ + + + +# LSP17Extendable + +:::info Standard Specifications + +[`LSP-17-ContractExtension`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-17-ContractExtension.md) + +::: +:::info Solidity implementation + +[`LSP17Extendable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp17contractextension-contracts/contracts/LSP17Extendable.sol) + +::: + +> Module to add more functionalities to a contract using extensions. + +Implementation of the `fallback(...)` logic according to LSP17 + +- Contract Extension standard. This module can be inherited to extend the functionality of the parent contract when calling a function that doesn't exist on the parent contract via forwarding the call to an extension mapped to the function selector being called, set originally by the parent contract + +## 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. + +### supportsInterface + +:::note References + +- Specification details: [**LSP-17-ContractExtension**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-17-ContractExtension.md#supportsinterface) +- Solidity implementation: [`LSP17Extendable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp17contractextension-contracts/contracts/LSP17Extendable.sol) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +See [`IERC165-supportsInterface`](#ierc165-supportsinterface). + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ----------- | +| `interfaceId` | `bytes4` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +
+ +## 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. + +### \_supportsInterfaceInERC165Extension + +```solidity +function _supportsInterfaceInERC165Extension( + bytes4 interfaceId +) internal view returns (bool); +``` + +Returns whether the interfaceId being checked is supported in the extension of the +[`supportsInterface`](#supportsinterface) selector. +To be used by extendable contracts wishing to extend the ERC165 interfaceIds originally +supported by reading whether the interfaceId queried is supported in the `supportsInterface` +extension if the extension is set, if not it returns false. + +
+ +### \_getExtensionAndForwardValue + +```solidity +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); +``` + +Returns the extension mapped to a specific function selector +If no extension was found, return the address(0) +To be overrided. +Up to the implementor contract to return an extension based on a function selector + +
+ +### \_fallbackLSP17Extendable + +:::tip Hint + +This function does not forward to the extension contract the `msg.value` received by the contract that inherits `LSP17Extendable`. +If you would like to forward the `msg.value` to the extension contract, you can override the code of this internal function as follow: + +```solidity +(bool success, bytes memory result) = extension.call{value: msg.value}( + abi.encodePacked(callData, msg.sender, msg.value) +); +``` + +::: + +```solidity +function _fallbackLSP17Extendable( + bytes callData +) internal nonpayable returns (bytes); +``` + +Forwards the call to an extension mapped to a function selector. +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being +called on the account. If there is no extension, the `address(0)` will be returned. +Forwards the value if the extension is payable. +Reverts if there is no extension for the function being called. +If there is an extension for the function selector being called, it calls the extension with the +`CALL` opcode, passing the `msg.data` appended with the 20 bytes of the [`msg.sender`](#msg.sender) and 32 bytes of the `msg.value`. + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP17ContractExtension/LSP17Extension.md b/packages/lsp-smart-contracts/docs/contracts/LSP17ContractExtension/LSP17Extension.md new file mode 100644 index 000000000..18ca24659 --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP17ContractExtension/LSP17Extension.md @@ -0,0 +1,117 @@ + + + +# LSP17Extension + +:::info Standard Specifications + +[`LSP-17-ContractExtension`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-17-ContractExtension.md) + +::: +:::info Solidity implementation + +[`LSP17Extension.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp17contractextension-contracts/contracts/LSP17Extendable.sol) + +::: + +> Module to create a contract that can act as an extension. + +Implementation of the extension logic according to LSP17ContractExtension. This module can be inherited to provide context of the msg variable related to the extendable contract + +## 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. + +### VERSION + +:::note References + +- Specification details: [**LSP-17-ContractExtension**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-17-ContractExtension.md#version) +- Solidity implementation: [`LSP17Extension.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp17contractextension-contracts/contracts/LSP17Extendable.sol) +- Function signature: `VERSION()` +- Function selector: `0xffa1ad74` + +::: + +```solidity +function VERSION() external view returns (string); +``` + +_Contract version._ + +#### Returns + +| Name | Type | Description | +| ---- | :------: | ----------- | +| `0` | `string` | - | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-17-ContractExtension**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-17-ContractExtension.md#supportsinterface) +- Solidity implementation: [`LSP17Extension.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp17contractextension-contracts/contracts/LSP17Extendable.sol) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +See [`IERC165-supportsInterface`](#ierc165-supportsinterface). + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ----------- | +| `interfaceId` | `bytes4` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +
+ +## 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. + +### \_extendableMsgData + +```solidity +function _extendableMsgData() internal view returns (bytes); +``` + +Returns the original `msg.data` passed to the extendable contract +without the appended `msg.sender` and `msg.value`. + +
+ +### \_extendableMsgSender + +```solidity +function _extendableMsgSender() internal view returns (address); +``` + +Returns the original `msg.sender` calling the extendable contract. + +
+ +### \_extendableMsgValue + +```solidity +function _extendableMsgValue() internal view returns (uint256); +``` + +Returns the original `msg.value` sent to the extendable contract. + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP.md b/packages/lsp-smart-contracts/docs/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP.md new file mode 100644 index 000000000..c14868d52 --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP.md @@ -0,0 +1,278 @@ + + + +# LSP1UniversalReceiverDelegateUP + +:::info Standard Specifications + +[`LSP-1-UniversalReceiver`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-1-UniversalReceiver.md) + +::: +:::info Solidity implementation + +[`LSP1UniversalReceiverDelegateUP.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp1-contracts/contracts/ILSP1UniversalReceiver.sol) + +::: + +> Implementation of a UniversalReceiverDelegate for the [LSP-0-ERC725Account] + +The [`LSP1UniversalReceiverDelegateUP`](#lsp1universalreceiverdelegateup) follows the [LSP-1-UniversalReceiver] standard and is designed for [LSP-0-ERC725Account] contracts. The [`LSP1UniversalReceiverDelegateUP`](#lsp1universalreceiverdelegateup) is a contract called by the [`universalReceiver(...)`](#universalreceiver) function of the [LSP-0-ERC725Account] contract that: + +- Writes the data keys representing assets received from type [LSP-7-DigitalAsset] and [LSP-8-IdentifiableDigitalAsset] into the account storage, and removes them when the balance is zero according to the [LSP-5-ReceivedAssets] Standard. + +- Writes the data keys representing the owned vaults from type [LSP-9-Vault] into your account storage, and removes them when transferring ownership to other accounts according to the [LSP-10-ReceivedVaults] Standard. + +## 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. + +### VERSION + +:::note References + +- Specification details: [**LSP-1-UniversalReceiver**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-1-UniversalReceiver.md#version) +- Solidity implementation: [`LSP1UniversalReceiverDelegateUP.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp1-contracts/contracts/ILSP1UniversalReceiver.sol) +- Function signature: `VERSION()` +- Function selector: `0xffa1ad74` + +::: + +```solidity +function VERSION() external view returns (string); +``` + +_Contract version._ + +#### Returns + +| Name | Type | Description | +| ---- | :------: | ----------- | +| `0` | `string` | - | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-1-UniversalReceiver**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-1-UniversalReceiver.md#supportsinterface) +- Solidity implementation: [`LSP1UniversalReceiverDelegateUP.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp1-contracts/contracts/ILSP1UniversalReceiver.sol) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +See [`IERC165-supportsInterface`](#ierc165-supportsinterface). + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ----------- | +| `interfaceId` | `bytes4` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +
+ +### universalReceiverDelegate + +:::note References + +- Specification details: [**LSP-1-UniversalReceiver**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-1-UniversalReceiver.md#universalreceiverdelegate) +- Solidity implementation: [`LSP1UniversalReceiverDelegateUP.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp1-contracts/contracts/ILSP1UniversalReceiver.sol) +- Function signature: `universalReceiverDelegate(address,uint256,bytes32,bytes)` +- Function selector: `0xa245bbda` + +::: + +:::info + +- If some issues occured with generating the `dataKeys` or `dataValues` the `returnedMessage` will be an error message, otherwise it will be empty. +- If an error occured when trying to use `setDataBatch(dataKeys,dataValues)`, it will return the raw error data back to the caller. + +::: + +:::caution Warning + +When the data stored in the ERC725Y storage of the LSP0 contract is corrupted (\_e.g: ([LSP-5-ReceivedAssets]'s Array length not 16 bytes long, the token received is already registered in `LSP5ReceivetAssets[]`, the token being sent is not sent as full balance, etc...), the function call will still pass and return (**not revert!**) and not modify any data key on the storage of the [LSP-0-ERC725Account]. + +::: + +```solidity +function universalReceiverDelegate( + address notifier, + uint256, + bytes32 typeId, + bytes +) external nonpayable returns (bytes); +``` + +_Reacted on received notification with `typeId`._ + +1. Writes the data keys of the received [LSP-7-DigitalAsset], [LSP-8-IdentifiableDigitalAsset] and [LSP-9-Vault] contract addresses into the account storage according to the [LSP-5-ReceivedAssets] and [LSP-10-ReceivedVaults] Standard. + +2. The data keys representing an asset/vault are cleared when the asset/vault is no longer owned by the account. + +
+ +**Requirements:** + +- This contract should be allowed to use the [`setDataBatch(...)`](#setdatabatch) function in order to update the LSP5 and LSP10 Data Keys. +- Cannot accept native tokens + +
+ +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ---------------------------------------------- | +| `notifier` | `address` | - | +| `_1` | `uint256` | - | +| `typeId` | `bytes32` | Unique identifier for a specific notification. | +| `_3` | `bytes` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ---------------------------------------- | +| `0` | `bytes` | The result of the reaction for `typeId`. | + +
+ +## 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. + +### \_tokenSender + +```solidity +function _tokenSender(address notifier) internal nonpayable returns (bytes); +``` + +Handler for LSP7 and LSP8 token sender type id. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------- | +| `notifier` | `address` | The LSP7 or LSP8 token address. | + +
+ +### \_tokenRecipient + +```solidity +function _tokenRecipient( + address notifier, + bytes4 interfaceId +) internal nonpayable returns (bytes); +``` + +Handler for LSP7 and LSP8 token recipient type id. + +#### Parameters + +| Name | Type | Description | +| ------------- | :-------: | ------------------------------- | +| `notifier` | `address` | The LSP7 or LSP8 token address. | +| `interfaceId` | `bytes4` | The LSP7 or LSP8 interface id. | + +
+ +### \_vaultSender + +```solidity +function _vaultSender(address notifier) internal nonpayable returns (bytes); +``` + +Handler for LSP9 vault sender type id. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------------------- | +| `notifier` | `address` | The LSP9 vault address. | + +
+ +### \_vaultRecipient + +```solidity +function _vaultRecipient(address notifier) internal nonpayable returns (bytes); +``` + +Handler for LSP9 vault recipient type id. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------------------- | +| `notifier` | `address` | The LSP9 vault address. | + +
+ +### \_setDataBatchWithoutReverting + +:::info + +If an the low-level transaction revert, the returned data will be forwarded. Th contract that uses this function can use the `Address` library to revert with the revert reason. + +::: + +```solidity +function _setDataBatchWithoutReverting( + bytes32[] dataKeys, + bytes[] dataValues +) internal nonpayable returns (bytes); +``` + +Calls `bytes4(keccak256(setDataBatch(bytes32[],bytes[])))` without checking for `bool success`, but it returns all the data back. + +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ---------------------- | +| `dataKeys` | `bytes32[]` | Data Keys to be set. | +| `dataValues` | `bytes[]` | Data Values to be set. | + +
+ +## Errors + +### CannotRegisterEOAsAsAssets + +:::note References + +- Specification details: [**LSP-1-UniversalReceiver**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-1-UniversalReceiver.md#cannotregistereoasasassets) +- Solidity implementation: [`LSP1UniversalReceiverDelegateUP.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp1-contracts/contracts/ILSP1UniversalReceiver.sol) +- Error signature: `CannotRegisterEOAsAsAssets(address)` +- Error hash: `0xa5295345` + +::: + +```solidity +error CannotRegisterEOAsAsAssets(address caller); +``` + +_EOA: `caller` cannot be registered as an asset._ + +Reverts when EOA calls the [`universalReceiver(..)`](#universalreceiver) function with an asset/vault typeId. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ---------------------- | +| `caller` | `address` | The address of the EOA | + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault.md b/packages/lsp-smart-contracts/docs/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault.md new file mode 100644 index 000000000..d0356d3bd --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault.md @@ -0,0 +1,235 @@ + + + +# LSP1UniversalReceiverDelegateVault + +:::info Standard Specifications + +[`LSP-1-UniversalReceiver`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-1-UniversalReceiver.md) + +::: +:::info Solidity implementation + +[`LSP1UniversalReceiverDelegateVault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp1-contracts/contracts/ILSP1UniversalReceiver.sol) + +::: + +> Implementation of a UniversalReceiverDelegate for the [LSP9Vault] + +The [`LSP1UniversalReceiverDelegateVault`](#lsp1universalreceiverdelegatevault) follows the [LSP-1-UniversalReceiver] standard and is designed for [LSP9Vault] contracts. The [`LSP1UniversalReceiverDelegateVault`](#lsp1universalreceiverdelegatevault) is a contract called by the [`universalReceiver(...)`](#universalreceiver) function of the [LSP-9-Vault] contract that: + +- Writes the data keys representing assets received from type [LSP-7-DigitalAsset] and [LSP-8-IdentifiableDigitalAsset] into the account storage, and removes them when the balance is zero according to the [LSP-5-ReceivedAssets] Standard. + +## 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. + +### VERSION + +:::note References + +- Specification details: [**LSP-1-UniversalReceiver**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-1-UniversalReceiver.md#version) +- Solidity implementation: [`LSP1UniversalReceiverDelegateVault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp1-contracts/contracts/ILSP1UniversalReceiver.sol) +- Function signature: `VERSION()` +- Function selector: `0xffa1ad74` + +::: + +```solidity +function VERSION() external view returns (string); +``` + +_Contract version._ + +#### Returns + +| Name | Type | Description | +| ---- | :------: | ----------- | +| `0` | `string` | - | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-1-UniversalReceiver**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-1-UniversalReceiver.md#supportsinterface) +- Solidity implementation: [`LSP1UniversalReceiverDelegateVault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp1-contracts/contracts/ILSP1UniversalReceiver.sol) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +See [`IERC165-supportsInterface`](#ierc165-supportsinterface). + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ----------- | +| `interfaceId` | `bytes4` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +
+ +### universalReceiverDelegate + +:::note References + +- Specification details: [**LSP-1-UniversalReceiver**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-1-UniversalReceiver.md#universalreceiverdelegate) +- Solidity implementation: [`LSP1UniversalReceiverDelegateVault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp1-contracts/contracts/ILSP1UniversalReceiver.sol) +- Function signature: `universalReceiverDelegate(address,uint256,bytes32,bytes)` +- Function selector: `0xa245bbda` + +::: + +:::info + +- If some issues occured with generating the `dataKeys` or `dataValues` the `returnedMessage` will be an error message, otherwise it will be empty. +- If an error occured when trying to use `setDataBatch(dataKeys,dataValues)`, it will return the raw error data back to the caller. + +::: + +```solidity +function universalReceiverDelegate( + address notifier, + uint256, + bytes32 typeId, + bytes +) external nonpayable returns (bytes); +``` + +_Reacted on received notification with `typeId`._ + +Handles two cases: Writes the received [LSP-7-DigitalAsset] or [LSP-8-IdentifiableDigitalAsset] assets into the vault storage according to the [LSP-5-ReceivedAssets] standard. + +
+ +**Requirements:** + +- Cannot accept native tokens. + +
+ +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ---------------------------------------------- | +| `notifier` | `address` | - | +| `_1` | `uint256` | - | +| `typeId` | `bytes32` | Unique identifier for a specific notification. | +| `_3` | `bytes` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ---------------------------------------- | +| `0` | `bytes` | The result of the reaction for `typeId`. | + +
+ +## 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. + +### \_tokenSender + +```solidity +function _tokenSender(address notifier) internal nonpayable returns (bytes); +``` + +Handler for LSP7 and LSP8 token sender type id. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------- | +| `notifier` | `address` | The LSP7 or LSP8 token address. | + +
+ +### \_tokenRecipient + +```solidity +function _tokenRecipient( + address notifier, + bytes4 interfaceId +) internal nonpayable returns (bytes); +``` + +Handler for LSP7 and LSP8 token recipient type id. + +#### Parameters + +| Name | Type | Description | +| ------------- | :-------: | ------------------------------- | +| `notifier` | `address` | The LSP7 or LSP8 token address. | +| `interfaceId` | `bytes4` | The LSP7 or LSP8 interface id. | + +
+ +### \_setDataBatchWithoutReverting + +:::info + +If an the low-level transaction revert, the returned data will be forwarded. Th contract that uses this function can use the `Address` library to revert with the revert reason. + +::: + +```solidity +function _setDataBatchWithoutReverting( + bytes32[] dataKeys, + bytes[] dataValues +) internal nonpayable returns (bytes); +``` + +Calls `bytes4(keccak256(setDataBatch(bytes32[],bytes[])))` without checking for `bool succes`, but it returns all the data back. + +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ---------------------- | +| `dataKeys` | `bytes32[]` | Data Keys to be set. | +| `dataValues` | `bytes[]` | Data Values to be set. | + +
+ +## Errors + +### CannotRegisterEOAsAsAssets + +:::note References + +- Specification details: [**LSP-1-UniversalReceiver**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-1-UniversalReceiver.md#cannotregistereoasasassets) +- Solidity implementation: [`LSP1UniversalReceiverDelegateVault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp1-contracts/contracts/ILSP1UniversalReceiver.sol) +- Error signature: `CannotRegisterEOAsAsAssets(address)` +- Error hash: `0xa5295345` + +::: + +```solidity +error CannotRegisterEOAsAsAssets(address caller); +``` + +_EOA: `caller` cannot be registered as an asset._ + +Reverts when EOA calls the [`universalReceiver(..)`](#universalreceiver) function with an asset/vault typeId. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ---------------------- | +| `caller` | `address` | The address of the EOA | + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP20CallVerification/LSP20CallVerification.md b/packages/lsp-smart-contracts/docs/contracts/LSP20CallVerification/LSP20CallVerification.md new file mode 100644 index 000000000..1545737be --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP20CallVerification/LSP20CallVerification.md @@ -0,0 +1,61 @@ + + + +# LSP20CallVerification + +:::info Standard Specifications + +[`LSP-20-CallVerification`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-20-CallVerification.md) + +::: +:::info Solidity implementation + +[`LSP20CallVerification.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp20-contracts/contracts/LSP20CallVerification.sol) + +::: + +> Implementation of a contract calling the verification functions according to LSP20 - Call Verification standard. + +Module to be inherited used to verify the execution of functions according to a verifier address. Verification can happen before or after execution based on a returnedStatus. + +## 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. + +### \_verifyCall + +```solidity +function _verifyCall( + address logicVerifier +) internal nonpayable returns (bool verifyAfter); +``` + +Calls [`lsp20VerifyCall`](#lsp20verifycall) function on the logicVerifier. + +
+ +### \_verifyCallResult + +```solidity +function _verifyCallResult( + address logicVerifier, + bytes callResult +) internal nonpayable; +``` + +Calls [`lsp20VerifyCallResult`](#lsp20verifycallresult) function on the logicVerifier. + +
+ +### \_revertWithLSP20DefaultError + +```solidity +function _revertWithLSP20DefaultError( + bool postCall, + bytes returnedData +) internal pure; +``` + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP23LinkedContractsFactory/IPostDeploymentModule.md b/packages/lsp-smart-contracts/docs/contracts/LSP23LinkedContractsFactory/IPostDeploymentModule.md new file mode 100644 index 000000000..7bf347d2d --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP23LinkedContractsFactory/IPostDeploymentModule.md @@ -0,0 +1,53 @@ + + + +# IPostDeploymentModule + +:::info Standard Specifications + +[`LSP-23-LinkedContractsFactory`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-23-LinkedContractsFactory.md) + +::: +:::info Solidity implementation + +[`IPostDeploymentModule.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp23-contracts/contracts/LSP23LinkedContractsFactory.sol) + +::: + +## 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. + +### executePostDeployment + +:::note References + +- Specification details: [**LSP-23-LinkedContractsFactory**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-23-LinkedContractsFactory.md#executepostdeployment) +- Solidity implementation: [`IPostDeploymentModule.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp23-contracts/contracts/LSP23LinkedContractsFactory.sol) +- Function signature: `executePostDeployment(address,address,bytes)` +- Function selector: `0x28c4d14e` + +::: + +```solidity +function executePostDeployment( + address primaryContract, + address secondaryContract, + bytes calldataToPostDeploymentModule +) external nonpayable; +``` + +_This function can be used to perform any additional setup or configuration after the primary and secondary contracts have been deployed._ + +Executes post-deployment logic for the primary and secondary contracts. + +#### Parameters + +| Name | Type | Description | +| -------------------------------- | :-------: | -------------------------------------------------------- | +| `primaryContract` | `address` | The address of the deployed primary contract. | +| `secondaryContract` | `address` | The address of the deployed secondary contract. | +| `calldataToPostDeploymentModule` | `bytes` | Calldata to be passed for the post-deployment execution. | + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP23LinkedContractsFactory/LSP23LinkedContractsFactory.md b/packages/lsp-smart-contracts/docs/contracts/LSP23LinkedContractsFactory/LSP23LinkedContractsFactory.md new file mode 100644 index 000000000..f1044092b --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP23LinkedContractsFactory/LSP23LinkedContractsFactory.md @@ -0,0 +1,403 @@ + + + +# LSP23LinkedContractsFactory + +:::info Standard Specifications + +[`LSP-23-LinkedContractsFactory`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-23-LinkedContractsFactory.md) + +::: +:::info Solidity implementation + +[`LSP23LinkedContractsFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp23-contracts/contracts/LSP23LinkedContractsFactory.sol) + +::: + +## 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. + +### computeAddresses + +:::note References + +- Specification details: [**LSP-23-LinkedContractsFactory**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-23-LinkedContractsFactory.md#computeaddresses) +- Solidity implementation: [`LSP23LinkedContractsFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp23-contracts/contracts/LSP23LinkedContractsFactory.sol) +- Function signature: `computeAddresses(ILSP23LinkedContractsFactory.PrimaryContractDeployment,ILSP23LinkedContractsFactory.SecondaryContractDeployment,address,bytes)` +- Function selector: `0xdecfb0b9` + +::: + +```solidity +function computeAddresses( + ILSP23LinkedContractsFactory.PrimaryContractDeployment primaryContractDeployment, + ILSP23LinkedContractsFactory.SecondaryContractDeployment secondaryContractDeployment, + address postDeploymentModule, + bytes postDeploymentModuleCalldata +) + external + view + returns (address primaryContractAddress, address secondaryContractAddress); +``` + +Computes the addresses of a primary contract and a secondary linked contract + +#### Parameters + +| Name | Type | Description | +| ------------------------------ | :--------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `primaryContractDeployment` | `ILSP23LinkedContractsFactory.PrimaryContractDeployment` | Contains the needed parameter to deploy the primary contract. (`salt`, `fundingAmount`, `creationBytecode`) | +| `secondaryContractDeployment` | `ILSP23LinkedContractsFactory.SecondaryContractDeployment` | Contains the needed parameter to deploy the secondary contract. (`fundingAmount`, `creationBytecode`, `addPrimaryContractAddress`, `extraConstructorParams`) | +| `postDeploymentModule` | `address` | The optional module to be executed after deployment | +| `postDeploymentModuleCalldata` | `bytes` | The data to be passed to the post deployment module | + +#### Returns + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------- | +| `primaryContractAddress` | `address` | The address of the deployed primary contract. | +| `secondaryContractAddress` | `address` | The address of the deployed secondary contract. | + +
+ +### computeERC1167Addresses + +:::note References + +- Specification details: [**LSP-23-LinkedContractsFactory**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-23-LinkedContractsFactory.md#computeerc1167addresses) +- Solidity implementation: [`LSP23LinkedContractsFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp23-contracts/contracts/LSP23LinkedContractsFactory.sol) +- Function signature: `computeERC1167Addresses(ILSP23LinkedContractsFactory.PrimaryContractDeploymentInit,ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit,address,bytes)` +- Function selector: `0x8da85898` + +::: + +```solidity +function computeERC1167Addresses( + ILSP23LinkedContractsFactory.PrimaryContractDeploymentInit primaryContractDeploymentInit, + ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit secondaryContractDeploymentInit, + address postDeploymentModule, + bytes postDeploymentModuleCalldata +) + external + view + returns (address primaryContractAddress, address secondaryContractAddress); +``` + +Computes the addresses of a primary and a secondary linked contracts ERC1167 proxies to be created + +#### Parameters + +| Name | Type | Description | +| --------------------------------- | :------------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `primaryContractDeploymentInit` | `ILSP23LinkedContractsFactory.PrimaryContractDeploymentInit` | Contains the needed parameters to deploy a primary proxy contract. (`salt`, `fundingAmount`, `implementationContract`, `initializationCalldata`) | +| `secondaryContractDeploymentInit` | `ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit` | Contains the needed parameters to deploy the secondary proxy contract. (`fundingAmount`, `implementationContract`, `initializationCalldata`, `addPrimaryContractAddress`, `extraInitializationParams`) | +| `postDeploymentModule` | `address` | The optional module to be executed after deployment. | +| `postDeploymentModuleCalldata` | `bytes` | The data to be passed to the post deployment module. | + +#### Returns + +| Name | Type | Description | +| -------------------------- | :-------: | ---------------------------------------------------- | +| `primaryContractAddress` | `address` | The address of the deployed primary contract proxy | +| `secondaryContractAddress` | `address` | The address of the deployed secondary contract proxy | + +
+ +### deployContracts + +:::note References + +- Specification details: [**LSP-23-LinkedContractsFactory**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-23-LinkedContractsFactory.md#deploycontracts) +- Solidity implementation: [`LSP23LinkedContractsFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp23-contracts/contracts/LSP23LinkedContractsFactory.sol) +- Function signature: `deployContracts(ILSP23LinkedContractsFactory.PrimaryContractDeployment,ILSP23LinkedContractsFactory.SecondaryContractDeployment,address,bytes)` +- Function selector: `0xf830c0ab` + +::: + +```solidity +function deployContracts( + ILSP23LinkedContractsFactory.PrimaryContractDeployment primaryContractDeployment, + ILSP23LinkedContractsFactory.SecondaryContractDeployment secondaryContractDeployment, + address postDeploymentModule, + bytes postDeploymentModuleCalldata +) + external + payable + returns (address primaryContractAddress, address secondaryContractAddress); +``` + +_Contracts deployed. Contract Address: `primaryContractAddress`. Primary Contract Address: `primaryContractAddress`_ + +Deploys a primary and a secondary linked contract. + +#### Parameters + +| Name | Type | Description | +| ------------------------------ | :--------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `primaryContractDeployment` | `ILSP23LinkedContractsFactory.PrimaryContractDeployment` | Contains the needed parameter to deploy a contract. (`salt`, `fundingAmount`, `creationBytecode`) | +| `secondaryContractDeployment` | `ILSP23LinkedContractsFactory.SecondaryContractDeployment` | Contains the needed parameter to deploy the secondary contract. (`fundingAmount`, `creationBytecode`, `addPrimaryContractAddress`, `extraConstructorParams`) | +| `postDeploymentModule` | `address` | The optional module to be executed after deployment | +| `postDeploymentModuleCalldata` | `bytes` | The data to be passed to the post deployment module | + +#### Returns + +| Name | Type | Description | +| -------------------------- | :-------: | -------------------------------------- | +| `primaryContractAddress` | `address` | The address of the primary contract. | +| `secondaryContractAddress` | `address` | The address of the secondary contract. | + +
+ +### deployERC1167Proxies + +:::note References + +- Specification details: [**LSP-23-LinkedContractsFactory**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-23-LinkedContractsFactory.md#deployerc1167proxies) +- Solidity implementation: [`LSP23LinkedContractsFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp23-contracts/contracts/LSP23LinkedContractsFactory.sol) +- Function signature: `deployERC1167Proxies(ILSP23LinkedContractsFactory.PrimaryContractDeploymentInit,ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit,address,bytes)` +- Function selector: `0x17c042c4` + +::: + +```solidity +function deployERC1167Proxies( + ILSP23LinkedContractsFactory.PrimaryContractDeploymentInit primaryContractDeploymentInit, + ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit secondaryContractDeploymentInit, + address postDeploymentModule, + bytes postDeploymentModuleCalldata +) + external + payable + returns (address primaryContractAddress, address secondaryContractAddress); +``` + +_Contract proxies deployed. Primary Proxy Address: `primaryContractAddress`. Secondary Contract Proxy Address: `secondaryContractAddress`_ + +Deploys ERC1167 proxies of a primary contract and a secondary linked contract + +#### Parameters + +| Name | Type | Description | +| --------------------------------- | :------------------------------------------------------------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `primaryContractDeploymentInit` | `ILSP23LinkedContractsFactory.PrimaryContractDeploymentInit` | Contains the needed parameters to deploy a proxy contract. (`salt`, `fundingAmount`, `implementationContract`, `initializationCalldata`) | +| `secondaryContractDeploymentInit` | `ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit` | Contains the needed parameters to deploy the secondary proxy contract. (`fundingAmount`, `implementationContract`, `initializationCalldata`, `addPrimaryContractAddress`, `extraInitializationParams`) | +| `postDeploymentModule` | `address` | The optional module to be executed after deployment. | +| `postDeploymentModuleCalldata` | `bytes` | The data to be passed to the post deployment module. | + +#### Returns + +| Name | Type | Description | +| -------------------------- | :-------: | ---------------------------------------------------- | +| `primaryContractAddress` | `address` | The address of the deployed primary contract proxy | +| `secondaryContractAddress` | `address` | The address of the deployed secondary contract proxy | + +
+ +## 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. + +### \_deployPrimaryContract + +```solidity +function _deployPrimaryContract(struct ILSP23LinkedContractsFactory.PrimaryContractDeployment primaryContractDeployment, struct ILSP23LinkedContractsFactory.SecondaryContractDeployment secondaryContractDeployment, address postDeploymentModule, bytes postDeploymentModuleCalldata) internal nonpayable returns (address primaryContractAddress); +``` + +
+ +### \_deploySecondaryContract + +```solidity +function _deploySecondaryContract(struct ILSP23LinkedContractsFactory.SecondaryContractDeployment secondaryContractDeployment, address primaryContractAddress) internal nonpayable returns (address secondaryContractAddress); +``` + +
+ +### \_deployAndInitializePrimaryContractProxy + +```solidity +function _deployAndInitializePrimaryContractProxy(struct ILSP23LinkedContractsFactory.PrimaryContractDeploymentInit primaryContractDeploymentInit, struct ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit secondaryContractDeploymentInit, address postDeploymentModule, bytes postDeploymentModuleCalldata) internal nonpayable returns (address primaryContractAddress); +``` + +
+ +### \_deployAndInitializeSecondaryContractProxy + +```solidity +function _deployAndInitializeSecondaryContractProxy(struct ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit secondaryContractDeploymentInit, address primaryContractAddress) internal nonpayable returns (address secondaryContractAddress); +``` + +
+ +### \_generatePrimaryContractSalt + +```solidity +function _generatePrimaryContractSalt(struct ILSP23LinkedContractsFactory.PrimaryContractDeployment primaryContractDeployment, struct ILSP23LinkedContractsFactory.SecondaryContractDeployment secondaryContractDeployment, address postDeploymentModule, bytes postDeploymentModuleCalldata) internal pure returns (bytes32 primaryContractGeneratedSalt); +``` + +
+ +### \_generatePrimaryContractProxySalt + +```solidity +function _generatePrimaryContractProxySalt(struct ILSP23LinkedContractsFactory.PrimaryContractDeploymentInit primaryContractDeploymentInit, struct ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit secondaryContractDeploymentInit, address postDeploymentModule, bytes postDeploymentModuleCalldata) internal pure returns (bytes32 primaryContractProxyGeneratedSalt); +``` + +
+ +## Events + +### DeployedContracts + +:::note References + +- Specification details: [**LSP-23-LinkedContractsFactory**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-23-LinkedContractsFactory.md#deployedcontracts) +- Solidity implementation: [`LSP23LinkedContractsFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp23-contracts/contracts/LSP23LinkedContractsFactory.sol) +- Event signature: `DeployedContracts(address,address,ILSP23LinkedContractsFactory.PrimaryContractDeployment,ILSP23LinkedContractsFactory.SecondaryContractDeployment,address,bytes)` +- Event topic hash: `0x1ea27dabd8fd1508e844ab51c2fd3d9081f2684346857f9187da6d4a1aa7d3e6` + +::: + +```solidity +event DeployedContracts( + address indexed primaryContract, + address indexed secondaryContract, + ILSP23LinkedContractsFactory.PrimaryContractDeployment primaryContractDeployment, + ILSP23LinkedContractsFactory.SecondaryContractDeployment secondaryContractDeployment, + address postDeploymentModule, + bytes postDeploymentModuleCalldata +); +``` + +Emitted when a primary and secondary contract are deployed. + +#### Parameters + +| Name | Type | Description | +| --------------------------------- | :--------------------------------------------------------: | ------------------------------------------------------ | +| `primaryContract` **`indexed`** | `address` | Address of the deployed primary contract. | +| `secondaryContract` **`indexed`** | `address` | Address of the deployed secondary contract. | +| `primaryContractDeployment` | `ILSP23LinkedContractsFactory.PrimaryContractDeployment` | Parameters used for the primary contract deployment. | +| `secondaryContractDeployment` | `ILSP23LinkedContractsFactory.SecondaryContractDeployment` | Parameters used for the secondary contract deployment. | +| `postDeploymentModule` | `address` | Address of the post-deployment module. | +| `postDeploymentModuleCalldata` | `bytes` | Calldata passed to the post-deployment module. | + +
+ +### DeployedERC1167Proxies + +:::note References + +- Specification details: [**LSP-23-LinkedContractsFactory**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-23-LinkedContractsFactory.md#deployederc1167proxies) +- Solidity implementation: [`LSP23LinkedContractsFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp23-contracts/contracts/LSP23LinkedContractsFactory.sol) +- Event signature: `DeployedERC1167Proxies(address,address,ILSP23LinkedContractsFactory.PrimaryContractDeploymentInit,ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit,address,bytes)` +- Event topic hash: `0xb03dbe7a02c063899f863d542410b5b038c8f537045be3a26e7144e0074e1c7b` + +::: + +```solidity +event DeployedERC1167Proxies( + address indexed primaryContract, + address indexed secondaryContract, + ILSP23LinkedContractsFactory.PrimaryContractDeploymentInit primaryContractDeploymentInit, + ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit secondaryContractDeploymentInit, + address postDeploymentModule, + bytes postDeploymentModuleCalldata +); +``` + +Emitted when proxies of a primary and secondary contract are deployed. + +#### Parameters + +| Name | Type | Description | +| --------------------------------- | :------------------------------------------------------------: | ------------------------------------------------------------ | +| `primaryContract` **`indexed`** | `address` | Address of the deployed primary contract proxy. | +| `secondaryContract` **`indexed`** | `address` | Address of the deployed secondary contract proxy. | +| `primaryContractDeploymentInit` | `ILSP23LinkedContractsFactory.PrimaryContractDeploymentInit` | Parameters used for the primary contract proxy deployment. | +| `secondaryContractDeploymentInit` | `ILSP23LinkedContractsFactory.SecondaryContractDeploymentInit` | Parameters used for the secondary contract proxy deployment. | +| `postDeploymentModule` | `address` | Address of the post-deployment module. | +| `postDeploymentModuleCalldata` | `bytes` | Calldata passed to the post-deployment module. | + +
+ +## Errors + +### InvalidValueSum + +:::note References + +- Specification details: [**LSP-23-LinkedContractsFactory**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-23-LinkedContractsFactory.md#invalidvaluesum) +- Solidity implementation: [`LSP23LinkedContractsFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp23-contracts/contracts/LSP23LinkedContractsFactory.sol) +- Error signature: `InvalidValueSum()` +- Error hash: `0x2fd9ca91` + +::: + +```solidity +error InvalidValueSum(); +``` + +_Invalid value sent._ + +Reverts when the `msg.value` sent is not equal to the sum of value used for the deployment of the contract & its owner contract. + +
+ +### PrimaryContractProxyInitFailureError + +:::note References + +- Specification details: [**LSP-23-LinkedContractsFactory**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-23-LinkedContractsFactory.md#primarycontractproxyinitfailureerror) +- Solidity implementation: [`LSP23LinkedContractsFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp23-contracts/contracts/LSP23LinkedContractsFactory.sol) +- Error signature: `PrimaryContractProxyInitFailureError(bytes)` +- Error hash: `0x4364b6ee` + +::: + +```solidity +error PrimaryContractProxyInitFailureError(bytes errorData); +``` + +_Failed to deploy & initialize the Primary Contract Proxy. Error: `errorData`._ + +Reverts when the deployment & intialization of the contract has failed. + +#### Parameters + +| Name | Type | Description | +| ----------- | :-----: | ----------------------------------------------------------------------------- | +| `errorData` | `bytes` | Potentially information about why the deployment & intialization have failed. | + +
+ +### SecondaryContractProxyInitFailureError + +:::note References + +- Specification details: [**LSP-23-LinkedContractsFactory**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-23-LinkedContractsFactory.md#secondarycontractproxyinitfailureerror) +- Solidity implementation: [`LSP23LinkedContractsFactory.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp23-contracts/contracts/LSP23LinkedContractsFactory.sol) +- Error signature: `SecondaryContractProxyInitFailureError(bytes)` +- Error hash: `0x9654a854` + +::: + +```solidity +error SecondaryContractProxyInitFailureError(bytes errorData); +``` + +_Failed to deploy & initialize the Secondary Contract Proxy. Error: `errorData`._ + +Reverts when the deployment & intialization of the secondary contract has failed. + +#### Parameters + +| Name | Type | Description | +| ----------- | :-----: | ----------------------------------------------------------------------------- | +| `errorData` | `bytes` | Potentially information about why the deployment & intialization have failed. | + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP25ExecuteRelayCall/LSP25MultiChannelNonce.md b/packages/lsp-smart-contracts/docs/contracts/LSP25ExecuteRelayCall/LSP25MultiChannelNonce.md new file mode 100644 index 000000000..e8c211075 --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP25ExecuteRelayCall/LSP25MultiChannelNonce.md @@ -0,0 +1,147 @@ + + + +# LSP25MultiChannelNonce + +:::info Standard Specifications + +[`LSP-25-ExecuteRelayCall`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-25-ExecuteRelayCall.md) + +::: +:::info Solidity implementation + +[`LSP25MultiChannelNonce.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp25-contracts/contracts/ILSP25ExecuteRelayCall.sol) + +::: + +> Implementation of the multi channel nonce and the signature verification defined in the LSP25 standard. + +This contract can be used as a backbone for other smart contracts to implement meta-transactions via the LSP25 Execute Relay Call interface. It contains a storage of nonces for signer addresses across various channel IDs, enabling these signers to submit signed transactions that order-independant. (transactions that do not need to be submitted one after the other in a specific order). Finally, it contains internal functions to verify signatures for specific calldata according the signature format specified in the LSP25 standard. + +## 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. + +### \_getNonce + +```solidity +function _getNonce( + address from, + uint128 channelId +) internal view returns (uint256 idx); +``` + +Read the nonce for a `from` address on a specific `channelId`. +This will return an `idx`, which is the concatenation of two `uint128` as follow: + +1. the `channelId` where the nonce was queried for. + +2. the actual nonce of the given `channelId`. + For example, if on `channelId` number `5`, the latest nonce is `1`, the `idx` returned by this function will be: + +``` +// in decimals = 1701411834604692317316873037158841057281 +idx = 0x0000000000000000000000000000000500000000000000000000000000000001 +``` + +This idx can be described as follow: + +``` + channelId => 5 nonce in this channel => 1 + v------------------------------v-------------------------------v +0x0000000000000000000000000000000500000000000000000000000000000001 +``` + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `from` | `address` | The address to read the nonce for. | +| `channelId` | `uint128` | The channel in which to extract the nonce. | + +#### Returns + +| Name | Type | Description | +| ----- | :-------: | ---------------------------------------------------------------------------------------------------------------------- | +| `idx` | `uint256` | The idx composed of two `uint128`: the channelId + nonce in channel concatenated together in a single `uint256` value. | + +
+ +### \_recoverSignerFromLSP25Signature + +```solidity +function _recoverSignerFromLSP25Signature( + bytes signature, + uint256 nonce, + uint256 validityTimestamps, + uint256 msgValue, + bytes callData +) internal view returns (address); +``` + +Recover the address of the signer that generated a `signature` using the parameters provided `nonce`, `validityTimestamps`, `msgValue` and `callData`. +The address of the signer will be recovered using the LSP25 signature format. + +#### Parameters + +| Name | Type | Description | +| -------------------- | :-------: | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `signature` | `bytes` | A 65 bytes long signature generated according to the signature format specified in the LSP25 standard. | +| `nonce` | `uint256` | The nonce that the signer used to generate the `signature`. | +| `validityTimestamps` | `uint256` | The validity timestamp that the signer used to generate the signature (See [`_verifyValidityTimestamps`](#_verifyvaliditytimestamps) to learn more). | +| `msgValue` | `uint256` | The amount of native tokens intended to be sent for the relay transaction. | +| `callData` | `bytes` | The calldata to execute as a relay transaction that the signer signed for. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | -------------------------------------------------------- | +| `0` | `address` | The address that signed, recovered from the `signature`. | + +
+ +### \_verifyValidityTimestamps + +```solidity +function _verifyValidityTimestamps(uint256 validityTimestamps) internal view; +``` + +Verify that the current timestamp is within the date and time range provided by `validityTimestamps`. + +#### Parameters + +| Name | Type | Description | +| -------------------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------- | +| `validityTimestamps` | `uint256` | Two `uint128` concatenated together, where the left-most `uint128` represent the timestamp from which the transaction can be executed, | + +
+ +### \_isValidNonce + +```solidity +function _isValidNonce(address from, uint256 idx) internal view returns (bool); +``` + +Verify that the nonce `_idx` for `_from` (obtained via [`getNonce`](#getnonce)) is valid in its channel ID. +The "idx" is a 256bits (unsigned) integer, where: + +- the 128 leftmost bits = channelId + +- and the 128 rightmost bits = nonce within the channel + +#### Parameters + +| Name | Type | Description | +| ------ | :-------: | ---------------------------------------------------------------------------- | +| `from` | `address` | The signer's address. | +| `idx` | `uint256` | The concatenation of the `channelId` + `nonce` within a specific channel ID. | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ------------------------------------------------------------------------ | +| `0` | `bool` | true if the nonce is the latest nonce for the `signer`, false otherwise. | + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.md b/packages/lsp-smart-contracts/docs/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.md new file mode 100644 index 000000000..a9dd74016 --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.md @@ -0,0 +1,574 @@ + + + +# LSP4DigitalAssetMetadata + +:::info Standard Specifications + +[`LSP-4-DigitalAsset-Metadata`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md) + +::: +:::info Solidity implementation + +[`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.sol) + +::: + +> Implementation of a LSP4DigitalAssetMetadata contract that stores the **Token-Metadata** (`LSP4TokenName` and `LSP4TokenSymbol`) in its ERC725Y data store. + +Standard Implementation of the LSP4 standard. + +## 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. + +### getData + +:::note References + +- Specification details: [**LSP-4-DigitalAsset-Metadata**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md#getdata) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.sol) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_Reading the ERC725Y storage for data key `dataKey` returned the following value: `dataValue`._ + +Get in the ERC725Y storage the bytes data stored at a specific data key `dataKey`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------------------------------- | +| `dataKey` | `bytes32` | The data key for which to retrieve the value. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ---------------------------------------------------- | +| `dataValue` | `bytes` | The bytes value stored under the specified data key. | + +
+ +### getDataBatch + +:::note References + +- Specification details: [**LSP-4-DigitalAsset-Metadata**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md#getdatabatch) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.sol) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Reading the ERC725Y storage for data keys `dataKeys` returned the following values: `dataValues`._ + +Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys`. + +#### 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 | + +
+ +### owner + +:::note References + +- Specification details: [**LSP-4-DigitalAsset-Metadata**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md#owner) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.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-4-DigitalAsset-Metadata**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md#renounceownership) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.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. + +
+ +### setData + +:::note References + +- Specification details: [**LSP-4-DigitalAsset-Metadata**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md#setdata) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.sol) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +:::caution Warning + +**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**. + +::: + +```solidity +function setData(bytes32 dataKey, bytes dataValue) external payable; +``` + +_Setting the following data key value pair in the ERC725Y storage. Data key: `dataKey`, data value: `dataValue`._ + +Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data key `dataKey`. The function is marked as payable to enable flexibility on child contracts. For instance to implement a fee mechanism for setting specific data. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner). + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `dataKey` | `bytes32` | The data key for which to set a new value. | +| `dataValue` | `bytes` | The new bytes value to set. | + +
+ +### setDataBatch + +:::note References + +- Specification details: [**LSP-4-DigitalAsset-Metadata**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md#setdatabatch) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.sol) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +:::caution Warning + +**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**. + +::: + +```solidity +function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable; +``` + +_Setting the following data key value pairs in the ERC725Y storage. Data keys: `dataKeys`, data values: `dataValues`._ + +Batch data setting function that behaves the same as [`setData`](#setdata) but allowing to set multiple data key/value pairs in the ERC725Y storage in the same transaction. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner) of the contract. + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event **for each data key/value pair set**. + +
+ +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ---------------------------------------------------- | +| `dataKeys` | `bytes32[]` | An array of data keys to set bytes values for. | +| `dataValues` | `bytes[]` | An array of bytes values to set for each `dataKeys`. | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-4-DigitalAsset-Metadata**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md#supportsinterface) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.sol) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +See [`IERC165-supportsInterface`](#ierc165-supportsinterface). + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ----------- | +| `interfaceId` | `bytes4` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +
+ +### transferOwnership + +:::note References + +- Specification details: [**LSP-4-DigitalAsset-Metadata**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md#transferownership) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.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); +``` + +Read the value stored under a specific `dataKey` inside the underlying ERC725Y storage, +represented as a mapping of `bytes32` data keys mapped to their `bytes` data values. + +```solidity +mapping(bytes32 => bytes) _store +``` + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------------------------------------------------------------------- | +| `dataKey` | `bytes32` | A bytes32 data key to read the associated `bytes` value from the store. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ----------------------------------------------------------------------------- | +| `dataValue` | `bytes` | The `bytes` value associated with the given `dataKey` in the ERC725Y storage. | + +
+ +### \_setData + +```solidity +function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; +``` + +The ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol` cannot be changed +via this function once the digital asset contract has been deployed. + +
+ +## Events + +### DataChanged + +:::note References + +- Specification details: [**LSP-4-DigitalAsset-Metadata**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md#datachanged) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_The following data key/value pair has been changed in the ERC725Y storage: Data key: `dataKey`, data value: `dataValue`._ + +Emitted when data at a specific `dataKey` was changed to a new value `dataValue`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------- | +| `dataKey` **`indexed`** | `bytes32` | The data key for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### OwnershipTransferred + +:::note References + +- Specification details: [**LSP-4-DigitalAsset-Metadata**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md#ownershiptransferred) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.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` | - | + +
+ +## Errors + +### ERC725Y_DataKeysValuesEmptyArray + +:::note References + +- Specification details: [**LSP-4-DigitalAsset-Metadata**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.sol) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +Reverts when one of the array parameter provided to [`setDataBatch`](#setdatabatch) function is an empty array. + +
+ +### ERC725Y_DataKeysValuesLengthMismatch + +:::note References + +- Specification details: [**LSP-4-DigitalAsset-Metadata**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.sol) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function. + +
+ +### ERC725Y_MsgValueDisallowed + +:::note References + +- Specification details: [**LSP-4-DigitalAsset-Metadata**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md#erc725y_msgvaluedisallowed) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.sol) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#setdatabatch) function. + +
+ +### LSP4TokenNameNotEditable + +:::note References + +- Specification details: [**LSP-4-DigitalAsset-Metadata**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md#lsp4tokennamenoteditable) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.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 / initialized. 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 / initialized. + +
+ +### LSP4TokenSymbolNotEditable + +:::note References + +- Specification details: [**LSP-4-DigitalAsset-Metadata**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md#lsp4tokensymbolnoteditable) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.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 / initialized. 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 / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-4-DigitalAsset-Metadata**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` 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 / initialized. + +
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-4-DigitalAsset-Metadata**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md#ownablecallernottheowner) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-4-DigitalAsset-Metadata**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-4-DigitalAsset-Metadata.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP6KeyManager/LSP6KeyManager.md b/packages/lsp-smart-contracts/docs/contracts/LSP6KeyManager/LSP6KeyManager.md new file mode 100644 index 000000000..852ea357c --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP6KeyManager/LSP6KeyManager.md @@ -0,0 +1,1969 @@ + + + +# LSP6KeyManager + +:::info Standard Specifications + +[`LSP-6-KeyManager`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md) + +::: +:::info Solidity implementation + +[`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) + +::: + +> Implementation of a contract acting as a controller of an ERC725 Account, using permissions stored in the ERC725Y storage. + +All the permissions can be set on the ERC725 Account using `setData(bytes32,bytes)` or `setData(bytes32[],bytes[])`. + +## 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-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#constructor) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) + +::: + +```solidity +constructor(address target_); +``` + +_Deploying a LSP6KeyManager linked to the contract at address `target_`._ + +Deploy a Key Manager and set the `target_` address in the contract storage, making this Key Manager linked to this `target_` contract. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ------------------------------------------------------------------------ | +| `target_` | `address` | The address of the contract to control and forward calldata payloads to. | + +
+ +### VERSION + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#version) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Function signature: `VERSION()` +- Function selector: `0xffa1ad74` + +::: + +```solidity +function VERSION() external view returns (string); +``` + +_Contract version._ + +#### Returns + +| Name | Type | Description | +| ---- | :------: | ----------- | +| `0` | `string` | - | + +
+ +### execute + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#execute) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Function signature: `execute(bytes)` +- Function selector: `0x09c5eabe` + +::: + +```solidity +function execute(bytes payload) external payable returns (bytes); +``` + +_Executing the following payload on the linked contract: `payload`_ + +Execute A `payload` on the linked [`target`](#target) contract after having verified the permissions associated with the function being run. The `payload` MUST be a valid abi-encoded function call of one of the functions present in the linked [`target`](#target), otherwise the call will fail. The linked [`target`](#target) will return some data on successful execution, or revert on failure. + +
+ +**Emitted events:** + +- [`PermissionsVerified`](#permissionsverified) event when the permissions related to `payload` have been verified successfully. + +
+ +#### Parameters + +| Name | Type | Description | +| --------- | :-----: | --------------------------------------------------------------------------- | +| `payload` | `bytes` | The abi-encoded function call to execute on the linked [`target`](#target). | + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | --------------------------------------------------------------------------------------- | +| `0` | `bytes` | The abi-decoded data returned by the function called on the linked [`target`](#target). | + +
+ +### executeBatch + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#executebatch) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Function signature: `executeBatch(uint256[],bytes[])` +- Function selector: `0xbf0176ff` + +::: + +```solidity +function executeBatch( + uint256[] values, + bytes[] payloads +) external payable returns (bytes[]); +``` + +\*Executing the following batch of payloads and sensind on the linked contract. + +- payloads: `payloads` + +- values transferred for each payload: `values`\* + +Same as [`execute`](#execute) but execute a batch of payloads (abi-encoded function calls) in a single transaction. + +
+ +**Emitted events:** + +- [`PermissionsVerified`](#permissionsverified) event for each permissions related to each `payload` that have been verified successfully. + +
+ +#### Parameters + +| Name | Type | Description | +| ---------- | :---------: | ------------------------------------------------------------------------------------------------- | +| `values` | `uint256[]` | An array of amount of native tokens to be transferred for each `payload`. | +| `payloads` | `bytes[]` | An array of abi-encoded function calls to execute successively on the linked [`target`](#target). | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------------------------------------------------------------ | +| `0` | `bytes[]` | An array of abi-decoded data returned by the functions called on the linked [`target`](#target). | + +
+ +### executeRelayCall + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#executerelaycall) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Function signature: `executeRelayCall(bytes,uint256,uint256,bytes)` +- Function selector: `0x4c8a4e74` + +::: + +:::tip Hint + +If you are looking to learn how to sign and execute relay transactions via the Key Manager, see our Javascript step by step guide [_"Execute Relay Transactions"_](../../../learn/expert-guides/key-manager/execute-relay-transactions.md). See the LSP6 Standard page for more details on how to [generate a valid signature for Execute Relay Call](../../../standards/universal-profile/lsp6-key-manager.md#how-to-sign-relay-transactions). + +::: + +```solidity +function executeRelayCall( + bytes signature, + uint256 nonce, + uint256 validityTimestamps, + bytes payload +) external payable returns (bytes); +``` + +_Executing the following payload given the nonce `nonce` and signature `signature`. Payload: `payload`_ + +Allows any address (executor) to execute a payload (= abi-encoded function call), given they have a valid signature from a signer address and a valid `nonce` for this signer. The signature MUST be generated according to the signature format defined by the LSP25 standard. The signer that generated the `signature` MUST be a controller with some permissions on the linked [`target`](#target). The `payload` will be executed on the [`target`](#target) contract once the LSP25 signature and the permissions of the signer have been verified. + +
+ +**Emitted events:** + +- [`PermissionsVerified`](#permissionsverified) event when the permissions related to `payload` have been verified successfully. + +
+ +#### Parameters + +| Name | Type | Description | +| -------------------- | :-------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `signature` | `bytes` | A 65 bytes long signature for a meta transaction according to LSP25. | +| `nonce` | `uint256` | The nonce of the address that signed the calldata (in a specific `_channel`), obtained via [`getNonce`](#getnonce). Used to prevent replay attack. | +| `validityTimestamps` | `uint256` | Two `uint128` timestamps concatenated together that describes when the relay transaction is valid "from" (left `uint128`) and "until" as a deadline (right `uint128`). | +| `payload` | `bytes` | The abi-encoded function call to execute. | + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ------------------------------------------------- | +| `0` | `bytes` | The data being returned by the function executed. | + +
+ +### executeRelayCallBatch + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#executerelaycallbatch) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Function signature: `executeRelayCallBatch(bytes[],uint256[],uint256[],uint256[],bytes[])` +- Function selector: `0xa20856a5` + +::: + +```solidity +function executeRelayCallBatch( + bytes[] signatures, + uint256[] nonces, + uint256[] validityTimestamps, + uint256[] values, + bytes[] payloads +) external payable returns (bytes[]); +``` + +_Executing a batch of relay calls (= meta-transactions)._ + +Same as [`executeRelayCall`](#executerelaycall) but execute a batch of signed calldata payloads (abi-encoded function calls) in a single transaction. The `signatures` can be from multiple controllers, not necessarely the same controller, as long as each of these controllers that signed have the right permissions related to the calldata `payload` they signed. + +
+ +**Requirements:** + +- the length of `signatures`, `nonces`, `validityTimestamps`, `values` and `payloads` MUST be the same. +- the value sent to this function (`msg.value`) MUST be equal to the sum of all `values` in the batch. There should not be any excess value sent to this function. + +
+ +#### Parameters + +| Name | Type | Description | +| -------------------- | :---------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| `signatures` | `bytes[]` | An array of 65 bytes long signatures for meta transactions according to LSP25. | +| `nonces` | `uint256[]` | An array of nonces of the addresses that signed the calldata payloads (in specific channels). Obtained via [`getNonce`](#getnonce). Used to prevent replay attack. | +| `validityTimestamps` | `uint256[]` | An array of two `uint128` concatenated timestamps that describe when the relay transaction is valid "from" (left `uint128`) and "until" (right `uint128`). | +| `values` | `uint256[]` | An array of amount of native tokens to be transferred for each calldata `payload`. | +| `payloads` | `bytes[]` | An array of abi-encoded function calls to be executed successively. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ---------------------------------------------------------------- | +| `0` | `bytes[]` | An array of abi-decoded data returned by the functions executed. | + +
+ +### getNonce + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#getnonce) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Function signature: `getNonce(address,uint128)` +- Function selector: `0xb44581d9` + +::: + +:::tip Hint + +A signer can choose its channel number arbitrarily. The recommended practice is to: + +- use `channelId == 0` for transactions for which the ordering of execution matters.abi _Example: you have two transactions A and B, and transaction A must be executed first and complete successfully before transaction B should be executed)._ +- use any other `channelId` number for transactions that you want to be order independant (out-of-order execution, execution _"in parallel"_). \_Example: you have two transactions A and B. You want transaction B to be executed a) without having to wait for transaction A to complete, or b) regardless if transaction A completed successfully or not. + +::: + +```solidity +function getNonce( + address from, + uint128 channelId +) external view returns (uint256); +``` + +_Reading the latest nonce of address `from` in the channel ID `channelId`._ + +Get the nonce for a specific `from` address that can be used for signing relay transactions via [`executeRelayCall`](#executerelaycall). + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | -------------------------------------------------------------------------- | +| `from` | `address` | The address of the signer of the transaction. | +| `channelId` | `uint128` | The channel id that the signer wants to use for executing the transaction. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | -------------------------------------------- | +| `0` | `uint256` | The current nonce on a specific `channelId`. | + +
+ +### isValidSignature + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#isvalidsignature) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Function signature: `isValidSignature(bytes32,bytes)` +- Function selector: `0x1626ba7e` + +::: + +:::caution Warning + +This function does not enforce by default the inclusion of the address of this contract in the signature digest. It is recommended that protocols or applications using this contract include the targeted address (= this contract) in the data to sign. To ensure that a signature is valid for a specific LSP6KeyManager and prevent signatures from the same EOA to be replayed across different LSP6KeyManager. + +::: + +```solidity +function isValidSignature( + bytes32 dataHash, + bytes signature +) external view returns (bytes4 returnedStatus); +``` + +Checks if a signature was signed by a controller that has the permission `SIGN`. If the signer is a controller with the permission `SIGN`, it will return the ERC1271 success value. + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------- | +| `dataHash` | `bytes32` | - | +| `signature` | `bytes` | Signature byte array associated with \_data | + +#### Returns + +| Name | Type | Description | +| ---------------- | :------: | ---------------------------------------------------- | +| `returnedStatus` | `bytes4` | `0x1626ba7e` on success, or `0xffffffff` on failure. | + +
+ +### lsp20VerifyCall + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#lsp20verifycall) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Function signature: `lsp20VerifyCall(address,address,address,uint256,bytes)` +- Function selector: `0xde928f14` + +::: + +:::tip Hint + +This function can call by any other address than the [`target`](#`target`). This allows to verify permissions in a _"read-only"_ manner. Anyone can call this function to verify if the `caller` has the right permissions to perform the abi-encoded function call `data` on the [`target`](#`target`) contract (while sending `msgValue` alongside the call). If the permissions have been verified successfully and `caller` is authorized, one of the following two LSP20 success value will be returned: + +- `0x1a238000`: LSP20 success value **without** post verification (last byte is `0x00`). +- `0x1a238001`: LSP20 success value **with** post-verification (last byte is `0x01`). + +::: + +```solidity +function lsp20VerifyCall( + address, + address targetContract, + address caller, + uint256 msgValue, + bytes callData +) external nonpayable returns (bytes4); +``` + +#### Parameters + +| Name | Type | Description | +| ---------------- | :-------: | ------------------------------------------------------------- | +| `_0` | `address` | - | +| `targetContract` | `address` | - | +| `caller` | `address` | The address who called the function on the `target` contract. | +| `msgValue` | `uint256` | - | +| `callData` | `bytes` | The calldata sent by the caller to the msg.sender | + +#### Returns + +| Name | Type | Description | +| ---- | :------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `0` | `bytes4` | MUST return the first 3 bytes of `lsp20VerifyCall(address,uint256,bytes)` function selector if the call to the function is allowed, concatened with a byte that determines if the lsp20VerifyCallResult function should be called after the original function call. The byte that invoke the lsp20VerifyCallResult function is strictly `0x01`. | + +
+ +### lsp20VerifyCallResult + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#lsp20verifycallresult) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Function signature: `lsp20VerifyCallResult(bytes32,bytes)` +- Function selector: `0xd3fc45d3` + +::: + +```solidity +function lsp20VerifyCallResult( + bytes32, + bytes +) external nonpayable returns (bytes4); +``` + +#### Parameters + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `_0` | `bytes32` | - | +| `_1` | `bytes` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :------: | ---------------------------------------------------------------------------------------------- | +| `0` | `bytes4` | MUST return the lsp20VerifyCallResult function selector if the call to the function is allowed | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#supportsinterface) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +See [`IERC165-supportsInterface`](#ierc165-supportsinterface). + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ----------- | +| `interfaceId` | `bytes4` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ----------- | +| `0` | `bool` | - | + +
+ +### target + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#target) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Function signature: `target()` +- Function selector: `0xd4b83992` + +::: + +```solidity +function target() external view returns (address); +``` + +Get The address of the contract linked to this Key Manager. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ---------------------------------- | +| `0` | `address` | The address of the linked contract | + +
+ +## 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. + +### \_verifyCanSetData + +```solidity +function _verifyCanSetData( + address controlledContract, + address controllerAddress, + bytes32 controllerPermissions, + bytes32 inputDataKey, + bytes inputDataValue +) internal view; +``` + +verify if the `controllerAddress` has the permissions required to set a data key on the ERC725Y storage of the `controlledContract`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------------------------- | +| `controlledContract` | `address` | the address of the ERC725Y contract where the data key is set. | +| `controllerAddress` | `address` | the address of the controller who wants to set the data key. | +| `controllerPermissions` | `bytes32` | the permissions of the controller address. | +| `inputDataKey` | `bytes32` | the data key to set on the `controlledContract`. | +| `inputDataValue` | `bytes` | the data value to set for the `inputDataKey`. | + +
+ +### \_verifyCanSetData + +```solidity +function _verifyCanSetData( + address controlledContract, + address controller, + bytes32 permissions, + bytes32[] inputDataKeys, + bytes[] inputDataValues +) internal view; +``` + +verify if the `controllerAddress` has the permissions required to set an array of data keys on the ERC725Y storage of the `controlledContract`. + +#### Parameters + +| Name | Type | Description | +| -------------------- | :---------: | -------------------------------------------------------------- | +| `controlledContract` | `address` | the address of the ERC725Y contract where the data key is set. | +| `controller` | `address` | the address of the controller who wants to set the data key. | +| `permissions` | `bytes32` | the permissions of the controller address. | +| `inputDataKeys` | `bytes32[]` | an array of data keys to set on the `controlledContract`. | +| `inputDataValues` | `bytes[]` | an array of data values to set for the `inputDataKeys`. | + +
+ +### \_getPermissionRequiredToSetDataKey + +```solidity +function _getPermissionRequiredToSetDataKey( + address controlledContract, + bytes32 controllerPermissions, + bytes32 inputDataKey, + bytes inputDataValue +) internal view returns (bytes32); +``` + +retrieve the permission required based on the data key to be set on the `controlledContract`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ----------------------------------------------------------------------------------------------------------------------- | +| `controlledContract` | `address` | the address of the ERC725Y contract where the data key is verified. | +| `controllerPermissions` | `bytes32` | - | +| `inputDataKey` | `bytes32` | the data key to set on the `controlledContract`. Can be related to LSP6 Permissions, LSP1 Delegate or LSP17 Extensions. | +| `inputDataValue` | `bytes` | the data value to set for the `inputDataKey`. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------------------------------------------ | +| `0` | `bytes32` | the permission required to set the `inputDataKey` on the `controlledContract`. | + +
+ +### \_getPermissionToSetPermissionsArray + +```solidity +function _getPermissionToSetPermissionsArray( + address controlledContract, + bytes32 inputDataKey, + bytes inputDataValue, + bool hasBothAddControllerAndEditPermissions +) internal view returns (bytes32); +``` + +retrieve the permission required to update the `AddressPermissions[]` array data key defined in LSP6. + +#### Parameters + +| Name | Type | Description | +| ---------------------------------------- | :-------: | ----------------------------------------------------------------------------------------- | +| `controlledContract` | `address` | the address of the ERC725Y contract where the data key is verified. | +| `inputDataKey` | `bytes32` | either `AddressPermissions[]` (array length) or `AddressPermissions[index]` (array index) | +| `inputDataValue` | `bytes` | the updated value for the `inputDataKey`. MUST be: | +| `hasBothAddControllerAndEditPermissions` | `bool` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | --------------------------------- | +| `0` | `bytes32` | either ADD or CHANGE PERMISSIONS. | + +
+ +### \_getPermissionToSetControllerPermissions + +```solidity +function _getPermissionToSetControllerPermissions( + address controlledContract, + bytes32 inputPermissionDataKey +) internal view returns (bytes32); +``` + +retrieve the permission required to set permissions for a controller address. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ------------------------------------------------------------------- | +| `controlledContract` | `address` | the address of the ERC725Y contract where the data key is verified. | +| `inputPermissionDataKey` | `bytes32` | `AddressPermissions:Permissions:`. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | --------------------------------- | +| `0` | `bytes32` | either ADD or CHANGE PERMISSIONS. | + +
+ +### \_getPermissionToSetAllowedCalls + +```solidity +function _getPermissionToSetAllowedCalls( + address controlledContract, + bytes32 dataKey, + bytes dataValue, + bool hasBothAddControllerAndEditPermissions +) internal view returns (bytes32); +``` + +Retrieve the permission required to set some AllowedCalls for a controller. + +#### Parameters + +| Name | Type | Description | +| ---------------------------------------- | :-------: | ------------------------------------------------------------------------------------------- | +| `controlledContract` | `address` | The address of the ERC725Y contract from which to fetch the value of `dataKey`. | +| `dataKey` | `bytes32` | A data key ion the format `AddressPermissions:AllowedCalls:`. | +| `dataValue` | `bytes` | The updated value for the `dataKey`. MUST be a bytes32[CompactBytesArray] of Allowed Calls. | +| `hasBothAddControllerAndEditPermissions` | `bool` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------- | +| `0` | `bytes32` | Either ADD or EDIT PERMISSIONS. | + +
+ +### \_getPermissionToSetAllowedERC725YDataKeys + +```solidity +function _getPermissionToSetAllowedERC725YDataKeys( + address controlledContract, + bytes32 dataKey, + bytes dataValue, + bool hasBothAddControllerAndEditPermissions +) internal view returns (bytes32); +``` + +Retrieve the permission required to set some Allowed ERC725Y Data Keys for a controller. + +#### Parameters + +| Name | Type | Description | +| ---------------------------------------- | :-------: | ----------------------------------------------------------------------------------------------------- | +| `controlledContract` | `address` | the address of the ERC725Y contract from which to fetch the value of `dataKey`. | +| `dataKey` | `bytes32` | A data key in the format `AddressPermissions:AllowedERC725YDataKeys:`. | +| `dataValue` | `bytes` | The updated value for the `dataKey`. MUST be a bytes[CompactBytesArray] of Allowed ERC725Y Data Keys. | +| `hasBothAddControllerAndEditPermissions` | `bool` | - | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------- | +| `0` | `bytes32` | Either ADD or EDIT PERMISSIONS. | + +
+ +### \_getPermissionToSetLSP1Delegate + +```solidity +function _getPermissionToSetLSP1Delegate( + address controlledContract, + bytes32 lsp1DelegateDataKey +) internal view returns (bytes32); +``` + +retrieve the permission required to either add or change the address +of a LSP1 Universal Receiver Delegate stored under a specific LSP1 data key. + +#### Parameters + +| Name | Type | Description | +| --------------------- | :-------: | -------------------------------------------------------------------- | +| `controlledContract` | `address` | the address of the ERC725Y contract where the data key is verified. | +| `lsp1DelegateDataKey` | `bytes32` | either the data key for the default `LSP1UniversalReceiverDelegate`, | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------------- | +| `0` | `bytes32` | either ADD or CHANGE UNIVERSALRECEIVERDELEGATE. | + +
+ +### \_getPermissionToSetLSP17Extension + +```solidity +function _getPermissionToSetLSP17Extension( + address controlledContract, + bytes32 lsp17ExtensionDataKey +) internal view returns (bytes32); +``` + +Verify if `controller` has the required permissions to either add or change the address +of an LSP0 Extension stored under a specific LSP17Extension data key + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ------------------------------------------------------------------- | +| `controlledContract` | `address` | the address of the ERC725Y contract where the data key is verified. | +| `lsp17ExtensionDataKey` | `bytes32` | the dataKey to set with `_LSP17_EXTENSION_PREFIX` as prefix. | + +
+ +### \_verifyAllowedERC725YSingleKey + +```solidity +function _verifyAllowedERC725YSingleKey( + address controllerAddress, + bytes32 inputDataKey, + bytes allowedERC725YDataKeysCompacted +) internal pure; +``` + +Verify if the `inputKey` is present in the list of `allowedERC725KeysCompacted` for the `controllerAddress`. + +#### Parameters + +| Name | Type | Description | +| --------------------------------- | :-------: | ----------------------------------------------------------------------------------------- | +| `controllerAddress` | `address` | the address of the controller. | +| `inputDataKey` | `bytes32` | the data key to verify against the allowed ERC725Y Data Keys for the `controllerAddress`. | +| `allowedERC725YDataKeysCompacted` | `bytes` | a CompactBytesArray of allowed ERC725Y Data Keys for the `controllerAddress`. | + +
+ +### \_verifyAllowedERC725YDataKeys + +```solidity +function _verifyAllowedERC725YDataKeys( + address controllerAddress, + bytes32[] inputDataKeys, + bytes allowedERC725YDataKeysCompacted, + bool[] validatedInputKeysList, + uint256 allowedDataKeysFound +) internal pure; +``` + +Verify if all the `inputDataKeys` are present in the list of `allowedERC725KeysCompacted` of the `controllerAddress`. + +#### Parameters + +| Name | Type | Description | +| --------------------------------- | :---------: | ---------------------------------------------------------------------------------------------------------------------------- | +| `controllerAddress` | `address` | the address of the controller. | +| `inputDataKeys` | `bytes32[]` | the data keys to verify against the allowed ERC725Y Data Keys of the `controllerAddress`. | +| `allowedERC725YDataKeysCompacted` | `bytes` | a CompactBytesArray of allowed ERC725Y Data Keys of the `controllerAddress`. | +| `validatedInputKeysList` | `bool[]` | an array of booleans to store the result of the verification of each data keys checked. | +| `allowedDataKeysFound` | `uint256` | the number of data keys that were previously validated for other permissions like `ADDCONTROLLER`, `EDITPERMISSIONS`, etc... | + +
+ +### \_requirePermissions + +```solidity +function _requirePermissions( + address controller, + bytes32 addressPermissions, + bytes32 permissionRequired +) internal pure; +``` + +Check if the `controller` has the `permissionRequired` among its permission listed in `controllerPermissions` +If not, this function will revert with the error `NotAuthorised` and the name of the permission missing by the controller. + +#### Parameters + +| Name | Type | Description | +| -------------------- | :-------: | --------------------------------- | +| `controller` | `address` | the caller address | +| `addressPermissions` | `bytes32` | the caller's permissions BitArray | +| `permissionRequired` | `bytes32` | the required permission | + +
+ +### \_verifyCanExecute + +```solidity +function _verifyCanExecute( + address controlledContract, + address controller, + bytes32 permissions, + uint256 operationType, + address to, + uint256 value, + bytes data +) internal view; +``` + +verify if `controllerAddress` has the required permissions to interact with other addresses using the controlledContract. + +#### Parameters + +| Name | Type | Description | +| -------------------- | :-------: | -------------------------------------------------------------------------------------------------------- | +| `controlledContract` | `address` | the address of the ERC725 contract where the payload is executed and where the permissions are verified. | +| `controller` | `address` | the address who want to run the execute function on the ERC725Account. | +| `permissions` | `bytes32` | the permissions of the controller address. | +| `operationType` | `uint256` | - | +| `to` | `address` | - | +| `value` | `uint256` | - | +| `data` | `bytes` | - | + +
+ +### \_verifyCanDeployContract + +```solidity +function _verifyCanDeployContract( + address controller, + bytes32 permissions, + bool isFundingContract +) internal view; +``` + +
+ +### \_verifyCanStaticCall + +```solidity +function _verifyCanStaticCall( + address controlledContract, + address controller, + bytes32 permissions, + address to, + uint256 value, + bytes data +) internal view; +``` + +
+ +### \_verifyCanCall + +```solidity +function _verifyCanCall( + address controlledContract, + address controller, + bytes32 permissions, + address to, + uint256 value, + bytes data +) internal view; +``` + +
+ +### \_verifyAllowedCall + +```solidity +function _verifyAllowedCall( + address controlledContract, + address controllerAddress, + uint256 operationType, + address to, + uint256 value, + bytes data +) internal view; +``` + +
+ +### \_extractCallType + +```solidity +function _extractCallType( + uint256 operationType, + uint256 value, + bytes data +) internal pure returns (bytes4 requiredCallTypes); +``` + +extract the bytes4 representation of a single bit for the type of call according to the `operationType` + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | -------------------------------------------- | +| `operationType` | `uint256` | 0 = CALL, 3 = STATICCALL or 3 = DELEGATECALL | +| `value` | `uint256` | - | +| `data` | `bytes` | - | + +#### Returns + +| Name | Type | Description | +| ------------------- | :------: | --------------------------------------------------------- | +| `requiredCallTypes` | `bytes4` | a bytes4 value containing a single 1 bit for the callType | + +
+ +### \_isAllowedAddress + +```solidity +function _isAllowedAddress( + bytes allowedCall, + address to +) internal pure returns (bool); +``` + +
+ +### \_isAllowedStandard + +```solidity +function _isAllowedStandard( + bytes allowedCall, + address to +) internal view returns (bool); +``` + +
+ +### \_isAllowedFunction + +```solidity +function _isAllowedFunction( + bytes allowedCall, + bytes data +) internal pure returns (bool); +``` + +
+ +### \_isAllowedCallType + +```solidity +function _isAllowedCallType( + bytes allowedCall, + bytes4 requiredCallTypes +) internal pure returns (bool); +``` + +
+ +### \_verifyExecuteRelayCallPermission + +```solidity +function _verifyExecuteRelayCallPermission( + address controllerAddress, + bytes32 controllerPermissions +) internal pure; +``` + +
+ +### \_verifyOwnershipPermissions + +```solidity +function _verifyOwnershipPermissions( + address controllerAddress, + bytes32 controllerPermissions +) internal pure; +``` + +
+ +### \_getNonce + +```solidity +function _getNonce( + address from, + uint128 channelId +) internal view returns (uint256 idx); +``` + +Read the nonce for a `from` address on a specific `channelId`. +This will return an `idx`, which is the concatenation of two `uint128` as follow: + +1. the `channelId` where the nonce was queried for. + +2. the actual nonce of the given `channelId`. + For example, if on `channelId` number `5`, the latest nonce is `1`, the `idx` returned by this function will be: + +``` +// in decimals = 1701411834604692317316873037158841057281 +idx = 0x0000000000000000000000000000000500000000000000000000000000000001 +``` + +This idx can be described as follow: + +``` + channelId => 5 nonce in this channel => 1 + v------------------------------v-------------------------------v +0x0000000000000000000000000000000500000000000000000000000000000001 +``` + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `from` | `address` | The address to read the nonce for. | +| `channelId` | `uint128` | The channel in which to extract the nonce. | + +#### Returns + +| Name | Type | Description | +| ----- | :-------: | ---------------------------------------------------------------------------------------------------------------------- | +| `idx` | `uint256` | The idx composed of two `uint128`: the channelId + nonce in channel concatenated together in a single `uint256` value. | + +
+ +### \_recoverSignerFromLSP25Signature + +```solidity +function _recoverSignerFromLSP25Signature( + bytes signature, + uint256 nonce, + uint256 validityTimestamps, + uint256 msgValue, + bytes callData +) internal view returns (address); +``` + +Recover the address of the signer that generated a `signature` using the parameters provided `nonce`, `validityTimestamps`, `msgValue` and `callData`. +The address of the signer will be recovered using the LSP25 signature format. + +#### Parameters + +| Name | Type | Description | +| -------------------- | :-------: | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `signature` | `bytes` | A 65 bytes long signature generated according to the signature format specified in the LSP25 standard. | +| `nonce` | `uint256` | The nonce that the signer used to generate the `signature`. | +| `validityTimestamps` | `uint256` | The validity timestamp that the signer used to generate the signature (See [`_verifyValidityTimestamps`](#_verifyvaliditytimestamps) to learn more). | +| `msgValue` | `uint256` | The amount of native tokens intended to be sent for the relay transaction. | +| `callData` | `bytes` | The calldata to execute as a relay transaction that the signer signed for. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | -------------------------------------------------------- | +| `0` | `address` | The address that signed, recovered from the `signature`. | + +
+ +### \_verifyValidityTimestamps + +```solidity +function _verifyValidityTimestamps(uint256 validityTimestamps) internal view; +``` + +Verify that the current timestamp is within the date and time range provided by `validityTimestamps`. + +#### Parameters + +| Name | Type | Description | +| -------------------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------- | +| `validityTimestamps` | `uint256` | Two `uint128` concatenated together, where the left-most `uint128` represent the timestamp from which the transaction can be executed, | + +
+ +### \_isValidNonce + +```solidity +function _isValidNonce(address from, uint256 idx) internal view returns (bool); +``` + +Verify that the nonce `_idx` for `_from` (obtained via [`getNonce`](#getnonce)) is valid in its channel ID. +The "idx" is a 256bits (unsigned) integer, where: + +- the 128 leftmost bits = channelId + +- and the 128 rightmost bits = nonce within the channel + +#### Parameters + +| Name | Type | Description | +| ------ | :-------: | ---------------------------------------------------------------------------- | +| `from` | `address` | The signer's address. | +| `idx` | `uint256` | The concatenation of the `channelId` + `nonce` within a specific channel ID. | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ------------------------------------------------------------------------ | +| `0` | `bool` | true if the nonce is the latest nonce for the `signer`, false otherwise. | + +
+ +### \_execute + +```solidity +function _execute( + uint256 msgValue, + bytes payload +) internal nonpayable returns (bytes); +``` + +
+ +### \_executeRelayCall + +:::caution Warning + +Be aware that this function can also throw an error if the `callData` was signed incorrectly (not conforming to the signature format defined in the LSP25 standard). +This is because the contract cannot distinguish if the data is signed correctly or not. Instead, it will recover an incorrect signer address from the signature +and throw an [`InvalidRelayNonce`](#invalidrelaynonce) error with the incorrect signer address as the first parameter. + +::: + +```solidity +function _executeRelayCall( + bytes signature, + uint256 nonce, + uint256 validityTimestamps, + uint256 msgValue, + bytes payload +) internal nonpayable returns (bytes); +``` + +Validate that the `nonce` given for the `signature` signed and the `payload` to execute is valid +and conform to the signature format according to the LSP25 standard. + +#### Parameters + +| Name | Type | Description | +| -------------------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------- | +| `signature` | `bytes` | A valid signature for a signer, generated according to the signature format specified in the LSP25 standard. | +| `nonce` | `uint256` | The nonce that the signer used to generate the `signature`. | +| `validityTimestamps` | `uint256` | Two `uint128` concatenated together, where the left-most `uint128` represent the timestamp from which the transaction can be executed, | +| `msgValue` | `uint256` | - | +| `payload` | `bytes` | The abi-encoded function call to execute. | + +
+ +### \_executePayload + +```solidity +function _executePayload( + address targetContract, + uint256 msgValue, + bytes payload +) internal nonpayable returns (bytes); +``` + +_Execute the `payload` passed to `execute(...)` or `executeRelayCall(...)`_ + +#### Parameters + +| Name | Type | Description | +| ---------------- | :-------: | ----------------------------------------------------------------------------- | +| `targetContract` | `address` | - | +| `msgValue` | `uint256` | - | +| `payload` | `bytes` | The abi-encoded function call to execute on the [`target`](#target) contract. | + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ------------------------------------------------------------------------------------ | +| `0` | `bytes` | bytes The data returned by the call made to the linked [`target`](#target) contract. | + +
+ +### \_verifyPermissions + +```solidity +function _verifyPermissions( + address targetContract, + address from, + bool isRelayedCall, + bytes payload +) internal view; +``` + +Verify if the `from` address is allowed to execute the `payload` on the [`target`](#target) contract linked to this Key Manager. + +#### Parameters + +| Name | Type | Description | +| ---------------- | :-------: | ---------------------------------------------------------------------------------------------------- | +| `targetContract` | `address` | The contract that is owned by the Key Manager | +| `from` | `address` | Either the caller of [`execute`](#execute) or the signer of [`executeRelayCall`](#executerelaycall). | +| `isRelayedCall` | `bool` | - | +| `payload` | `bytes` | The abi-encoded function call to execute on the [`target`](#target) contract. | + +
+ +### \_nonReentrantBefore + +```solidity +function _nonReentrantBefore( + address targetContract, + bool isSetData, + address from +) internal nonpayable returns (bool reentrancyStatus); +``` + +Check if we are in the context of a reentrant call, by checking if the reentrancy status is `true`. + +- If the status is `true`, the caller (or signer for relay call) MUST have the `REENTRANCY` permission. Otherwise, the call is reverted. + +- If the status is `false`, it is set to `true` only if we are not dealing with a call to the functions `setData` or `setDataBatch`. + Used at the beginning of the [`lsp20VerifyCall`](#`lsp20verifycall`), [`_execute`](#`_execute`) and [`_executeRelayCall`](#`_executerelaycall`) functions, before the methods execution starts. + +
+ +### \_nonReentrantAfter + +```solidity +function _nonReentrantAfter(address targetContract) internal nonpayable; +``` + +Resets the reentrancy status to `false` +Used at the end of the [`lsp20VerifyCall`](#`lsp20verifycall`), [`_execute`](#`_execute`) and [`_executeRelayCall`](#`_executerelaycall`) functions after the functions' execution is terminated. + +
+ +## Events + +### PermissionsVerified + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#permissionsverified) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Event signature: `PermissionsVerified(address,uint256,bytes4)` +- Event topic hash: `0xc0a62328f6bf5e3172bb1fcb2019f54b2c523b6a48e3513a2298fbf0150b781e` + +::: + +```solidity +event PermissionsVerified( + address indexed signer, + uint256 indexed value, + bytes4 indexed selector +); +``` + +_Verified the permissions of `signer` for calling function `selector` on the linked account and sending `value` of native token._ + +Emitted when the LSP6KeyManager contract verified the permissions of the `signer` successfully. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `signer` **`indexed`** | `address` | The address of the controller that executed the calldata payload (either directly via [`execute`](#execute) or via meta transaction using [`executeRelayCall`](#executerelaycall)). | +| `value` **`indexed`** | `uint256` | The amount of native token to be transferred in the calldata payload. | +| `selector` **`indexed`** | `bytes4` | The bytes4 function of the function that was executed on the linked [`target`](#target) | + +
+ +## Errors + +### BatchExecuteParamsLengthMismatch + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#batchexecuteparamslengthmismatch) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `BatchExecuteParamsLengthMismatch()` +- Error hash: `0x55a187db` + +::: + +```solidity +error BatchExecuteParamsLengthMismatch(); +``` + +_The array parameters provided to the function `executeBatch(...)` do not have the same number of elements. (Different array param's length)._ + +Reverts when the array parameters `uint256[] value` and `bytes[] payload` have different sizes. There should be the same number of elements for each array parameters. + +
+ +### BatchExecuteRelayCallParamsLengthMismatch + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#batchexecuterelaycallparamslengthmismatch) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `BatchExecuteRelayCallParamsLengthMismatch()` +- Error hash: `0xb4d50d21` + +::: + +```solidity +error BatchExecuteRelayCallParamsLengthMismatch(); +``` + +_The array parameters provided to the function `executeRelayCallBatch(...)` do not have the same number of elements. (Different array param's length)._ + +Reverts when providing array parameters of different sizes to `executeRelayCallBatch(bytes[],uint256[],bytes[])` + +
+ +### CallingKeyManagerNotAllowed + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#callingkeymanagernotallowed) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `CallingKeyManagerNotAllowed()` +- Error hash: `0xa431b236` + +::: + +```solidity +error CallingKeyManagerNotAllowed(); +``` + +_Calling the Key Manager address for this transaction is disallowed._ + +Reverts when calling the KeyManager through `execute(uint256,address,uint256,bytes)`. + +
+ +### DelegateCallDisallowedViaKeyManager + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#delegatecalldisallowedviakeymanager) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `DelegateCallDisallowedViaKeyManager()` +- Error hash: `0x80d6ebae` + +::: + +```solidity +error DelegateCallDisallowedViaKeyManager(); +``` + +_Performing DELEGATE CALLS via the Key Manager is currently disallowed._ + +Reverts when trying to do a `delegatecall` via the ERC725X.execute(uint256,address,uint256,bytes) (operation type 4) function of the linked [`target`](#target). `DELEGATECALL` is disallowed by default on the LSP6KeyManager. + +
+ +### ERC725X_ExecuteParametersEmptyArray + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#erc725x_executeparametersemptyarray) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `ERC725X_ExecuteParametersEmptyArray()` +- Error hash: `0xe9ad2b5f` + +::: + +```solidity +error ERC725X_ExecuteParametersEmptyArray(); +``` + +Reverts when one of the array parameter provided to the [`executeBatch`](#executebatch) function is an empty array. + +
+ +### ERC725X_ExecuteParametersLengthMismatch + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#erc725x_executeparameterslengthmismatch) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `ERC725X_ExecuteParametersLengthMismatch()` +- Error hash: `0x3ff55f4d` + +::: + +```solidity +error ERC725X_ExecuteParametersLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `operationTypes`, `targets` addresses, `values`, and `datas` array parameters provided when calling the [`executeBatch`](#executebatch) function. + +
+ +### ERC725Y_DataKeysValuesLengthMismatch + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function. + +
+ +### InvalidDataValuesForDataKeys + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#invaliddatavaluesfordatakeys) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `InvalidDataValuesForDataKeys(bytes32,bytes)` +- Error hash: `0x1fa41397` + +::: + +```solidity +error InvalidDataValuesForDataKeys(bytes32 dataKey, bytes dataValue); +``` + +_Data value: `dataValue` length is different from the required length for the data key which is set._ + +Reverts when the data value length is not one of the required lengths for the specific data key. + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ----------------------------------------------------------- | +| `dataKey` | `bytes32` | The data key that has a required length for the data value. | +| `dataValue` | `bytes` | The data value that has an invalid length. | + +
+ +### InvalidERC725Function + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#invaliderc725function) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `InvalidERC725Function(bytes4)` +- Error hash: `0x2ba8851c` + +::: + +```solidity +error InvalidERC725Function(bytes4 invalidFunction); +``` + +_The Key Manager could not verify the calldata of the transaction because it could not recognise the function being called. Invalid function selector: `invalidFunction`._ + +Reverts when trying to call a function on the linked [`target`](#target), that is not any of the following: + +- `setData(bytes32,bytes)` (ERC725Y) + +- `setDataBatch(bytes32[],bytes[])` (ERC725Y) + +- `execute(uint256,address,uint256,bytes)` (ERC725X) + +- `transferOwnership(address)` (LSP14) + +- `acceptOwnership()` (LSP14) + +- `renounceOwnership()` (LSP14) + +#### Parameters + +| Name | Type | Description | +| ----------------- | :------: | --------------------------------------------------------------------------------------------------------------------------- | +| `invalidFunction` | `bytes4` | The `bytes4` selector of the function that was attempted to be called on the linked [`target`](#target) but not recognised. | + +
+ +### InvalidEncodedAllowedCalls + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#invalidencodedallowedcalls) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `InvalidEncodedAllowedCalls(bytes)` +- Error hash: `0x187e77ab` + +::: + +```solidity +error InvalidEncodedAllowedCalls(bytes allowedCallsValue); +``` + +_Could not decode the Allowed Calls. Value = `allowedCallsValue`._ + +Reverts when `allowedCallsValue` is not properly encoded as a `(bytes4,address,bytes4,bytes4)[CompactBytesArray]` (CompactBytesArray made of tuples that are 32 bytes long each). See LSP2 value type `CompactBytesArray` for more infos. + +#### Parameters + +| Name | Type | Description | +| ------------------- | :-----: | ----------------------------------------------------------------------------------------------------------------- | +| `allowedCallsValue` | `bytes` | The list of allowedCalls that are not encoded correctly as a `(bytes4,address,bytes4,bytes4)[CompactBytesArray]`. | + +
+ +### InvalidEncodedAllowedERC725YDataKeys + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#invalidencodedallowederc725ydatakeys) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `InvalidEncodedAllowedERC725YDataKeys(bytes,string)` +- Error hash: `0xae6cbd37` + +::: + +```solidity +error InvalidEncodedAllowedERC725YDataKeys(bytes value, string context); +``` + +_Error when reading the Allowed ERC725Y Data Keys. Reason: `context`, Allowed ERC725Y Data Keys value read: `value`._ + +Reverts when `value` is not encoded properly as a `bytes32[CompactBytesArray]`. The `context` string provides context on when this error occurred (\_e.g: when fetching the `AllowedERC725YDataKeys` to verify the permissions of a controller, or when validating the `AllowedERC725YDataKeys` when setting them for a controller). + +#### Parameters + +| Name | Type | Description | +| --------- | :------: | ---------------------------------------------------------- | +| `value` | `bytes` | The value that is not a valid `bytes32[CompactBytesArray]` | +| `context` | `string` | A brief description of where the error occurred. | + +
+ +### InvalidLSP6Target + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#invalidlsp6target) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `InvalidLSP6Target()` +- Error hash: `0xfc854579` + +::: + +```solidity +error InvalidLSP6Target(); +``` + +_Invalid address supplied to link this Key Manager to (`address(0)`)._ + +Reverts when the address provided to set as the [`target`](#target) linked to this KeyManager is invalid (_e.g. `address(0)`_). + +
+ +### InvalidPayload + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#invalidpayload) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `InvalidPayload(bytes)` +- Error hash: `0x3621bbcc` + +::: + +```solidity +error InvalidPayload(bytes payload); +``` + +_Invalid calldata payload sent._ + +Reverts when the payload is invalid. + +#### Parameters + +| Name | Type | Description | +| --------- | :-----: | ----------- | +| `payload` | `bytes` | - | + +
+ +### InvalidRelayNonce + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#invalidrelaynonce) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `InvalidRelayNonce(address,uint256,bytes)` +- Error hash: `0xc9bd9eb9` + +::: + +```solidity +error InvalidRelayNonce(address signer, uint256 invalidNonce, bytes signature); +``` + +_The relay call failed because an invalid nonce was provided for the address `signer` that signed the execute relay call. Invalid nonce: `invalidNonce`, signature of signer: `signature`._ + +Reverts when the `signer` address retrieved from the `signature` has an invalid nonce: `invalidNonce`. + +#### Parameters + +| Name | Type | Description | +| -------------- | :-------: | ---------------------------------------------------- | +| `signer` | `address` | The address of the signer. | +| `invalidNonce` | `uint256` | The nonce retrieved for the `signer` address. | +| `signature` | `bytes` | The signature used to retrieve the `signer` address. | + +
+ +### InvalidWhitelistedCall + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#invalidwhitelistedcall) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `InvalidWhitelistedCall(address)` +- Error hash: `0x6fd203c5` + +::: + +```solidity +error InvalidWhitelistedCall(address from); +``` + +_Invalid allowed calls (`0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff`) set for address `from`. Could not perform external call._ + +Reverts when a `from` address has _"any whitelisted call"_ as allowed call set. This revert happens during the verification of the permissions of the address for its allowed calls. A `from` address is not allowed to have 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff in its list of `AddressPermissions:AllowedCalls:
`, as this allows any STANDARD:ADDRESS:FUNCTION. This is equivalent to granting the SUPER permission and should never be valid. + +#### Parameters + +| Name | Type | Description | +| ------ | :-------: | ---------------------------------------------------------------------- | +| `from` | `address` | The controller address that has _"any allowed calls"_ whitelisted set. | + +
+ +### KeyManagerCannotBeSetAsExtensionForLSP20Functions + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#keymanagercannotbesetasextensionforlsp20functions) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `KeyManagerCannotBeSetAsExtensionForLSP20Functions()` +- Error hash: `0x4a9fa8cf` + +::: + +```solidity +error KeyManagerCannotBeSetAsExtensionForLSP20Functions(); +``` + +_Key Manager cannot be used as an LSP17 extension for LSP20 functions._ + +Reverts when the address of the Key Manager is being set as extensions for lsp20 functions + +
+ +### LSP6BatchExcessiveValueSent + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#lsp6batchexcessivevaluesent) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `LSP6BatchExcessiveValueSent(uint256,uint256)` +- Error hash: `0xa51868b6` + +::: + +```solidity +error LSP6BatchExcessiveValueSent(uint256 totalValues, uint256 msgValue); +``` + +_Too much funds sent to forward each amount in the batch. No amount of native tokens should stay in the Key Manager._ + +This error occurs when there was too much funds sent to the batch functions `execute(uint256[],bytes[])` or `executeRelayCall(bytes[],uint256[],uint256[],bytes[])` to cover the sum of all the values forwarded on Reverts to avoid the KeyManager to holds some remaining funds sent to the following batch functions: + +- execute(uint256[],bytes[]) + +- executeRelayCall(bytes[],uint256[],uint256[],bytes[]) This error occurs when `msg.value` is more than the sum of all the values being forwarded on each payloads (`values[]` parameter from the batch functions above). + +#### Parameters + +| Name | Type | Description | +| ------------- | :-------: | ----------- | +| `totalValues` | `uint256` | - | +| `msgValue` | `uint256` | - | + +
+ +### LSP6BatchInsufficientValueSent + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#lsp6batchinsufficientvaluesent) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `LSP6BatchInsufficientValueSent(uint256,uint256)` +- Error hash: `0x30a324ac` + +::: + +```solidity +error LSP6BatchInsufficientValueSent(uint256 totalValues, uint256 msgValue); +``` + +_Not enough funds sent to forward each amount in the batch._ + +This error occurs when there was not enough funds sent to the batch functions `execute(uint256[],bytes[])` or `executeRelayCall(bytes[],uint256[],uint256[],bytes[])` to cover the sum of all the values forwarded on each payloads (`values[]` parameter from the batch functions above). This mean that `msg.value` is less than the sum of all the values being forwarded on each payloads (`values[]` parameters). + +#### Parameters + +| Name | Type | Description | +| ------------- | :-------: | ------------------------------------------------------------------------------------------------------------------------------------------------ | +| `totalValues` | `uint256` | The sum of all the values forwarded on each payloads (`values[]` parameter from the batch functions above). | +| `msgValue` | `uint256` | The amount of native tokens sent to the batch functions `execute(uint256[],bytes[])` or `executeRelayCall(bytes[],uint256[],uint256[],bytes[])`. | + +
+ +### NoCallsAllowed + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#nocallsallowed) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `NoCallsAllowed(address)` +- Error hash: `0x6cb60587` + +::: + +```solidity +error NoCallsAllowed(address from); +``` + +_The address `from` is not authorised to use the linked account contract to make external calls, because it has no Allowed Calls set._ + +Reverts when the `from` address has no `AllowedCalls` set and cannot interact with any address using the linked [`target`](#target). + +#### Parameters + +| Name | Type | Description | +| ------ | :-------: | ------------------------------------- | +| `from` | `address` | The address that has no AllowedCalls. | + +
+ +### NoERC725YDataKeysAllowed + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#noerc725ydatakeysallowed) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `NoERC725YDataKeysAllowed(address)` +- Error hash: `0xed7fa509` + +::: + +```solidity +error NoERC725YDataKeysAllowed(address from); +``` + +_The address `from` is not authorised to set data, because it has no ERC725Y Data Key allowed._ + +Reverts when the `from` address has no AllowedERC725YDataKeys set and cannot set any ERC725Y data key on the ERC725Y storage of the linked [`target`](#target). + +#### Parameters + +| Name | Type | Description | +| ------ | :-------: | ----------------------------------------------------- | +| `from` | `address` | The address that has no `AllowedERC725YDataKeys` set. | + +
+ +### NoPermissionsSet + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#nopermissionsset) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `NoPermissionsSet(address)` +- Error hash: `0xf292052a` + +::: + +```solidity +error NoPermissionsSet(address from); +``` + +_The address `from` does not have any permission set on the contract linked to the Key Manager._ + +Reverts when address `from` does not have any permissions set on the account linked to this Key Manager + +#### Parameters + +| Name | Type | Description | +| ------ | :-------: | ------------------------------------------ | +| `from` | `address` | the address that does not have permissions | + +
+ +### NotAllowedCall + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#notallowedcall) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `NotAllowedCall(address,address,bytes4)` +- Error hash: `0x45147bce` + +::: + +```solidity +error NotAllowedCall(address from, address to, bytes4 selector); +``` + +_The address `from` is not authorised to call the function `selector` on the `to` address._ + +Reverts when `from` is not authorised to call the `execute(uint256,address,uint256,bytes)` function because of a not allowed callType, address, standard or function. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The controller that tried to call the `execute(uint256,address,uint256,bytes)` function. | +| `to` | `address` | The address of an EOA or contract that `from` tried to call using the linked [`target`](#target) | +| `selector` | `bytes4` | If `to` is a contract, the bytes4 selector of the function that `from` is trying to call. If no function is called (_e.g: a native token transfer_), selector = `0x00000000` | + +
+ +### NotAllowedERC725YDataKey + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#notallowederc725ydatakey) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `NotAllowedERC725YDataKey(address,bytes32)` +- Error hash: `0x557ae079` + +::: + +```solidity +error NotAllowedERC725YDataKey(address from, bytes32 disallowedKey); +``` + +_The address `from` is not authorised to set the data key `disallowedKey` on the contract linked to the Key Manager._ + +Reverts when address `from` is not authorised to set the key `disallowedKey` on the linked [`target`](#target). + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | address The controller that tried to `setData` on the linked [`target`](#target). | +| `disallowedKey` | `bytes32` | A bytes32 data key that `from` is not authorised to set on the ERC725Y storage of the linked [`target`](#target). | + +
+ +### NotAuthorised + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#notauthorised) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `NotAuthorised(address,string)` +- Error hash: `0x3bdad6e6` + +::: + +```solidity +error NotAuthorised(address from, string permission); +``` + +_The address `from` is not authorised to `permission` on the contract linked to the Key Manager._ + +Reverts when address `from` is not authorised and does not have `permission` on the linked [`target`](#target) + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ------------------------------------------------------------------------------ | +| `from` | `address` | address The address that was not authorised. | +| `permission` | `string` | permission The permission required (\_e.g: `SETDATA`, `CALL`, `TRANSFERVALUE`) | + +
+ +### NotRecognisedPermissionKey + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#notrecognisedpermissionkey) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `NotRecognisedPermissionKey(bytes32)` +- Error hash: `0x0f7d735b` + +::: + +```solidity +error NotRecognisedPermissionKey(bytes32 dataKey); +``` + +_The data key `dataKey` starts with `AddressPermissions` prefix but is none of the permission data keys defined in LSP6._ + +Reverts when `dataKey` is a `bytes32` value that does not adhere to any of the permission data keys defined by the LSP6 standard + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ------------------------------------------------------------------------------ | +| `dataKey` | `bytes32` | The dataKey that does not match any of the standard LSP6 permission data keys. | + +
+ +### RelayCallBeforeStartTime + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#relaycallbeforestarttime) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `RelayCallBeforeStartTime()` +- Error hash: `0x00de4b8a` + +::: + +```solidity +error RelayCallBeforeStartTime(); +``` + +_Relay call not valid yet._ + +Reverts when the relay call is cannot yet bet executed. This mean that the starting timestamp provided to [`executeRelayCall`](#executerelaycall) function is bigger than the current timestamp. + +
+ +### RelayCallExpired + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md#relaycallexpired) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) +- Error signature: `RelayCallExpired()` +- Error hash: `0x5c53a98c` + +::: + +```solidity +error RelayCallExpired(); +``` + +_Relay call expired (deadline passed)._ + +Reverts when the period to execute the relay call has expired. + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md b/packages/lsp-smart-contracts/docs/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md new file mode 100644 index 000000000..2bbcd5109 --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md @@ -0,0 +1,1916 @@ + + + +# LSP7DigitalAsset + +:::info Standard Specifications + +[`LSP-7-DigitalAsset`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md) + +::: +:::info Solidity implementation + +[`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) + +::: + +> Implementation of a LSP7 Digital Asset, a contract that represents a fungible token. + +Minting and transferring are supplied with a `uint256` amount. This implementation is agnostic to the way tokens are created. A supply mechanism has to be added in a derived contract using [`_mint`](#_mint) For a generic mechanism, see [`LSP7Mintable`](#lsp7mintable). + +## 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. + +### fallback + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#fallback) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) + +::: + +```solidity +fallback(bytes calldata callData) external payable returns (bytes memory); +``` + +_The `fallback` function was called with the following amount of native tokens: `msg.value`; and the following calldata: `callData`._ + +Achieves the goal of [LSP-17-ContractExtension] standard by extending the contract to handle calls of functions that do not exist natively, +forwarding the function call to the extension address mapped to the function being called. +This function is executed when: + +- Sending data of length less than 4 bytes to the contract. + +- The first 4 bytes of the calldata do not match any publicly callable functions from the contract ABI. + +- Receiving native tokens + +1. If the data is equal or longer than 4 bytes, the [ERC-725Y] storage is queried with the following data key: [_LSP17_EXTENSION_PREFIX] + `bytes4(msg.sig)` (Check [LSP-2-ERC725YJSONSchema] for encoding the data key) + +- If there is no address stored under the following data key, revert with [`NoExtensionFoundForFunctionSelector(bytes4)`](#noextensionfoundforfunctionselector). The data key relative to `bytes4(0)` is an exception, where no reverts occurs if there is no extension address stored under. This exception is made to allow users to send random data (graffiti) to the account and to be able to react on it. + +- If there is an address, forward the `msg.data` to the extension using the CALL opcode, appending 52 bytes (20 bytes of `msg.sender` and 32 bytes of `msg.value`). Return what the calls returns, or revert if the call failed. + +2. If the data sent to this function is of length less than 4 bytes (not a function selector), revert. + +
+ +### receive + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#receive) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) + +::: + +```solidity +receive() external payable; +``` + +_LSP7 contract cannot receive native tokens._ + +Reverts whenever someone tries to send native tokens to a LSP7 contract. + +
+ +### authorizeOperator + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#authorizeoperator) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `authorizeOperator(address,uint256,bytes)` +- Function selector: `0xb49506fd` + +::: + +:::danger + +To avoid front-running and Allowance Double-Spend Exploit when increasing or decreasing the authorized amount of an operator, it is advised to use the [`increaseAllowance`](#increaseallowance) and [`decreaseAllowance`](#decreaseallowance) functions. For more information, see: https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/ + +::: + +```solidity +function authorizeOperator( + address operator, + uint256 amount, + bytes operatorNotificationData +) external nonpayable; +``` + +Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). Notify the operator based on the LSP1-UniversalReceiver standard + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ------------------------------------------------------ | +| `operator` | `address` | The address to authorize as an operator. | +| `amount` | `uint256` | The allowance amount of tokens operator has access to. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### authorizedAmountFor + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#authorizedamountfor) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `authorizedAmountFor(address,address)` +- Function selector: `0x65aeaa95` + +::: + +```solidity +function authorizedAmountFor( + address operator, + address tokenOwner +) external view returns (uint256); +``` + +Get the amount of tokens `operator` address has access to from `tokenOwner`. Operators can send and burn tokens on behalf of their owners. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ---------------------------------------------------------- | +| `operator` | `address` | The operator's address to query the authorized amount for. | +| `tokenOwner` | `address` | The token owner that `operator` has allowance on. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | --------------------------------------------------------------------------------------- | +| `0` | `uint256` | The amount of tokens the `operator`'s address has access on the `tokenOwner`'s balance. | + +
+ +### balanceOf + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#balanceof) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `balanceOf(address)` +- Function selector: `0x70a08231` + +::: + +```solidity +function balanceOf(address tokenOwner) external view returns (uint256); +``` + +Get the number of tokens owned by `tokenOwner`. If the token is divisible (the [`decimals`](#decimals) function returns `18`), the amount returned should be divided by 1e18 to get a better picture of the actual balance of the `tokenOwner`. _Example:_ `balanceOf(someAddress) -> 42_000_000_000_000_000_000 / 1e18 = 42 tokens` + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | --------------------------------------------------------- | +| `tokenOwner` | `address` | The address of the token holder to query the balance for. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------- | +| `0` | `uint256` | The amount of tokens owned by `tokenOwner`. | + +
+ +### batchCalls + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `batchCalls(bytes[])` +- Function selector: `0x6963d438` + +::: + +:::info + +It's not possible to send value along the functions call due to the use of `delegatecall`. + +::: + +```solidity +function batchCalls(bytes[] data) external nonpayable returns (bytes[] results); +``` + +_Executing the following batch of abi-encoded function calls on the contract: `data`._ + +Allows a caller to batch different function calls in one call. Perform a `delegatecall` on self, to call different functions with preserving the context. + +#### Parameters + +| Name | Type | Description | +| ------ | :-------: | -------------------------------------------------------------------- | +| `data` | `bytes[]` | An array of ABI encoded function calls to be called on the contract. | + +#### Returns + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------------------------------------- | +| `results` | `bytes[]` | An array of abi-encoded data returned by the functions executed. | + +
+ +### decimals + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#decimals) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `decimals()` +- Function selector: `0x313ce567` + +::: + +```solidity +function decimals() external view returns (uint8); +``` + +Returns the number of decimals used to get its user representation. If the asset contract has been set to be non-divisible via the `isNonDivisible_` parameter in the `constructor`, the decimals returned wiil be `0`. Otherwise `18` is the common value. + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ----------------------------------------------------------------------- | +| `0` | `uint8` | the number of decimals. If `0` is returned, the asset is non-divisible. | + +
+ +### decreaseAllowance + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#decreaseallowance) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `decreaseAllowance(address,address,uint256,bytes)` +- Function selector: `0x78381670` + +::: + +```solidity +function decreaseAllowance( + address operator, + address tokenOwner, + uint256 subtractedAmount, + bytes operatorNotificationData +) external nonpayable; +``` + +_Decrease the allowance of `operator` by -`subtractedAmount`_ + +Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ------------------------------------------------------ | +| `operator` | `address` | The operator to decrease allowance for `msg.sender` | +| `tokenOwner` | `address` | The address of the token owner. | +| `subtractedAmount` | `uint256` | The amount to decrease by in the operator's allowance. | +| `operatorNotificationData` | `bytes` | - | + +
+ +### getData + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#getdata) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_Reading the ERC725Y storage for data key `dataKey` returned the following value: `dataValue`._ + +Get in the ERC725Y storage the bytes data stored at a specific data key `dataKey`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------------------------------- | +| `dataKey` | `bytes32` | The data key for which to retrieve the value. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ---------------------------------------------------- | +| `dataValue` | `bytes` | The bytes value stored under the specified data key. | + +
+ +### getDataBatch + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#getdatabatch) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Reading the ERC725Y storage for data keys `dataKeys` returned the following values: `dataValues`._ + +Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys`. + +#### 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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#getoperatorsof) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `getOperatorsOf(address)` +- Function selector: `0xd72fc29a` + +::: + +```solidity +function getOperatorsOf(address tokenOwner) external view returns (address[]); +``` + +Returns all `operator` addresses that are allowed to transfer or burn on behalf of `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------- | +| `tokenOwner` | `address` | The token owner to get the operators for. | + +#### Returns + +| Name | Type | Description | +| ---- | :---------: | ----------------------------------------------------------------------------------- | +| `0` | `address[]` | An array of operators allowed to transfer or burn tokens on behalf of `tokenOwner`. | + +
+ +### increaseAllowance + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#increaseallowance) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `increaseAllowance(address,uint256,bytes)` +- Function selector: `0x2bc1da82` + +::: + +```solidity +function increaseAllowance( + address operator, + uint256 addedAmount, + bytes operatorNotificationData +) external nonpayable; +``` + +_Increase the allowance of `operator` by +`addedAmount`_ + +Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------- | +| `operator` | `address` | The operator to increase the allowance for `msg.sender` | +| `addedAmount` | `uint256` | The additional amount to add on top of the current operator's allowance | +| `operatorNotificationData` | `bytes` | - | + +
+ +### owner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#owner) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#renounceownership) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#revokeoperator) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `revokeOperator(address,address,bool,bytes)` +- Function selector: `0x30d0dc37` + +::: + +```solidity +function revokeOperator( + address operator, + address tokenOwner, + bool notify, + bytes operatorNotificationData +) external nonpayable; +``` + +Enables `tokenOwner` to remove `operator` for its tokens, disallowing it to send any amount of tokens on its behalf. This function also allows the `operator` to remove itself if it is the caller of this function + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | --------------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `tokenOwner` | `address` | The address of the token owner. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### setData + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#setdata) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +:::caution Warning + +**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**. + +::: + +```solidity +function setData(bytes32 dataKey, bytes dataValue) external payable; +``` + +_Setting the following data key value pair in the ERC725Y storage. Data key: `dataKey`, data value: `dataValue`._ + +Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data key `dataKey`. The function is marked as payable to enable flexibility on child contracts. For instance to implement a fee mechanism for setting specific data. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner). + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `dataKey` | `bytes32` | The data key for which to set a new value. | +| `dataValue` | `bytes` | The new bytes value to set. | + +
+ +### setDataBatch + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#setdatabatch) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +:::caution Warning + +**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**. + +::: + +```solidity +function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable; +``` + +_Setting the following data key value pairs in the ERC725Y storage. Data keys: `dataKeys`, data values: `dataValues`._ + +Batch data setting function that behaves the same as [`setData`](#setdata) but allowing to set multiple data key/value pairs in the ERC725Y storage in the same transaction. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner) of the contract. + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event **for each data key/value pair set**. + +
+ +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ---------------------------------------------------- | +| `dataKeys` | `bytes32[]` | An array of data keys to set bytes values for. | +| `dataValues` | `bytes[]` | An array of bytes values to set for each `dataKeys`. | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#supportsinterface) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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` | - | + +
+ +### totalSupply + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#totalsupply) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#transfer) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `transfer(address,address,uint256,bool,bytes)` +- Function selector: `0x760d9bba` + +::: + +```solidity +function transfer( + address from, + address to, + uint256 amount, + bool force, + bytes data +) external nonpayable; +``` + +Transfers an `amount` of tokens from the `from` address to the `to` address and notify both sender and recipients via the LSP1 [`universalReceiver(...)`](#`universalreceiver) function. If the tokens are transferred by an operator on behalf of a token holder, the allowance for the operator will be decreased by `amount` once the token transfer has been completed (See [`authorizedAmountFor`](#authorizedamountfor)). + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The sender address. | +| `to` | `address` | The recipient address. | +| `amount` | `uint256` | The amount of tokens to transfer. | +| `force` | `bool` | When set to `true`, the `to` address CAN be any address. 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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#transferbatch) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `transferBatch(address[],address[],uint256[],bool[],bytes[])` +- Function selector: `0x2d7667c9` + +::: + +```solidity +function transferBatch( + address[] from, + address[] to, + uint256[] amount, + bool[] force, + bytes[] data +) external nonpayable; +``` + +Same as [`transfer(...)`](#`transfer) but transfer multiple tokens based on the arrays of `from`, `to`, `amount`. + +#### Parameters + +| Name | Type | Description | +| -------- | :---------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address[]` | An array of sending addresses. | +| `to` | `address[]` | An array of receiving addresses. | +| `amount` | `uint256[]` | An array of amount of tokens to transfer for each `from -> to` transfer. | +| `force` | `bool[]` | For each transfer, when set to `true`, the `to` address CAN be any address. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard. | +| `data` | `bytes[]` | An array of additional data the caller wants included in the emitted event, and sent in the hooks to `from` and `to` addresses. | + +
+ +### transferOwnership + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#transferownership) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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); +``` + +Read the value stored under a specific `dataKey` inside the underlying ERC725Y storage, +represented as a mapping of `bytes32` data keys mapped to their `bytes` data values. + +```solidity +mapping(bytes32 => bytes) _store +``` + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------------------------------------------------------------------- | +| `dataKey` | `bytes32` | A bytes32 data key to read the associated `bytes` value from the store. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ----------------------------------------------------------------------------- | +| `dataValue` | `bytes` | The `bytes` value associated with the given `dataKey` in the ERC725Y storage. | + +
+ +### \_setData + +```solidity +function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; +``` + +The ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol` cannot be changed +via this function once the digital asset contract has been deployed. + +
+ +### \_updateOperator + +```solidity +function _updateOperator( + address tokenOwner, + address operator, + uint256 allowance, + bool notified, + bytes operatorNotificationData +) internal nonpayable; +``` + +Changes token `amount` the `operator` has access to from `tokenOwner` tokens. +If the amount is zero the operator is removed from the list of operators, otherwise he is added to the list of operators. +If the amount is zero then the operator is being revoked, otherwise the operator amount is being modified. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------------------------------------------------------- | +| `tokenOwner` | `address` | The address that will give `operator` an allowance for on its balance. | +| `operator` | `address` | @param operatorNotificationData The data to send to the universalReceiver function of the operator in case of notifying | +| `allowance` | `uint256` | The maximum amount of token that `operator` can spend from the `tokenOwner`'s balance. | +| `notified` | `bool` | Boolean indicating whether the operator has been notified about the change of allowance | +| `operatorNotificationData` | `bytes` | The data to send to the universalReceiver function of the operator in case of notifying | + +
+ +### \_mint + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances, **but before notifying the recipient via LSP1**. + +::: + +```solidity +function _mint( + address to, + uint256 amount, + bool force, + bytes data +) internal nonpayable; +``` + +Mints `amount` of tokens and transfers it to `to`. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event with `address(0)` as `from`. + +
+ +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------- | +| `to` | `address` | The address to mint tokens for. | +| `amount` | `uint256` | The amount of tokens to mint. | +| `force` | `bool` | A boolean that describe if transfer to a `to` address that does not support LSP1 is allowed or not. | +| `data` | `bytes` | Additional data the caller wants included in the emitted [`Transfer`](#transfer) event, and sent in the LSP1 hook to the `to` address. | + +
+ +### \_burn + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances, **but before notifying the sender via LSP1**. + +::: + +:::tip Hint + +In dApps, you can know which address is burning tokens by listening for the `Transfer` event and filter with the zero address as `to`. + +::: + +```solidity +function _burn(address from, uint256 amount, bytes data) internal nonpayable; +``` + +Burns (= destroys) `amount` of tokens, decrease the `from` balance. This is done by sending them to the zero address. +Both the sender and recipient will be notified of the token transfer through the 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. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event with `address(0)` as the `to` address + +
+ +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The address to burn tokens from its balance. | +| `amount` | `uint256` | The amount of tokens to burn. | +| `data` | `bytes` | Additional data the caller wants included in the emitted event, and sent in the LSP1 hook to the `from` and `to` address. | + +
+ +### \_spendAllowance + +```solidity +function _spendAllowance( + address operator, + address tokenOwner, + uint256 amountToSpend +) internal nonpayable; +``` + +Spend `amountToSpend` from the `operator`'s authorized on behalf of the `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ------------------------------------------------------------------- | +| `operator` | `address` | The address of the operator to decrease the allowance of. | +| `tokenOwner` | `address` | The address that granted an allowance on its balance to `operator`. | +| `amountToSpend` | `uint256` | The amount of tokens to substract in allowance of `operator`. | + +
+ +### \_transfer + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances, **but before notifying the sender/recipient via LSP1**. + +::: + +```solidity +function _transfer( + address from, + address to, + uint256 amount, + bool force, + bytes data +) internal nonpayable; +``` + +Transfer tokens from `from` to `to` by decreasing the balance of `from` by `-amount` and increasing the balance +of `to` by `+amount`. +Both the sender and recipient will be notified of the token transfer through the 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. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event. + +
+ +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The address to decrease the balance. | +| `to` | `address` | The address to increase the balance. | +| `amount` | `uint256` | The amount of tokens to transfer from `from` to `to`. | +| `force` | `bool` | A boolean that describe if transfer to a `to` address that does not support LSP1 is allowed or not. | +| `data` | `bytes` | Additional data the caller wants included in the emitted event, and sent in the LSP1 hook to the `from` and `to` address. | + +
+ +### \_beforeTokenTransfer + +```solidity +function _beforeTokenTransfer( + address from, + address to, + uint256 amount, + bytes data +) 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` | The recipient address | +| `amount` | `uint256` | The amount of token to transfer | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + uint256 amount, + bytes data +) internal nonpayable; +``` + +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient** by overriding this function. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------ | +| `from` | `address` | The sender address | +| `to` | `address` | The recipient address | +| `amount` | `uint256` | The amount of token to transfer | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_notifyTokenOperator + +```solidity +function _notifyTokenOperator( + address operator, + bytes lsp1Data +) internal nonpayable; +``` + +Attempt to notify the operator `operator` about the `amount` tokens being authorized with. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. +If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------------------------ | +| `operator` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | + +
+ +### \_notifyTokenSender + +```solidity +function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; +``` + +Attempt to notify the token sender `from` about the `amount` of tokens being transferred. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENSSENDER` as typeId, if `from` is a contract that supports the LSP1 interface. +If `from` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------------------------ | +| `from` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `lsp1Data` | `bytes` | the data to be sent to the `from` address in the `universalReceiver` call. | + +
+ +### \_notifyTokenReceiver + +```solidity +function _notifyTokenReceiver( + address to, + bool force, + bytes lsp1Data +) internal nonpayable; +``` + +Attempt to notify the token receiver `to` about the `amount` tokens being received. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENSRECIPIENT` as typeId, if `to` is a contract that supports the LSP1 interface. +If `to` is is an EOA or a contract that does not support the LSP1 interface, the behaviour will depend on the `force` boolean flag. + +- if `force` is set to `true`, nothing will happen and no notification will be sent. + +- if `force` is set to `false, the transaction will revert. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | --------------------------------------------------------------------------------------------------- | +| `to` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `force` | `bool` | A boolean that describe if transfer to a `to` address that does not support LSP1 is allowed or not. | +| `lsp1Data` | `bytes` | The data to be sent to the `to` address in the `universalReceiver(...)` call. | + +
+ +### \_supportsInterfaceInERC165Extension + +```solidity +function _supportsInterfaceInERC165Extension( + bytes4 interfaceId +) internal view returns (bool); +``` + +Returns whether the interfaceId being checked is supported in the extension of the +[`supportsInterface`](#supportsinterface) selector. +To be used by extendable contracts wishing to extend the ERC165 interfaceIds originally +supported by reading whether the interfaceId queried is supported in the `supportsInterface` +extension if the extension is set, if not it returns false. + +
+ +### \_getExtensionAndForwardValue + +```solidity +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); +``` + +Returns the extension address stored under the following data key: + +- [`_LSP17_EXTENSION_PREFIX`](#_lsp17_extension_prefix) + `` (Check [LSP2-ERC725YJSONSchema] for encoding the data key). + +- If no extension is stored, returns the address(0). + +- we do not check that payable bool as in lsp7 standard we will always forward the value to the extension + +
+ +### \_fallbackLSP17Extendable + +:::info + +The LSP7 Token contract should not hold any native tokens. Any native tokens received by the contract +will be forwarded to the extension address mapped to the selector from `msg.sig`. + +::: + +```solidity +function _fallbackLSP17Extendable( + bytes callData +) internal nonpayable returns (bytes); +``` + +Forwards the call with the received value to an extension mapped to a function selector. +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being +called on the account. If there is no extension, the address(0) will be returned. +Forwards the value if the extension is payable. +Reverts if there is no extension for the function being called. +If there is an extension for the function selector being called, it calls the extension with the +CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and +32 bytes of the [`msg.value`](#msg.value) + +
+ +## Events + +### DataChanged + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#datachanged) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_The following data key/value pair has been changed in the ERC725Y storage: Data key: `dataKey`, data value: `dataValue`._ + +Emitted when data at a specific `dataKey` was changed to a new value `dataValue`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------- | +| `dataKey` **`indexed`** | `bytes32` | The data key for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### OperatorAuthorizationChanged + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#operatorauthorizationchanged) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Event signature: `OperatorAuthorizationChanged(address,address,uint256,bytes)` +- Event topic hash: `0xf772a43bfdf4729b196e3fb54a818b91a2ca6c49d10b2e16278752f9f515c25d` + +::: + +```solidity +event OperatorAuthorizationChanged( + address indexed operator, + address indexed tokenOwner, + uint256 indexed amount, + bytes operatorNotificationData +); +``` + +Emitted when `tokenOwner` enables `operator` for `amount` tokens. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address authorized as an operator | +| `tokenOwner` **`indexed`** | `address` | The token owner | +| `amount` **`indexed`** | `uint256` | The amount of tokens `operator` address has access to from `tokenOwner` | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### OperatorRevoked + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#operatorrevoked) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Event signature: `OperatorRevoked(address,address,bool,bytes)` +- Event topic hash: `0x0ebf5762d8855cbe012d2ca42fb33a81175e17c8a8751f8859931ba453bd4167` + +::: + +```solidity +event OperatorRevoked( + address indexed operator, + address indexed tokenOwner, + bool indexed notified, + bytes operatorNotificationData +); +``` + +Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [`authorizedAmountFor(...)`](#`authorizedamountfor) to `0`. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from operating | +| `tokenOwner` **`indexed`** | `address` | The token owner | +| `notified` **`indexed`** | `bool` | Bool indicating whether the operator has been notified or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### OwnershipTransferred + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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` | - | + +
+ +### Transfer + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#transfer) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Event signature: `Transfer(address,address,address,uint256,bool,bytes)` +- Event topic hash: `0x3997e418d2cef0b3b0e907b1e39605c3f7d32dbd061e82ea5b4a770d46a160a6` + +::: + +```solidity +event Transfer( + address indexed operator, + address indexed from, + address indexed to, + uint256 amount, + bool force, + bytes data +); +``` + +Emitted when the `from` transferred successfully `amount` of tokens to `to`. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ---------------------------------------------------------------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address of the operator that executed the transfer. | +| `from` **`indexed`** | `address` | The address which tokens were sent from (balance decreased by `-amount`). | +| `to` **`indexed`** | `address` | The address that received the tokens (balance increased by `+amount`). | +| `amount` | `uint256` | The amount of tokens transferred. | +| `force` | `bool` | if the transferred enforced the `to` recipient address to be a contract that implements the LSP1 standard or not. | +| `data` | `bytes` | Any additional data included by the caller during the transfer, and sent in the LSP1 hooks to the `from` and `to` addresses. | + +
+ +## Errors + +### ERC725Y_DataKeysValuesEmptyArray + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +Reverts when one of the array parameter provided to [`setDataBatch`](#setdatabatch) function is an empty array. + +
+ +### ERC725Y_DataKeysValuesLengthMismatch + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function. + +
+ +### ERC725Y_MsgValueDisallowed + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#erc725y_msgvaluedisallowed) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#setdatabatch) function. + +
+ +### InvalidExtensionAddress + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#invalidextensionaddress) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `InvalidExtensionAddress(bytes)` +- Error hash: `0x42bfe79f` + +::: + +```solidity +error InvalidExtensionAddress(bytes storedData); +``` + +reverts when the bytes retrieved from the LSP17 data key is not a valid address (not 20 bytes) + +#### Parameters + +| Name | Type | Description | +| ------------ | :-----: | ----------- | +| `storedData` | `bytes` | - | + +
+ +### InvalidFunctionSelector + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#invalidfunctionselector) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `InvalidFunctionSelector(bytes)` +- Error hash: `0xe5099ee3` + +::: + +```solidity +error InvalidFunctionSelector(bytes data); +``` + +reverts when the contract is called with a function selector not valid (less than 4 bytes of data) + +#### Parameters + +| Name | Type | Description | +| ------ | :-----: | ----------- | +| `data` | `bytes` | - | + +
+ +### LSP4TokenNameNotEditable + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokennamenoteditable) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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 / initialized. 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 / initialized. + +
+ +### LSP4TokenSymbolNotEditable + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokensymbolnoteditable) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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 / initialized. 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 / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` 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 / initialized. + +
+ +### LSP7AmountExceedsAuthorizedAmount + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7amountexceedsauthorizedamount) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7AmountExceedsAuthorizedAmount(address,uint256,address,uint256)` +- Error hash: `0xf3a6b691` + +::: + +```solidity +error LSP7AmountExceedsAuthorizedAmount( + address tokenOwner, + uint256 authorizedAmount, + address operator, + uint256 amount +); +``` + +reverts when `operator` of `tokenOwner` send an `amount` of tokens larger than the `authorizedAmount`. + +#### Parameters + +| Name | Type | Description | +| ------------------ | :-------: | ----------- | +| `tokenOwner` | `address` | - | +| `authorizedAmount` | `uint256` | - | +| `operator` | `address` | - | +| `amount` | `uint256` | - | + +
+ +### LSP7AmountExceedsBalance + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7amountexceedsbalance) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7AmountExceedsBalance(uint256,address,uint256)` +- Error hash: `0x08d47949` + +::: + +```solidity +error LSP7AmountExceedsBalance( + uint256 balance, + address tokenOwner, + uint256 amount +); +``` + +reverts when sending an `amount` of tokens larger than the current `balance` of the `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `balance` | `uint256` | - | +| `tokenOwner` | `address` | - | +| `amount` | `uint256` | - | + +
+ +### LSP7BatchCallFailed + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7batchcallfailed) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7BatchCallFailed(uint256)` +- Error hash: `0xb774c284` + +::: + +```solidity +error LSP7BatchCallFailed(uint256 callIndex); +``` + +_Batch call failed._ + +Reverts when a batch call failed. + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ----------- | +| `callIndex` | `uint256` | - | + +
+ +### LSP7CannotSendWithAddressZero + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7cannotsendwithaddresszero) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7CannotSendWithAddressZero()` +- Error hash: `0xd2d5ec30` + +::: + +```solidity +error LSP7CannotSendWithAddressZero(); +``` + +reverts when trying to: + +- mint tokens to the zero address. + +- burn tokens from the zero address. + +- transfer tokens from or to the zero address. + +
+ +### LSP7CannotUseAddressZeroAsOperator + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7cannotuseaddresszeroasoperator) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7CannotUseAddressZeroAsOperator()` +- Error hash: `0x6355e766` + +::: + +```solidity +error LSP7CannotUseAddressZeroAsOperator(); +``` + +reverts when trying to set the zero address as an operator. + +
+ +### LSP7DecreaseAllowanceNotAuthorized + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7decreaseallowancenotauthorized) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7DecreaseAllowanceNotAuthorized(address,address,address)` +- Error hash: `0x98ce2945` + +::: + +```solidity +error LSP7DecreaseAllowanceNotAuthorized( + address caller, + address tokenOwner, + address operator +); +``` + +Reverts when the call to decrease allowance is not authorized. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `caller` | `address` | - | +| `tokenOwner` | `address` | - | +| `operator` | `address` | - | + +
+ +### LSP7DecreasedAllowanceBelowZero + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7decreasedallowancebelowzero) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7DecreasedAllowanceBelowZero()` +- Error hash: `0x0ef76c35` + +::: + +```solidity +error LSP7DecreasedAllowanceBelowZero(); +``` + +Reverts when trying to decrease an operator's allowance to more than its current allowance. + +
+ +### LSP7InvalidTransferBatch + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7invalidtransferbatch) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7InvalidTransferBatch()` +- Error hash: `0x263eee8d` + +::: + +```solidity +error LSP7InvalidTransferBatch(); +``` + +reverts when the array parameters used in [`transferBatch`](#transferbatch) have different lengths. + +
+ +### LSP7NotifyTokenReceiverContractMissingLSP1Interface + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7notifytokenreceivercontractmissinglsp1interface) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7NotifyTokenReceiverContractMissingLSP1Interface(address)` +- Error hash: `0xa608fbb6` + +::: + +```solidity +error LSP7NotifyTokenReceiverContractMissingLSP1Interface( + address tokenReceiver +); +``` + +reverts if the `tokenReceiver` does not implement LSP1 when minting or transferring tokens with `bool force` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP7NotifyTokenReceiverIsEOA + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7notifytokenreceiveriseoa) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7NotifyTokenReceiverIsEOA(address)` +- Error hash: `0x26c247f4` + +::: + +```solidity +error LSP7NotifyTokenReceiverIsEOA(address tokenReceiver); +``` + +reverts if the `tokenReceiver` is an EOA when minting or transferring tokens with `bool force` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP7RevokeOperatorNotAuthorized + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7revokeoperatornotauthorized) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7RevokeOperatorNotAuthorized(address,address,address)` +- Error hash: `0x1a525b32` + +::: + +```solidity +error LSP7RevokeOperatorNotAuthorized( + address caller, + address tokenOwner, + address operator +); +``` + +Reverts when the call to revoke operator is not authorized. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `caller` | `address` | - | +| `tokenOwner` | `address` | - | +| `operator` | `address` | - | + +
+ +### LSP7TokenContractCannotHoldValue + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7tokencontractcannotholdvalue) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7TokenContractCannotHoldValue()` +- Error hash: `0x388f5adc` + +::: + +```solidity +error LSP7TokenContractCannotHoldValue(); +``` + +_LSP7 contract cannot receive native tokens._ + +Error occurs when sending native tokens to the LSP7 contract without sending any data. E.g. Sending value without passing a bytes4 function selector to call a LSP17 Extension. + +
+ +### LSP7TokenOwnerCannotBeOperator + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7tokenownercannotbeoperator) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7TokenOwnerCannotBeOperator()` +- Error hash: `0xdab75047` + +::: + +```solidity +error LSP7TokenOwnerCannotBeOperator(); +``` + +reverts when trying to authorize or revoke the token's owner as an operator. + +
+ +### NoExtensionFoundForFunctionSelector + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#noextensionfoundforfunctionselector) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `NoExtensionFoundForFunctionSelector(bytes4)` +- Error hash: `0xbb370b2b` + +::: + +```solidity +error NoExtensionFoundForFunctionSelector(bytes4 functionSelector); +``` + +reverts when there is no extension for the function selector being called with + +#### Parameters + +| Name | Type | Description | +| ------------------ | :------: | ----------- | +| `functionSelector` | `bytes4` | - | + +
+ +### OperatorAllowanceCannotBeIncreasedFromZero + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#operatorallowancecannotbeincreasedfromzero) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `OperatorAllowanceCannotBeIncreasedFromZero(address)` +- Error hash: `0xcba6e977` + +::: + +```solidity +error OperatorAllowanceCannotBeIncreasedFromZero(address operator); +``` + +Reverts when token owner call [`increaseAllowance`](#increaseallowance) for an operator that does not have any allowance + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | + +
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md b/packages/lsp-smart-contracts/docs/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md new file mode 100644 index 000000000..d5ecec050 --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md @@ -0,0 +1,1941 @@ + + + +# LSP7Burnable + +:::info Standard Specifications + +[`LSP-7-DigitalAsset`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md) + +::: +:::info Solidity implementation + +[`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) + +::: + +> LSP7 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. + +### fallback + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#fallback) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) + +::: + +```solidity +fallback(bytes calldata callData) external payable returns (bytes memory); +``` + +_The `fallback` function was called with the following amount of native tokens: `msg.value`; and the following calldata: `callData`._ + +Achieves the goal of [LSP-17-ContractExtension] standard by extending the contract to handle calls of functions that do not exist natively, +forwarding the function call to the extension address mapped to the function being called. +This function is executed when: + +- Sending data of length less than 4 bytes to the contract. + +- The first 4 bytes of the calldata do not match any publicly callable functions from the contract ABI. + +- Receiving native tokens + +1. If the data is equal or longer than 4 bytes, the [ERC-725Y] storage is queried with the following data key: [_LSP17_EXTENSION_PREFIX] + `bytes4(msg.sig)` (Check [LSP-2-ERC725YJSONSchema] for encoding the data key) + +- If there is no address stored under the following data key, revert with [`NoExtensionFoundForFunctionSelector(bytes4)`](#noextensionfoundforfunctionselector). The data key relative to `bytes4(0)` is an exception, where no reverts occurs if there is no extension address stored under. This exception is made to allow users to send random data (graffiti) to the account and to be able to react on it. + +- If there is an address, forward the `msg.data` to the extension using the CALL opcode, appending 52 bytes (20 bytes of `msg.sender` and 32 bytes of `msg.value`). Return what the calls returns, or revert if the call failed. + +2. If the data sent to this function is of length less than 4 bytes (not a function selector), revert. + +
+ +### receive + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#receive) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) + +::: + +```solidity +receive() external payable; +``` + +_LSP7 contract cannot receive native tokens._ + +Reverts whenever someone tries to send native tokens to a LSP7 contract. + +
+ +### authorizeOperator + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#authorizeoperator) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `authorizeOperator(address,uint256,bytes)` +- Function selector: `0xb49506fd` + +::: + +:::danger + +To avoid front-running and Allowance Double-Spend Exploit when increasing or decreasing the authorized amount of an operator, it is advised to use the [`increaseAllowance`](#increaseallowance) and [`decreaseAllowance`](#decreaseallowance) functions. For more information, see: https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/ + +::: + +```solidity +function authorizeOperator( + address operator, + uint256 amount, + bytes operatorNotificationData +) external nonpayable; +``` + +Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). Notify the operator based on the LSP1-UniversalReceiver standard + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ------------------------------------------------------ | +| `operator` | `address` | The address to authorize as an operator. | +| `amount` | `uint256` | The allowance amount of tokens operator has access to. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### authorizedAmountFor + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#authorizedamountfor) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `authorizedAmountFor(address,address)` +- Function selector: `0x65aeaa95` + +::: + +```solidity +function authorizedAmountFor( + address operator, + address tokenOwner +) external view returns (uint256); +``` + +Get the amount of tokens `operator` address has access to from `tokenOwner`. Operators can send and burn tokens on behalf of their owners. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ---------------------------------------------------------- | +| `operator` | `address` | The operator's address to query the authorized amount for. | +| `tokenOwner` | `address` | The token owner that `operator` has allowance on. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | --------------------------------------------------------------------------------------- | +| `0` | `uint256` | The amount of tokens the `operator`'s address has access on the `tokenOwner`'s balance. | + +
+ +### balanceOf + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#balanceof) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `balanceOf(address)` +- Function selector: `0x70a08231` + +::: + +```solidity +function balanceOf(address tokenOwner) external view returns (uint256); +``` + +Get the number of tokens owned by `tokenOwner`. If the token is divisible (the [`decimals`](#decimals) function returns `18`), the amount returned should be divided by 1e18 to get a better picture of the actual balance of the `tokenOwner`. _Example:_ `balanceOf(someAddress) -> 42_000_000_000_000_000_000 / 1e18 = 42 tokens` + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | --------------------------------------------------------- | +| `tokenOwner` | `address` | The address of the token holder to query the balance for. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------- | +| `0` | `uint256` | The amount of tokens owned by `tokenOwner`. | + +
+ +### batchCalls + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `batchCalls(bytes[])` +- Function selector: `0x6963d438` + +::: + +:::info + +It's not possible to send value along the functions call due to the use of `delegatecall`. + +::: + +```solidity +function batchCalls(bytes[] data) external nonpayable returns (bytes[] results); +``` + +_Executing the following batch of abi-encoded function calls on the contract: `data`._ + +Allows a caller to batch different function calls in one call. Perform a `delegatecall` on self, to call different functions with preserving the context. + +#### Parameters + +| Name | Type | Description | +| ------ | :-------: | -------------------------------------------------------------------- | +| `data` | `bytes[]` | An array of ABI encoded function calls to be called on the contract. | + +#### Returns + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------------------------------------- | +| `results` | `bytes[]` | An array of abi-encoded data returned by the functions executed. | + +
+ +### burn + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#burn) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `burn(address,uint256,bytes)` +- Function selector: `0x44d17187` + +::: + +```solidity +function burn(address from, uint256 amount, bytes data) external nonpayable; +``` + +See internal [`_burn`](#_burn) function for details. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ----------- | +| `from` | `address` | - | +| `amount` | `uint256` | - | +| `data` | `bytes` | - | + +
+ +### decimals + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#decimals) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `decimals()` +- Function selector: `0x313ce567` + +::: + +```solidity +function decimals() external view returns (uint8); +``` + +Returns the number of decimals used to get its user representation. If the asset contract has been set to be non-divisible via the `isNonDivisible_` parameter in the `constructor`, the decimals returned wiil be `0`. Otherwise `18` is the common value. + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ----------------------------------------------------------------------- | +| `0` | `uint8` | the number of decimals. If `0` is returned, the asset is non-divisible. | + +
+ +### decreaseAllowance + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#decreaseallowance) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `decreaseAllowance(address,address,uint256,bytes)` +- Function selector: `0x78381670` + +::: + +```solidity +function decreaseAllowance( + address operator, + address tokenOwner, + uint256 subtractedAmount, + bytes operatorNotificationData +) external nonpayable; +``` + +_Decrease the allowance of `operator` by -`subtractedAmount`_ + +Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ------------------------------------------------------ | +| `operator` | `address` | The operator to decrease allowance for `msg.sender` | +| `tokenOwner` | `address` | The address of the token owner. | +| `subtractedAmount` | `uint256` | The amount to decrease by in the operator's allowance. | +| `operatorNotificationData` | `bytes` | - | + +
+ +### getData + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#getdata) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_Reading the ERC725Y storage for data key `dataKey` returned the following value: `dataValue`._ + +Get in the ERC725Y storage the bytes data stored at a specific data key `dataKey`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------------------------------- | +| `dataKey` | `bytes32` | The data key for which to retrieve the value. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ---------------------------------------------------- | +| `dataValue` | `bytes` | The bytes value stored under the specified data key. | + +
+ +### getDataBatch + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#getdatabatch) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Reading the ERC725Y storage for data keys `dataKeys` returned the following values: `dataValues`._ + +Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys`. + +#### 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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#getoperatorsof) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `getOperatorsOf(address)` +- Function selector: `0xd72fc29a` + +::: + +```solidity +function getOperatorsOf(address tokenOwner) external view returns (address[]); +``` + +Returns all `operator` addresses that are allowed to transfer or burn on behalf of `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------- | +| `tokenOwner` | `address` | The token owner to get the operators for. | + +#### Returns + +| Name | Type | Description | +| ---- | :---------: | ----------------------------------------------------------------------------------- | +| `0` | `address[]` | An array of operators allowed to transfer or burn tokens on behalf of `tokenOwner`. | + +
+ +### increaseAllowance + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#increaseallowance) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `increaseAllowance(address,uint256,bytes)` +- Function selector: `0x2bc1da82` + +::: + +```solidity +function increaseAllowance( + address operator, + uint256 addedAmount, + bytes operatorNotificationData +) external nonpayable; +``` + +_Increase the allowance of `operator` by +`addedAmount`_ + +Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------- | +| `operator` | `address` | The operator to increase the allowance for `msg.sender` | +| `addedAmount` | `uint256` | The additional amount to add on top of the current operator's allowance | +| `operatorNotificationData` | `bytes` | - | + +
+ +### owner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#owner) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#renounceownership) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#revokeoperator) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `revokeOperator(address,address,bool,bytes)` +- Function selector: `0x30d0dc37` + +::: + +```solidity +function revokeOperator( + address operator, + address tokenOwner, + bool notify, + bytes operatorNotificationData +) external nonpayable; +``` + +Enables `tokenOwner` to remove `operator` for its tokens, disallowing it to send any amount of tokens on its behalf. This function also allows the `operator` to remove itself if it is the caller of this function + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | --------------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `tokenOwner` | `address` | The address of the token owner. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### setData + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#setdata) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +:::caution Warning + +**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**. + +::: + +```solidity +function setData(bytes32 dataKey, bytes dataValue) external payable; +``` + +_Setting the following data key value pair in the ERC725Y storage. Data key: `dataKey`, data value: `dataValue`._ + +Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data key `dataKey`. The function is marked as payable to enable flexibility on child contracts. For instance to implement a fee mechanism for setting specific data. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner). + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `dataKey` | `bytes32` | The data key for which to set a new value. | +| `dataValue` | `bytes` | The new bytes value to set. | + +
+ +### setDataBatch + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#setdatabatch) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +:::caution Warning + +**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**. + +::: + +```solidity +function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable; +``` + +_Setting the following data key value pairs in the ERC725Y storage. Data keys: `dataKeys`, data values: `dataValues`._ + +Batch data setting function that behaves the same as [`setData`](#setdata) but allowing to set multiple data key/value pairs in the ERC725Y storage in the same transaction. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner) of the contract. + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event **for each data key/value pair set**. + +
+ +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ---------------------------------------------------- | +| `dataKeys` | `bytes32[]` | An array of data keys to set bytes values for. | +| `dataValues` | `bytes[]` | An array of bytes values to set for each `dataKeys`. | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#supportsinterface) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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` | - | + +
+ +### totalSupply + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#totalsupply) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#transfer) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `transfer(address,address,uint256,bool,bytes)` +- Function selector: `0x760d9bba` + +::: + +```solidity +function transfer( + address from, + address to, + uint256 amount, + bool force, + bytes data +) external nonpayable; +``` + +Transfers an `amount` of tokens from the `from` address to the `to` address and notify both sender and recipients via the LSP1 [`universalReceiver(...)`](#`universalreceiver) function. If the tokens are transferred by an operator on behalf of a token holder, the allowance for the operator will be decreased by `amount` once the token transfer has been completed (See [`authorizedAmountFor`](#authorizedamountfor)). + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The sender address. | +| `to` | `address` | The recipient address. | +| `amount` | `uint256` | The amount of tokens to transfer. | +| `force` | `bool` | When set to `true`, the `to` address CAN be any address. 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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#transferbatch) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `transferBatch(address[],address[],uint256[],bool[],bytes[])` +- Function selector: `0x2d7667c9` + +::: + +```solidity +function transferBatch( + address[] from, + address[] to, + uint256[] amount, + bool[] force, + bytes[] data +) external nonpayable; +``` + +Same as [`transfer(...)`](#`transfer) but transfer multiple tokens based on the arrays of `from`, `to`, `amount`. + +#### Parameters + +| Name | Type | Description | +| -------- | :---------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address[]` | An array of sending addresses. | +| `to` | `address[]` | An array of receiving addresses. | +| `amount` | `uint256[]` | An array of amount of tokens to transfer for each `from -> to` transfer. | +| `force` | `bool[]` | For each transfer, when set to `true`, the `to` address CAN be any address. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard. | +| `data` | `bytes[]` | An array of additional data the caller wants included in the emitted event, and sent in the hooks to `from` and `to` addresses. | + +
+ +### transferOwnership + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#transferownership) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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); +``` + +Read the value stored under a specific `dataKey` inside the underlying ERC725Y storage, +represented as a mapping of `bytes32` data keys mapped to their `bytes` data values. + +```solidity +mapping(bytes32 => bytes) _store +``` + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------------------------------------------------------------------- | +| `dataKey` | `bytes32` | A bytes32 data key to read the associated `bytes` value from the store. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ----------------------------------------------------------------------------- | +| `dataValue` | `bytes` | The `bytes` value associated with the given `dataKey` in the ERC725Y storage. | + +
+ +### \_setData + +```solidity +function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; +``` + +The ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol` cannot be changed +via this function once the digital asset contract has been deployed. + +
+ +### \_updateOperator + +```solidity +function _updateOperator( + address tokenOwner, + address operator, + uint256 allowance, + bool notified, + bytes operatorNotificationData +) internal nonpayable; +``` + +Changes token `amount` the `operator` has access to from `tokenOwner` tokens. +If the amount is zero the operator is removed from the list of operators, otherwise he is added to the list of operators. +If the amount is zero then the operator is being revoked, otherwise the operator amount is being modified. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------------------------------------------------------- | +| `tokenOwner` | `address` | The address that will give `operator` an allowance for on its balance. | +| `operator` | `address` | @param operatorNotificationData The data to send to the universalReceiver function of the operator in case of notifying | +| `allowance` | `uint256` | The maximum amount of token that `operator` can spend from the `tokenOwner`'s balance. | +| `notified` | `bool` | Boolean indicating whether the operator has been notified about the change of allowance | +| `operatorNotificationData` | `bytes` | The data to send to the universalReceiver function of the operator in case of notifying | + +
+ +### \_mint + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances, **but before notifying the recipient via LSP1**. + +::: + +```solidity +function _mint( + address to, + uint256 amount, + bool force, + bytes data +) internal nonpayable; +``` + +Mints `amount` of tokens and transfers it to `to`. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event with `address(0)` as `from`. + +
+ +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------- | +| `to` | `address` | The address to mint tokens for. | +| `amount` | `uint256` | The amount of tokens to mint. | +| `force` | `bool` | A boolean that describe if transfer to a `to` address that does not support LSP1 is allowed or not. | +| `data` | `bytes` | Additional data the caller wants included in the emitted [`Transfer`](#transfer) event, and sent in the LSP1 hook to the `to` address. | + +
+ +### \_burn + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances, **but before notifying the sender via LSP1**. + +::: + +:::tip Hint + +In dApps, you can know which address is burning tokens by listening for the `Transfer` event and filter with the zero address as `to`. + +::: + +```solidity +function _burn(address from, uint256 amount, bytes data) internal nonpayable; +``` + +Burns (= destroys) `amount` of tokens, decrease the `from` balance. This is done by sending them to the zero address. +Both the sender and recipient will be notified of the token transfer through the 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. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event with `address(0)` as the `to` address + +
+ +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The address to burn tokens from its balance. | +| `amount` | `uint256` | The amount of tokens to burn. | +| `data` | `bytes` | Additional data the caller wants included in the emitted event, and sent in the LSP1 hook to the `from` and `to` address. | + +
+ +### \_spendAllowance + +```solidity +function _spendAllowance( + address operator, + address tokenOwner, + uint256 amountToSpend +) internal nonpayable; +``` + +Spend `amountToSpend` from the `operator`'s authorized on behalf of the `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ------------------------------------------------------------------- | +| `operator` | `address` | The address of the operator to decrease the allowance of. | +| `tokenOwner` | `address` | The address that granted an allowance on its balance to `operator`. | +| `amountToSpend` | `uint256` | The amount of tokens to substract in allowance of `operator`. | + +
+ +### \_transfer + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances, **but before notifying the sender/recipient via LSP1**. + +::: + +```solidity +function _transfer( + address from, + address to, + uint256 amount, + bool force, + bytes data +) internal nonpayable; +``` + +Transfer tokens from `from` to `to` by decreasing the balance of `from` by `-amount` and increasing the balance +of `to` by `+amount`. +Both the sender and recipient will be notified of the token transfer through the 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. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event. + +
+ +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The address to decrease the balance. | +| `to` | `address` | The address to increase the balance. | +| `amount` | `uint256` | The amount of tokens to transfer from `from` to `to`. | +| `force` | `bool` | A boolean that describe if transfer to a `to` address that does not support LSP1 is allowed or not. | +| `data` | `bytes` | Additional data the caller wants included in the emitted event, and sent in the LSP1 hook to the `from` and `to` address. | + +
+ +### \_beforeTokenTransfer + +```solidity +function _beforeTokenTransfer( + address from, + address to, + uint256 amount, + bytes data +) 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` | The recipient address | +| `amount` | `uint256` | The amount of token to transfer | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + uint256 amount, + bytes data +) internal nonpayable; +``` + +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient** by overriding this function. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------ | +| `from` | `address` | The sender address | +| `to` | `address` | The recipient address | +| `amount` | `uint256` | The amount of token to transfer | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_notifyTokenOperator + +```solidity +function _notifyTokenOperator( + address operator, + bytes lsp1Data +) internal nonpayable; +``` + +Attempt to notify the operator `operator` about the `amount` tokens being authorized with. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. +If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------------------------ | +| `operator` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | + +
+ +### \_notifyTokenSender + +```solidity +function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; +``` + +Attempt to notify the token sender `from` about the `amount` of tokens being transferred. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENSSENDER` as typeId, if `from` is a contract that supports the LSP1 interface. +If `from` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------------------------ | +| `from` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `lsp1Data` | `bytes` | the data to be sent to the `from` address in the `universalReceiver` call. | + +
+ +### \_notifyTokenReceiver + +```solidity +function _notifyTokenReceiver( + address to, + bool force, + bytes lsp1Data +) internal nonpayable; +``` + +Attempt to notify the token receiver `to` about the `amount` tokens being received. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENSRECIPIENT` as typeId, if `to` is a contract that supports the LSP1 interface. +If `to` is is an EOA or a contract that does not support the LSP1 interface, the behaviour will depend on the `force` boolean flag. + +- if `force` is set to `true`, nothing will happen and no notification will be sent. + +- if `force` is set to `false, the transaction will revert. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | --------------------------------------------------------------------------------------------------- | +| `to` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `force` | `bool` | A boolean that describe if transfer to a `to` address that does not support LSP1 is allowed or not. | +| `lsp1Data` | `bytes` | The data to be sent to the `to` address in the `universalReceiver(...)` call. | + +
+ +### \_supportsInterfaceInERC165Extension + +```solidity +function _supportsInterfaceInERC165Extension( + bytes4 interfaceId +) internal view returns (bool); +``` + +Returns whether the interfaceId being checked is supported in the extension of the +[`supportsInterface`](#supportsinterface) selector. +To be used by extendable contracts wishing to extend the ERC165 interfaceIds originally +supported by reading whether the interfaceId queried is supported in the `supportsInterface` +extension if the extension is set, if not it returns false. + +
+ +### \_getExtensionAndForwardValue + +```solidity +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); +``` + +Returns the extension address stored under the following data key: + +- [`_LSP17_EXTENSION_PREFIX`](#_lsp17_extension_prefix) + `` (Check [LSP2-ERC725YJSONSchema] for encoding the data key). + +- If no extension is stored, returns the address(0). + +- we do not check that payable bool as in lsp7 standard we will always forward the value to the extension + +
+ +### \_fallbackLSP17Extendable + +:::info + +The LSP7 Token contract should not hold any native tokens. Any native tokens received by the contract +will be forwarded to the extension address mapped to the selector from `msg.sig`. + +::: + +```solidity +function _fallbackLSP17Extendable( + bytes callData +) internal nonpayable returns (bytes); +``` + +Forwards the call with the received value to an extension mapped to a function selector. +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being +called on the account. If there is no extension, the address(0) will be returned. +Forwards the value if the extension is payable. +Reverts if there is no extension for the function being called. +If there is an extension for the function selector being called, it calls the extension with the +CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and +32 bytes of the [`msg.value`](#msg.value) + +
+ +## Events + +### DataChanged + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#datachanged) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_The following data key/value pair has been changed in the ERC725Y storage: Data key: `dataKey`, data value: `dataValue`._ + +Emitted when data at a specific `dataKey` was changed to a new value `dataValue`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------- | +| `dataKey` **`indexed`** | `bytes32` | The data key for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### OperatorAuthorizationChanged + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#operatorauthorizationchanged) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Event signature: `OperatorAuthorizationChanged(address,address,uint256,bytes)` +- Event topic hash: `0xf772a43bfdf4729b196e3fb54a818b91a2ca6c49d10b2e16278752f9f515c25d` + +::: + +```solidity +event OperatorAuthorizationChanged( + address indexed operator, + address indexed tokenOwner, + uint256 indexed amount, + bytes operatorNotificationData +); +``` + +Emitted when `tokenOwner` enables `operator` for `amount` tokens. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address authorized as an operator | +| `tokenOwner` **`indexed`** | `address` | The token owner | +| `amount` **`indexed`** | `uint256` | The amount of tokens `operator` address has access to from `tokenOwner` | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### OperatorRevoked + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#operatorrevoked) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Event signature: `OperatorRevoked(address,address,bool,bytes)` +- Event topic hash: `0x0ebf5762d8855cbe012d2ca42fb33a81175e17c8a8751f8859931ba453bd4167` + +::: + +```solidity +event OperatorRevoked( + address indexed operator, + address indexed tokenOwner, + bool indexed notified, + bytes operatorNotificationData +); +``` + +Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [`authorizedAmountFor(...)`](#`authorizedamountfor) to `0`. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from operating | +| `tokenOwner` **`indexed`** | `address` | The token owner | +| `notified` **`indexed`** | `bool` | Bool indicating whether the operator has been notified or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### OwnershipTransferred + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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` | - | + +
+ +### Transfer + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#transfer) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Event signature: `Transfer(address,address,address,uint256,bool,bytes)` +- Event topic hash: `0x3997e418d2cef0b3b0e907b1e39605c3f7d32dbd061e82ea5b4a770d46a160a6` + +::: + +```solidity +event Transfer( + address indexed operator, + address indexed from, + address indexed to, + uint256 amount, + bool force, + bytes data +); +``` + +Emitted when the `from` transferred successfully `amount` of tokens to `to`. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ---------------------------------------------------------------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address of the operator that executed the transfer. | +| `from` **`indexed`** | `address` | The address which tokens were sent from (balance decreased by `-amount`). | +| `to` **`indexed`** | `address` | The address that received the tokens (balance increased by `+amount`). | +| `amount` | `uint256` | The amount of tokens transferred. | +| `force` | `bool` | if the transferred enforced the `to` recipient address to be a contract that implements the LSP1 standard or not. | +| `data` | `bytes` | Any additional data included by the caller during the transfer, and sent in the LSP1 hooks to the `from` and `to` addresses. | + +
+ +## Errors + +### ERC725Y_DataKeysValuesEmptyArray + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +Reverts when one of the array parameter provided to [`setDataBatch`](#setdatabatch) function is an empty array. + +
+ +### ERC725Y_DataKeysValuesLengthMismatch + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function. + +
+ +### ERC725Y_MsgValueDisallowed + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#erc725y_msgvaluedisallowed) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#setdatabatch) function. + +
+ +### InvalidExtensionAddress + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#invalidextensionaddress) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `InvalidExtensionAddress(bytes)` +- Error hash: `0x42bfe79f` + +::: + +```solidity +error InvalidExtensionAddress(bytes storedData); +``` + +reverts when the bytes retrieved from the LSP17 data key is not a valid address (not 20 bytes) + +#### Parameters + +| Name | Type | Description | +| ------------ | :-----: | ----------- | +| `storedData` | `bytes` | - | + +
+ +### InvalidFunctionSelector + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#invalidfunctionselector) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `InvalidFunctionSelector(bytes)` +- Error hash: `0xe5099ee3` + +::: + +```solidity +error InvalidFunctionSelector(bytes data); +``` + +reverts when the contract is called with a function selector not valid (less than 4 bytes of data) + +#### Parameters + +| Name | Type | Description | +| ------ | :-----: | ----------- | +| `data` | `bytes` | - | + +
+ +### LSP4TokenNameNotEditable + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokennamenoteditable) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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 / initialized. 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 / initialized. + +
+ +### LSP4TokenSymbolNotEditable + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokensymbolnoteditable) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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 / initialized. 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 / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` 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 / initialized. + +
+ +### LSP7AmountExceedsAuthorizedAmount + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7amountexceedsauthorizedamount) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7AmountExceedsAuthorizedAmount(address,uint256,address,uint256)` +- Error hash: `0xf3a6b691` + +::: + +```solidity +error LSP7AmountExceedsAuthorizedAmount( + address tokenOwner, + uint256 authorizedAmount, + address operator, + uint256 amount +); +``` + +reverts when `operator` of `tokenOwner` send an `amount` of tokens larger than the `authorizedAmount`. + +#### Parameters + +| Name | Type | Description | +| ------------------ | :-------: | ----------- | +| `tokenOwner` | `address` | - | +| `authorizedAmount` | `uint256` | - | +| `operator` | `address` | - | +| `amount` | `uint256` | - | + +
+ +### LSP7AmountExceedsBalance + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7amountexceedsbalance) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7AmountExceedsBalance(uint256,address,uint256)` +- Error hash: `0x08d47949` + +::: + +```solidity +error LSP7AmountExceedsBalance( + uint256 balance, + address tokenOwner, + uint256 amount +); +``` + +reverts when sending an `amount` of tokens larger than the current `balance` of the `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `balance` | `uint256` | - | +| `tokenOwner` | `address` | - | +| `amount` | `uint256` | - | + +
+ +### LSP7BatchCallFailed + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7batchcallfailed) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7BatchCallFailed(uint256)` +- Error hash: `0xb774c284` + +::: + +```solidity +error LSP7BatchCallFailed(uint256 callIndex); +``` + +_Batch call failed._ + +Reverts when a batch call failed. + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ----------- | +| `callIndex` | `uint256` | - | + +
+ +### LSP7CannotSendWithAddressZero + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7cannotsendwithaddresszero) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7CannotSendWithAddressZero()` +- Error hash: `0xd2d5ec30` + +::: + +```solidity +error LSP7CannotSendWithAddressZero(); +``` + +reverts when trying to: + +- mint tokens to the zero address. + +- burn tokens from the zero address. + +- transfer tokens from or to the zero address. + +
+ +### LSP7CannotUseAddressZeroAsOperator + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7cannotuseaddresszeroasoperator) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7CannotUseAddressZeroAsOperator()` +- Error hash: `0x6355e766` + +::: + +```solidity +error LSP7CannotUseAddressZeroAsOperator(); +``` + +reverts when trying to set the zero address as an operator. + +
+ +### LSP7DecreaseAllowanceNotAuthorized + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7decreaseallowancenotauthorized) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7DecreaseAllowanceNotAuthorized(address,address,address)` +- Error hash: `0x98ce2945` + +::: + +```solidity +error LSP7DecreaseAllowanceNotAuthorized( + address caller, + address tokenOwner, + address operator +); +``` + +Reverts when the call to decrease allowance is not authorized. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `caller` | `address` | - | +| `tokenOwner` | `address` | - | +| `operator` | `address` | - | + +
+ +### LSP7DecreasedAllowanceBelowZero + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7decreasedallowancebelowzero) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7DecreasedAllowanceBelowZero()` +- Error hash: `0x0ef76c35` + +::: + +```solidity +error LSP7DecreasedAllowanceBelowZero(); +``` + +Reverts when trying to decrease an operator's allowance to more than its current allowance. + +
+ +### LSP7InvalidTransferBatch + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7invalidtransferbatch) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7InvalidTransferBatch()` +- Error hash: `0x263eee8d` + +::: + +```solidity +error LSP7InvalidTransferBatch(); +``` + +reverts when the array parameters used in [`transferBatch`](#transferbatch) have different lengths. + +
+ +### LSP7NotifyTokenReceiverContractMissingLSP1Interface + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7notifytokenreceivercontractmissinglsp1interface) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7NotifyTokenReceiverContractMissingLSP1Interface(address)` +- Error hash: `0xa608fbb6` + +::: + +```solidity +error LSP7NotifyTokenReceiverContractMissingLSP1Interface( + address tokenReceiver +); +``` + +reverts if the `tokenReceiver` does not implement LSP1 when minting or transferring tokens with `bool force` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP7NotifyTokenReceiverIsEOA + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7notifytokenreceiveriseoa) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7NotifyTokenReceiverIsEOA(address)` +- Error hash: `0x26c247f4` + +::: + +```solidity +error LSP7NotifyTokenReceiverIsEOA(address tokenReceiver); +``` + +reverts if the `tokenReceiver` is an EOA when minting or transferring tokens with `bool force` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP7RevokeOperatorNotAuthorized + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7revokeoperatornotauthorized) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7RevokeOperatorNotAuthorized(address,address,address)` +- Error hash: `0x1a525b32` + +::: + +```solidity +error LSP7RevokeOperatorNotAuthorized( + address caller, + address tokenOwner, + address operator +); +``` + +Reverts when the call to revoke operator is not authorized. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `caller` | `address` | - | +| `tokenOwner` | `address` | - | +| `operator` | `address` | - | + +
+ +### LSP7TokenContractCannotHoldValue + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7tokencontractcannotholdvalue) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7TokenContractCannotHoldValue()` +- Error hash: `0x388f5adc` + +::: + +```solidity +error LSP7TokenContractCannotHoldValue(); +``` + +_LSP7 contract cannot receive native tokens._ + +Error occurs when sending native tokens to the LSP7 contract without sending any data. E.g. Sending value without passing a bytes4 function selector to call a LSP17 Extension. + +
+ +### LSP7TokenOwnerCannotBeOperator + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7tokenownercannotbeoperator) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7TokenOwnerCannotBeOperator()` +- Error hash: `0xdab75047` + +::: + +```solidity +error LSP7TokenOwnerCannotBeOperator(); +``` + +reverts when trying to authorize or revoke the token's owner as an operator. + +
+ +### NoExtensionFoundForFunctionSelector + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#noextensionfoundforfunctionselector) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `NoExtensionFoundForFunctionSelector(bytes4)` +- Error hash: `0xbb370b2b` + +::: + +```solidity +error NoExtensionFoundForFunctionSelector(bytes4 functionSelector); +``` + +reverts when there is no extension for the function selector being called with + +#### Parameters + +| Name | Type | Description | +| ------------------ | :------: | ----------- | +| `functionSelector` | `bytes4` | - | + +
+ +### OperatorAllowanceCannotBeIncreasedFromZero + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#operatorallowancecannotbeincreasedfromzero) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `OperatorAllowanceCannotBeIncreasedFromZero(address)` +- Error hash: `0xcba6e977` + +::: + +```solidity +error OperatorAllowanceCannotBeIncreasedFromZero(address operator); +``` + +Reverts when token owner call [`increaseAllowance`](#increaseallowance) for an operator that does not have any allowance + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | + +
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md b/packages/lsp-smart-contracts/docs/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md new file mode 100644 index 000000000..5c0d29917 --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md @@ -0,0 +1,1957 @@ + + + +# LSP7CappedSupply + +:::info Standard Specifications + +[`LSP-7-DigitalAsset`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md) + +::: +:::info Solidity implementation + +[`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) + +::: + +LSP7 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. + +### fallback + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#fallback) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) + +::: + +```solidity +fallback(bytes calldata callData) external payable returns (bytes memory); +``` + +_The `fallback` function was called with the following amount of native tokens: `msg.value`; and the following calldata: `callData`._ + +Achieves the goal of [LSP-17-ContractExtension] standard by extending the contract to handle calls of functions that do not exist natively, +forwarding the function call to the extension address mapped to the function being called. +This function is executed when: + +- Sending data of length less than 4 bytes to the contract. + +- The first 4 bytes of the calldata do not match any publicly callable functions from the contract ABI. + +- Receiving native tokens + +1. If the data is equal or longer than 4 bytes, the [ERC-725Y] storage is queried with the following data key: [_LSP17_EXTENSION_PREFIX] + `bytes4(msg.sig)` (Check [LSP-2-ERC725YJSONSchema] for encoding the data key) + +- If there is no address stored under the following data key, revert with [`NoExtensionFoundForFunctionSelector(bytes4)`](#noextensionfoundforfunctionselector). The data key relative to `bytes4(0)` is an exception, where no reverts occurs if there is no extension address stored under. This exception is made to allow users to send random data (graffiti) to the account and to be able to react on it. + +- If there is an address, forward the `msg.data` to the extension using the CALL opcode, appending 52 bytes (20 bytes of `msg.sender` and 32 bytes of `msg.value`). Return what the calls returns, or revert if the call failed. + +2. If the data sent to this function is of length less than 4 bytes (not a function selector), revert. + +
+ +### receive + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#receive) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) + +::: + +```solidity +receive() external payable; +``` + +_LSP7 contract cannot receive native tokens._ + +Reverts whenever someone tries to send native tokens to a LSP7 contract. + +
+ +### authorizeOperator + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#authorizeoperator) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `authorizeOperator(address,uint256,bytes)` +- Function selector: `0xb49506fd` + +::: + +:::danger + +To avoid front-running and Allowance Double-Spend Exploit when increasing or decreasing the authorized amount of an operator, it is advised to use the [`increaseAllowance`](#increaseallowance) and [`decreaseAllowance`](#decreaseallowance) functions. For more information, see: https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/ + +::: + +```solidity +function authorizeOperator( + address operator, + uint256 amount, + bytes operatorNotificationData +) external nonpayable; +``` + +Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). Notify the operator based on the LSP1-UniversalReceiver standard + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ------------------------------------------------------ | +| `operator` | `address` | The address to authorize as an operator. | +| `amount` | `uint256` | The allowance amount of tokens operator has access to. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### authorizedAmountFor + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#authorizedamountfor) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `authorizedAmountFor(address,address)` +- Function selector: `0x65aeaa95` + +::: + +```solidity +function authorizedAmountFor( + address operator, + address tokenOwner +) external view returns (uint256); +``` + +Get the amount of tokens `operator` address has access to from `tokenOwner`. Operators can send and burn tokens on behalf of their owners. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ---------------------------------------------------------- | +| `operator` | `address` | The operator's address to query the authorized amount for. | +| `tokenOwner` | `address` | The token owner that `operator` has allowance on. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | --------------------------------------------------------------------------------------- | +| `0` | `uint256` | The amount of tokens the `operator`'s address has access on the `tokenOwner`'s balance. | + +
+ +### balanceOf + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#balanceof) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `balanceOf(address)` +- Function selector: `0x70a08231` + +::: + +```solidity +function balanceOf(address tokenOwner) external view returns (uint256); +``` + +Get the number of tokens owned by `tokenOwner`. If the token is divisible (the [`decimals`](#decimals) function returns `18`), the amount returned should be divided by 1e18 to get a better picture of the actual balance of the `tokenOwner`. _Example:_ `balanceOf(someAddress) -> 42_000_000_000_000_000_000 / 1e18 = 42 tokens` + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | --------------------------------------------------------- | +| `tokenOwner` | `address` | The address of the token holder to query the balance for. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------- | +| `0` | `uint256` | The amount of tokens owned by `tokenOwner`. | + +
+ +### batchCalls + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `batchCalls(bytes[])` +- Function selector: `0x6963d438` + +::: + +:::info + +It's not possible to send value along the functions call due to the use of `delegatecall`. + +::: + +```solidity +function batchCalls(bytes[] data) external nonpayable returns (bytes[] results); +``` + +_Executing the following batch of abi-encoded function calls on the contract: `data`._ + +Allows a caller to batch different function calls in one call. Perform a `delegatecall` on self, to call different functions with preserving the context. + +#### Parameters + +| Name | Type | Description | +| ------ | :-------: | -------------------------------------------------------------------- | +| `data` | `bytes[]` | An array of ABI encoded function calls to be called on the contract. | + +#### Returns + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------------------------------------- | +| `results` | `bytes[]` | An array of abi-encoded data returned by the functions executed. | + +
+ +### decimals + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#decimals) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `decimals()` +- Function selector: `0x313ce567` + +::: + +```solidity +function decimals() external view returns (uint8); +``` + +Returns the number of decimals used to get its user representation. If the asset contract has been set to be non-divisible via the `isNonDivisible_` parameter in the `constructor`, the decimals returned wiil be `0`. Otherwise `18` is the common value. + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ----------------------------------------------------------------------- | +| `0` | `uint8` | the number of decimals. If `0` is returned, the asset is non-divisible. | + +
+ +### decreaseAllowance + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#decreaseallowance) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `decreaseAllowance(address,address,uint256,bytes)` +- Function selector: `0x78381670` + +::: + +```solidity +function decreaseAllowance( + address operator, + address tokenOwner, + uint256 subtractedAmount, + bytes operatorNotificationData +) external nonpayable; +``` + +_Decrease the allowance of `operator` by -`subtractedAmount`_ + +Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ------------------------------------------------------ | +| `operator` | `address` | The operator to decrease allowance for `msg.sender` | +| `tokenOwner` | `address` | The address of the token owner. | +| `subtractedAmount` | `uint256` | The amount to decrease by in the operator's allowance. | +| `operatorNotificationData` | `bytes` | - | + +
+ +### getData + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#getdata) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_Reading the ERC725Y storage for data key `dataKey` returned the following value: `dataValue`._ + +Get in the ERC725Y storage the bytes data stored at a specific data key `dataKey`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------------------------------- | +| `dataKey` | `bytes32` | The data key for which to retrieve the value. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ---------------------------------------------------- | +| `dataValue` | `bytes` | The bytes value stored under the specified data key. | + +
+ +### getDataBatch + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#getdatabatch) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Reading the ERC725Y storage for data keys `dataKeys` returned the following values: `dataValues`._ + +Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys`. + +#### 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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#getoperatorsof) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `getOperatorsOf(address)` +- Function selector: `0xd72fc29a` + +::: + +```solidity +function getOperatorsOf(address tokenOwner) external view returns (address[]); +``` + +Returns all `operator` addresses that are allowed to transfer or burn on behalf of `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------- | +| `tokenOwner` | `address` | The token owner to get the operators for. | + +#### Returns + +| Name | Type | Description | +| ---- | :---------: | ----------------------------------------------------------------------------------- | +| `0` | `address[]` | An array of operators allowed to transfer or burn tokens on behalf of `tokenOwner`. | + +
+ +### increaseAllowance + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#increaseallowance) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `increaseAllowance(address,uint256,bytes)` +- Function selector: `0x2bc1da82` + +::: + +```solidity +function increaseAllowance( + address operator, + uint256 addedAmount, + bytes operatorNotificationData +) external nonpayable; +``` + +_Increase the allowance of `operator` by +`addedAmount`_ + +Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------- | +| `operator` | `address` | The operator to increase the allowance for `msg.sender` | +| `addedAmount` | `uint256` | The additional amount to add on top of the current operator's allowance | +| `operatorNotificationData` | `bytes` | - | + +
+ +### owner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#owner) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#renounceownership) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#revokeoperator) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `revokeOperator(address,address,bool,bytes)` +- Function selector: `0x30d0dc37` + +::: + +```solidity +function revokeOperator( + address operator, + address tokenOwner, + bool notify, + bytes operatorNotificationData +) external nonpayable; +``` + +Enables `tokenOwner` to remove `operator` for its tokens, disallowing it to send any amount of tokens on its behalf. This function also allows the `operator` to remove itself if it is the caller of this function + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | --------------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `tokenOwner` | `address` | The address of the token owner. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### setData + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#setdata) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +:::caution Warning + +**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**. + +::: + +```solidity +function setData(bytes32 dataKey, bytes dataValue) external payable; +``` + +_Setting the following data key value pair in the ERC725Y storage. Data key: `dataKey`, data value: `dataValue`._ + +Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data key `dataKey`. The function is marked as payable to enable flexibility on child contracts. For instance to implement a fee mechanism for setting specific data. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner). + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `dataKey` | `bytes32` | The data key for which to set a new value. | +| `dataValue` | `bytes` | The new bytes value to set. | + +
+ +### setDataBatch + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#setdatabatch) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +:::caution Warning + +**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**. + +::: + +```solidity +function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable; +``` + +_Setting the following data key value pairs in the ERC725Y storage. Data keys: `dataKeys`, data values: `dataValues`._ + +Batch data setting function that behaves the same as [`setData`](#setdata) but allowing to set multiple data key/value pairs in the ERC725Y storage in the same transaction. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner) of the contract. + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event **for each data key/value pair set**. + +
+ +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ---------------------------------------------------- | +| `dataKeys` | `bytes32[]` | An array of data keys to set bytes values for. | +| `dataValues` | `bytes[]` | An array of bytes values to set for each `dataKeys`. | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#supportsinterface) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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` | - | + +
+ +### tokenSupplyCap + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#tokensupplycap) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `tokenSupplyCap()` +- Function selector: `0x52058d8a` + +::: + +```solidity +function tokenSupplyCap() external view returns (uint256); +``` + +_The maximum supply amount of tokens allowed to exist is `_TOKEN_SUPPLY_CAP`._ + +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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#totalsupply) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#transfer) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `transfer(address,address,uint256,bool,bytes)` +- Function selector: `0x760d9bba` + +::: + +```solidity +function transfer( + address from, + address to, + uint256 amount, + bool force, + bytes data +) external nonpayable; +``` + +Transfers an `amount` of tokens from the `from` address to the `to` address and notify both sender and recipients via the LSP1 [`universalReceiver(...)`](#`universalreceiver) function. If the tokens are transferred by an operator on behalf of a token holder, the allowance for the operator will be decreased by `amount` once the token transfer has been completed (See [`authorizedAmountFor`](#authorizedamountfor)). + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The sender address. | +| `to` | `address` | The recipient address. | +| `amount` | `uint256` | The amount of tokens to transfer. | +| `force` | `bool` | When set to `true`, the `to` address CAN be any address. 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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#transferbatch) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `transferBatch(address[],address[],uint256[],bool[],bytes[])` +- Function selector: `0x2d7667c9` + +::: + +```solidity +function transferBatch( + address[] from, + address[] to, + uint256[] amount, + bool[] force, + bytes[] data +) external nonpayable; +``` + +Same as [`transfer(...)`](#`transfer) but transfer multiple tokens based on the arrays of `from`, `to`, `amount`. + +#### Parameters + +| Name | Type | Description | +| -------- | :---------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address[]` | An array of sending addresses. | +| `to` | `address[]` | An array of receiving addresses. | +| `amount` | `uint256[]` | An array of amount of tokens to transfer for each `from -> to` transfer. | +| `force` | `bool[]` | For each transfer, when set to `true`, the `to` address CAN be any address. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard. | +| `data` | `bytes[]` | An array of additional data the caller wants included in the emitted event, and sent in the hooks to `from` and `to` addresses. | + +
+ +### transferOwnership + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#transferownership) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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); +``` + +Read the value stored under a specific `dataKey` inside the underlying ERC725Y storage, +represented as a mapping of `bytes32` data keys mapped to their `bytes` data values. + +```solidity +mapping(bytes32 => bytes) _store +``` + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------------------------------------------------------------------- | +| `dataKey` | `bytes32` | A bytes32 data key to read the associated `bytes` value from the store. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ----------------------------------------------------------------------------- | +| `dataValue` | `bytes` | The `bytes` value associated with the given `dataKey` in the ERC725Y storage. | + +
+ +### \_setData + +```solidity +function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; +``` + +The ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol` cannot be changed +via this function once the digital asset contract has been deployed. + +
+ +### \_updateOperator + +```solidity +function _updateOperator( + address tokenOwner, + address operator, + uint256 allowance, + bool notified, + bytes operatorNotificationData +) internal nonpayable; +``` + +Changes token `amount` the `operator` has access to from `tokenOwner` tokens. +If the amount is zero the operator is removed from the list of operators, otherwise he is added to the list of operators. +If the amount is zero then the operator is being revoked, otherwise the operator amount is being modified. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------------------------------------------------------- | +| `tokenOwner` | `address` | The address that will give `operator` an allowance for on its balance. | +| `operator` | `address` | @param operatorNotificationData The data to send to the universalReceiver function of the operator in case of notifying | +| `allowance` | `uint256` | The maximum amount of token that `operator` can spend from the `tokenOwner`'s balance. | +| `notified` | `bool` | Boolean indicating whether the operator has been notified about the change of allowance | +| `operatorNotificationData` | `bytes` | The data to send to the universalReceiver function of the operator in case of notifying | + +
+ +### \_mint + +```solidity +function _mint( + address to, + uint256 amount, + bool force, + bytes data +) internal nonpayable; +``` + +Same as [`_mint`](#_mint) but allows to mint only if the [`totalSupply`](#totalsupply) does not exceed the [`tokenSupplyCap`](#tokensupplycap) +after `amount` of tokens have been minted. + +
+ +### \_burn + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances, **but before notifying the sender via LSP1**. + +::: + +:::tip Hint + +In dApps, you can know which address is burning tokens by listening for the `Transfer` event and filter with the zero address as `to`. + +::: + +```solidity +function _burn(address from, uint256 amount, bytes data) internal nonpayable; +``` + +Burns (= destroys) `amount` of tokens, decrease the `from` balance. This is done by sending them to the zero address. +Both the sender and recipient will be notified of the token transfer through the 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. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event with `address(0)` as the `to` address + +
+ +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The address to burn tokens from its balance. | +| `amount` | `uint256` | The amount of tokens to burn. | +| `data` | `bytes` | Additional data the caller wants included in the emitted event, and sent in the LSP1 hook to the `from` and `to` address. | + +
+ +### \_spendAllowance + +```solidity +function _spendAllowance( + address operator, + address tokenOwner, + uint256 amountToSpend +) internal nonpayable; +``` + +Spend `amountToSpend` from the `operator`'s authorized on behalf of the `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ------------------------------------------------------------------- | +| `operator` | `address` | The address of the operator to decrease the allowance of. | +| `tokenOwner` | `address` | The address that granted an allowance on its balance to `operator`. | +| `amountToSpend` | `uint256` | The amount of tokens to substract in allowance of `operator`. | + +
+ +### \_transfer + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances, **but before notifying the sender/recipient via LSP1**. + +::: + +```solidity +function _transfer( + address from, + address to, + uint256 amount, + bool force, + bytes data +) internal nonpayable; +``` + +Transfer tokens from `from` to `to` by decreasing the balance of `from` by `-amount` and increasing the balance +of `to` by `+amount`. +Both the sender and recipient will be notified of the token transfer through the 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. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event. + +
+ +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The address to decrease the balance. | +| `to` | `address` | The address to increase the balance. | +| `amount` | `uint256` | The amount of tokens to transfer from `from` to `to`. | +| `force` | `bool` | A boolean that describe if transfer to a `to` address that does not support LSP1 is allowed or not. | +| `data` | `bytes` | Additional data the caller wants included in the emitted event, and sent in the LSP1 hook to the `from` and `to` address. | + +
+ +### \_beforeTokenTransfer + +```solidity +function _beforeTokenTransfer( + address from, + address to, + uint256 amount, + bytes data +) 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` | The recipient address | +| `amount` | `uint256` | The amount of token to transfer | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + uint256 amount, + bytes data +) internal nonpayable; +``` + +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient** by overriding this function. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------ | +| `from` | `address` | The sender address | +| `to` | `address` | The recipient address | +| `amount` | `uint256` | The amount of token to transfer | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_notifyTokenOperator + +```solidity +function _notifyTokenOperator( + address operator, + bytes lsp1Data +) internal nonpayable; +``` + +Attempt to notify the operator `operator` about the `amount` tokens being authorized with. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. +If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------------------------ | +| `operator` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | + +
+ +### \_notifyTokenSender + +```solidity +function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; +``` + +Attempt to notify the token sender `from` about the `amount` of tokens being transferred. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENSSENDER` as typeId, if `from` is a contract that supports the LSP1 interface. +If `from` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------------------------ | +| `from` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `lsp1Data` | `bytes` | the data to be sent to the `from` address in the `universalReceiver` call. | + +
+ +### \_notifyTokenReceiver + +```solidity +function _notifyTokenReceiver( + address to, + bool force, + bytes lsp1Data +) internal nonpayable; +``` + +Attempt to notify the token receiver `to` about the `amount` tokens being received. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENSRECIPIENT` as typeId, if `to` is a contract that supports the LSP1 interface. +If `to` is is an EOA or a contract that does not support the LSP1 interface, the behaviour will depend on the `force` boolean flag. + +- if `force` is set to `true`, nothing will happen and no notification will be sent. + +- if `force` is set to `false, the transaction will revert. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | --------------------------------------------------------------------------------------------------- | +| `to` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `force` | `bool` | A boolean that describe if transfer to a `to` address that does not support LSP1 is allowed or not. | +| `lsp1Data` | `bytes` | The data to be sent to the `to` address in the `universalReceiver(...)` call. | + +
+ +### \_supportsInterfaceInERC165Extension + +```solidity +function _supportsInterfaceInERC165Extension( + bytes4 interfaceId +) internal view returns (bool); +``` + +Returns whether the interfaceId being checked is supported in the extension of the +[`supportsInterface`](#supportsinterface) selector. +To be used by extendable contracts wishing to extend the ERC165 interfaceIds originally +supported by reading whether the interfaceId queried is supported in the `supportsInterface` +extension if the extension is set, if not it returns false. + +
+ +### \_getExtensionAndForwardValue + +```solidity +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); +``` + +Returns the extension address stored under the following data key: + +- [`_LSP17_EXTENSION_PREFIX`](#_lsp17_extension_prefix) + `` (Check [LSP2-ERC725YJSONSchema] for encoding the data key). + +- If no extension is stored, returns the address(0). + +- we do not check that payable bool as in lsp7 standard we will always forward the value to the extension + +
+ +### \_fallbackLSP17Extendable + +:::info + +The LSP7 Token contract should not hold any native tokens. Any native tokens received by the contract +will be forwarded to the extension address mapped to the selector from `msg.sig`. + +::: + +```solidity +function _fallbackLSP17Extendable( + bytes callData +) internal nonpayable returns (bytes); +``` + +Forwards the call with the received value to an extension mapped to a function selector. +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being +called on the account. If there is no extension, the address(0) will be returned. +Forwards the value if the extension is payable. +Reverts if there is no extension for the function being called. +If there is an extension for the function selector being called, it calls the extension with the +CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and +32 bytes of the [`msg.value`](#msg.value) + +
+ +## Events + +### DataChanged + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#datachanged) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_The following data key/value pair has been changed in the ERC725Y storage: Data key: `dataKey`, data value: `dataValue`._ + +Emitted when data at a specific `dataKey` was changed to a new value `dataValue`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------- | +| `dataKey` **`indexed`** | `bytes32` | The data key for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### OperatorAuthorizationChanged + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#operatorauthorizationchanged) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Event signature: `OperatorAuthorizationChanged(address,address,uint256,bytes)` +- Event topic hash: `0xf772a43bfdf4729b196e3fb54a818b91a2ca6c49d10b2e16278752f9f515c25d` + +::: + +```solidity +event OperatorAuthorizationChanged( + address indexed operator, + address indexed tokenOwner, + uint256 indexed amount, + bytes operatorNotificationData +); +``` + +Emitted when `tokenOwner` enables `operator` for `amount` tokens. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address authorized as an operator | +| `tokenOwner` **`indexed`** | `address` | The token owner | +| `amount` **`indexed`** | `uint256` | The amount of tokens `operator` address has access to from `tokenOwner` | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### OperatorRevoked + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#operatorrevoked) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Event signature: `OperatorRevoked(address,address,bool,bytes)` +- Event topic hash: `0x0ebf5762d8855cbe012d2ca42fb33a81175e17c8a8751f8859931ba453bd4167` + +::: + +```solidity +event OperatorRevoked( + address indexed operator, + address indexed tokenOwner, + bool indexed notified, + bytes operatorNotificationData +); +``` + +Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [`authorizedAmountFor(...)`](#`authorizedamountfor) to `0`. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from operating | +| `tokenOwner` **`indexed`** | `address` | The token owner | +| `notified` **`indexed`** | `bool` | Bool indicating whether the operator has been notified or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### OwnershipTransferred + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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` | - | + +
+ +### Transfer + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#transfer) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Event signature: `Transfer(address,address,address,uint256,bool,bytes)` +- Event topic hash: `0x3997e418d2cef0b3b0e907b1e39605c3f7d32dbd061e82ea5b4a770d46a160a6` + +::: + +```solidity +event Transfer( + address indexed operator, + address indexed from, + address indexed to, + uint256 amount, + bool force, + bytes data +); +``` + +Emitted when the `from` transferred successfully `amount` of tokens to `to`. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ---------------------------------------------------------------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address of the operator that executed the transfer. | +| `from` **`indexed`** | `address` | The address which tokens were sent from (balance decreased by `-amount`). | +| `to` **`indexed`** | `address` | The address that received the tokens (balance increased by `+amount`). | +| `amount` | `uint256` | The amount of tokens transferred. | +| `force` | `bool` | if the transferred enforced the `to` recipient address to be a contract that implements the LSP1 standard or not. | +| `data` | `bytes` | Any additional data included by the caller during the transfer, and sent in the LSP1 hooks to the `from` and `to` addresses. | + +
+ +## Errors + +### ERC725Y_DataKeysValuesEmptyArray + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +Reverts when one of the array parameter provided to [`setDataBatch`](#setdatabatch) function is an empty array. + +
+ +### ERC725Y_DataKeysValuesLengthMismatch + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function. + +
+ +### ERC725Y_MsgValueDisallowed + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#erc725y_msgvaluedisallowed) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#setdatabatch) function. + +
+ +### InvalidExtensionAddress + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#invalidextensionaddress) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `InvalidExtensionAddress(bytes)` +- Error hash: `0x42bfe79f` + +::: + +```solidity +error InvalidExtensionAddress(bytes storedData); +``` + +reverts when the bytes retrieved from the LSP17 data key is not a valid address (not 20 bytes) + +#### Parameters + +| Name | Type | Description | +| ------------ | :-----: | ----------- | +| `storedData` | `bytes` | - | + +
+ +### InvalidFunctionSelector + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#invalidfunctionselector) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `InvalidFunctionSelector(bytes)` +- Error hash: `0xe5099ee3` + +::: + +```solidity +error InvalidFunctionSelector(bytes data); +``` + +reverts when the contract is called with a function selector not valid (less than 4 bytes of data) + +#### Parameters + +| Name | Type | Description | +| ------ | :-----: | ----------- | +| `data` | `bytes` | - | + +
+ +### LSP4TokenNameNotEditable + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokennamenoteditable) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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 / initialized. 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 / initialized. + +
+ +### LSP4TokenSymbolNotEditable + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokensymbolnoteditable) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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 / initialized. 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 / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` 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 / initialized. + +
+ +### LSP7AmountExceedsAuthorizedAmount + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7amountexceedsauthorizedamount) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7AmountExceedsAuthorizedAmount(address,uint256,address,uint256)` +- Error hash: `0xf3a6b691` + +::: + +```solidity +error LSP7AmountExceedsAuthorizedAmount( + address tokenOwner, + uint256 authorizedAmount, + address operator, + uint256 amount +); +``` + +reverts when `operator` of `tokenOwner` send an `amount` of tokens larger than the `authorizedAmount`. + +#### Parameters + +| Name | Type | Description | +| ------------------ | :-------: | ----------- | +| `tokenOwner` | `address` | - | +| `authorizedAmount` | `uint256` | - | +| `operator` | `address` | - | +| `amount` | `uint256` | - | + +
+ +### LSP7AmountExceedsBalance + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7amountexceedsbalance) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7AmountExceedsBalance(uint256,address,uint256)` +- Error hash: `0x08d47949` + +::: + +```solidity +error LSP7AmountExceedsBalance( + uint256 balance, + address tokenOwner, + uint256 amount +); +``` + +reverts when sending an `amount` of tokens larger than the current `balance` of the `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `balance` | `uint256` | - | +| `tokenOwner` | `address` | - | +| `amount` | `uint256` | - | + +
+ +### LSP7BatchCallFailed + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7batchcallfailed) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7BatchCallFailed(uint256)` +- Error hash: `0xb774c284` + +::: + +```solidity +error LSP7BatchCallFailed(uint256 callIndex); +``` + +_Batch call failed._ + +Reverts when a batch call failed. + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ----------- | +| `callIndex` | `uint256` | - | + +
+ +### LSP7CannotSendWithAddressZero + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7cannotsendwithaddresszero) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7CannotSendWithAddressZero()` +- Error hash: `0xd2d5ec30` + +::: + +```solidity +error LSP7CannotSendWithAddressZero(); +``` + +reverts when trying to: + +- mint tokens to the zero address. + +- burn tokens from the zero address. + +- transfer tokens from or to the zero address. + +
+ +### LSP7CannotUseAddressZeroAsOperator + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7cannotuseaddresszeroasoperator) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7CannotUseAddressZeroAsOperator()` +- Error hash: `0x6355e766` + +::: + +```solidity +error LSP7CannotUseAddressZeroAsOperator(); +``` + +reverts when trying to set the zero address as an operator. + +
+ +### LSP7CappedSupplyCannotMintOverCap + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7cappedsupplycannotmintovercap) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7CappedSupplyCannotMintOverCap()` +- Error hash: `0xeacbf0d1` + +::: + +```solidity +error LSP7CappedSupplyCannotMintOverCap(); +``` + +_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). + +
+ +### LSP7CappedSupplyRequired + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7cappedsupplyrequired) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7CappedSupplyRequired()` +- Error hash: `0xacf1d8c5` + +::: + +```solidity +error LSP7CappedSupplyRequired(); +``` + +_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. + +
+ +### LSP7DecreaseAllowanceNotAuthorized + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7decreaseallowancenotauthorized) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7DecreaseAllowanceNotAuthorized(address,address,address)` +- Error hash: `0x98ce2945` + +::: + +```solidity +error LSP7DecreaseAllowanceNotAuthorized( + address caller, + address tokenOwner, + address operator +); +``` + +Reverts when the call to decrease allowance is not authorized. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `caller` | `address` | - | +| `tokenOwner` | `address` | - | +| `operator` | `address` | - | + +
+ +### LSP7DecreasedAllowanceBelowZero + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7decreasedallowancebelowzero) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7DecreasedAllowanceBelowZero()` +- Error hash: `0x0ef76c35` + +::: + +```solidity +error LSP7DecreasedAllowanceBelowZero(); +``` + +Reverts when trying to decrease an operator's allowance to more than its current allowance. + +
+ +### LSP7InvalidTransferBatch + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7invalidtransferbatch) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7InvalidTransferBatch()` +- Error hash: `0x263eee8d` + +::: + +```solidity +error LSP7InvalidTransferBatch(); +``` + +reverts when the array parameters used in [`transferBatch`](#transferbatch) have different lengths. + +
+ +### LSP7NotifyTokenReceiverContractMissingLSP1Interface + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7notifytokenreceivercontractmissinglsp1interface) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7NotifyTokenReceiverContractMissingLSP1Interface(address)` +- Error hash: `0xa608fbb6` + +::: + +```solidity +error LSP7NotifyTokenReceiverContractMissingLSP1Interface( + address tokenReceiver +); +``` + +reverts if the `tokenReceiver` does not implement LSP1 when minting or transferring tokens with `bool force` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP7NotifyTokenReceiverIsEOA + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7notifytokenreceiveriseoa) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7NotifyTokenReceiverIsEOA(address)` +- Error hash: `0x26c247f4` + +::: + +```solidity +error LSP7NotifyTokenReceiverIsEOA(address tokenReceiver); +``` + +reverts if the `tokenReceiver` is an EOA when minting or transferring tokens with `bool force` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP7RevokeOperatorNotAuthorized + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7revokeoperatornotauthorized) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7RevokeOperatorNotAuthorized(address,address,address)` +- Error hash: `0x1a525b32` + +::: + +```solidity +error LSP7RevokeOperatorNotAuthorized( + address caller, + address tokenOwner, + address operator +); +``` + +Reverts when the call to revoke operator is not authorized. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `caller` | `address` | - | +| `tokenOwner` | `address` | - | +| `operator` | `address` | - | + +
+ +### LSP7TokenContractCannotHoldValue + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7tokencontractcannotholdvalue) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7TokenContractCannotHoldValue()` +- Error hash: `0x388f5adc` + +::: + +```solidity +error LSP7TokenContractCannotHoldValue(); +``` + +_LSP7 contract cannot receive native tokens._ + +Error occurs when sending native tokens to the LSP7 contract without sending any data. E.g. Sending value without passing a bytes4 function selector to call a LSP17 Extension. + +
+ +### LSP7TokenOwnerCannotBeOperator + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7tokenownercannotbeoperator) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7TokenOwnerCannotBeOperator()` +- Error hash: `0xdab75047` + +::: + +```solidity +error LSP7TokenOwnerCannotBeOperator(); +``` + +reverts when trying to authorize or revoke the token's owner as an operator. + +
+ +### NoExtensionFoundForFunctionSelector + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#noextensionfoundforfunctionselector) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `NoExtensionFoundForFunctionSelector(bytes4)` +- Error hash: `0xbb370b2b` + +::: + +```solidity +error NoExtensionFoundForFunctionSelector(bytes4 functionSelector); +``` + +reverts when there is no extension for the function selector being called with + +#### Parameters + +| Name | Type | Description | +| ------------------ | :------: | ----------- | +| `functionSelector` | `bytes4` | - | + +
+ +### OperatorAllowanceCannotBeIncreasedFromZero + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#operatorallowancecannotbeincreasedfromzero) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `OperatorAllowanceCannotBeIncreasedFromZero(address)` +- Error hash: `0xcba6e977` + +::: + +```solidity +error OperatorAllowanceCannotBeIncreasedFromZero(address operator); +``` + +Reverts when token owner call [`increaseAllowance`](#increaseallowance) for an operator that does not have any allowance + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | + +
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md b/packages/lsp-smart-contracts/docs/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md new file mode 100644 index 000000000..99fde2ae2 --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md @@ -0,0 +1,1980 @@ + + + +# LSP7Mintable + +:::info Standard Specifications + +[`LSP-7-DigitalAsset`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md) + +::: +:::info Solidity implementation + +[`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) + +::: + +> LSP7DigitalAsset deployable preset contract with a public [`mint`](#mint) function callable only by the contract [`owner`](#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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#constructor) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) + +::: + +```solidity +constructor( + string name_, + string symbol_, + address newOwner_, + uint256 lsp4TokenType_, + bool isNonDivisible_ +); +``` + +_Deploying a `LSP7Mintable` 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. | +| `lsp4TokenType_` | `uint256` | The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection). | +| `isNonDivisible_` | `bool` | Specify if the LSP7 token is a fungible or non-fungible token. | + +
+ +### fallback + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#fallback) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) + +::: + +```solidity +fallback(bytes calldata callData) external payable returns (bytes memory); +``` + +_The `fallback` function was called with the following amount of native tokens: `msg.value`; and the following calldata: `callData`._ + +Achieves the goal of [LSP-17-ContractExtension] standard by extending the contract to handle calls of functions that do not exist natively, +forwarding the function call to the extension address mapped to the function being called. +This function is executed when: + +- Sending data of length less than 4 bytes to the contract. + +- The first 4 bytes of the calldata do not match any publicly callable functions from the contract ABI. + +- Receiving native tokens + +1. If the data is equal or longer than 4 bytes, the [ERC-725Y] storage is queried with the following data key: [_LSP17_EXTENSION_PREFIX] + `bytes4(msg.sig)` (Check [LSP-2-ERC725YJSONSchema] for encoding the data key) + +- If there is no address stored under the following data key, revert with [`NoExtensionFoundForFunctionSelector(bytes4)`](#noextensionfoundforfunctionselector). The data key relative to `bytes4(0)` is an exception, where no reverts occurs if there is no extension address stored under. This exception is made to allow users to send random data (graffiti) to the account and to be able to react on it. + +- If there is an address, forward the `msg.data` to the extension using the CALL opcode, appending 52 bytes (20 bytes of `msg.sender` and 32 bytes of `msg.value`). Return what the calls returns, or revert if the call failed. + +2. If the data sent to this function is of length less than 4 bytes (not a function selector), revert. + +
+ +### receive + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#receive) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) + +::: + +```solidity +receive() external payable; +``` + +_LSP7 contract cannot receive native tokens._ + +Reverts whenever someone tries to send native tokens to a LSP7 contract. + +
+ +### authorizeOperator + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#authorizeoperator) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `authorizeOperator(address,uint256,bytes)` +- Function selector: `0xb49506fd` + +::: + +:::danger + +To avoid front-running and Allowance Double-Spend Exploit when increasing or decreasing the authorized amount of an operator, it is advised to use the [`increaseAllowance`](#increaseallowance) and [`decreaseAllowance`](#decreaseallowance) functions. For more information, see: https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/ + +::: + +```solidity +function authorizeOperator( + address operator, + uint256 amount, + bytes operatorNotificationData +) external nonpayable; +``` + +Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). Notify the operator based on the LSP1-UniversalReceiver standard + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ------------------------------------------------------ | +| `operator` | `address` | The address to authorize as an operator. | +| `amount` | `uint256` | The allowance amount of tokens operator has access to. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### authorizedAmountFor + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#authorizedamountfor) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `authorizedAmountFor(address,address)` +- Function selector: `0x65aeaa95` + +::: + +```solidity +function authorizedAmountFor( + address operator, + address tokenOwner +) external view returns (uint256); +``` + +Get the amount of tokens `operator` address has access to from `tokenOwner`. Operators can send and burn tokens on behalf of their owners. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ---------------------------------------------------------- | +| `operator` | `address` | The operator's address to query the authorized amount for. | +| `tokenOwner` | `address` | The token owner that `operator` has allowance on. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | --------------------------------------------------------------------------------------- | +| `0` | `uint256` | The amount of tokens the `operator`'s address has access on the `tokenOwner`'s balance. | + +
+ +### balanceOf + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#balanceof) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `balanceOf(address)` +- Function selector: `0x70a08231` + +::: + +```solidity +function balanceOf(address tokenOwner) external view returns (uint256); +``` + +Get the number of tokens owned by `tokenOwner`. If the token is divisible (the [`decimals`](#decimals) function returns `18`), the amount returned should be divided by 1e18 to get a better picture of the actual balance of the `tokenOwner`. _Example:_ `balanceOf(someAddress) -> 42_000_000_000_000_000_000 / 1e18 = 42 tokens` + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | --------------------------------------------------------- | +| `tokenOwner` | `address` | The address of the token holder to query the balance for. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------- | +| `0` | `uint256` | The amount of tokens owned by `tokenOwner`. | + +
+ +### batchCalls + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `batchCalls(bytes[])` +- Function selector: `0x6963d438` + +::: + +:::info + +It's not possible to send value along the functions call due to the use of `delegatecall`. + +::: + +```solidity +function batchCalls(bytes[] data) external nonpayable returns (bytes[] results); +``` + +_Executing the following batch of abi-encoded function calls on the contract: `data`._ + +Allows a caller to batch different function calls in one call. Perform a `delegatecall` on self, to call different functions with preserving the context. + +#### Parameters + +| Name | Type | Description | +| ------ | :-------: | -------------------------------------------------------------------- | +| `data` | `bytes[]` | An array of ABI encoded function calls to be called on the contract. | + +#### Returns + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------------------------------------- | +| `results` | `bytes[]` | An array of abi-encoded data returned by the functions executed. | + +
+ +### decimals + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#decimals) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `decimals()` +- Function selector: `0x313ce567` + +::: + +```solidity +function decimals() external view returns (uint8); +``` + +Returns the number of decimals used to get its user representation. If the asset contract has been set to be non-divisible via the `isNonDivisible_` parameter in the `constructor`, the decimals returned wiil be `0`. Otherwise `18` is the common value. + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ----------------------------------------------------------------------- | +| `0` | `uint8` | the number of decimals. If `0` is returned, the asset is non-divisible. | + +
+ +### decreaseAllowance + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#decreaseallowance) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `decreaseAllowance(address,address,uint256,bytes)` +- Function selector: `0x78381670` + +::: + +```solidity +function decreaseAllowance( + address operator, + address tokenOwner, + uint256 subtractedAmount, + bytes operatorNotificationData +) external nonpayable; +``` + +_Decrease the allowance of `operator` by -`subtractedAmount`_ + +Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ------------------------------------------------------ | +| `operator` | `address` | The operator to decrease allowance for `msg.sender` | +| `tokenOwner` | `address` | The address of the token owner. | +| `subtractedAmount` | `uint256` | The amount to decrease by in the operator's allowance. | +| `operatorNotificationData` | `bytes` | - | + +
+ +### getData + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#getdata) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_Reading the ERC725Y storage for data key `dataKey` returned the following value: `dataValue`._ + +Get in the ERC725Y storage the bytes data stored at a specific data key `dataKey`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------------------------------- | +| `dataKey` | `bytes32` | The data key for which to retrieve the value. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ---------------------------------------------------- | +| `dataValue` | `bytes` | The bytes value stored under the specified data key. | + +
+ +### getDataBatch + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#getdatabatch) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Reading the ERC725Y storage for data keys `dataKeys` returned the following values: `dataValues`._ + +Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys`. + +#### 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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#getoperatorsof) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `getOperatorsOf(address)` +- Function selector: `0xd72fc29a` + +::: + +```solidity +function getOperatorsOf(address tokenOwner) external view returns (address[]); +``` + +Returns all `operator` addresses that are allowed to transfer or burn on behalf of `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------- | +| `tokenOwner` | `address` | The token owner to get the operators for. | + +#### Returns + +| Name | Type | Description | +| ---- | :---------: | ----------------------------------------------------------------------------------- | +| `0` | `address[]` | An array of operators allowed to transfer or burn tokens on behalf of `tokenOwner`. | + +
+ +### increaseAllowance + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#increaseallowance) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `increaseAllowance(address,uint256,bytes)` +- Function selector: `0x2bc1da82` + +::: + +```solidity +function increaseAllowance( + address operator, + uint256 addedAmount, + bytes operatorNotificationData +) external nonpayable; +``` + +_Increase the allowance of `operator` by +`addedAmount`_ + +Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------- | +| `operator` | `address` | The operator to increase the allowance for `msg.sender` | +| `addedAmount` | `uint256` | The additional amount to add on top of the current operator's allowance | +| `operatorNotificationData` | `bytes` | - | + +
+ +### mint + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#mint) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `mint(address,uint256,bool,bytes)` +- Function selector: `0x7580d920` + +::: + +```solidity +function mint( + address to, + uint256 amount, + bool force, + bytes data +) external nonpayable; +``` + +Public [`_mint`](#_mint) function only callable by the [`owner`](#owner). + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ----------- | +| `to` | `address` | - | +| `amount` | `uint256` | - | +| `force` | `bool` | - | +| `data` | `bytes` | - | + +
+ +### owner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#owner) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#renounceownership) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#revokeoperator) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `revokeOperator(address,address,bool,bytes)` +- Function selector: `0x30d0dc37` + +::: + +```solidity +function revokeOperator( + address operator, + address tokenOwner, + bool notify, + bytes operatorNotificationData +) external nonpayable; +``` + +Enables `tokenOwner` to remove `operator` for its tokens, disallowing it to send any amount of tokens on its behalf. This function also allows the `operator` to remove itself if it is the caller of this function + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | --------------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `tokenOwner` | `address` | The address of the token owner. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### setData + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#setdata) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +:::caution Warning + +**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**. + +::: + +```solidity +function setData(bytes32 dataKey, bytes dataValue) external payable; +``` + +_Setting the following data key value pair in the ERC725Y storage. Data key: `dataKey`, data value: `dataValue`._ + +Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data key `dataKey`. The function is marked as payable to enable flexibility on child contracts. For instance to implement a fee mechanism for setting specific data. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner). + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `dataKey` | `bytes32` | The data key for which to set a new value. | +| `dataValue` | `bytes` | The new bytes value to set. | + +
+ +### setDataBatch + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#setdatabatch) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +:::caution Warning + +**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**. + +::: + +```solidity +function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable; +``` + +_Setting the following data key value pairs in the ERC725Y storage. Data keys: `dataKeys`, data values: `dataValues`._ + +Batch data setting function that behaves the same as [`setData`](#setdata) but allowing to set multiple data key/value pairs in the ERC725Y storage in the same transaction. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner) of the contract. + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event **for each data key/value pair set**. + +
+ +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ---------------------------------------------------- | +| `dataKeys` | `bytes32[]` | An array of data keys to set bytes values for. | +| `dataValues` | `bytes[]` | An array of bytes values to set for each `dataKeys`. | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#supportsinterface) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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` | - | + +
+ +### totalSupply + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#totalsupply) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#transfer) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `transfer(address,address,uint256,bool,bytes)` +- Function selector: `0x760d9bba` + +::: + +```solidity +function transfer( + address from, + address to, + uint256 amount, + bool force, + bytes data +) external nonpayable; +``` + +Transfers an `amount` of tokens from the `from` address to the `to` address and notify both sender and recipients via the LSP1 [`universalReceiver(...)`](#`universalreceiver) function. If the tokens are transferred by an operator on behalf of a token holder, the allowance for the operator will be decreased by `amount` once the token transfer has been completed (See [`authorizedAmountFor`](#authorizedamountfor)). + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The sender address. | +| `to` | `address` | The recipient address. | +| `amount` | `uint256` | The amount of tokens to transfer. | +| `force` | `bool` | When set to `true`, the `to` address CAN be any address. 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-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#transferbatch) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Function signature: `transferBatch(address[],address[],uint256[],bool[],bytes[])` +- Function selector: `0x2d7667c9` + +::: + +```solidity +function transferBatch( + address[] from, + address[] to, + uint256[] amount, + bool[] force, + bytes[] data +) external nonpayable; +``` + +Same as [`transfer(...)`](#`transfer) but transfer multiple tokens based on the arrays of `from`, `to`, `amount`. + +#### Parameters + +| Name | Type | Description | +| -------- | :---------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address[]` | An array of sending addresses. | +| `to` | `address[]` | An array of receiving addresses. | +| `amount` | `uint256[]` | An array of amount of tokens to transfer for each `from -> to` transfer. | +| `force` | `bool[]` | For each transfer, when set to `true`, the `to` address CAN be any address. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard. | +| `data` | `bytes[]` | An array of additional data the caller wants included in the emitted event, and sent in the hooks to `from` and `to` addresses. | + +
+ +### transferOwnership + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#transferownership) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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); +``` + +Read the value stored under a specific `dataKey` inside the underlying ERC725Y storage, +represented as a mapping of `bytes32` data keys mapped to their `bytes` data values. + +```solidity +mapping(bytes32 => bytes) _store +``` + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------------------------------------------------------------------- | +| `dataKey` | `bytes32` | A bytes32 data key to read the associated `bytes` value from the store. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ----------------------------------------------------------------------------- | +| `dataValue` | `bytes` | The `bytes` value associated with the given `dataKey` in the ERC725Y storage. | + +
+ +### \_setData + +```solidity +function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; +``` + +The ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol` cannot be changed +via this function once the digital asset contract has been deployed. + +
+ +### \_updateOperator + +```solidity +function _updateOperator( + address tokenOwner, + address operator, + uint256 allowance, + bool notified, + bytes operatorNotificationData +) internal nonpayable; +``` + +Changes token `amount` the `operator` has access to from `tokenOwner` tokens. +If the amount is zero the operator is removed from the list of operators, otherwise he is added to the list of operators. +If the amount is zero then the operator is being revoked, otherwise the operator amount is being modified. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------------------------------------------------------- | +| `tokenOwner` | `address` | The address that will give `operator` an allowance for on its balance. | +| `operator` | `address` | @param operatorNotificationData The data to send to the universalReceiver function of the operator in case of notifying | +| `allowance` | `uint256` | The maximum amount of token that `operator` can spend from the `tokenOwner`'s balance. | +| `notified` | `bool` | Boolean indicating whether the operator has been notified about the change of allowance | +| `operatorNotificationData` | `bytes` | The data to send to the universalReceiver function of the operator in case of notifying | + +
+ +### \_mint + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances, **but before notifying the recipient via LSP1**. + +::: + +```solidity +function _mint( + address to, + uint256 amount, + bool force, + bytes data +) internal nonpayable; +``` + +Mints `amount` of tokens and transfers it to `to`. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event with `address(0)` as `from`. + +
+ +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------- | +| `to` | `address` | The address to mint tokens for. | +| `amount` | `uint256` | The amount of tokens to mint. | +| `force` | `bool` | A boolean that describe if transfer to a `to` address that does not support LSP1 is allowed or not. | +| `data` | `bytes` | Additional data the caller wants included in the emitted [`Transfer`](#transfer) event, and sent in the LSP1 hook to the `to` address. | + +
+ +### \_burn + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances, **but before notifying the sender via LSP1**. + +::: + +:::tip Hint + +In dApps, you can know which address is burning tokens by listening for the `Transfer` event and filter with the zero address as `to`. + +::: + +```solidity +function _burn(address from, uint256 amount, bytes data) internal nonpayable; +``` + +Burns (= destroys) `amount` of tokens, decrease the `from` balance. This is done by sending them to the zero address. +Both the sender and recipient will be notified of the token transfer through the 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. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event with `address(0)` as the `to` address + +
+ +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The address to burn tokens from its balance. | +| `amount` | `uint256` | The amount of tokens to burn. | +| `data` | `bytes` | Additional data the caller wants included in the emitted event, and sent in the LSP1 hook to the `from` and `to` address. | + +
+ +### \_spendAllowance + +```solidity +function _spendAllowance( + address operator, + address tokenOwner, + uint256 amountToSpend +) internal nonpayable; +``` + +Spend `amountToSpend` from the `operator`'s authorized on behalf of the `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ------------------------------------------------------------------- | +| `operator` | `address` | The address of the operator to decrease the allowance of. | +| `tokenOwner` | `address` | The address that granted an allowance on its balance to `operator`. | +| `amountToSpend` | `uint256` | The amount of tokens to substract in allowance of `operator`. | + +
+ +### \_transfer + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances, **but before notifying the sender/recipient via LSP1**. + +::: + +```solidity +function _transfer( + address from, + address to, + uint256 amount, + bool force, + bytes data +) internal nonpayable; +``` + +Transfer tokens from `from` to `to` by decreasing the balance of `from` by `-amount` and increasing the balance +of `to` by `+amount`. +Both the sender and recipient will be notified of the token transfer through the 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. + +
+ +**Emitted events:** + +- [`Transfer`](#transfer) event. + +
+ +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------------------------------------------------------------------------------------------- | +| `from` | `address` | The address to decrease the balance. | +| `to` | `address` | The address to increase the balance. | +| `amount` | `uint256` | The amount of tokens to transfer from `from` to `to`. | +| `force` | `bool` | A boolean that describe if transfer to a `to` address that does not support LSP1 is allowed or not. | +| `data` | `bytes` | Additional data the caller wants included in the emitted event, and sent in the LSP1 hook to the `from` and `to` address. | + +
+ +### \_beforeTokenTransfer + +```solidity +function _beforeTokenTransfer( + address from, + address to, + uint256 amount, + bytes data +) 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` | The recipient address | +| `amount` | `uint256` | The amount of token to transfer | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + uint256 amount, + bytes data +) internal nonpayable; +``` + +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient** by overriding this function. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------ | +| `from` | `address` | The sender address | +| `to` | `address` | The recipient address | +| `amount` | `uint256` | The amount of token to transfer | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_notifyTokenOperator + +```solidity +function _notifyTokenOperator( + address operator, + bytes lsp1Data +) internal nonpayable; +``` + +Attempt to notify the operator `operator` about the `amount` tokens being authorized with. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. +If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------------------------ | +| `operator` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | + +
+ +### \_notifyTokenSender + +```solidity +function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; +``` + +Attempt to notify the token sender `from` about the `amount` of tokens being transferred. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENSSENDER` as typeId, if `from` is a contract that supports the LSP1 interface. +If `from` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------------------------ | +| `from` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `lsp1Data` | `bytes` | the data to be sent to the `from` address in the `universalReceiver` call. | + +
+ +### \_notifyTokenReceiver + +```solidity +function _notifyTokenReceiver( + address to, + bool force, + bytes lsp1Data +) internal nonpayable; +``` + +Attempt to notify the token receiver `to` about the `amount` tokens being received. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENSRECIPIENT` as typeId, if `to` is a contract that supports the LSP1 interface. +If `to` is is an EOA or a contract that does not support the LSP1 interface, the behaviour will depend on the `force` boolean flag. + +- if `force` is set to `true`, nothing will happen and no notification will be sent. + +- if `force` is set to `false, the transaction will revert. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | --------------------------------------------------------------------------------------------------- | +| `to` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `force` | `bool` | A boolean that describe if transfer to a `to` address that does not support LSP1 is allowed or not. | +| `lsp1Data` | `bytes` | The data to be sent to the `to` address in the `universalReceiver(...)` call. | + +
+ +### \_supportsInterfaceInERC165Extension + +```solidity +function _supportsInterfaceInERC165Extension( + bytes4 interfaceId +) internal view returns (bool); +``` + +Returns whether the interfaceId being checked is supported in the extension of the +[`supportsInterface`](#supportsinterface) selector. +To be used by extendable contracts wishing to extend the ERC165 interfaceIds originally +supported by reading whether the interfaceId queried is supported in the `supportsInterface` +extension if the extension is set, if not it returns false. + +
+ +### \_getExtensionAndForwardValue + +```solidity +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); +``` + +Returns the extension address stored under the following data key: + +- [`_LSP17_EXTENSION_PREFIX`](#_lsp17_extension_prefix) + `` (Check [LSP2-ERC725YJSONSchema] for encoding the data key). + +- If no extension is stored, returns the address(0). + +- we do not check that payable bool as in lsp7 standard we will always forward the value to the extension + +
+ +### \_fallbackLSP17Extendable + +:::info + +The LSP7 Token contract should not hold any native tokens. Any native tokens received by the contract +will be forwarded to the extension address mapped to the selector from `msg.sig`. + +::: + +```solidity +function _fallbackLSP17Extendable( + bytes callData +) internal nonpayable returns (bytes); +``` + +Forwards the call with the received value to an extension mapped to a function selector. +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being +called on the account. If there is no extension, the address(0) will be returned. +Forwards the value if the extension is payable. +Reverts if there is no extension for the function being called. +If there is an extension for the function selector being called, it calls the extension with the +CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and +32 bytes of the [`msg.value`](#msg.value) + +
+ +## Events + +### DataChanged + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#datachanged) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_The following data key/value pair has been changed in the ERC725Y storage: Data key: `dataKey`, data value: `dataValue`._ + +Emitted when data at a specific `dataKey` was changed to a new value `dataValue`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------- | +| `dataKey` **`indexed`** | `bytes32` | The data key for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### OperatorAuthorizationChanged + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#operatorauthorizationchanged) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Event signature: `OperatorAuthorizationChanged(address,address,uint256,bytes)` +- Event topic hash: `0xf772a43bfdf4729b196e3fb54a818b91a2ca6c49d10b2e16278752f9f515c25d` + +::: + +```solidity +event OperatorAuthorizationChanged( + address indexed operator, + address indexed tokenOwner, + uint256 indexed amount, + bytes operatorNotificationData +); +``` + +Emitted when `tokenOwner` enables `operator` for `amount` tokens. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address authorized as an operator | +| `tokenOwner` **`indexed`** | `address` | The token owner | +| `amount` **`indexed`** | `uint256` | The amount of tokens `operator` address has access to from `tokenOwner` | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### OperatorRevoked + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#operatorrevoked) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Event signature: `OperatorRevoked(address,address,bool,bytes)` +- Event topic hash: `0x0ebf5762d8855cbe012d2ca42fb33a81175e17c8a8751f8859931ba453bd4167` + +::: + +```solidity +event OperatorRevoked( + address indexed operator, + address indexed tokenOwner, + bool indexed notified, + bytes operatorNotificationData +); +``` + +Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [`authorizedAmountFor(...)`](#`authorizedamountfor) to `0`. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from operating | +| `tokenOwner` **`indexed`** | `address` | The token owner | +| `notified` **`indexed`** | `bool` | Bool indicating whether the operator has been notified or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### OwnershipTransferred + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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` | - | + +
+ +### Transfer + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#transfer) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Event signature: `Transfer(address,address,address,uint256,bool,bytes)` +- Event topic hash: `0x3997e418d2cef0b3b0e907b1e39605c3f7d32dbd061e82ea5b4a770d46a160a6` + +::: + +```solidity +event Transfer( + address indexed operator, + address indexed from, + address indexed to, + uint256 amount, + bool force, + bytes data +); +``` + +Emitted when the `from` transferred successfully `amount` of tokens to `to`. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ---------------------------------------------------------------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address of the operator that executed the transfer. | +| `from` **`indexed`** | `address` | The address which tokens were sent from (balance decreased by `-amount`). | +| `to` **`indexed`** | `address` | The address that received the tokens (balance increased by `+amount`). | +| `amount` | `uint256` | The amount of tokens transferred. | +| `force` | `bool` | if the transferred enforced the `to` recipient address to be a contract that implements the LSP1 standard or not. | +| `data` | `bytes` | Any additional data included by the caller during the transfer, and sent in the LSP1 hooks to the `from` and `to` addresses. | + +
+ +## Errors + +### ERC725Y_DataKeysValuesEmptyArray + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +Reverts when one of the array parameter provided to [`setDataBatch`](#setdatabatch) function is an empty array. + +
+ +### ERC725Y_DataKeysValuesLengthMismatch + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function. + +
+ +### ERC725Y_MsgValueDisallowed + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#erc725y_msgvaluedisallowed) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#setdatabatch) function. + +
+ +### InvalidExtensionAddress + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#invalidextensionaddress) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `InvalidExtensionAddress(bytes)` +- Error hash: `0x42bfe79f` + +::: + +```solidity +error InvalidExtensionAddress(bytes storedData); +``` + +reverts when the bytes retrieved from the LSP17 data key is not a valid address (not 20 bytes) + +#### Parameters + +| Name | Type | Description | +| ------------ | :-----: | ----------- | +| `storedData` | `bytes` | - | + +
+ +### InvalidFunctionSelector + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#invalidfunctionselector) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `InvalidFunctionSelector(bytes)` +- Error hash: `0xe5099ee3` + +::: + +```solidity +error InvalidFunctionSelector(bytes data); +``` + +reverts when the contract is called with a function selector not valid (less than 4 bytes of data) + +#### Parameters + +| Name | Type | Description | +| ------ | :-----: | ----------- | +| `data` | `bytes` | - | + +
+ +### LSP4TokenNameNotEditable + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokennamenoteditable) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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 / initialized. 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 / initialized. + +
+ +### LSP4TokenSymbolNotEditable + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokensymbolnoteditable) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.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 / initialized. 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 / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` 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 / initialized. + +
+ +### LSP7AmountExceedsAuthorizedAmount + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7amountexceedsauthorizedamount) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7AmountExceedsAuthorizedAmount(address,uint256,address,uint256)` +- Error hash: `0xf3a6b691` + +::: + +```solidity +error LSP7AmountExceedsAuthorizedAmount( + address tokenOwner, + uint256 authorizedAmount, + address operator, + uint256 amount +); +``` + +reverts when `operator` of `tokenOwner` send an `amount` of tokens larger than the `authorizedAmount`. + +#### Parameters + +| Name | Type | Description | +| ------------------ | :-------: | ----------- | +| `tokenOwner` | `address` | - | +| `authorizedAmount` | `uint256` | - | +| `operator` | `address` | - | +| `amount` | `uint256` | - | + +
+ +### LSP7AmountExceedsBalance + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7amountexceedsbalance) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7AmountExceedsBalance(uint256,address,uint256)` +- Error hash: `0x08d47949` + +::: + +```solidity +error LSP7AmountExceedsBalance( + uint256 balance, + address tokenOwner, + uint256 amount +); +``` + +reverts when sending an `amount` of tokens larger than the current `balance` of the `tokenOwner`. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `balance` | `uint256` | - | +| `tokenOwner` | `address` | - | +| `amount` | `uint256` | - | + +
+ +### LSP7BatchCallFailed + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7batchcallfailed) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7BatchCallFailed(uint256)` +- Error hash: `0xb774c284` + +::: + +```solidity +error LSP7BatchCallFailed(uint256 callIndex); +``` + +_Batch call failed._ + +Reverts when a batch call failed. + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ----------- | +| `callIndex` | `uint256` | - | + +
+ +### LSP7CannotSendWithAddressZero + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7cannotsendwithaddresszero) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7CannotSendWithAddressZero()` +- Error hash: `0xd2d5ec30` + +::: + +```solidity +error LSP7CannotSendWithAddressZero(); +``` + +reverts when trying to: + +- mint tokens to the zero address. + +- burn tokens from the zero address. + +- transfer tokens from or to the zero address. + +
+ +### LSP7CannotUseAddressZeroAsOperator + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7cannotuseaddresszeroasoperator) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7CannotUseAddressZeroAsOperator()` +- Error hash: `0x6355e766` + +::: + +```solidity +error LSP7CannotUseAddressZeroAsOperator(); +``` + +reverts when trying to set the zero address as an operator. + +
+ +### LSP7DecreaseAllowanceNotAuthorized + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7decreaseallowancenotauthorized) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7DecreaseAllowanceNotAuthorized(address,address,address)` +- Error hash: `0x98ce2945` + +::: + +```solidity +error LSP7DecreaseAllowanceNotAuthorized( + address caller, + address tokenOwner, + address operator +); +``` + +Reverts when the call to decrease allowance is not authorized. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `caller` | `address` | - | +| `tokenOwner` | `address` | - | +| `operator` | `address` | - | + +
+ +### LSP7DecreasedAllowanceBelowZero + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7decreasedallowancebelowzero) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7DecreasedAllowanceBelowZero()` +- Error hash: `0x0ef76c35` + +::: + +```solidity +error LSP7DecreasedAllowanceBelowZero(); +``` + +Reverts when trying to decrease an operator's allowance to more than its current allowance. + +
+ +### LSP7InvalidTransferBatch + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7invalidtransferbatch) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7InvalidTransferBatch()` +- Error hash: `0x263eee8d` + +::: + +```solidity +error LSP7InvalidTransferBatch(); +``` + +reverts when the array parameters used in [`transferBatch`](#transferbatch) have different lengths. + +
+ +### LSP7NotifyTokenReceiverContractMissingLSP1Interface + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7notifytokenreceivercontractmissinglsp1interface) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7NotifyTokenReceiverContractMissingLSP1Interface(address)` +- Error hash: `0xa608fbb6` + +::: + +```solidity +error LSP7NotifyTokenReceiverContractMissingLSP1Interface( + address tokenReceiver +); +``` + +reverts if the `tokenReceiver` does not implement LSP1 when minting or transferring tokens with `bool force` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP7NotifyTokenReceiverIsEOA + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7notifytokenreceiveriseoa) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7NotifyTokenReceiverIsEOA(address)` +- Error hash: `0x26c247f4` + +::: + +```solidity +error LSP7NotifyTokenReceiverIsEOA(address tokenReceiver); +``` + +reverts if the `tokenReceiver` is an EOA when minting or transferring tokens with `bool force` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP7RevokeOperatorNotAuthorized + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7revokeoperatornotauthorized) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7RevokeOperatorNotAuthorized(address,address,address)` +- Error hash: `0x1a525b32` + +::: + +```solidity +error LSP7RevokeOperatorNotAuthorized( + address caller, + address tokenOwner, + address operator +); +``` + +Reverts when the call to revoke operator is not authorized. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `caller` | `address` | - | +| `tokenOwner` | `address` | - | +| `operator` | `address` | - | + +
+ +### LSP7TokenContractCannotHoldValue + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7tokencontractcannotholdvalue) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7TokenContractCannotHoldValue()` +- Error hash: `0x388f5adc` + +::: + +```solidity +error LSP7TokenContractCannotHoldValue(); +``` + +_LSP7 contract cannot receive native tokens._ + +Error occurs when sending native tokens to the LSP7 contract without sending any data. E.g. Sending value without passing a bytes4 function selector to call a LSP17 Extension. + +
+ +### LSP7TokenOwnerCannotBeOperator + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#lsp7tokenownercannotbeoperator) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `LSP7TokenOwnerCannotBeOperator()` +- Error hash: `0xdab75047` + +::: + +```solidity +error LSP7TokenOwnerCannotBeOperator(); +``` + +reverts when trying to authorize or revoke the token's owner as an operator. + +
+ +### NoExtensionFoundForFunctionSelector + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#noextensionfoundforfunctionselector) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `NoExtensionFoundForFunctionSelector(bytes4)` +- Error hash: `0xbb370b2b` + +::: + +```solidity +error NoExtensionFoundForFunctionSelector(bytes4 functionSelector); +``` + +reverts when there is no extension for the function selector being called with + +#### Parameters + +| Name | Type | Description | +| ------------------ | :------: | ----------- | +| `functionSelector` | `bytes4` | - | + +
+ +### OperatorAllowanceCannotBeIncreasedFromZero + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#operatorallowancecannotbeincreasedfromzero) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `OperatorAllowanceCannotBeIncreasedFromZero(address)` +- Error hash: `0xcba6e977` + +::: + +```solidity +error OperatorAllowanceCannotBeIncreasedFromZero(address operator); +``` + +Reverts when token owner call [`increaseAllowance`](#increaseallowance) for an operator that does not have any allowance + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | + +
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-7-DigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp7-contracts/contracts/LSP7DigitalAsset.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md b/packages/lsp-smart-contracts/docs/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md new file mode 100644 index 000000000..aa24a6377 --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md @@ -0,0 +1,2204 @@ + + + +# LSP8IdentifiableDigitalAsset + +:::info Standard Specifications + +[`LSP-8-IdentifiableDigitalAsset`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md) + +::: +:::info Solidity implementation + +[`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) + +::: + +> Implementation of a LSP8 Identifiable Digital Asset, a contract that represents a non-fungible token. + +Standard implementation contract of the LSP8 standard. Minting and transferring are done by providing a unique `tokenId`. This implementation is agnostic to the way tokens are created. A supply mechanism has to be added in a derived contract using [`_mint`](#_mint) For a generic mechanism, see [`LSP7Mintable`](#lsp7mintable). + +## 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. + +### fallback + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#fallback) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) + +::: + +```solidity +fallback(bytes calldata callData) external payable returns (bytes memory); +``` + +_The `fallback` function was called with the following amount of native tokens: `msg.value`; and the following calldata: `callData`._ + +Achieves the goal of [LSP-17-ContractExtension] standard by extending the contract to handle calls of functions that do not exist natively, +forwarding the function call to the extension address mapped to the function being called. +This function is executed when: + +- Sending data of length less than 4 bytes to the contract. + +- The first 4 bytes of the calldata do not match any publicly callable functions from the contract ABI. + +- Receiving native tokens + +1. If the data is equal or longer than 4 bytes, the [ERC-725Y] storage is queried with the following data key: [_LSP17_EXTENSION_PREFIX] + `bytes4(msg.sig)` (Check [LSP-2-ERC725YJSONSchema] for encoding the data key) + +- If there is no address stored under the following data key, revert with [`NoExtensionFoundForFunctionSelector(bytes4)`](#noextensionfoundforfunctionselector). The data key relative to `bytes4(0)` is an exception, where no reverts occurs if there is no extension address stored under. This exception is made to allow users to send random data (graffiti) to the account and to be able to react on it. + +- If there is an address, forward the `msg.data` to the extension using the CALL opcode, appending 52 bytes (20 bytes of `msg.sender` and 32 bytes of `msg.value`). Return what the calls returns, or revert if the call failed. + +2. If the data sent to this function is of length less than 4 bytes (not a function selector), revert. + +
+ +### receive + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#receive) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) + +::: + +```solidity +receive() external payable; +``` + +_LSP8 contract cannot receive native tokens._ + +Reverts whenever someone tries to send native tokens to a LSP8 contract. + +
+ +### authorizeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizeoperator) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `authorizeOperator(address,bytes32,bytes)` +- Function selector: `0x86a10ddd` + +::: + +```solidity +function authorizeOperator( + address operator, + bytes32 tokenId, + bytes operatorNotificationData +) external nonpayable; +``` + +Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). Notify the operator based on the LSP1-UniversalReceiver standard + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------- | +| `operator` | `address` | The address to authorize as an operator. | +| `tokenId` | `bytes32` | The token ID operator has access to. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### balanceOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#balanceof) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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. | + +
+ +### batchCalls + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `batchCalls(bytes[])` +- Function selector: `0x6963d438` + +::: + +:::info + +It's not possible to send value along the functions call due to the use of `delegatecall`. + +::: + +```solidity +function batchCalls(bytes[] data) external nonpayable returns (bytes[] results); +``` + +_Executing the following batch of abi-encoded function calls on the contract: `data`._ + +Allows a caller to batch different function calls in one call. Perform a `delegatecall` on self, to call different functions with preserving the context. + +#### Parameters + +| Name | Type | Description | +| ------ | :-------: | -------------------------------------------------------------------- | +| `data` | `bytes[]` | An array of ABI encoded function calls to be called on the contract. | + +#### Returns + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------------------------------------- | +| `results` | `bytes[]` | An array of abi-encoded data returned by the functions executed. | + +
+ +### getData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdata) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_Reading the ERC725Y storage for data key `dataKey` returned the following value: `dataValue`._ + +Get in the ERC725Y storage the bytes data stored at a specific data key `dataKey`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------------------------------- | +| `dataKey` | `bytes32` | The data key for which to retrieve the value. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ---------------------------------------------------- | +| `dataValue` | `bytes` | The bytes value stored under the specified data key. | + +
+ +### getDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatch) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Reading the ERC725Y storage for data keys `dataKeys` returned the following values: `dataValues`._ + +Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys`. + +#### 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 | + +
+ +### getDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatchfortokenids) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `getDataBatchForTokenIds(bytes32[],bytes32[])` +- Function selector: `0x1d26fce6` + +::: + +```solidity +function getDataBatchForTokenIds( + bytes32[] tokenIds, + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Retrieves data in batch for multiple `tokenId` and `dataKey` pairs._ + +#### Parameters + +| Name | Type | Description | +| ---------- | :---------: | ----------------------------------------------------- | +| `tokenIds` | `bytes32[]` | An array of token IDs. | +| `dataKeys` | `bytes32[]` | An array of data keys corresponding to the token IDs. | + +#### Returns + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------------------------------- | +| `dataValues` | `bytes[]` | An array of data values for each pair of `tokenId` and `dataKey`. | + +
+ +### getDataForTokenId + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatafortokenid) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `getDataForTokenId(bytes32,bytes32)` +- Function selector: `0x16e023b3` + +::: + +```solidity +function getDataForTokenId( + bytes32 tokenId, + bytes32 dataKey +) external view returns (bytes dataValue); +``` + +_Retrieves data for a specific `tokenId` and `dataKey`._ + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------- | +| `tokenId` | `bytes32` | The unique identifier for a token. | +| `dataKey` | `bytes32` | The key for the data to retrieve. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ----------------------------------------------------------------- | +| `dataValue` | `bytes` | The data value associated with the given `tokenId` and `dataKey`. | + +
+ +### getOperatorsOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getoperatorsof) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#isoperatorfor) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#owner) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#renounceownership) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokeoperator) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `revokeOperator(address,bytes32,bool,bytes)` +- Function selector: `0xdb8c9663` + +::: + +```solidity +function revokeOperator( + address operator, + bytes32 tokenId, + bool notify, + bytes operatorNotificationData +) 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. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### setData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdata) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +:::caution Warning + +**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**. + +::: + +```solidity +function setData(bytes32 dataKey, bytes dataValue) external payable; +``` + +_Setting the following data key value pair in the ERC725Y storage. Data key: `dataKey`, data value: `dataValue`._ + +Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data key `dataKey`. The function is marked as payable to enable flexibility on child contracts. For instance to implement a fee mechanism for setting specific data. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner). + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `dataKey` | `bytes32` | The data key for which to set a new value. | +| `dataValue` | `bytes` | The new bytes value to set. | + +
+ +### setDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatch) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +:::caution Warning + +**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**. + +::: + +```solidity +function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable; +``` + +_Setting the following data key value pairs in the ERC725Y storage. Data keys: `dataKeys`, data values: `dataValues`._ + +Batch data setting function that behaves the same as [`setData`](#setdata) but allowing to set multiple data key/value pairs in the ERC725Y storage in the same transaction. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner) of the contract. + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event **for each data key/value pair set**. + +
+ +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ---------------------------------------------------- | +| `dataKeys` | `bytes32[]` | An array of data keys to set bytes values for. | +| `dataValues` | `bytes[]` | An array of bytes values to set for each `dataKeys`. | + +
+ +### setDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatchfortokenids) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `setDataBatchForTokenIds(bytes32[],bytes32[],bytes[])` +- Function selector: `0xbe9f0e6f` + +::: + +```solidity +function setDataBatchForTokenIds( + bytes32[] tokenIds, + bytes32[] dataKeys, + bytes[] dataValues +) external nonpayable; +``` + +_Sets data in batch for multiple `tokenId` and `dataKey` pairs._ + +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ----------------------------------------------------- | +| `tokenIds` | `bytes32[]` | An array of token IDs. | +| `dataKeys` | `bytes32[]` | An array of data keys corresponding to the token IDs. | +| `dataValues` | `bytes[]` | An array of values to set for the given data keys. | + +
+ +### setDataForTokenId + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatafortokenid) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `setDataForTokenId(bytes32,bytes32,bytes)` +- Function selector: `0xd6c1407c` + +::: + +```solidity +function setDataForTokenId( + bytes32 tokenId, + bytes32 dataKey, + bytes dataValue +) external nonpayable; +``` + +_Sets data for a specific `tokenId` and `dataKey`._ + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ---------------------------------------- | +| `tokenId` | `bytes32` | The unique identifier for a token. | +| `dataKey` | `bytes32` | The key for the data to set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#supportsinterface) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenidsof) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenownerof) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `tokenOwnerOf(bytes32)` +- Function selector: `0x217b2270` + +::: + +```solidity +function tokenOwnerOf(bytes32 tokenId) external view returns (address); +``` + +Returns the address that owns a given `tokenId`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ------------------------------------ | +| `tokenId` | `bytes32` | The token ID to query the owner for. | + +#### 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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#totalsupply) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `transfer(address,address,bytes32,bool,bytes)` +- Function selector: `0x511b6952` + +::: + +```solidity +function transfer( + address from, + address to, + bytes32 tokenId, + bool force, + 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 `force` 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. | +| `force` | `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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferbatch) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `transferBatch(address[],address[],bytes32[],bool[],bytes[])` +- Function selector: `0x7e87632c` + +::: + +```solidity +function transferBatch( + address[] from, + address[] to, + bytes32[] tokenId, + bool[] force, + 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. | +| `force` | `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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferownership) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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); +``` + +Read the value stored under a specific `dataKey` inside the underlying ERC725Y storage, +represented as a mapping of `bytes32` data keys mapped to their `bytes` data values. + +```solidity +mapping(bytes32 => bytes) _store +``` + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------------------------------------------------------------------- | +| `dataKey` | `bytes32` | A bytes32 data key to read the associated `bytes` value from the store. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ----------------------------------------------------------------------------- | +| `dataValue` | `bytes` | The `bytes` value associated with the given `dataKey` in the ERC725Y storage. | + +
+ +### \_setData + +```solidity +function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; +``` + +The ERC725Y data key `_LSP8_TOKENID_FORMAT_KEY` cannot be changed +once the identifiable digital asset contract has been deployed. + +
+ +### \_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, + bool notified, + bytes operatorNotificationData +) 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 + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances and ownership of `tokenId`s. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances and ownership of `tokenId`s, **but before notifying the recipient via LSP1**. + +::: + +```solidity +function _mint( + address to, + bytes32 tokenId, + bool force, + 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). | +| `force` | `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 + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances and ownership of `tokenId`s. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender via LSP1**. + +::: + +:::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. + +
+ +**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 + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances and ownership of `tokenId`s. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender/recipient via LSP1**. + +::: + +:::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 force, + 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. + +
+ +**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. | +| `force` | `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. | + +
+ +### \_setDataForTokenId + +```solidity +function _setDataForTokenId( + bytes32 tokenId, + bytes32 dataKey, + bytes dataValue +) internal nonpayable; +``` + +Sets data for a specific `tokenId` and `dataKey` in the ERC725Y storage +The ERC725Y data key is the hash of the `tokenId` and `dataKey` concatenated + +
+ +**Emitted events:** + +- [`TokenIdDataChanged`](#tokeniddatachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ---------------------------------------- | +| `tokenId` | `bytes32` | The unique identifier for a token. | +| `dataKey` | `bytes32` | The key for the data to set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### \_getDataForTokenId + +```solidity +function _getDataForTokenId( + bytes32 tokenId, + bytes32 dataKey +) internal view returns (bytes dataValues); +``` + +Retrieves data for a specific `tokenId` and `dataKey` from the ERC725Y storage +The ERC725Y data key is the hash of the `tokenId` and `dataKey` concatenated + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------- | +| `tokenId` | `bytes32` | The unique identifier for a token. | +| `dataKey` | `bytes32` | The key for the data to retrieve. | + +#### Returns + +| Name | Type | Description | +| ------------ | :-----: | ----------------------------------------------------------------- | +| `dataValues` | `bytes` | The data value associated with the given `tokenId` and `dataKey`. | + +
+ +### \_beforeTokenTransfer + +```solidity +function _beforeTokenTransfer( + address from, + address to, + bytes32 tokenId, + bytes data +) 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 | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + bytes32 tokenId, + bytes data +) internal nonpayable; +``` + +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient via LSP1** 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 | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_notifyTokenOperator + +```solidity +function _notifyTokenOperator( + address operator, + bytes lsp1Data +) internal nonpayable; +``` + +Attempt to notify the operator `operator` about the `tokenId` being authorized. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. +If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------------------------ | +| `operator` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | + +
+ +### \_notifyTokenSender + +```solidity +function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; +``` + +Attempt to notify the token sender `from` about the `tokenId` being transferred. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENSSENDER` as typeId, if `from` is a contract that supports the LSP1 interface. +If `from` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------------------------ | +| `from` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `lsp1Data` | `bytes` | the data to be sent to the `from` address in the `universalReceiver` call. | + +
+ +### \_notifyTokenReceiver + +```solidity +function _notifyTokenReceiver( + address to, + bool force, + bytes lsp1Data +) internal nonpayable; +``` + +Attempt to notify the token receiver `to` about the `tokenId` being received. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENSRECIPIENT` as typeId, if `to` is a contract that supports the LSP1 interface. +If `to` is is an EOA or a contract that does not support the LSP1 interface, the behaviour will depend on the `force` boolean flag. + +- if `force` is set to `true`, nothing will happen and no notification will be sent. + +- if `force` is set to `false, the transaction will revert. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | --------------------------------------------------------------------------------------------------- | +| `to` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `force` | `bool` | A boolean that describe if transfer to a `to` address that does not support LSP1 is allowed or not. | +| `lsp1Data` | `bytes` | The data to be sent to the `to` address in the `universalReceiver(...)` call. | + +
+ +### \_supportsInterfaceInERC165Extension + +```solidity +function _supportsInterfaceInERC165Extension( + bytes4 interfaceId +) internal view returns (bool); +``` + +Returns whether the interfaceId being checked is supported in the extension of the +[`supportsInterface`](#supportsinterface) selector. +To be used by extendable contracts wishing to extend the ERC165 interfaceIds originally +supported by reading whether the interfaceId queried is supported in the `supportsInterface` +extension if the extension is set, if not it returns false. + +
+ +### \_getExtensionAndForwardValue + +```solidity +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); +``` + +Returns the extension address stored under the following data key: + +- [`_LSP17_EXTENSION_PREFIX`](#_lsp17_extension_prefix) + `` (Check [LSP2-ERC725YJSONSchema] for encoding the data key). + +- If no extension is stored, returns the address(0). + +
+ +### \_fallbackLSP17Extendable + +:::info + +The LSP8 Token contract should not hold any native tokens. Any native tokens received by the contract +will be forwarded to the extension address mapped to the selector from `msg.sig`. + +::: + +```solidity +function _fallbackLSP17Extendable( + bytes callData +) internal nonpayable returns (bytes); +``` + +Forwards the call with the received value to an extension mapped to a function selector. +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being +called on the account. If there is no extension, the address(0) will be returned. +We will always forward the value to the extension, as the LSP8 contract is not supposed to hold any native tokens. +Reverts if there is no extension for the function being called. +If there is an extension for the function selector being called, it calls the extension with the +CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and +32 bytes of the [`msg.value`](#msg.value) + +
+ +## Events + +### DataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_The following data key/value pair has been changed in the ERC725Y storage: Data key: `dataKey`, data value: `dataValue`._ + +Emitted when data at a specific `dataKey` was changed to a new value `dataValue`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------- | +| `dataKey` **`indexed`** | `bytes32` | The data key for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### OperatorAuthorizationChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorauthorizationchanged) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Event signature: `OperatorAuthorizationChanged(address,address,bytes32,bytes)` +- Event topic hash: `0x1b1b58aa2ec0cec2228b2d37124556d41f5a1f7b12f089171f896cc236671215` + +::: + +```solidity +event OperatorAuthorizationChanged( + address indexed operator, + address indexed tokenOwner, + bytes32 indexed tokenId, + bytes operatorNotificationData +); +``` + +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`. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### OperatorRevoked + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorrevoked) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Event signature: `OperatorRevoked(address,address,bytes32,bool,bytes)` +- Event topic hash: `0xc78cd419d6136f9f1c1c6aec1d3fae098cffaf8bc86314a8f2685e32fe574e3c` + +::: + +```solidity +event OperatorRevoked( + address indexed operator, + address indexed tokenOwner, + bytes32 indexed tokenId, + bool notified, + bytes operatorNotificationData +); +``` + +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`](#getoperatorsof)). | +| `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | +| `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` is revoked from operating on. | +| `notified` | `bool` | Bool indicating whether the operator has been notified or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### OwnershipTransferred + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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` | - | + +
+ +### TokenIdDataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokeniddatachanged) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Event signature: `TokenIdDataChanged(bytes32,bytes32,bytes)` +- Event topic hash: `0xa6e4251f855f750545fe414f120db91c76b88def14d120969e5bb2d3f05debbb` + +::: + +```solidity +event TokenIdDataChanged( + bytes32 indexed tokenId, + bytes32 indexed dataKey, + bytes dataValue +); +``` + +Emitted when setting data for `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------- | +| `tokenId` **`indexed`** | `bytes32` | The tokenId which data is set for. | +| `dataKey` **`indexed`** | `bytes32` | The data key for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### Transfer + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 force, + 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 | +| `force` | `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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +Reverts when one of the array parameter provided to [`setDataBatch`](#setdatabatch) function is an empty array. + +
+ +### ERC725Y_DataKeysValuesLengthMismatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function. + +
+ +### ERC725Y_MsgValueDisallowed + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_msgvaluedisallowed) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#setdatabatch) function. + +
+ +### InvalidExtensionAddress + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#invalidextensionaddress) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `InvalidExtensionAddress(bytes)` +- Error hash: `0x42bfe79f` + +::: + +```solidity +error InvalidExtensionAddress(bytes storedData); +``` + +reverts when the bytes retrieved from the LSP17 data key is not a valid address (not 20 bytes) + +#### Parameters + +| Name | Type | Description | +| ------------ | :-----: | ----------- | +| `storedData` | `bytes` | - | + +
+ +### InvalidFunctionSelector + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#invalidfunctionselector) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `InvalidFunctionSelector(bytes)` +- Error hash: `0xe5099ee3` + +::: + +```solidity +error InvalidFunctionSelector(bytes data); +``` + +reverts when the contract is called with a function selector not valid (less than 4 bytes of data) + +#### Parameters + +| Name | Type | Description | +| ------ | :-----: | ----------- | +| `data` | `bytes` | - | + +
+ +### LSP4TokenNameNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokennamenoteditable) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 / initialized. 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 / initialized. + +
+ +### LSP4TokenSymbolNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokensymbolnoteditable) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 / initialized. 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 / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` 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 / initialized. + +
+ +### LSP8BatchCallFailed + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8batchcallfailed) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8BatchCallFailed(uint256)` +- Error hash: `0x234eb819` + +::: + +```solidity +error LSP8BatchCallFailed(uint256 callIndex); +``` + +_Batch call failed._ + +Reverts when a batch call failed. + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ----------- | +| `callIndex` | `uint256` | - | + +
+ +### LSP8CannotSendToAddressZero + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotsendtoaddresszero) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8CannotSendToAddressZero()` +- Error hash: `0x24ecef4d` + +::: + +```solidity +error LSP8CannotSendToAddressZero(); +``` + +Reverts when trying to send token to the zero address. + +
+ +### LSP8CannotUseAddressZeroAsOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotuseaddresszeroasoperator) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8invalidtransferbatch) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistenttokenid) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistingoperator) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenoperator) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenowner) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceivercontractmissinglsp1interface) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 force` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8NotifyTokenReceiverIsEOA + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceiveriseoa) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 force` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8OperatorAlreadyAuthorized + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8operatoralreadyauthorized) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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` | - | + +
+ +### LSP8RevokeOperatorNotAuthorized + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8revokeoperatornotauthorized) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8RevokeOperatorNotAuthorized(address,address,bytes32)` +- Error hash: `0x760b5acd` + +::: + +```solidity +error LSP8RevokeOperatorNotAuthorized( + address caller, + address tokenOwner, + bytes32 tokenId +); +``` + +Reverts when the call to revoke operator is not authorized. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `caller` | `address` | - | +| `tokenOwner` | `address` | - | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8TokenContractCannotHoldValue + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokencontractcannotholdvalue) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenContractCannotHoldValue()` +- Error hash: `0x61f49442` + +::: + +```solidity +error LSP8TokenContractCannotHoldValue(); +``` + +_LSP8 contract cannot receive native tokens._ + +Error occurs when sending native tokens to the LSP8 contract without sending any data. E.g. Sending value without passing a bytes4 function selector to call a LSP17 Extension. + +
+ +### LSP8TokenIdFormatNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidformatnoteditable) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenIdFormatNotEditable()` +- Error hash: `0x3664800a` + +::: + +```solidity +error LSP8TokenIdFormatNotEditable(); +``` + +Reverts when trying to edit the data key `LSP8TokenIdFormat` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdFormat` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed. + +
+ +### LSP8TokenIdsDataEmptyArray + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdataemptyarray) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenIdsDataEmptyArray()` +- Error hash: `0x80c98305` + +::: + +```solidity +error LSP8TokenIdsDataEmptyArray(); +``` + +Reverts when empty arrays is passed to the function + +
+ +### LSP8TokenIdsDataLengthMismatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdatalengthmismatch) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenIdsDataLengthMismatch()` +- Error hash: `0x2fa71dfe` + +::: + +```solidity +error LSP8TokenIdsDataLengthMismatch(); +``` + +Reverts when the length of the token IDs data arrays is not equal + +
+ +### LSP8TokenOwnerCannotBeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenownercannotbeoperator) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenOwnerCannotBeOperator()` +- Error hash: `0x89fdad62` + +::: + +```solidity +error LSP8TokenOwnerCannotBeOperator(); +``` + +Reverts when trying to authorize or revoke the token's owner as an operator. + +
+ +### LSP8TokenOwnerChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenownerchanged) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenOwnerChanged(bytes32,address,address)` +- Error hash: `0x5a9c31d3` + +::: + +```solidity +error LSP8TokenOwnerChanged( + bytes32 tokenId, + address oldOwner, + address newOwner +); +``` + +Reverts when the token owner changed inside the [`_beforeTokenTransfer`](#_beforetokentransfer) hook. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `tokenId` | `bytes32` | - | +| `oldOwner` | `address` | - | +| `newOwner` | `address` | - | + +
+ +### NoExtensionFoundForFunctionSelector + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#noextensionfoundforfunctionselector) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `NoExtensionFoundForFunctionSelector(bytes4)` +- Error hash: `0xbb370b2b` + +::: + +```solidity +error NoExtensionFoundForFunctionSelector(bytes4 functionSelector); +``` + +reverts when there is no extension for the function selector being called with + +#### Parameters + +| Name | Type | Description | +| ------------------ | :------: | ----------- | +| `functionSelector` | `bytes4` | - | + +
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md b/packages/lsp-smart-contracts/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md new file mode 100644 index 000000000..3d623117a --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md @@ -0,0 +1,2230 @@ + + + +# LSP8Burnable + +:::info Standard Specifications + +[`LSP-8-IdentifiableDigitalAsset`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md) + +::: +:::info Solidity implementation + +[`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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. + +### fallback + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#fallback) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) + +::: + +```solidity +fallback(bytes calldata callData) external payable returns (bytes memory); +``` + +_The `fallback` function was called with the following amount of native tokens: `msg.value`; and the following calldata: `callData`._ + +Achieves the goal of [LSP-17-ContractExtension] standard by extending the contract to handle calls of functions that do not exist natively, +forwarding the function call to the extension address mapped to the function being called. +This function is executed when: + +- Sending data of length less than 4 bytes to the contract. + +- The first 4 bytes of the calldata do not match any publicly callable functions from the contract ABI. + +- Receiving native tokens + +1. If the data is equal or longer than 4 bytes, the [ERC-725Y] storage is queried with the following data key: [_LSP17_EXTENSION_PREFIX] + `bytes4(msg.sig)` (Check [LSP-2-ERC725YJSONSchema] for encoding the data key) + +- If there is no address stored under the following data key, revert with [`NoExtensionFoundForFunctionSelector(bytes4)`](#noextensionfoundforfunctionselector). The data key relative to `bytes4(0)` is an exception, where no reverts occurs if there is no extension address stored under. This exception is made to allow users to send random data (graffiti) to the account and to be able to react on it. + +- If there is an address, forward the `msg.data` to the extension using the CALL opcode, appending 52 bytes (20 bytes of `msg.sender` and 32 bytes of `msg.value`). Return what the calls returns, or revert if the call failed. + +2. If the data sent to this function is of length less than 4 bytes (not a function selector), revert. + +
+ +### receive + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#receive) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) + +::: + +```solidity +receive() external payable; +``` + +_LSP8 contract cannot receive native tokens._ + +Reverts whenever someone tries to send native tokens to a LSP8 contract. + +
+ +### authorizeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizeoperator) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `authorizeOperator(address,bytes32,bytes)` +- Function selector: `0x86a10ddd` + +::: + +```solidity +function authorizeOperator( + address operator, + bytes32 tokenId, + bytes operatorNotificationData +) external nonpayable; +``` + +Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). Notify the operator based on the LSP1-UniversalReceiver standard + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------- | +| `operator` | `address` | The address to authorize as an operator. | +| `tokenId` | `bytes32` | The token ID operator has access to. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### balanceOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#balanceof) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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. | + +
+ +### batchCalls + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `batchCalls(bytes[])` +- Function selector: `0x6963d438` + +::: + +:::info + +It's not possible to send value along the functions call due to the use of `delegatecall`. + +::: + +```solidity +function batchCalls(bytes[] data) external nonpayable returns (bytes[] results); +``` + +_Executing the following batch of abi-encoded function calls on the contract: `data`._ + +Allows a caller to batch different function calls in one call. Perform a `delegatecall` on self, to call different functions with preserving the context. + +#### Parameters + +| Name | Type | Description | +| ------ | :-------: | -------------------------------------------------------------------- | +| `data` | `bytes[]` | An array of ABI encoded function calls to be called on the contract. | + +#### Returns + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------------------------------------- | +| `results` | `bytes[]` | An array of abi-encoded data returned by the functions executed. | + +
+ +### burn + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#burn) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdata) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_Reading the ERC725Y storage for data key `dataKey` returned the following value: `dataValue`._ + +Get in the ERC725Y storage the bytes data stored at a specific data key `dataKey`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------------------------------- | +| `dataKey` | `bytes32` | The data key for which to retrieve the value. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ---------------------------------------------------- | +| `dataValue` | `bytes` | The bytes value stored under the specified data key. | + +
+ +### getDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatch) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Reading the ERC725Y storage for data keys `dataKeys` returned the following values: `dataValues`._ + +Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys`. + +#### 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 | + +
+ +### getDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatchfortokenids) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `getDataBatchForTokenIds(bytes32[],bytes32[])` +- Function selector: `0x1d26fce6` + +::: + +```solidity +function getDataBatchForTokenIds( + bytes32[] tokenIds, + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Retrieves data in batch for multiple `tokenId` and `dataKey` pairs._ + +#### Parameters + +| Name | Type | Description | +| ---------- | :---------: | ----------------------------------------------------- | +| `tokenIds` | `bytes32[]` | An array of token IDs. | +| `dataKeys` | `bytes32[]` | An array of data keys corresponding to the token IDs. | + +#### Returns + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------------------------------- | +| `dataValues` | `bytes[]` | An array of data values for each pair of `tokenId` and `dataKey`. | + +
+ +### getDataForTokenId + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatafortokenid) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `getDataForTokenId(bytes32,bytes32)` +- Function selector: `0x16e023b3` + +::: + +```solidity +function getDataForTokenId( + bytes32 tokenId, + bytes32 dataKey +) external view returns (bytes dataValue); +``` + +_Retrieves data for a specific `tokenId` and `dataKey`._ + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------- | +| `tokenId` | `bytes32` | The unique identifier for a token. | +| `dataKey` | `bytes32` | The key for the data to retrieve. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ----------------------------------------------------------------- | +| `dataValue` | `bytes` | The data value associated with the given `tokenId` and `dataKey`. | + +
+ +### getOperatorsOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getoperatorsof) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#isoperatorfor) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#owner) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#renounceownership) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokeoperator) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `revokeOperator(address,bytes32,bool,bytes)` +- Function selector: `0xdb8c9663` + +::: + +```solidity +function revokeOperator( + address operator, + bytes32 tokenId, + bool notify, + bytes operatorNotificationData +) 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. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### setData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdata) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +:::caution Warning + +**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**. + +::: + +```solidity +function setData(bytes32 dataKey, bytes dataValue) external payable; +``` + +_Setting the following data key value pair in the ERC725Y storage. Data key: `dataKey`, data value: `dataValue`._ + +Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data key `dataKey`. The function is marked as payable to enable flexibility on child contracts. For instance to implement a fee mechanism for setting specific data. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner). + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `dataKey` | `bytes32` | The data key for which to set a new value. | +| `dataValue` | `bytes` | The new bytes value to set. | + +
+ +### setDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatch) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +:::caution Warning + +**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**. + +::: + +```solidity +function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable; +``` + +_Setting the following data key value pairs in the ERC725Y storage. Data keys: `dataKeys`, data values: `dataValues`._ + +Batch data setting function that behaves the same as [`setData`](#setdata) but allowing to set multiple data key/value pairs in the ERC725Y storage in the same transaction. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner) of the contract. + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event **for each data key/value pair set**. + +
+ +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ---------------------------------------------------- | +| `dataKeys` | `bytes32[]` | An array of data keys to set bytes values for. | +| `dataValues` | `bytes[]` | An array of bytes values to set for each `dataKeys`. | + +
+ +### setDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatchfortokenids) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `setDataBatchForTokenIds(bytes32[],bytes32[],bytes[])` +- Function selector: `0xbe9f0e6f` + +::: + +```solidity +function setDataBatchForTokenIds( + bytes32[] tokenIds, + bytes32[] dataKeys, + bytes[] dataValues +) external nonpayable; +``` + +_Sets data in batch for multiple `tokenId` and `dataKey` pairs._ + +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ----------------------------------------------------- | +| `tokenIds` | `bytes32[]` | An array of token IDs. | +| `dataKeys` | `bytes32[]` | An array of data keys corresponding to the token IDs. | +| `dataValues` | `bytes[]` | An array of values to set for the given data keys. | + +
+ +### setDataForTokenId + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatafortokenid) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `setDataForTokenId(bytes32,bytes32,bytes)` +- Function selector: `0xd6c1407c` + +::: + +```solidity +function setDataForTokenId( + bytes32 tokenId, + bytes32 dataKey, + bytes dataValue +) external nonpayable; +``` + +_Sets data for a specific `tokenId` and `dataKey`._ + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ---------------------------------------- | +| `tokenId` | `bytes32` | The unique identifier for a token. | +| `dataKey` | `bytes32` | The key for the data to set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#supportsinterface) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenidsof) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenownerof) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `tokenOwnerOf(bytes32)` +- Function selector: `0x217b2270` + +::: + +```solidity +function tokenOwnerOf(bytes32 tokenId) external view returns (address); +``` + +Returns the address that owns a given `tokenId`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ------------------------------------ | +| `tokenId` | `bytes32` | The token ID to query the owner for. | + +#### 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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#totalsupply) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `transfer(address,address,bytes32,bool,bytes)` +- Function selector: `0x511b6952` + +::: + +```solidity +function transfer( + address from, + address to, + bytes32 tokenId, + bool force, + 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 `force` 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. | +| `force` | `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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferbatch) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `transferBatch(address[],address[],bytes32[],bool[],bytes[])` +- Function selector: `0x7e87632c` + +::: + +```solidity +function transferBatch( + address[] from, + address[] to, + bytes32[] tokenId, + bool[] force, + 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. | +| `force` | `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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferownership) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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); +``` + +Read the value stored under a specific `dataKey` inside the underlying ERC725Y storage, +represented as a mapping of `bytes32` data keys mapped to their `bytes` data values. + +```solidity +mapping(bytes32 => bytes) _store +``` + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------------------------------------------------------------------- | +| `dataKey` | `bytes32` | A bytes32 data key to read the associated `bytes` value from the store. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ----------------------------------------------------------------------------- | +| `dataValue` | `bytes` | The `bytes` value associated with the given `dataKey` in the ERC725Y storage. | + +
+ +### \_setData + +```solidity +function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; +``` + +The ERC725Y data key `_LSP8_TOKENID_FORMAT_KEY` cannot be changed +once the identifiable digital asset contract has been deployed. + +
+ +### \_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, + bool notified, + bytes operatorNotificationData +) 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 + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances and ownership of `tokenId`s. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances and ownership of `tokenId`s, **but before notifying the recipient via LSP1**. + +::: + +```solidity +function _mint( + address to, + bytes32 tokenId, + bool force, + 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). | +| `force` | `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 + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances and ownership of `tokenId`s. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender via LSP1**. + +::: + +:::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. + +
+ +**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 + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances and ownership of `tokenId`s. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender/recipient via LSP1**. + +::: + +:::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 force, + 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. + +
+ +**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. | +| `force` | `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. | + +
+ +### \_setDataForTokenId + +```solidity +function _setDataForTokenId( + bytes32 tokenId, + bytes32 dataKey, + bytes dataValue +) internal nonpayable; +``` + +Sets data for a specific `tokenId` and `dataKey` in the ERC725Y storage +The ERC725Y data key is the hash of the `tokenId` and `dataKey` concatenated + +
+ +**Emitted events:** + +- [`TokenIdDataChanged`](#tokeniddatachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ---------------------------------------- | +| `tokenId` | `bytes32` | The unique identifier for a token. | +| `dataKey` | `bytes32` | The key for the data to set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### \_getDataForTokenId + +```solidity +function _getDataForTokenId( + bytes32 tokenId, + bytes32 dataKey +) internal view returns (bytes dataValues); +``` + +Retrieves data for a specific `tokenId` and `dataKey` from the ERC725Y storage +The ERC725Y data key is the hash of the `tokenId` and `dataKey` concatenated + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------- | +| `tokenId` | `bytes32` | The unique identifier for a token. | +| `dataKey` | `bytes32` | The key for the data to retrieve. | + +#### Returns + +| Name | Type | Description | +| ------------ | :-----: | ----------------------------------------------------------------- | +| `dataValues` | `bytes` | The data value associated with the given `tokenId` and `dataKey`. | + +
+ +### \_beforeTokenTransfer + +```solidity +function _beforeTokenTransfer( + address from, + address to, + bytes32 tokenId, + bytes data +) 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 | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + bytes32 tokenId, + bytes data +) internal nonpayable; +``` + +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient via LSP1** 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 | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_notifyTokenOperator + +```solidity +function _notifyTokenOperator( + address operator, + bytes lsp1Data +) internal nonpayable; +``` + +Attempt to notify the operator `operator` about the `tokenId` being authorized. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. +If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------------------------ | +| `operator` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | + +
+ +### \_notifyTokenSender + +```solidity +function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; +``` + +Attempt to notify the token sender `from` about the `tokenId` being transferred. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENSSENDER` as typeId, if `from` is a contract that supports the LSP1 interface. +If `from` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------------------------ | +| `from` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `lsp1Data` | `bytes` | the data to be sent to the `from` address in the `universalReceiver` call. | + +
+ +### \_notifyTokenReceiver + +```solidity +function _notifyTokenReceiver( + address to, + bool force, + bytes lsp1Data +) internal nonpayable; +``` + +Attempt to notify the token receiver `to` about the `tokenId` being received. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENSRECIPIENT` as typeId, if `to` is a contract that supports the LSP1 interface. +If `to` is is an EOA or a contract that does not support the LSP1 interface, the behaviour will depend on the `force` boolean flag. + +- if `force` is set to `true`, nothing will happen and no notification will be sent. + +- if `force` is set to `false, the transaction will revert. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | --------------------------------------------------------------------------------------------------- | +| `to` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `force` | `bool` | A boolean that describe if transfer to a `to` address that does not support LSP1 is allowed or not. | +| `lsp1Data` | `bytes` | The data to be sent to the `to` address in the `universalReceiver(...)` call. | + +
+ +### \_supportsInterfaceInERC165Extension + +```solidity +function _supportsInterfaceInERC165Extension( + bytes4 interfaceId +) internal view returns (bool); +``` + +Returns whether the interfaceId being checked is supported in the extension of the +[`supportsInterface`](#supportsinterface) selector. +To be used by extendable contracts wishing to extend the ERC165 interfaceIds originally +supported by reading whether the interfaceId queried is supported in the `supportsInterface` +extension if the extension is set, if not it returns false. + +
+ +### \_getExtensionAndForwardValue + +```solidity +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); +``` + +Returns the extension address stored under the following data key: + +- [`_LSP17_EXTENSION_PREFIX`](#_lsp17_extension_prefix) + `` (Check [LSP2-ERC725YJSONSchema] for encoding the data key). + +- If no extension is stored, returns the address(0). + +
+ +### \_fallbackLSP17Extendable + +:::info + +The LSP8 Token contract should not hold any native tokens. Any native tokens received by the contract +will be forwarded to the extension address mapped to the selector from `msg.sig`. + +::: + +```solidity +function _fallbackLSP17Extendable( + bytes callData +) internal nonpayable returns (bytes); +``` + +Forwards the call with the received value to an extension mapped to a function selector. +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being +called on the account. If there is no extension, the address(0) will be returned. +We will always forward the value to the extension, as the LSP8 contract is not supposed to hold any native tokens. +Reverts if there is no extension for the function being called. +If there is an extension for the function selector being called, it calls the extension with the +CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and +32 bytes of the [`msg.value`](#msg.value) + +
+ +## Events + +### DataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_The following data key/value pair has been changed in the ERC725Y storage: Data key: `dataKey`, data value: `dataValue`._ + +Emitted when data at a specific `dataKey` was changed to a new value `dataValue`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------- | +| `dataKey` **`indexed`** | `bytes32` | The data key for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### OperatorAuthorizationChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorauthorizationchanged) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Event signature: `OperatorAuthorizationChanged(address,address,bytes32,bytes)` +- Event topic hash: `0x1b1b58aa2ec0cec2228b2d37124556d41f5a1f7b12f089171f896cc236671215` + +::: + +```solidity +event OperatorAuthorizationChanged( + address indexed operator, + address indexed tokenOwner, + bytes32 indexed tokenId, + bytes operatorNotificationData +); +``` + +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`. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### OperatorRevoked + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorrevoked) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Event signature: `OperatorRevoked(address,address,bytes32,bool,bytes)` +- Event topic hash: `0xc78cd419d6136f9f1c1c6aec1d3fae098cffaf8bc86314a8f2685e32fe574e3c` + +::: + +```solidity +event OperatorRevoked( + address indexed operator, + address indexed tokenOwner, + bytes32 indexed tokenId, + bool notified, + bytes operatorNotificationData +); +``` + +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`](#getoperatorsof)). | +| `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | +| `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` is revoked from operating on. | +| `notified` | `bool` | Bool indicating whether the operator has been notified or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### OwnershipTransferred + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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` | - | + +
+ +### TokenIdDataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokeniddatachanged) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Event signature: `TokenIdDataChanged(bytes32,bytes32,bytes)` +- Event topic hash: `0xa6e4251f855f750545fe414f120db91c76b88def14d120969e5bb2d3f05debbb` + +::: + +```solidity +event TokenIdDataChanged( + bytes32 indexed tokenId, + bytes32 indexed dataKey, + bytes dataValue +); +``` + +Emitted when setting data for `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------- | +| `tokenId` **`indexed`** | `bytes32` | The tokenId which data is set for. | +| `dataKey` **`indexed`** | `bytes32` | The data key for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### Transfer + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 force, + 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 | +| `force` | `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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +Reverts when one of the array parameter provided to [`setDataBatch`](#setdatabatch) function is an empty array. + +
+ +### ERC725Y_DataKeysValuesLengthMismatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function. + +
+ +### ERC725Y_MsgValueDisallowed + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_msgvaluedisallowed) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#setdatabatch) function. + +
+ +### InvalidExtensionAddress + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#invalidextensionaddress) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `InvalidExtensionAddress(bytes)` +- Error hash: `0x42bfe79f` + +::: + +```solidity +error InvalidExtensionAddress(bytes storedData); +``` + +reverts when the bytes retrieved from the LSP17 data key is not a valid address (not 20 bytes) + +#### Parameters + +| Name | Type | Description | +| ------------ | :-----: | ----------- | +| `storedData` | `bytes` | - | + +
+ +### InvalidFunctionSelector + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#invalidfunctionselector) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `InvalidFunctionSelector(bytes)` +- Error hash: `0xe5099ee3` + +::: + +```solidity +error InvalidFunctionSelector(bytes data); +``` + +reverts when the contract is called with a function selector not valid (less than 4 bytes of data) + +#### Parameters + +| Name | Type | Description | +| ------ | :-----: | ----------- | +| `data` | `bytes` | - | + +
+ +### LSP4TokenNameNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokennamenoteditable) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 / initialized. 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 / initialized. + +
+ +### LSP4TokenSymbolNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokensymbolnoteditable) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 / initialized. 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 / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` 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 / initialized. + +
+ +### LSP8BatchCallFailed + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8batchcallfailed) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8BatchCallFailed(uint256)` +- Error hash: `0x234eb819` + +::: + +```solidity +error LSP8BatchCallFailed(uint256 callIndex); +``` + +_Batch call failed._ + +Reverts when a batch call failed. + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ----------- | +| `callIndex` | `uint256` | - | + +
+ +### LSP8CannotSendToAddressZero + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotsendtoaddresszero) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8CannotSendToAddressZero()` +- Error hash: `0x24ecef4d` + +::: + +```solidity +error LSP8CannotSendToAddressZero(); +``` + +Reverts when trying to send token to the zero address. + +
+ +### LSP8CannotUseAddressZeroAsOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotuseaddresszeroasoperator) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8invalidtransferbatch) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistenttokenid) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistingoperator) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenoperator) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenowner) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceivercontractmissinglsp1interface) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 force` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8NotifyTokenReceiverIsEOA + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceiveriseoa) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 force` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8OperatorAlreadyAuthorized + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8operatoralreadyauthorized) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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` | - | + +
+ +### LSP8RevokeOperatorNotAuthorized + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8revokeoperatornotauthorized) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8RevokeOperatorNotAuthorized(address,address,bytes32)` +- Error hash: `0x760b5acd` + +::: + +```solidity +error LSP8RevokeOperatorNotAuthorized( + address caller, + address tokenOwner, + bytes32 tokenId +); +``` + +Reverts when the call to revoke operator is not authorized. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `caller` | `address` | - | +| `tokenOwner` | `address` | - | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8TokenContractCannotHoldValue + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokencontractcannotholdvalue) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenContractCannotHoldValue()` +- Error hash: `0x61f49442` + +::: + +```solidity +error LSP8TokenContractCannotHoldValue(); +``` + +_LSP8 contract cannot receive native tokens._ + +Error occurs when sending native tokens to the LSP8 contract without sending any data. E.g. Sending value without passing a bytes4 function selector to call a LSP17 Extension. + +
+ +### LSP8TokenIdFormatNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidformatnoteditable) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenIdFormatNotEditable()` +- Error hash: `0x3664800a` + +::: + +```solidity +error LSP8TokenIdFormatNotEditable(); +``` + +Reverts when trying to edit the data key `LSP8TokenIdFormat` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdFormat` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed. + +
+ +### LSP8TokenIdsDataEmptyArray + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdataemptyarray) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenIdsDataEmptyArray()` +- Error hash: `0x80c98305` + +::: + +```solidity +error LSP8TokenIdsDataEmptyArray(); +``` + +Reverts when empty arrays is passed to the function + +
+ +### LSP8TokenIdsDataLengthMismatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdatalengthmismatch) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenIdsDataLengthMismatch()` +- Error hash: `0x2fa71dfe` + +::: + +```solidity +error LSP8TokenIdsDataLengthMismatch(); +``` + +Reverts when the length of the token IDs data arrays is not equal + +
+ +### LSP8TokenOwnerCannotBeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenownercannotbeoperator) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenOwnerCannotBeOperator()` +- Error hash: `0x89fdad62` + +::: + +```solidity +error LSP8TokenOwnerCannotBeOperator(); +``` + +Reverts when trying to authorize or revoke the token's owner as an operator. + +
+ +### LSP8TokenOwnerChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenownerchanged) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenOwnerChanged(bytes32,address,address)` +- Error hash: `0x5a9c31d3` + +::: + +```solidity +error LSP8TokenOwnerChanged( + bytes32 tokenId, + address oldOwner, + address newOwner +); +``` + +Reverts when the token owner changed inside the [`_beforeTokenTransfer`](#_beforetokentransfer) hook. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `tokenId` | `bytes32` | - | +| `oldOwner` | `address` | - | +| `newOwner` | `address` | - | + +
+ +### NoExtensionFoundForFunctionSelector + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#noextensionfoundforfunctionselector) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `NoExtensionFoundForFunctionSelector(bytes4)` +- Error hash: `0xbb370b2b` + +::: + +```solidity +error NoExtensionFoundForFunctionSelector(bytes4 functionSelector); +``` + +reverts when there is no extension for the function selector being called with + +#### Parameters + +| Name | Type | Description | +| ------------------ | :------: | ----------- | +| `functionSelector` | `bytes4` | - | + +
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md b/packages/lsp-smart-contracts/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md new file mode 100644 index 000000000..9841715d8 --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md @@ -0,0 +1,2246 @@ + + + +# LSP8CappedSupply + +:::info Standard Specifications + +[`LSP-8-IdentifiableDigitalAsset`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md) + +::: +:::info Solidity implementation + +[`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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. + +### fallback + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#fallback) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) + +::: + +```solidity +fallback(bytes calldata callData) external payable returns (bytes memory); +``` + +_The `fallback` function was called with the following amount of native tokens: `msg.value`; and the following calldata: `callData`._ + +Achieves the goal of [LSP-17-ContractExtension] standard by extending the contract to handle calls of functions that do not exist natively, +forwarding the function call to the extension address mapped to the function being called. +This function is executed when: + +- Sending data of length less than 4 bytes to the contract. + +- The first 4 bytes of the calldata do not match any publicly callable functions from the contract ABI. + +- Receiving native tokens + +1. If the data is equal or longer than 4 bytes, the [ERC-725Y] storage is queried with the following data key: [_LSP17_EXTENSION_PREFIX] + `bytes4(msg.sig)` (Check [LSP-2-ERC725YJSONSchema] for encoding the data key) + +- If there is no address stored under the following data key, revert with [`NoExtensionFoundForFunctionSelector(bytes4)`](#noextensionfoundforfunctionselector). The data key relative to `bytes4(0)` is an exception, where no reverts occurs if there is no extension address stored under. This exception is made to allow users to send random data (graffiti) to the account and to be able to react on it. + +- If there is an address, forward the `msg.data` to the extension using the CALL opcode, appending 52 bytes (20 bytes of `msg.sender` and 32 bytes of `msg.value`). Return what the calls returns, or revert if the call failed. + +2. If the data sent to this function is of length less than 4 bytes (not a function selector), revert. + +
+ +### receive + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#receive) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) + +::: + +```solidity +receive() external payable; +``` + +_LSP8 contract cannot receive native tokens._ + +Reverts whenever someone tries to send native tokens to a LSP8 contract. + +
+ +### authorizeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizeoperator) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `authorizeOperator(address,bytes32,bytes)` +- Function selector: `0x86a10ddd` + +::: + +```solidity +function authorizeOperator( + address operator, + bytes32 tokenId, + bytes operatorNotificationData +) external nonpayable; +``` + +Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). Notify the operator based on the LSP1-UniversalReceiver standard + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------- | +| `operator` | `address` | The address to authorize as an operator. | +| `tokenId` | `bytes32` | The token ID operator has access to. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### balanceOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#balanceof) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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. | + +
+ +### batchCalls + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `batchCalls(bytes[])` +- Function selector: `0x6963d438` + +::: + +:::info + +It's not possible to send value along the functions call due to the use of `delegatecall`. + +::: + +```solidity +function batchCalls(bytes[] data) external nonpayable returns (bytes[] results); +``` + +_Executing the following batch of abi-encoded function calls on the contract: `data`._ + +Allows a caller to batch different function calls in one call. Perform a `delegatecall` on self, to call different functions with preserving the context. + +#### Parameters + +| Name | Type | Description | +| ------ | :-------: | -------------------------------------------------------------------- | +| `data` | `bytes[]` | An array of ABI encoded function calls to be called on the contract. | + +#### Returns + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------------------------------------- | +| `results` | `bytes[]` | An array of abi-encoded data returned by the functions executed. | + +
+ +### getData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdata) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_Reading the ERC725Y storage for data key `dataKey` returned the following value: `dataValue`._ + +Get in the ERC725Y storage the bytes data stored at a specific data key `dataKey`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------------------------------- | +| `dataKey` | `bytes32` | The data key for which to retrieve the value. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ---------------------------------------------------- | +| `dataValue` | `bytes` | The bytes value stored under the specified data key. | + +
+ +### getDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatch) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Reading the ERC725Y storage for data keys `dataKeys` returned the following values: `dataValues`._ + +Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys`. + +#### 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 | + +
+ +### getDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatchfortokenids) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `getDataBatchForTokenIds(bytes32[],bytes32[])` +- Function selector: `0x1d26fce6` + +::: + +```solidity +function getDataBatchForTokenIds( + bytes32[] tokenIds, + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Retrieves data in batch for multiple `tokenId` and `dataKey` pairs._ + +#### Parameters + +| Name | Type | Description | +| ---------- | :---------: | ----------------------------------------------------- | +| `tokenIds` | `bytes32[]` | An array of token IDs. | +| `dataKeys` | `bytes32[]` | An array of data keys corresponding to the token IDs. | + +#### Returns + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------------------------------- | +| `dataValues` | `bytes[]` | An array of data values for each pair of `tokenId` and `dataKey`. | + +
+ +### getDataForTokenId + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatafortokenid) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `getDataForTokenId(bytes32,bytes32)` +- Function selector: `0x16e023b3` + +::: + +```solidity +function getDataForTokenId( + bytes32 tokenId, + bytes32 dataKey +) external view returns (bytes dataValue); +``` + +_Retrieves data for a specific `tokenId` and `dataKey`._ + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------- | +| `tokenId` | `bytes32` | The unique identifier for a token. | +| `dataKey` | `bytes32` | The key for the data to retrieve. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ----------------------------------------------------------------- | +| `dataValue` | `bytes` | The data value associated with the given `tokenId` and `dataKey`. | + +
+ +### getOperatorsOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getoperatorsof) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#isoperatorfor) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#owner) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#renounceownership) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokeoperator) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `revokeOperator(address,bytes32,bool,bytes)` +- Function selector: `0xdb8c9663` + +::: + +```solidity +function revokeOperator( + address operator, + bytes32 tokenId, + bool notify, + bytes operatorNotificationData +) 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. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### setData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdata) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +:::caution Warning + +**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**. + +::: + +```solidity +function setData(bytes32 dataKey, bytes dataValue) external payable; +``` + +_Setting the following data key value pair in the ERC725Y storage. Data key: `dataKey`, data value: `dataValue`._ + +Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data key `dataKey`. The function is marked as payable to enable flexibility on child contracts. For instance to implement a fee mechanism for setting specific data. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner). + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `dataKey` | `bytes32` | The data key for which to set a new value. | +| `dataValue` | `bytes` | The new bytes value to set. | + +
+ +### setDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatch) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +:::caution Warning + +**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**. + +::: + +```solidity +function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable; +``` + +_Setting the following data key value pairs in the ERC725Y storage. Data keys: `dataKeys`, data values: `dataValues`._ + +Batch data setting function that behaves the same as [`setData`](#setdata) but allowing to set multiple data key/value pairs in the ERC725Y storage in the same transaction. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner) of the contract. + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event **for each data key/value pair set**. + +
+ +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ---------------------------------------------------- | +| `dataKeys` | `bytes32[]` | An array of data keys to set bytes values for. | +| `dataValues` | `bytes[]` | An array of bytes values to set for each `dataKeys`. | + +
+ +### setDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatchfortokenids) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `setDataBatchForTokenIds(bytes32[],bytes32[],bytes[])` +- Function selector: `0xbe9f0e6f` + +::: + +```solidity +function setDataBatchForTokenIds( + bytes32[] tokenIds, + bytes32[] dataKeys, + bytes[] dataValues +) external nonpayable; +``` + +_Sets data in batch for multiple `tokenId` and `dataKey` pairs._ + +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ----------------------------------------------------- | +| `tokenIds` | `bytes32[]` | An array of token IDs. | +| `dataKeys` | `bytes32[]` | An array of data keys corresponding to the token IDs. | +| `dataValues` | `bytes[]` | An array of values to set for the given data keys. | + +
+ +### setDataForTokenId + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatafortokenid) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `setDataForTokenId(bytes32,bytes32,bytes)` +- Function selector: `0xd6c1407c` + +::: + +```solidity +function setDataForTokenId( + bytes32 tokenId, + bytes32 dataKey, + bytes dataValue +) external nonpayable; +``` + +_Sets data for a specific `tokenId` and `dataKey`._ + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ---------------------------------------- | +| `tokenId` | `bytes32` | The unique identifier for a token. | +| `dataKey` | `bytes32` | The key for the data to set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#supportsinterface) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenidsof) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenownerof) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `tokenOwnerOf(bytes32)` +- Function selector: `0x217b2270` + +::: + +```solidity +function tokenOwnerOf(bytes32 tokenId) external view returns (address); +``` + +Returns the address that owns a given `tokenId`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ------------------------------------ | +| `tokenId` | `bytes32` | The token ID to query the owner for. | + +#### 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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokensupplycap) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `tokenSupplyCap()` +- Function selector: `0x52058d8a` + +::: + +```solidity +function tokenSupplyCap() external view returns (uint256); +``` + +_The maximum supply amount of tokens allowed to exist is `_TOKEN_SUPPLY_CAP`._ + +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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#totalsupply) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `transfer(address,address,bytes32,bool,bytes)` +- Function selector: `0x511b6952` + +::: + +```solidity +function transfer( + address from, + address to, + bytes32 tokenId, + bool force, + 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 `force` 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. | +| `force` | `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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferbatch) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `transferBatch(address[],address[],bytes32[],bool[],bytes[])` +- Function selector: `0x7e87632c` + +::: + +```solidity +function transferBatch( + address[] from, + address[] to, + bytes32[] tokenId, + bool[] force, + 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. | +| `force` | `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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferownership) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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); +``` + +Read the value stored under a specific `dataKey` inside the underlying ERC725Y storage, +represented as a mapping of `bytes32` data keys mapped to their `bytes` data values. + +```solidity +mapping(bytes32 => bytes) _store +``` + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------------------------------------------------------------------- | +| `dataKey` | `bytes32` | A bytes32 data key to read the associated `bytes` value from the store. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ----------------------------------------------------------------------------- | +| `dataValue` | `bytes` | The `bytes` value associated with the given `dataKey` in the ERC725Y storage. | + +
+ +### \_setData + +```solidity +function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; +``` + +The ERC725Y data key `_LSP8_TOKENID_FORMAT_KEY` cannot be changed +once the identifiable digital asset contract has been deployed. + +
+ +### \_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, + bool notified, + bytes operatorNotificationData +) 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 force, + 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 + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances and ownership of `tokenId`s. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender via LSP1**. + +::: + +:::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. + +
+ +**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 + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances and ownership of `tokenId`s. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender/recipient via LSP1**. + +::: + +:::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 force, + 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. + +
+ +**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. | +| `force` | `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. | + +
+ +### \_setDataForTokenId + +```solidity +function _setDataForTokenId( + bytes32 tokenId, + bytes32 dataKey, + bytes dataValue +) internal nonpayable; +``` + +Sets data for a specific `tokenId` and `dataKey` in the ERC725Y storage +The ERC725Y data key is the hash of the `tokenId` and `dataKey` concatenated + +
+ +**Emitted events:** + +- [`TokenIdDataChanged`](#tokeniddatachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ---------------------------------------- | +| `tokenId` | `bytes32` | The unique identifier for a token. | +| `dataKey` | `bytes32` | The key for the data to set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### \_getDataForTokenId + +```solidity +function _getDataForTokenId( + bytes32 tokenId, + bytes32 dataKey +) internal view returns (bytes dataValues); +``` + +Retrieves data for a specific `tokenId` and `dataKey` from the ERC725Y storage +The ERC725Y data key is the hash of the `tokenId` and `dataKey` concatenated + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------- | +| `tokenId` | `bytes32` | The unique identifier for a token. | +| `dataKey` | `bytes32` | The key for the data to retrieve. | + +#### Returns + +| Name | Type | Description | +| ------------ | :-----: | ----------------------------------------------------------------- | +| `dataValues` | `bytes` | The data value associated with the given `tokenId` and `dataKey`. | + +
+ +### \_beforeTokenTransfer + +```solidity +function _beforeTokenTransfer( + address from, + address to, + bytes32 tokenId, + bytes data +) 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 | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + bytes32 tokenId, + bytes data +) internal nonpayable; +``` + +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient via LSP1** 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 | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_notifyTokenOperator + +```solidity +function _notifyTokenOperator( + address operator, + bytes lsp1Data +) internal nonpayable; +``` + +Attempt to notify the operator `operator` about the `tokenId` being authorized. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. +If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------------------------ | +| `operator` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | + +
+ +### \_notifyTokenSender + +```solidity +function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; +``` + +Attempt to notify the token sender `from` about the `tokenId` being transferred. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENSSENDER` as typeId, if `from` is a contract that supports the LSP1 interface. +If `from` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------------------------ | +| `from` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `lsp1Data` | `bytes` | the data to be sent to the `from` address in the `universalReceiver` call. | + +
+ +### \_notifyTokenReceiver + +```solidity +function _notifyTokenReceiver( + address to, + bool force, + bytes lsp1Data +) internal nonpayable; +``` + +Attempt to notify the token receiver `to` about the `tokenId` being received. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENSRECIPIENT` as typeId, if `to` is a contract that supports the LSP1 interface. +If `to` is is an EOA or a contract that does not support the LSP1 interface, the behaviour will depend on the `force` boolean flag. + +- if `force` is set to `true`, nothing will happen and no notification will be sent. + +- if `force` is set to `false, the transaction will revert. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | --------------------------------------------------------------------------------------------------- | +| `to` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `force` | `bool` | A boolean that describe if transfer to a `to` address that does not support LSP1 is allowed or not. | +| `lsp1Data` | `bytes` | The data to be sent to the `to` address in the `universalReceiver(...)` call. | + +
+ +### \_supportsInterfaceInERC165Extension + +```solidity +function _supportsInterfaceInERC165Extension( + bytes4 interfaceId +) internal view returns (bool); +``` + +Returns whether the interfaceId being checked is supported in the extension of the +[`supportsInterface`](#supportsinterface) selector. +To be used by extendable contracts wishing to extend the ERC165 interfaceIds originally +supported by reading whether the interfaceId queried is supported in the `supportsInterface` +extension if the extension is set, if not it returns false. + +
+ +### \_getExtensionAndForwardValue + +```solidity +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); +``` + +Returns the extension address stored under the following data key: + +- [`_LSP17_EXTENSION_PREFIX`](#_lsp17_extension_prefix) + `` (Check [LSP2-ERC725YJSONSchema] for encoding the data key). + +- If no extension is stored, returns the address(0). + +
+ +### \_fallbackLSP17Extendable + +:::info + +The LSP8 Token contract should not hold any native tokens. Any native tokens received by the contract +will be forwarded to the extension address mapped to the selector from `msg.sig`. + +::: + +```solidity +function _fallbackLSP17Extendable( + bytes callData +) internal nonpayable returns (bytes); +``` + +Forwards the call with the received value to an extension mapped to a function selector. +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being +called on the account. If there is no extension, the address(0) will be returned. +We will always forward the value to the extension, as the LSP8 contract is not supposed to hold any native tokens. +Reverts if there is no extension for the function being called. +If there is an extension for the function selector being called, it calls the extension with the +CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and +32 bytes of the [`msg.value`](#msg.value) + +
+ +## Events + +### DataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_The following data key/value pair has been changed in the ERC725Y storage: Data key: `dataKey`, data value: `dataValue`._ + +Emitted when data at a specific `dataKey` was changed to a new value `dataValue`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------- | +| `dataKey` **`indexed`** | `bytes32` | The data key for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### OperatorAuthorizationChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorauthorizationchanged) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Event signature: `OperatorAuthorizationChanged(address,address,bytes32,bytes)` +- Event topic hash: `0x1b1b58aa2ec0cec2228b2d37124556d41f5a1f7b12f089171f896cc236671215` + +::: + +```solidity +event OperatorAuthorizationChanged( + address indexed operator, + address indexed tokenOwner, + bytes32 indexed tokenId, + bytes operatorNotificationData +); +``` + +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`. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### OperatorRevoked + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorrevoked) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Event signature: `OperatorRevoked(address,address,bytes32,bool,bytes)` +- Event topic hash: `0xc78cd419d6136f9f1c1c6aec1d3fae098cffaf8bc86314a8f2685e32fe574e3c` + +::: + +```solidity +event OperatorRevoked( + address indexed operator, + address indexed tokenOwner, + bytes32 indexed tokenId, + bool notified, + bytes operatorNotificationData +); +``` + +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`](#getoperatorsof)). | +| `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | +| `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` is revoked from operating on. | +| `notified` | `bool` | Bool indicating whether the operator has been notified or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### OwnershipTransferred + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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` | - | + +
+ +### TokenIdDataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokeniddatachanged) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Event signature: `TokenIdDataChanged(bytes32,bytes32,bytes)` +- Event topic hash: `0xa6e4251f855f750545fe414f120db91c76b88def14d120969e5bb2d3f05debbb` + +::: + +```solidity +event TokenIdDataChanged( + bytes32 indexed tokenId, + bytes32 indexed dataKey, + bytes dataValue +); +``` + +Emitted when setting data for `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------- | +| `tokenId` **`indexed`** | `bytes32` | The tokenId which data is set for. | +| `dataKey` **`indexed`** | `bytes32` | The data key for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### Transfer + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 force, + 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 | +| `force` | `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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +Reverts when one of the array parameter provided to [`setDataBatch`](#setdatabatch) function is an empty array. + +
+ +### ERC725Y_DataKeysValuesLengthMismatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function. + +
+ +### ERC725Y_MsgValueDisallowed + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_msgvaluedisallowed) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#setdatabatch) function. + +
+ +### InvalidExtensionAddress + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#invalidextensionaddress) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `InvalidExtensionAddress(bytes)` +- Error hash: `0x42bfe79f` + +::: + +```solidity +error InvalidExtensionAddress(bytes storedData); +``` + +reverts when the bytes retrieved from the LSP17 data key is not a valid address (not 20 bytes) + +#### Parameters + +| Name | Type | Description | +| ------------ | :-----: | ----------- | +| `storedData` | `bytes` | - | + +
+ +### InvalidFunctionSelector + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#invalidfunctionselector) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `InvalidFunctionSelector(bytes)` +- Error hash: `0xe5099ee3` + +::: + +```solidity +error InvalidFunctionSelector(bytes data); +``` + +reverts when the contract is called with a function selector not valid (less than 4 bytes of data) + +#### Parameters + +| Name | Type | Description | +| ------ | :-----: | ----------- | +| `data` | `bytes` | - | + +
+ +### LSP4TokenNameNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokennamenoteditable) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 / initialized. 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 / initialized. + +
+ +### LSP4TokenSymbolNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokensymbolnoteditable) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 / initialized. 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 / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` 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 / initialized. + +
+ +### LSP8BatchCallFailed + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8batchcallfailed) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8BatchCallFailed(uint256)` +- Error hash: `0x234eb819` + +::: + +```solidity +error LSP8BatchCallFailed(uint256 callIndex); +``` + +_Batch call failed._ + +Reverts when a batch call failed. + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ----------- | +| `callIndex` | `uint256` | - | + +
+ +### LSP8CannotSendToAddressZero + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotsendtoaddresszero) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8CannotSendToAddressZero()` +- Error hash: `0x24ecef4d` + +::: + +```solidity +error LSP8CannotSendToAddressZero(); +``` + +Reverts when trying to send token to the zero address. + +
+ +### LSP8CannotUseAddressZeroAsOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotuseaddresszeroasoperator) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cappedsupplycannotmintovercap) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cappedsupplyrequired) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8invalidtransferbatch) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistenttokenid) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistingoperator) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenoperator) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenowner) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceivercontractmissinglsp1interface) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 force` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8NotifyTokenReceiverIsEOA + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceiveriseoa) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 force` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8OperatorAlreadyAuthorized + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8operatoralreadyauthorized) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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` | - | + +
+ +### LSP8RevokeOperatorNotAuthorized + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8revokeoperatornotauthorized) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8RevokeOperatorNotAuthorized(address,address,bytes32)` +- Error hash: `0x760b5acd` + +::: + +```solidity +error LSP8RevokeOperatorNotAuthorized( + address caller, + address tokenOwner, + bytes32 tokenId +); +``` + +Reverts when the call to revoke operator is not authorized. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `caller` | `address` | - | +| `tokenOwner` | `address` | - | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8TokenContractCannotHoldValue + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokencontractcannotholdvalue) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenContractCannotHoldValue()` +- Error hash: `0x61f49442` + +::: + +```solidity +error LSP8TokenContractCannotHoldValue(); +``` + +_LSP8 contract cannot receive native tokens._ + +Error occurs when sending native tokens to the LSP8 contract without sending any data. E.g. Sending value without passing a bytes4 function selector to call a LSP17 Extension. + +
+ +### LSP8TokenIdFormatNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidformatnoteditable) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenIdFormatNotEditable()` +- Error hash: `0x3664800a` + +::: + +```solidity +error LSP8TokenIdFormatNotEditable(); +``` + +Reverts when trying to edit the data key `LSP8TokenIdFormat` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdFormat` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed. + +
+ +### LSP8TokenIdsDataEmptyArray + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdataemptyarray) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenIdsDataEmptyArray()` +- Error hash: `0x80c98305` + +::: + +```solidity +error LSP8TokenIdsDataEmptyArray(); +``` + +Reverts when empty arrays is passed to the function + +
+ +### LSP8TokenIdsDataLengthMismatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdatalengthmismatch) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenIdsDataLengthMismatch()` +- Error hash: `0x2fa71dfe` + +::: + +```solidity +error LSP8TokenIdsDataLengthMismatch(); +``` + +Reverts when the length of the token IDs data arrays is not equal + +
+ +### LSP8TokenOwnerCannotBeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenownercannotbeoperator) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenOwnerCannotBeOperator()` +- Error hash: `0x89fdad62` + +::: + +```solidity +error LSP8TokenOwnerCannotBeOperator(); +``` + +Reverts when trying to authorize or revoke the token's owner as an operator. + +
+ +### LSP8TokenOwnerChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenownerchanged) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenOwnerChanged(bytes32,address,address)` +- Error hash: `0x5a9c31d3` + +::: + +```solidity +error LSP8TokenOwnerChanged( + bytes32 tokenId, + address oldOwner, + address newOwner +); +``` + +Reverts when the token owner changed inside the [`_beforeTokenTransfer`](#_beforetokentransfer) hook. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `tokenId` | `bytes32` | - | +| `oldOwner` | `address` | - | +| `newOwner` | `address` | - | + +
+ +### NoExtensionFoundForFunctionSelector + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#noextensionfoundforfunctionselector) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `NoExtensionFoundForFunctionSelector(bytes4)` +- Error hash: `0xbb370b2b` + +::: + +```solidity +error NoExtensionFoundForFunctionSelector(bytes4 functionSelector); +``` + +reverts when there is no extension for the function selector being called with + +#### Parameters + +| Name | Type | Description | +| ------------------ | :------: | ----------- | +| `functionSelector` | `bytes4` | - | + +
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md b/packages/lsp-smart-contracts/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md new file mode 100644 index 000000000..37095361c --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md @@ -0,0 +1,2232 @@ + + + +# LSP8Enumerable + +:::info Standard Specifications + +[`LSP-8-IdentifiableDigitalAsset`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md) + +::: +:::info Solidity implementation + +[`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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. + +### fallback + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#fallback) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) + +::: + +```solidity +fallback(bytes calldata callData) external payable returns (bytes memory); +``` + +_The `fallback` function was called with the following amount of native tokens: `msg.value`; and the following calldata: `callData`._ + +Achieves the goal of [LSP-17-ContractExtension] standard by extending the contract to handle calls of functions that do not exist natively, +forwarding the function call to the extension address mapped to the function being called. +This function is executed when: + +- Sending data of length less than 4 bytes to the contract. + +- The first 4 bytes of the calldata do not match any publicly callable functions from the contract ABI. + +- Receiving native tokens + +1. If the data is equal or longer than 4 bytes, the [ERC-725Y] storage is queried with the following data key: [_LSP17_EXTENSION_PREFIX] + `bytes4(msg.sig)` (Check [LSP-2-ERC725YJSONSchema] for encoding the data key) + +- If there is no address stored under the following data key, revert with [`NoExtensionFoundForFunctionSelector(bytes4)`](#noextensionfoundforfunctionselector). The data key relative to `bytes4(0)` is an exception, where no reverts occurs if there is no extension address stored under. This exception is made to allow users to send random data (graffiti) to the account and to be able to react on it. + +- If there is an address, forward the `msg.data` to the extension using the CALL opcode, appending 52 bytes (20 bytes of `msg.sender` and 32 bytes of `msg.value`). Return what the calls returns, or revert if the call failed. + +2. If the data sent to this function is of length less than 4 bytes (not a function selector), revert. + +
+ +### receive + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#receive) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) + +::: + +```solidity +receive() external payable; +``` + +_LSP8 contract cannot receive native tokens._ + +Reverts whenever someone tries to send native tokens to a LSP8 contract. + +
+ +### authorizeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizeoperator) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `authorizeOperator(address,bytes32,bytes)` +- Function selector: `0x86a10ddd` + +::: + +```solidity +function authorizeOperator( + address operator, + bytes32 tokenId, + bytes operatorNotificationData +) external nonpayable; +``` + +Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). Notify the operator based on the LSP1-UniversalReceiver standard + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------- | +| `operator` | `address` | The address to authorize as an operator. | +| `tokenId` | `bytes32` | The token ID operator has access to. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### balanceOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#balanceof) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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. | + +
+ +### batchCalls + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `batchCalls(bytes[])` +- Function selector: `0x6963d438` + +::: + +:::info + +It's not possible to send value along the functions call due to the use of `delegatecall`. + +::: + +```solidity +function batchCalls(bytes[] data) external nonpayable returns (bytes[] results); +``` + +_Executing the following batch of abi-encoded function calls on the contract: `data`._ + +Allows a caller to batch different function calls in one call. Perform a `delegatecall` on self, to call different functions with preserving the context. + +#### Parameters + +| Name | Type | Description | +| ------ | :-------: | -------------------------------------------------------------------- | +| `data` | `bytes[]` | An array of ABI encoded function calls to be called on the contract. | + +#### Returns + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------------------------------------- | +| `results` | `bytes[]` | An array of abi-encoded data returned by the functions executed. | + +
+ +### getData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdata) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_Reading the ERC725Y storage for data key `dataKey` returned the following value: `dataValue`._ + +Get in the ERC725Y storage the bytes data stored at a specific data key `dataKey`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------------------------------- | +| `dataKey` | `bytes32` | The data key for which to retrieve the value. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ---------------------------------------------------- | +| `dataValue` | `bytes` | The bytes value stored under the specified data key. | + +
+ +### getDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatch) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Reading the ERC725Y storage for data keys `dataKeys` returned the following values: `dataValues`._ + +Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys`. + +#### 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 | + +
+ +### getDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatchfortokenids) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `getDataBatchForTokenIds(bytes32[],bytes32[])` +- Function selector: `0x1d26fce6` + +::: + +```solidity +function getDataBatchForTokenIds( + bytes32[] tokenIds, + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Retrieves data in batch for multiple `tokenId` and `dataKey` pairs._ + +#### Parameters + +| Name | Type | Description | +| ---------- | :---------: | ----------------------------------------------------- | +| `tokenIds` | `bytes32[]` | An array of token IDs. | +| `dataKeys` | `bytes32[]` | An array of data keys corresponding to the token IDs. | + +#### Returns + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------------------------------- | +| `dataValues` | `bytes[]` | An array of data values for each pair of `tokenId` and `dataKey`. | + +
+ +### getDataForTokenId + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatafortokenid) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `getDataForTokenId(bytes32,bytes32)` +- Function selector: `0x16e023b3` + +::: + +```solidity +function getDataForTokenId( + bytes32 tokenId, + bytes32 dataKey +) external view returns (bytes dataValue); +``` + +_Retrieves data for a specific `tokenId` and `dataKey`._ + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------- | +| `tokenId` | `bytes32` | The unique identifier for a token. | +| `dataKey` | `bytes32` | The key for the data to retrieve. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ----------------------------------------------------------------- | +| `dataValue` | `bytes` | The data value associated with the given `tokenId` and `dataKey`. | + +
+ +### getOperatorsOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getoperatorsof) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#isoperatorfor) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#owner) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#renounceownership) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokeoperator) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `revokeOperator(address,bytes32,bool,bytes)` +- Function selector: `0xdb8c9663` + +::: + +```solidity +function revokeOperator( + address operator, + bytes32 tokenId, + bool notify, + bytes operatorNotificationData +) 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. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### setData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdata) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +:::caution Warning + +**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**. + +::: + +```solidity +function setData(bytes32 dataKey, bytes dataValue) external payable; +``` + +_Setting the following data key value pair in the ERC725Y storage. Data key: `dataKey`, data value: `dataValue`._ + +Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data key `dataKey`. The function is marked as payable to enable flexibility on child contracts. For instance to implement a fee mechanism for setting specific data. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner). + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `dataKey` | `bytes32` | The data key for which to set a new value. | +| `dataValue` | `bytes` | The new bytes value to set. | + +
+ +### setDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatch) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +:::caution Warning + +**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**. + +::: + +```solidity +function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable; +``` + +_Setting the following data key value pairs in the ERC725Y storage. Data keys: `dataKeys`, data values: `dataValues`._ + +Batch data setting function that behaves the same as [`setData`](#setdata) but allowing to set multiple data key/value pairs in the ERC725Y storage in the same transaction. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner) of the contract. + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event **for each data key/value pair set**. + +
+ +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ---------------------------------------------------- | +| `dataKeys` | `bytes32[]` | An array of data keys to set bytes values for. | +| `dataValues` | `bytes[]` | An array of bytes values to set for each `dataKeys`. | + +
+ +### setDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatchfortokenids) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `setDataBatchForTokenIds(bytes32[],bytes32[],bytes[])` +- Function selector: `0xbe9f0e6f` + +::: + +```solidity +function setDataBatchForTokenIds( + bytes32[] tokenIds, + bytes32[] dataKeys, + bytes[] dataValues +) external nonpayable; +``` + +_Sets data in batch for multiple `tokenId` and `dataKey` pairs._ + +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ----------------------------------------------------- | +| `tokenIds` | `bytes32[]` | An array of token IDs. | +| `dataKeys` | `bytes32[]` | An array of data keys corresponding to the token IDs. | +| `dataValues` | `bytes[]` | An array of values to set for the given data keys. | + +
+ +### setDataForTokenId + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatafortokenid) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `setDataForTokenId(bytes32,bytes32,bytes)` +- Function selector: `0xd6c1407c` + +::: + +```solidity +function setDataForTokenId( + bytes32 tokenId, + bytes32 dataKey, + bytes dataValue +) external nonpayable; +``` + +_Sets data for a specific `tokenId` and `dataKey`._ + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ---------------------------------------- | +| `tokenId` | `bytes32` | The unique identifier for a token. | +| `dataKey` | `bytes32` | The key for the data to set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#supportsinterface) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenat) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenidsof) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenownerof) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `tokenOwnerOf(bytes32)` +- Function selector: `0x217b2270` + +::: + +```solidity +function tokenOwnerOf(bytes32 tokenId) external view returns (address); +``` + +Returns the address that owns a given `tokenId`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ------------------------------------ | +| `tokenId` | `bytes32` | The token ID to query the owner for. | + +#### 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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#totalsupply) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `transfer(address,address,bytes32,bool,bytes)` +- Function selector: `0x511b6952` + +::: + +```solidity +function transfer( + address from, + address to, + bytes32 tokenId, + bool force, + 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 `force` 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. | +| `force` | `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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferbatch) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `transferBatch(address[],address[],bytes32[],bool[],bytes[])` +- Function selector: `0x7e87632c` + +::: + +```solidity +function transferBatch( + address[] from, + address[] to, + bytes32[] tokenId, + bool[] force, + 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. | +| `force` | `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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferownership) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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); +``` + +Read the value stored under a specific `dataKey` inside the underlying ERC725Y storage, +represented as a mapping of `bytes32` data keys mapped to their `bytes` data values. + +```solidity +mapping(bytes32 => bytes) _store +``` + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------------------------------------------------------------------- | +| `dataKey` | `bytes32` | A bytes32 data key to read the associated `bytes` value from the store. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ----------------------------------------------------------------------------- | +| `dataValue` | `bytes` | The `bytes` value associated with the given `dataKey` in the ERC725Y storage. | + +
+ +### \_setData + +```solidity +function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; +``` + +The ERC725Y data key `_LSP8_TOKENID_FORMAT_KEY` cannot be changed +once the identifiable digital asset contract has been deployed. + +
+ +### \_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, + bool notified, + bytes operatorNotificationData +) 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 + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances and ownership of `tokenId`s. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances and ownership of `tokenId`s, **but before notifying the recipient via LSP1**. + +::: + +```solidity +function _mint( + address to, + bytes32 tokenId, + bool force, + 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). | +| `force` | `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 + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances and ownership of `tokenId`s. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender via LSP1**. + +::: + +:::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. + +
+ +**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 + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances and ownership of `tokenId`s. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender/recipient via LSP1**. + +::: + +:::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 force, + 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. + +
+ +**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. | +| `force` | `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. | + +
+ +### \_setDataForTokenId + +```solidity +function _setDataForTokenId( + bytes32 tokenId, + bytes32 dataKey, + bytes dataValue +) internal nonpayable; +``` + +Sets data for a specific `tokenId` and `dataKey` in the ERC725Y storage +The ERC725Y data key is the hash of the `tokenId` and `dataKey` concatenated + +
+ +**Emitted events:** + +- [`TokenIdDataChanged`](#tokeniddatachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ---------------------------------------- | +| `tokenId` | `bytes32` | The unique identifier for a token. | +| `dataKey` | `bytes32` | The key for the data to set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### \_getDataForTokenId + +```solidity +function _getDataForTokenId( + bytes32 tokenId, + bytes32 dataKey +) internal view returns (bytes dataValues); +``` + +Retrieves data for a specific `tokenId` and `dataKey` from the ERC725Y storage +The ERC725Y data key is the hash of the `tokenId` and `dataKey` concatenated + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------- | +| `tokenId` | `bytes32` | The unique identifier for a token. | +| `dataKey` | `bytes32` | The key for the data to retrieve. | + +#### Returns + +| Name | Type | Description | +| ------------ | :-----: | ----------------------------------------------------------------- | +| `dataValues` | `bytes` | The data value associated with the given `tokenId` and `dataKey`. | + +
+ +### \_beforeTokenTransfer + +```solidity +function _beforeTokenTransfer( + address from, + address to, + bytes32 tokenId, + bytes data +) 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. | +| `data` | `bytes` | The data sent alongside the the token transfer. | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + bytes32 tokenId, + bytes data +) internal nonpayable; +``` + +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient via LSP1** 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 | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_notifyTokenOperator + +```solidity +function _notifyTokenOperator( + address operator, + bytes lsp1Data +) internal nonpayable; +``` + +Attempt to notify the operator `operator` about the `tokenId` being authorized. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. +If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------------------------ | +| `operator` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | + +
+ +### \_notifyTokenSender + +```solidity +function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; +``` + +Attempt to notify the token sender `from` about the `tokenId` being transferred. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENSSENDER` as typeId, if `from` is a contract that supports the LSP1 interface. +If `from` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------------------------ | +| `from` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `lsp1Data` | `bytes` | the data to be sent to the `from` address in the `universalReceiver` call. | + +
+ +### \_notifyTokenReceiver + +```solidity +function _notifyTokenReceiver( + address to, + bool force, + bytes lsp1Data +) internal nonpayable; +``` + +Attempt to notify the token receiver `to` about the `tokenId` being received. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENSRECIPIENT` as typeId, if `to` is a contract that supports the LSP1 interface. +If `to` is is an EOA or a contract that does not support the LSP1 interface, the behaviour will depend on the `force` boolean flag. + +- if `force` is set to `true`, nothing will happen and no notification will be sent. + +- if `force` is set to `false, the transaction will revert. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | --------------------------------------------------------------------------------------------------- | +| `to` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `force` | `bool` | A boolean that describe if transfer to a `to` address that does not support LSP1 is allowed or not. | +| `lsp1Data` | `bytes` | The data to be sent to the `to` address in the `universalReceiver(...)` call. | + +
+ +### \_supportsInterfaceInERC165Extension + +```solidity +function _supportsInterfaceInERC165Extension( + bytes4 interfaceId +) internal view returns (bool); +``` + +Returns whether the interfaceId being checked is supported in the extension of the +[`supportsInterface`](#supportsinterface) selector. +To be used by extendable contracts wishing to extend the ERC165 interfaceIds originally +supported by reading whether the interfaceId queried is supported in the `supportsInterface` +extension if the extension is set, if not it returns false. + +
+ +### \_getExtensionAndForwardValue + +```solidity +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); +``` + +Returns the extension address stored under the following data key: + +- [`_LSP17_EXTENSION_PREFIX`](#_lsp17_extension_prefix) + `` (Check [LSP2-ERC725YJSONSchema] for encoding the data key). + +- If no extension is stored, returns the address(0). + +
+ +### \_fallbackLSP17Extendable + +:::info + +The LSP8 Token contract should not hold any native tokens. Any native tokens received by the contract +will be forwarded to the extension address mapped to the selector from `msg.sig`. + +::: + +```solidity +function _fallbackLSP17Extendable( + bytes callData +) internal nonpayable returns (bytes); +``` + +Forwards the call with the received value to an extension mapped to a function selector. +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being +called on the account. If there is no extension, the address(0) will be returned. +We will always forward the value to the extension, as the LSP8 contract is not supposed to hold any native tokens. +Reverts if there is no extension for the function being called. +If there is an extension for the function selector being called, it calls the extension with the +CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and +32 bytes of the [`msg.value`](#msg.value) + +
+ +## Events + +### DataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_The following data key/value pair has been changed in the ERC725Y storage: Data key: `dataKey`, data value: `dataValue`._ + +Emitted when data at a specific `dataKey` was changed to a new value `dataValue`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------- | +| `dataKey` **`indexed`** | `bytes32` | The data key for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### OperatorAuthorizationChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorauthorizationchanged) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Event signature: `OperatorAuthorizationChanged(address,address,bytes32,bytes)` +- Event topic hash: `0x1b1b58aa2ec0cec2228b2d37124556d41f5a1f7b12f089171f896cc236671215` + +::: + +```solidity +event OperatorAuthorizationChanged( + address indexed operator, + address indexed tokenOwner, + bytes32 indexed tokenId, + bytes operatorNotificationData +); +``` + +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`. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### OperatorRevoked + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorrevoked) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Event signature: `OperatorRevoked(address,address,bytes32,bool,bytes)` +- Event topic hash: `0xc78cd419d6136f9f1c1c6aec1d3fae098cffaf8bc86314a8f2685e32fe574e3c` + +::: + +```solidity +event OperatorRevoked( + address indexed operator, + address indexed tokenOwner, + bytes32 indexed tokenId, + bool notified, + bytes operatorNotificationData +); +``` + +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`](#getoperatorsof)). | +| `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | +| `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` is revoked from operating on. | +| `notified` | `bool` | Bool indicating whether the operator has been notified or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### OwnershipTransferred + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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` | - | + +
+ +### TokenIdDataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokeniddatachanged) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Event signature: `TokenIdDataChanged(bytes32,bytes32,bytes)` +- Event topic hash: `0xa6e4251f855f750545fe414f120db91c76b88def14d120969e5bb2d3f05debbb` + +::: + +```solidity +event TokenIdDataChanged( + bytes32 indexed tokenId, + bytes32 indexed dataKey, + bytes dataValue +); +``` + +Emitted when setting data for `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------- | +| `tokenId` **`indexed`** | `bytes32` | The tokenId which data is set for. | +| `dataKey` **`indexed`** | `bytes32` | The data key for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### Transfer + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 force, + 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 | +| `force` | `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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +Reverts when one of the array parameter provided to [`setDataBatch`](#setdatabatch) function is an empty array. + +
+ +### ERC725Y_DataKeysValuesLengthMismatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function. + +
+ +### ERC725Y_MsgValueDisallowed + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_msgvaluedisallowed) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#setdatabatch) function. + +
+ +### InvalidExtensionAddress + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#invalidextensionaddress) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `InvalidExtensionAddress(bytes)` +- Error hash: `0x42bfe79f` + +::: + +```solidity +error InvalidExtensionAddress(bytes storedData); +``` + +reverts when the bytes retrieved from the LSP17 data key is not a valid address (not 20 bytes) + +#### Parameters + +| Name | Type | Description | +| ------------ | :-----: | ----------- | +| `storedData` | `bytes` | - | + +
+ +### InvalidFunctionSelector + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#invalidfunctionselector) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `InvalidFunctionSelector(bytes)` +- Error hash: `0xe5099ee3` + +::: + +```solidity +error InvalidFunctionSelector(bytes data); +``` + +reverts when the contract is called with a function selector not valid (less than 4 bytes of data) + +#### Parameters + +| Name | Type | Description | +| ------ | :-----: | ----------- | +| `data` | `bytes` | - | + +
+ +### LSP4TokenNameNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokennamenoteditable) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 / initialized. 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 / initialized. + +
+ +### LSP4TokenSymbolNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokensymbolnoteditable) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 / initialized. 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 / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` 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 / initialized. + +
+ +### LSP8BatchCallFailed + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8batchcallfailed) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8BatchCallFailed(uint256)` +- Error hash: `0x234eb819` + +::: + +```solidity +error LSP8BatchCallFailed(uint256 callIndex); +``` + +_Batch call failed._ + +Reverts when a batch call failed. + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ----------- | +| `callIndex` | `uint256` | - | + +
+ +### LSP8CannotSendToAddressZero + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotsendtoaddresszero) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8CannotSendToAddressZero()` +- Error hash: `0x24ecef4d` + +::: + +```solidity +error LSP8CannotSendToAddressZero(); +``` + +Reverts when trying to send token to the zero address. + +
+ +### LSP8CannotUseAddressZeroAsOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotuseaddresszeroasoperator) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8invalidtransferbatch) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistenttokenid) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistingoperator) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenoperator) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenowner) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceivercontractmissinglsp1interface) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 force` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8NotifyTokenReceiverIsEOA + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceiveriseoa) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 force` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8OperatorAlreadyAuthorized + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8operatoralreadyauthorized) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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` | - | + +
+ +### LSP8RevokeOperatorNotAuthorized + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8revokeoperatornotauthorized) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8RevokeOperatorNotAuthorized(address,address,bytes32)` +- Error hash: `0x760b5acd` + +::: + +```solidity +error LSP8RevokeOperatorNotAuthorized( + address caller, + address tokenOwner, + bytes32 tokenId +); +``` + +Reverts when the call to revoke operator is not authorized. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `caller` | `address` | - | +| `tokenOwner` | `address` | - | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8TokenContractCannotHoldValue + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokencontractcannotholdvalue) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenContractCannotHoldValue()` +- Error hash: `0x61f49442` + +::: + +```solidity +error LSP8TokenContractCannotHoldValue(); +``` + +_LSP8 contract cannot receive native tokens._ + +Error occurs when sending native tokens to the LSP8 contract without sending any data. E.g. Sending value without passing a bytes4 function selector to call a LSP17 Extension. + +
+ +### LSP8TokenIdFormatNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidformatnoteditable) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenIdFormatNotEditable()` +- Error hash: `0x3664800a` + +::: + +```solidity +error LSP8TokenIdFormatNotEditable(); +``` + +Reverts when trying to edit the data key `LSP8TokenIdFormat` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdFormat` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed. + +
+ +### LSP8TokenIdsDataEmptyArray + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdataemptyarray) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenIdsDataEmptyArray()` +- Error hash: `0x80c98305` + +::: + +```solidity +error LSP8TokenIdsDataEmptyArray(); +``` + +Reverts when empty arrays is passed to the function + +
+ +### LSP8TokenIdsDataLengthMismatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdatalengthmismatch) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenIdsDataLengthMismatch()` +- Error hash: `0x2fa71dfe` + +::: + +```solidity +error LSP8TokenIdsDataLengthMismatch(); +``` + +Reverts when the length of the token IDs data arrays is not equal + +
+ +### LSP8TokenOwnerCannotBeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenownercannotbeoperator) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenOwnerCannotBeOperator()` +- Error hash: `0x89fdad62` + +::: + +```solidity +error LSP8TokenOwnerCannotBeOperator(); +``` + +Reverts when trying to authorize or revoke the token's owner as an operator. + +
+ +### LSP8TokenOwnerChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenownerchanged) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenOwnerChanged(bytes32,address,address)` +- Error hash: `0x5a9c31d3` + +::: + +```solidity +error LSP8TokenOwnerChanged( + bytes32 tokenId, + address oldOwner, + address newOwner +); +``` + +Reverts when the token owner changed inside the [`_beforeTokenTransfer`](#_beforetokentransfer) hook. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `tokenId` | `bytes32` | - | +| `oldOwner` | `address` | - | +| `newOwner` | `address` | - | + +
+ +### NoExtensionFoundForFunctionSelector + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#noextensionfoundforfunctionselector) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `NoExtensionFoundForFunctionSelector(bytes4)` +- Error hash: `0xbb370b2b` + +::: + +```solidity +error NoExtensionFoundForFunctionSelector(bytes4 functionSelector); +``` + +reverts when there is no extension for the function selector being called with + +#### Parameters + +| Name | Type | Description | +| ------------------ | :------: | ----------- | +| `functionSelector` | `bytes4` | - | + +
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md b/packages/lsp-smart-contracts/docs/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md new file mode 100644 index 000000000..bdaaa1fce --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md @@ -0,0 +1,2295 @@ + + + +# LSP8Mintable + +:::info Standard Specifications + +[`LSP-8-IdentifiableDigitalAsset`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md) + +::: +:::info Solidity implementation + +[`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) + +::: + +> LSP8IdentifiableDigitalAsset deployable preset contract with a public [`mint`](#mint) function callable only by the contract [`owner`](#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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#constructor) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) + +::: + +```solidity +constructor( + string name_, + string symbol_, + address newOwner_, + uint256 lsp4TokenType_, + uint256 lsp8TokenIdFormat_ +); +``` + +_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. | +| `lsp4TokenType_` | `uint256` | The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection). | +| `lsp8TokenIdFormat_` | `uint256` | The format of tokenIds (= NFTs) that this contract will create. | + +
+ +### fallback + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#fallback) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) + +::: + +```solidity +fallback(bytes calldata callData) external payable returns (bytes memory); +``` + +_The `fallback` function was called with the following amount of native tokens: `msg.value`; and the following calldata: `callData`._ + +Achieves the goal of [LSP-17-ContractExtension] standard by extending the contract to handle calls of functions that do not exist natively, +forwarding the function call to the extension address mapped to the function being called. +This function is executed when: + +- Sending data of length less than 4 bytes to the contract. + +- The first 4 bytes of the calldata do not match any publicly callable functions from the contract ABI. + +- Receiving native tokens + +1. If the data is equal or longer than 4 bytes, the [ERC-725Y] storage is queried with the following data key: [_LSP17_EXTENSION_PREFIX] + `bytes4(msg.sig)` (Check [LSP-2-ERC725YJSONSchema] for encoding the data key) + +- If there is no address stored under the following data key, revert with [`NoExtensionFoundForFunctionSelector(bytes4)`](#noextensionfoundforfunctionselector). The data key relative to `bytes4(0)` is an exception, where no reverts occurs if there is no extension address stored under. This exception is made to allow users to send random data (graffiti) to the account and to be able to react on it. + +- If there is an address, forward the `msg.data` to the extension using the CALL opcode, appending 52 bytes (20 bytes of `msg.sender` and 32 bytes of `msg.value`). Return what the calls returns, or revert if the call failed. + +2. If the data sent to this function is of length less than 4 bytes (not a function selector), revert. + +
+ +### receive + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#receive) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) + +::: + +```solidity +receive() external payable; +``` + +_LSP8 contract cannot receive native tokens._ + +Reverts whenever someone tries to send native tokens to a LSP8 contract. + +
+ +### authorizeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizeoperator) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `authorizeOperator(address,bytes32,bytes)` +- Function selector: `0x86a10ddd` + +::: + +```solidity +function authorizeOperator( + address operator, + bytes32 tokenId, + bytes operatorNotificationData +) external nonpayable; +``` + +Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). Notify the operator based on the LSP1-UniversalReceiver standard + +#### Parameters + +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------- | +| `operator` | `address` | The address to authorize as an operator. | +| `tokenId` | `bytes32` | The token ID operator has access to. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### balanceOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#balanceof) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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. | + +
+ +### batchCalls + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `batchCalls(bytes[])` +- Function selector: `0x6963d438` + +::: + +:::info + +It's not possible to send value along the functions call due to the use of `delegatecall`. + +::: + +```solidity +function batchCalls(bytes[] data) external nonpayable returns (bytes[] results); +``` + +_Executing the following batch of abi-encoded function calls on the contract: `data`._ + +Allows a caller to batch different function calls in one call. Perform a `delegatecall` on self, to call different functions with preserving the context. + +#### Parameters + +| Name | Type | Description | +| ------ | :-------: | -------------------------------------------------------------------- | +| `data` | `bytes[]` | An array of ABI encoded function calls to be called on the contract. | + +#### Returns + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------------------------------------- | +| `results` | `bytes[]` | An array of abi-encoded data returned by the functions executed. | + +
+ +### getData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdata) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_Reading the ERC725Y storage for data key `dataKey` returned the following value: `dataValue`._ + +Get in the ERC725Y storage the bytes data stored at a specific data key `dataKey`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------------------------------- | +| `dataKey` | `bytes32` | The data key for which to retrieve the value. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ---------------------------------------------------- | +| `dataValue` | `bytes` | The bytes value stored under the specified data key. | + +
+ +### getDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatch) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Reading the ERC725Y storage for data keys `dataKeys` returned the following values: `dataValues`._ + +Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys`. + +#### 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 | + +
+ +### getDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatchfortokenids) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `getDataBatchForTokenIds(bytes32[],bytes32[])` +- Function selector: `0x1d26fce6` + +::: + +```solidity +function getDataBatchForTokenIds( + bytes32[] tokenIds, + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Retrieves data in batch for multiple `tokenId` and `dataKey` pairs._ + +#### Parameters + +| Name | Type | Description | +| ---------- | :---------: | ----------------------------------------------------- | +| `tokenIds` | `bytes32[]` | An array of token IDs. | +| `dataKeys` | `bytes32[]` | An array of data keys corresponding to the token IDs. | + +#### Returns + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------------------------------- | +| `dataValues` | `bytes[]` | An array of data values for each pair of `tokenId` and `dataKey`. | + +
+ +### getDataForTokenId + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatafortokenid) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `getDataForTokenId(bytes32,bytes32)` +- Function selector: `0x16e023b3` + +::: + +```solidity +function getDataForTokenId( + bytes32 tokenId, + bytes32 dataKey +) external view returns (bytes dataValue); +``` + +_Retrieves data for a specific `tokenId` and `dataKey`._ + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------- | +| `tokenId` | `bytes32` | The unique identifier for a token. | +| `dataKey` | `bytes32` | The key for the data to retrieve. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ----------------------------------------------------------------- | +| `dataValue` | `bytes` | The data value associated with the given `tokenId` and `dataKey`. | + +
+ +### getOperatorsOf + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getoperatorsof) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#isoperatorfor) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#mint) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `mint(address,bytes32,bool,bytes)` +- Function selector: `0xaf255b61` + +::: + +```solidity +function mint( + address to, + bytes32 tokenId, + bool force, + bytes data +) external nonpayable; +``` + +_Minting tokenId `tokenId` for address `to` with the additional data `data` (Note: allow non-LSP1 recipient is set to `force`)._ + +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. | +| `force` | `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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#owner) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#renounceownership) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokeoperator) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `revokeOperator(address,bytes32,bool,bytes)` +- Function selector: `0xdb8c9663` + +::: + +```solidity +function revokeOperator( + address operator, + bytes32 tokenId, + bool notify, + bytes operatorNotificationData +) 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. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### setData + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdata) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +:::caution Warning + +**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**. + +::: + +```solidity +function setData(bytes32 dataKey, bytes dataValue) external payable; +``` + +_Setting the following data key value pair in the ERC725Y storage. Data key: `dataKey`, data value: `dataValue`._ + +Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data key `dataKey`. The function is marked as payable to enable flexibility on child contracts. For instance to implement a fee mechanism for setting specific data. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner). + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `dataKey` | `bytes32` | The data key for which to set a new value. | +| `dataValue` | `bytes` | The new bytes value to set. | + +
+ +### setDataBatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatch) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +:::caution Warning + +**Note for developers:** despite the fact that this function is set as `payable`, if the function is not intended to receive value (= native tokens), **an additional check should be implemented to ensure that `msg.value` sent was equal to 0**. + +::: + +```solidity +function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable; +``` + +_Setting the following data key value pairs in the ERC725Y storage. Data keys: `dataKeys`, data values: `dataValues`._ + +Batch data setting function that behaves the same as [`setData`](#setdata) but allowing to set multiple data key/value pairs in the ERC725Y storage in the same transaction. + +
+ +**Requirements:** + +- SHOULD only be callable by the [`owner`](#owner) of the contract. + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event **for each data key/value pair set**. + +
+ +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ---------------------------------------------------- | +| `dataKeys` | `bytes32[]` | An array of data keys to set bytes values for. | +| `dataValues` | `bytes[]` | An array of bytes values to set for each `dataKeys`. | + +
+ +### setDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatchfortokenids) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `setDataBatchForTokenIds(bytes32[],bytes32[],bytes[])` +- Function selector: `0xbe9f0e6f` + +::: + +```solidity +function setDataBatchForTokenIds( + bytes32[] tokenIds, + bytes32[] dataKeys, + bytes[] dataValues +) external nonpayable; +``` + +_Sets data in batch for multiple `tokenId` and `dataKey` pairs._ + +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ----------------------------------------------------- | +| `tokenIds` | `bytes32[]` | An array of token IDs. | +| `dataKeys` | `bytes32[]` | An array of data keys corresponding to the token IDs. | +| `dataValues` | `bytes[]` | An array of values to set for the given data keys. | + +
+ +### setDataForTokenId + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatafortokenid) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `setDataForTokenId(bytes32,bytes32,bytes)` +- Function selector: `0xd6c1407c` + +::: + +```solidity +function setDataForTokenId( + bytes32 tokenId, + bytes32 dataKey, + bytes dataValue +) external nonpayable; +``` + +_Sets data for a specific `tokenId` and `dataKey`._ + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ---------------------------------------- | +| `tokenId` | `bytes32` | The unique identifier for a token. | +| `dataKey` | `bytes32` | The key for the data to set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#supportsinterface) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenidsof) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenownerof) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `tokenOwnerOf(bytes32)` +- Function selector: `0x217b2270` + +::: + +```solidity +function tokenOwnerOf(bytes32 tokenId) external view returns (address); +``` + +Returns the address that owns a given `tokenId`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ------------------------------------ | +| `tokenId` | `bytes32` | The token ID to query the owner for. | + +#### 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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#totalsupply) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `transfer(address,address,bytes32,bool,bytes)` +- Function selector: `0x511b6952` + +::: + +```solidity +function transfer( + address from, + address to, + bytes32 tokenId, + bool force, + 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 `force` 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. | +| `force` | `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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferbatch) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `transferBatch(address[],address[],bytes32[],bool[],bytes[])` +- Function selector: `0x7e87632c` + +::: + +```solidity +function transferBatch( + address[] from, + address[] to, + bytes32[] tokenId, + bool[] force, + 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. | +| `force` | `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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transferownership) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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); +``` + +Read the value stored under a specific `dataKey` inside the underlying ERC725Y storage, +represented as a mapping of `bytes32` data keys mapped to their `bytes` data values. + +```solidity +mapping(bytes32 => bytes) _store +``` + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------------------------------------------------------------------- | +| `dataKey` | `bytes32` | A bytes32 data key to read the associated `bytes` value from the store. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ----------------------------------------------------------------------------- | +| `dataValue` | `bytes` | The `bytes` value associated with the given `dataKey` in the ERC725Y storage. | + +
+ +### \_setData + +```solidity +function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; +``` + +The ERC725Y data key `_LSP8_TOKENID_FORMAT_KEY` cannot be changed +once the identifiable digital asset contract has been deployed. + +
+ +### \_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, + bool notified, + bytes operatorNotificationData +) 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 + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances and ownership of `tokenId`s. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances and ownership of `tokenId`s, **but before notifying the recipient via LSP1**. + +::: + +```solidity +function _mint( + address to, + bytes32 tokenId, + bool force, + 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). | +| `force` | `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 + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances and ownership of `tokenId`s. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender via LSP1**. + +::: + +:::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. + +
+ +**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 + +:::info + +Any logic in the: + +- [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances and ownership of `tokenId`s. + +- [`_afterTokenTransfer`](#_aftertokentransfer) function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender/recipient via LSP1**. + +::: + +:::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 force, + 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. + +
+ +**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. | +| `force` | `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. | + +
+ +### \_setDataForTokenId + +```solidity +function _setDataForTokenId( + bytes32 tokenId, + bytes32 dataKey, + bytes dataValue +) internal nonpayable; +``` + +Sets data for a specific `tokenId` and `dataKey` in the ERC725Y storage +The ERC725Y data key is the hash of the `tokenId` and `dataKey` concatenated + +
+ +**Emitted events:** + +- [`TokenIdDataChanged`](#tokeniddatachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ---------------------------------------- | +| `tokenId` | `bytes32` | The unique identifier for a token. | +| `dataKey` | `bytes32` | The key for the data to set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### \_getDataForTokenId + +```solidity +function _getDataForTokenId( + bytes32 tokenId, + bytes32 dataKey +) internal view returns (bytes dataValues); +``` + +Retrieves data for a specific `tokenId` and `dataKey` from the ERC725Y storage +The ERC725Y data key is the hash of the `tokenId` and `dataKey` concatenated + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------- | +| `tokenId` | `bytes32` | The unique identifier for a token. | +| `dataKey` | `bytes32` | The key for the data to retrieve. | + +#### Returns + +| Name | Type | Description | +| ------------ | :-----: | ----------------------------------------------------------------- | +| `dataValues` | `bytes` | The data value associated with the given `tokenId` and `dataKey`. | + +
+ +### \_beforeTokenTransfer + +```solidity +function _beforeTokenTransfer( + address from, + address to, + bytes32 tokenId, + bytes data +) 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 | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + bytes32 tokenId, + bytes data +) internal nonpayable; +``` + +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient via LSP1** 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 | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_notifyTokenOperator + +```solidity +function _notifyTokenOperator( + address operator, + bytes lsp1Data +) internal nonpayable; +``` + +Attempt to notify the operator `operator` about the `tokenId` being authorized. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. +If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------------------------ | +| `operator` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | + +
+ +### \_notifyTokenSender + +```solidity +function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; +``` + +Attempt to notify the token sender `from` about the `tokenId` being transferred. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENSSENDER` as typeId, if `from` is a contract that supports the LSP1 interface. +If `from` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------------------------------------------------ | +| `from` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `lsp1Data` | `bytes` | the data to be sent to the `from` address in the `universalReceiver` call. | + +
+ +### \_notifyTokenReceiver + +```solidity +function _notifyTokenReceiver( + address to, + bool force, + bytes lsp1Data +) internal nonpayable; +``` + +Attempt to notify the token receiver `to` about the `tokenId` being received. +This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENSRECIPIENT` as typeId, if `to` is a contract that supports the LSP1 interface. +If `to` is is an EOA or a contract that does not support the LSP1 interface, the behaviour will depend on the `force` boolean flag. + +- if `force` is set to `true`, nothing will happen and no notification will be sent. + +- if `force` is set to `false, the transaction will revert. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | --------------------------------------------------------------------------------------------------- | +| `to` | `address` | The address to call the [`universalReceiver`](#universalreceiver) function on. | +| `force` | `bool` | A boolean that describe if transfer to a `to` address that does not support LSP1 is allowed or not. | +| `lsp1Data` | `bytes` | The data to be sent to the `to` address in the `universalReceiver(...)` call. | + +
+ +### \_supportsInterfaceInERC165Extension + +```solidity +function _supportsInterfaceInERC165Extension( + bytes4 interfaceId +) internal view returns (bool); +``` + +Returns whether the interfaceId being checked is supported in the extension of the +[`supportsInterface`](#supportsinterface) selector. +To be used by extendable contracts wishing to extend the ERC165 interfaceIds originally +supported by reading whether the interfaceId queried is supported in the `supportsInterface` +extension if the extension is set, if not it returns false. + +
+ +### \_getExtensionAndForwardValue + +```solidity +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); +``` + +Returns the extension address stored under the following data key: + +- [`_LSP17_EXTENSION_PREFIX`](#_lsp17_extension_prefix) + `` (Check [LSP2-ERC725YJSONSchema] for encoding the data key). + +- If no extension is stored, returns the address(0). + +
+ +### \_fallbackLSP17Extendable + +:::info + +The LSP8 Token contract should not hold any native tokens. Any native tokens received by the contract +will be forwarded to the extension address mapped to the selector from `msg.sig`. + +::: + +```solidity +function _fallbackLSP17Extendable( + bytes callData +) internal nonpayable returns (bytes); +``` + +Forwards the call with the received value to an extension mapped to a function selector. +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being +called on the account. If there is no extension, the address(0) will be returned. +We will always forward the value to the extension, as the LSP8 contract is not supposed to hold any native tokens. +Reverts if there is no extension for the function being called. +If there is an extension for the function selector being called, it calls the extension with the +CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and +32 bytes of the [`msg.value`](#msg.value) + +
+ +## Events + +### DataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_The following data key/value pair has been changed in the ERC725Y storage: Data key: `dataKey`, data value: `dataValue`._ + +Emitted when data at a specific `dataKey` was changed to a new value `dataValue`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------- | +| `dataKey` **`indexed`** | `bytes32` | The data key for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### OperatorAuthorizationChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorauthorizationchanged) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Event signature: `OperatorAuthorizationChanged(address,address,bytes32,bytes)` +- Event topic hash: `0x1b1b58aa2ec0cec2228b2d37124556d41f5a1f7b12f089171f896cc236671215` + +::: + +```solidity +event OperatorAuthorizationChanged( + address indexed operator, + address indexed tokenOwner, + bytes32 indexed tokenId, + bytes operatorNotificationData +); +``` + +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`. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### OperatorRevoked + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorrevoked) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Event signature: `OperatorRevoked(address,address,bytes32,bool,bytes)` +- Event topic hash: `0xc78cd419d6136f9f1c1c6aec1d3fae098cffaf8bc86314a8f2685e32fe574e3c` + +::: + +```solidity +event OperatorRevoked( + address indexed operator, + address indexed tokenOwner, + bytes32 indexed tokenId, + bool notified, + bytes operatorNotificationData +); +``` + +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`](#getoperatorsof)). | +| `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | +| `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` is revoked from operating on. | +| `notified` | `bool` | Bool indicating whether the operator has been notified or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | + +
+ +### OwnershipTransferred + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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` | - | + +
+ +### TokenIdDataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokeniddatachanged) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Event signature: `TokenIdDataChanged(bytes32,bytes32,bytes)` +- Event topic hash: `0xa6e4251f855f750545fe414f120db91c76b88def14d120969e5bb2d3f05debbb` + +::: + +```solidity +event TokenIdDataChanged( + bytes32 indexed tokenId, + bytes32 indexed dataKey, + bytes dataValue +); +``` + +Emitted when setting data for `tokenId`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------- | +| `tokenId` **`indexed`** | `bytes32` | The tokenId which data is set for. | +| `dataKey` **`indexed`** | `bytes32` | The data key for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### Transfer + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 force, + 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 | +| `force` | `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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +Reverts when one of the array parameter provided to [`setDataBatch`](#setdatabatch) function is an empty array. + +
+ +### ERC725Y_DataKeysValuesLengthMismatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function. + +
+ +### ERC725Y_MsgValueDisallowed + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#erc725y_msgvaluedisallowed) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#setdatabatch) function. + +
+ +### InvalidExtensionAddress + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#invalidextensionaddress) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `InvalidExtensionAddress(bytes)` +- Error hash: `0x42bfe79f` + +::: + +```solidity +error InvalidExtensionAddress(bytes storedData); +``` + +reverts when the bytes retrieved from the LSP17 data key is not a valid address (not 20 bytes) + +#### Parameters + +| Name | Type | Description | +| ------------ | :-----: | ----------- | +| `storedData` | `bytes` | - | + +
+ +### InvalidFunctionSelector + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#invalidfunctionselector) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `InvalidFunctionSelector(bytes)` +- Error hash: `0xe5099ee3` + +::: + +```solidity +error InvalidFunctionSelector(bytes data); +``` + +reverts when the contract is called with a function selector not valid (less than 4 bytes of data) + +#### Parameters + +| Name | Type | Description | +| ------ | :-----: | ----------- | +| `data` | `bytes` | - | + +
+ +### LSP4TokenNameNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokennamenoteditable) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 / initialized. 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 / initialized. + +
+ +### LSP4TokenSymbolNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokensymbolnoteditable) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 / initialized. 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 / initialized. + +
+ +### LSP4TokenTypeNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP4TokenTypeNotEditable()` +- Error hash: `0x4ef6d7fb` + +::: + +```solidity +error LSP4TokenTypeNotEditable(); +``` + +Reverts when trying to edit the data key `LSP4TokenType` after the digital asset contract has been deployed / initialized. The `LSP4TokenType` 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 / initialized. + +
+ +### LSP8BatchCallFailed + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8batchcallfailed) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8BatchCallFailed(uint256)` +- Error hash: `0x234eb819` + +::: + +```solidity +error LSP8BatchCallFailed(uint256 callIndex); +``` + +_Batch call failed._ + +Reverts when a batch call failed. + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ----------- | +| `callIndex` | `uint256` | - | + +
+ +### LSP8CannotSendToAddressZero + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotsendtoaddresszero) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8CannotSendToAddressZero()` +- Error hash: `0x24ecef4d` + +::: + +```solidity +error LSP8CannotSendToAddressZero(); +``` + +Reverts when trying to send token to the zero address. + +
+ +### LSP8CannotUseAddressZeroAsOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8cannotuseaddresszeroasoperator) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8invalidtransferbatch) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistenttokenid) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nonexistingoperator) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenoperator) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8nottokenowner) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceivercontractmissinglsp1interface) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 force` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8NotifyTokenReceiverIsEOA + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8notifytokenreceiveriseoa) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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 force` set as `false`. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------- | +| `tokenReceiver` | `address` | - | + +
+ +### LSP8OperatorAlreadyAuthorized + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8operatoralreadyauthorized) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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` | - | + +
+ +### LSP8RevokeOperatorNotAuthorized + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8revokeoperatornotauthorized) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8RevokeOperatorNotAuthorized(address,address,bytes32)` +- Error hash: `0x760b5acd` + +::: + +```solidity +error LSP8RevokeOperatorNotAuthorized( + address caller, + address tokenOwner, + bytes32 tokenId +); +``` + +Reverts when the call to revoke operator is not authorized. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------- | +| `caller` | `address` | - | +| `tokenOwner` | `address` | - | +| `tokenId` | `bytes32` | - | + +
+ +### LSP8TokenContractCannotHoldValue + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokencontractcannotholdvalue) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenContractCannotHoldValue()` +- Error hash: `0x61f49442` + +::: + +```solidity +error LSP8TokenContractCannotHoldValue(); +``` + +_LSP8 contract cannot receive native tokens._ + +Error occurs when sending native tokens to the LSP8 contract without sending any data. E.g. Sending value without passing a bytes4 function selector to call a LSP17 Extension. + +
+ +### LSP8TokenIdAlreadyMinted + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidalreadyminted) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.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` | - | + +
+ +### LSP8TokenIdFormatNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidformatnoteditable) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenIdFormatNotEditable()` +- Error hash: `0x3664800a` + +::: + +```solidity +error LSP8TokenIdFormatNotEditable(); +``` + +Reverts when trying to edit the data key `LSP8TokenIdFormat` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdFormat` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract. It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed. + +
+ +### LSP8TokenIdsDataEmptyArray + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdataemptyarray) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenIdsDataEmptyArray()` +- Error hash: `0x80c98305` + +::: + +```solidity +error LSP8TokenIdsDataEmptyArray(); +``` + +Reverts when empty arrays is passed to the function + +
+ +### LSP8TokenIdsDataLengthMismatch + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdatalengthmismatch) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenIdsDataLengthMismatch()` +- Error hash: `0x2fa71dfe` + +::: + +```solidity +error LSP8TokenIdsDataLengthMismatch(); +``` + +Reverts when the length of the token IDs data arrays is not equal + +
+ +### LSP8TokenOwnerCannotBeOperator + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenownercannotbeoperator) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenOwnerCannotBeOperator()` +- Error hash: `0x89fdad62` + +::: + +```solidity +error LSP8TokenOwnerCannotBeOperator(); +``` + +Reverts when trying to authorize or revoke the token's owner as an operator. + +
+ +### LSP8TokenOwnerChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenownerchanged) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `LSP8TokenOwnerChanged(bytes32,address,address)` +- Error hash: `0x5a9c31d3` + +::: + +```solidity +error LSP8TokenOwnerChanged( + bytes32 tokenId, + address oldOwner, + address newOwner +); +``` + +Reverts when the token owner changed inside the [`_beforeTokenTransfer`](#_beforetokentransfer) hook. + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `tokenId` | `bytes32` | - | +| `oldOwner` | `address` | - | +| `newOwner` | `address` | - | + +
+ +### NoExtensionFoundForFunctionSelector + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#noextensionfoundforfunctionselector) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `NoExtensionFoundForFunctionSelector(bytes4)` +- Error hash: `0xbb370b2b` + +::: + +```solidity +error NoExtensionFoundForFunctionSelector(bytes4 functionSelector); +``` + +reverts when there is no extension for the function selector being called with + +#### Parameters + +| Name | Type | Description | +| ------------------ | :------: | ----------- | +| `functionSelector` | `bytes4` | - | + +
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp8-contracts/contracts/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/LSP9Vault/LSP9Vault.md b/packages/lsp-smart-contracts/docs/contracts/LSP9Vault/LSP9Vault.md new file mode 100644 index 000000000..f66fbb91d --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/LSP9Vault/LSP9Vault.md @@ -0,0 +1,1807 @@ + + + +# LSP9Vault + +:::info Standard Specifications + +[`LSP-9-Vault`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md) + +::: +:::info Solidity implementation + +[`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) + +::: + +> Implementation of LSP9Vault built on top of [ERC725], [LSP-1-UniversalReceiver] + +Could be owned by an EOA or by a contract and is able to receive and send assets. Also allows for registering received assets by leveraging the key-value storage. + +## 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-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#constructor) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) + +::: + +```solidity +constructor(address newOwner); +``` + +_Deploying a LSP9Vault contract with owner set to address `initialOwner`._ + +Sets `initialOwner` as the contract owner and the `SupportedStandards:LSP9Vault` Data Key. The `constructor` also allows funding the contract on deployment. + +
+ +**Emitted events:** + +- [`UniversalReceiver`](#universalreceiver) event when funding the contract on deployment. +- [`OwnershipTransferred`](#ownershiptransferred) event when `initialOwner` is set as the contract [`owner`](#owner). +- [`DataChanged`](#datachanged) event when setting the [`_LSP9_SUPPORTED_STANDARDS_KEY`](#_lsp9_supported_standards_key). +- [`UniversalReceiver`](#universalreceiver) event when notifying the `initialOwner`. + +
+ +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------ | +| `newOwner` | `address` | The new owner of the contract. | + +
+ +### fallback + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#fallback) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) + +::: + +```solidity +fallback(bytes calldata callData) external payable returns (bytes memory); +``` + +_The `fallback` function was called with the following amount of native tokens: `msg.value`; and the following calldata: `callData`._ + +Achieves the goal of [LSP-17-ContractExtension] standard by extending the contract to handle calls of functions that do not exist natively, +forwarding the function call to the extension address mapped to the function being called. +This function is executed when: + +- Sending data of length less than 4 bytes to the contract. + +- The first 4 bytes of the calldata do not match any publicly callable functions from the contract ABI. + +- Receiving native tokens with some calldata. + +1. If the data is equal or longer than 4 bytes, the [ERC-725Y] storage is queried with the following data key: [_LSP17_EXTENSION_PREFIX] + `bytes4(msg.sig)` (Check [LSP-2-ERC725YJSONSchema] for encoding the data key) + +- If there is no address stored under the following data key, revert with [`NoExtensionFoundForFunctionSelector(bytes4)`](#noextensionfoundforfunctionselector). The data key relative to `bytes4(0)` is an exception, where no reverts occurs if there is no extension address stored under. This exception is made to allow users to send random data (graffiti) to the account and to be able to react on it. + +- If there is an address, forward the `msg.data` to the extension using the CALL opcode, appending 52 bytes (20 bytes of `msg.sender` and 32 bytes of `msg.value`). Return what the calls returns, or revert if the call failed. + +2. If the data sent to this function is of length less than 4 bytes (not a function selector), return. + +
+ +**Emitted events:** + +- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens and extension function selector is not found or not payable. + +
+ +
+ +### receive + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#receive) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) + +::: + +```solidity +receive() external payable; +``` + +Executed: + +- When receiving some native tokens without any additional data. + +- On empty calls to the contract. + +
+ +**Emitted events:** + +- [`UniversalReceiver`](#universalreceiver) when receiving native tokens. + +
+ +
+ +### RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#renounce_ownership_confirmation_delay) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Function signature: `RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY()` +- Function selector: `0xead3fbdf` + +::: + +```solidity +function RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY() + external + view + returns (uint256); +``` + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `uint256` | - | + +
+ +### RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#renounce_ownership_confirmation_period) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Function signature: `RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD()` +- Function selector: `0x01bfba61` + +::: + +```solidity +function RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD() + external + view + returns (uint256); +``` + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `uint256` | - | + +
+ +### VERSION + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#version) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Function signature: `VERSION()` +- Function selector: `0xffa1ad74` + +::: + +```solidity +function VERSION() external view returns (string); +``` + +_Contract version._ + +#### Returns + +| Name | Type | Description | +| ---- | :------: | ----------- | +| `0` | `string` | - | + +
+ +### acceptOwnership + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#acceptownership) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Function signature: `acceptOwnership()` +- Function selector: `0x79ba5097` + +::: + +```solidity +function acceptOwnership() external nonpayable; +``` + +_`msg.sender` is accepting ownership of contract: `address(this)`._ + +Transfer ownership of the contract from the current [`owner()`](#owner) to the [`pendingOwner()`](#pendingowner). Once this function is called: + +- The current [`owner()`](#owner) will lose access to the functions restricted to the [`owner()`](#owner) only. + +- The [`pendingOwner()`](#pendingowner) will gain access to the functions restricted to the [`owner()`](#owner) only. + +
+ +**Requirements:** + +- Only the [`pendingOwner`](#pendingowner) can call this function. +- When notifying the previous owner via LSP1, the typeId used must be the `keccak256(...)` hash of [LSP0OwnershipTransferred_SenderNotification]. +- When notifying the new owner via LSP1, the typeId used must be the `keccak256(...)` hash of [LSP0OwnershipTransferred_RecipientNotification]. + +
+ +
+ +### batchCalls + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#batchcalls) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Function signature: `batchCalls(bytes[])` +- Function selector: `0x6963d438` + +::: + +:::info + +It's not possible to send value along the functions call due to the use of `delegatecall`. + +::: + +```solidity +function batchCalls(bytes[] data) external nonpayable returns (bytes[] results); +``` + +_Executing the following batch of abi-encoded function calls on the contract: `data`._ + +Allows a caller to batch different function calls in one call. Perform a `delegatecall` on self, to call different functions with preserving the context. + +#### Parameters + +| Name | Type | Description | +| ------ | :-------: | -------------------------------------------------------------------- | +| `data` | `bytes[]` | An array of ABI encoded function calls to be called on the contract. | + +#### Returns + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------------------------------------- | +| `results` | `bytes[]` | An array of abi-encoded data returned by the functions executed. | + +
+ +### execute + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#execute) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Function signature: `execute(uint256,address,uint256,bytes)` +- Function selector: `0x44c028fe` + +::: + +:::info + +The `operationType` 4 `DELEGATECALL` is disabled by default in the LSP9 Vault. + +::: + +```solidity +function execute( + uint256 operationType, + address target, + uint256 value, + bytes data +) external payable returns (bytes); +``` + +_Calling address `target` using `operationType`, transferring `value` wei and data: `data`._ + +Generic executor function to: + +- send native tokens to any address. + +- interact with any contract by passing an abi-encoded function call in the `data` parameter. + +- deploy a contract by providing its creation bytecode in the `data` parameter. + +
+ +**Requirements:** + +- Can be only called by the [`owner`](#owner) or by an authorised address that pass the verification check performed on the owner. +- If a `value` is provided, the contract must have at least this amount in its balance to execute successfully. +- If the operation type is `CREATE` (1) or `CREATE2` (2), `target` must be `address(0)`. +- If the operation type is `STATICCALL` (3), `value` transfer is disallowed and must be 0. + +
+ +
+ +**Emitted events:** + +- [`Executed`](#executed) event for each call that uses under `operationType`: `CALL` (0) and `STATICCALL` (3). +- [`ContractCreated`](#contractcreated) event, when a contract is created under `operationType`: `CREATE` (1) and `CREATE2` (2). +- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens. + +
+ +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------------------------------------------------------------------------------------------------- | +| `operationType` | `uint256` | The operation type used: CALL = 0; CREATE = 1; CREATE2 = 2; STATICCALL = 3; DELEGATECALL = 4 | +| `target` | `address` | The address of the EOA or smart contract. (unused if a contract is created via operation type 1 or 2) | +| `value` | `uint256` | The amount of native tokens to transfer (in Wei) | +| `data` | `bytes` | The call data, or the creation bytecode of the contract to deploy if `operationType` is `1` or `2`. | + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ----------- | +| `0` | `bytes` | - | + +
+ +### executeBatch + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#executebatch) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Function signature: `executeBatch(uint256[],address[],uint256[],bytes[])` +- Function selector: `0x31858452` + +::: + +:::info + +The `operationType` 4 `DELEGATECALL` is disabled by default in the LSP9 Vault. + +::: + +```solidity +function executeBatch( + uint256[] operationsType, + address[] targets, + uint256[] values, + bytes[] datas +) external payable returns (bytes[]); +``` + +_Calling multiple addresses `targets` using `operationsType`, transferring `values` wei and data: `datas`._ + +Batch executor function that behaves the same as [`execute`](#execute) but allowing multiple operations in the same transaction. + +
+ +**Requirements:** + +- The length of the parameters provided must be equal. +- Can be only called by the [`owner`](#owner) or by an authorised address that pass the verification check performed on the owner. +- If a `value` is provided, the contract must have at least this amount in its balance to execute successfully. +- If the operation type is `CREATE` (1) or `CREATE2` (2), `target` must be `address(0)`. +- If the operation type is `STATICCALL` (3), `value` transfer is disallowed and must be 0. + +
+ +
+ +**Emitted events:** + +- [`Executed`](#executed) event for each call that uses under `operationType`: `CALL` (0) and `STATICCALL` (3). (each iteration) +- [`ContractCreated`](#contractcreated) event, when a contract is created under `operationType`: `CREATE` (1) and `CREATE2` (2). (each iteration) +- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens. + +
+ +#### Parameters + +| Name | Type | Description | +| ---------------- | :---------: | --------------------------------------------------------------------------------------------------------------- | +| `operationsType` | `uint256[]` | The list of operations type used: `CALL = 0`; `CREATE = 1`; `CREATE2 = 2`; `STATICCALL = 3`; `DELEGATECALL = 4` | +| `targets` | `address[]` | The list of addresses to call. `targets` will be unused if a contract is created (operation types 1 and 2). | +| `values` | `uint256[]` | The list of native token amounts to transfer (in Wei). | +| `datas` | `bytes[]` | The list of calldata, or the creation bytecode of the contract to deploy if `operationType` is `1` or `2`. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `bytes[]` | - | + +
+ +### getData + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#getdata) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_Reading the ERC725Y storage for data key `dataKey` returned the following value: `dataValue`._ + +Get in the ERC725Y storage the bytes data stored at a specific data key `dataKey`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------------------------------- | +| `dataKey` | `bytes32` | The data key for which to retrieve the value. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ---------------------------------------------------- | +| `dataValue` | `bytes` | The bytes value stored under the specified data key. | + +
+ +### getDataBatch + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#getdatabatch) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Reading the ERC725Y storage for data keys `dataKeys` returned the following values: `dataValues`._ + +Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys`. + +#### 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 | + +
+ +### owner + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#owner) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.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` | - | + +
+ +### pendingOwner + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#pendingowner) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Function signature: `pendingOwner()` +- Function selector: `0xe30c3978` + +::: + +:::info + +If no ownership transfer is in progress, the pendingOwner will be `address(0).`. + +::: + +```solidity +function pendingOwner() external view returns (address); +``` + +The address that ownership of the contract is transferred to. This address may use [`acceptOwnership()`](#acceptownership) to gain ownership of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `address` | - | + +
+ +### renounceOwnership + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#renounceownership) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Function signature: `renounceOwnership()` +- Function selector: `0x715018a6` + +::: + +:::danger + +Leaves the contract without an owner. Once ownership of the contract has been renounced, any functions that are restricted to be called by the owner will be permanently inaccessible, making these functions not callable anymore and unusable. + +::: + +```solidity +function renounceOwnership() external nonpayable; +``` + +_`msg.sender` is renouncing ownership of contract `address(this)`._ + +Renounce ownership of the contract in a 2-step process. + +1. The first call will initiate the process of renouncing ownership. + +2. The second call is used as a confirmation and will leave the contract without an owner. + +
+ +**Requirements:** + +- Can be only called by the [`owner`](#owner) or by an authorised address that pass the verification check performed on the owner. + +
+ +
+ +### setData + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#setdata) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +```solidity +function setData(bytes32 dataKey, bytes dataValue) external payable; +``` + +_Setting the following data key value pair in the ERC725Y storage. Data key: `dataKey`, data value: `dataValue`._ + +Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data key `dataKey`. The function is marked as payable to enable flexibility on child contracts. For instance to implement a fee mechanism for setting specific data. + +
+ +**Requirements:** + +- Can be only called by the [`owner`](#owner) or by an authorised address that pass the verification check performed on the owner. + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `dataKey` | `bytes32` | The data key for which to set a new value. | +| `dataValue` | `bytes` | The new bytes value to set. | + +
+ +### setDataBatch + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#setdatabatch) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +```solidity +function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable; +``` + +_Setting the following data key value pairs in the ERC725Y storage. Data keys: `dataKeys`, data values: `dataValues`._ + +Batch data setting function that behaves the same as [`setData`](#setdata) but allowing to set multiple data key/value pairs in the ERC725Y storage in the same transaction. + +
+ +**Requirements:** + +- Can be only called by the [`owner`](#owner) or by an authorised address that pass the verification check performed on the owner. + +
+ +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event. (on each iteration of setting data) + +
+ +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ---------------------------------------------------- | +| `dataKeys` | `bytes32[]` | An array of data keys to set bytes values for. | +| `dataValues` | `bytes[]` | An array of bytes values to set for each `dataKeys`. | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#supportsinterface) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +_Checking if this contract supports the interface defined by the `bytes4` interface ID `interfaceId`._ + +Achieves the goal of [ERC-165] to detect supported interfaces and [LSP-17-ContractExtension] by checking if the interfaceId being queried is supported on another linked extension. If the contract doesn't support the `interfaceId`, it forwards the call to the `supportsInterface` extension according to [LSP-17-ContractExtension], and checks if the extension implements the interface defined by `interfaceId`. + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ------------------------------------------------------ | +| `interfaceId` | `bytes4` | The interface ID to check if the contract supports it. | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | --------------------------------------------------------------------------------------------- | +| `0` | `bool` | `true` if this contract implements the interface defined by `interfaceId`, `false` otherwise. | + +
+ +### transferOwnership + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#transferownership) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Function signature: `transferOwnership(address)` +- Function selector: `0xf2fde38b` + +::: + +```solidity +function transferOwnership(address newOwner) external nonpayable; +``` + +_Transfer ownership initiated by `newOwner`._ + +Initiate the process of transferring ownership of the contract by setting the new owner as the pending owner. If the new owner is a contract that supports + implements LSP1, this will also attempt to notify the new owner that ownership has been transferred to them by calling the [`universalReceiver()`](#universalreceiver) function on the `newOwner` contract. + +
+ +**Requirements:** + +- Can be only called by the [`owner`](#owner) or by an authorised address that pass the verification check performed on the owner. +- When notifying the new owner via LSP1, the `typeId` used must be the `keccak256(...)` hash of [LSP0OwnershipTransferStarted]. +- Pending owner cannot accept ownership in the same tx via the LSP1 hook. + +
+ +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------------------------- | +| `newOwner` | `address` | The address of the new owner. | + +
+ +### universalReceiver + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#universalreceiver) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Function signature: `universalReceiver(bytes32,bytes)` +- Function selector: `0x6bb56a14` + +::: + +```solidity +function universalReceiver( + bytes32 typeId, + bytes receivedData +) external payable returns (bytes returnedValues); +``` + +_Notifying the contract by calling its `universalReceiver` function with the following informations: typeId: `typeId`; data: `data`._ + +Achieves the goal of [LSP-1-UniversalReceiver] by allowing the account to be notified about incoming/outgoing transactions and enabling reactions to these actions. The reaction is achieved by having two external contracts ([LSP1UniversalReceiverDelegate]) that react on the whole transaction and on the specific typeId, respectively. The function performs the following steps: + +1. Query the [ERC-725Y] storage with the data key [_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY]. + +- If there is an address stored under the data key, check if this address supports the LSP1 interfaceId. + +- If yes, call this address with the typeId and data (params), along with additional calldata consisting of 20 bytes of `msg.sender` and 32 bytes of `msg.value`. If not, continue the execution of the function. + +2. Query the [ERC-725Y] storage with the data key [_LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX] + `bytes32(typeId)`. (Check [LSP-2-ERC725YJSONSchema] for encoding the data key) + +- If there is an address stored under the data key, check if this address supports the LSP1 interfaceId. + +- If yes, call this address with the typeId and data (params), along with additional calldata consisting of 20 bytes of `msg.sender` and 32 bytes of `msg.value`. If not, continue the execution of the function. + +
+ +**Emitted events:** + +- [`UniversalReceiver`](#universalreceiver) event with the function parameters, call options, and the response of the UniversalReceiverDelegates (URD) contract that was called. + +
+ +#### Parameters + +| Name | Type | Description | +| -------------- | :-------: | -------------------------- | +| `typeId` | `bytes32` | The type of call received. | +| `receivedData` | `bytes` | The data received. | + +#### Returns + +| Name | Type | Description | +| ---------------- | :-----: | ------------------------------------------------------------------------------------------------------- | +| `returnedValues` | `bytes` | The ABI encoded return value of the LSP1UniversalReceiverDelegate call and the LSP1TypeIdDelegate call. | + +
+ +## 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. + +
+ +### \_execute + +:::caution Warning + +Providing operation type DELEGATECALL (4) as argument will result in custom error [`ERC725X_UnknownOperationType(4)`](#erc725x_unknownoperationtype) + +::: + +```solidity +function _execute( + uint256 operationType, + address target, + uint256 value, + bytes data +) internal nonpayable returns (bytes); +``` + +This function overrides the [`ERC725XCore`](#erc725xcore) internal [`_execute`](#_execute) function to disable operation type DELEGATECALL (4). + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ------------------------------------------------------------------------------------------------------ | +| `operationType` | `uint256` | The operation type used: CALL = 0; CREATE = 1; CREATE2 = 2; STATICCALL = 3. | +| `target` | `address` | The address of the EOA or smart contract. (unused if a contract is created via operation type 1 or 2). | +| `value` | `uint256` | The amount of native tokens to transfer (in Wei). | +| `data` | `bytes` | The call data, or the creation bytecode of the contract to deploy if `operationType` is `1` or `2`. | + +
+ +### \_executeBatch + +```solidity +function _executeBatch( + uint256[] operationsType, + address[] targets, + uint256[] values, + bytes[] datas +) internal nonpayable returns (bytes[]); +``` + +check each `operationType` provided in the batch and perform the associated low-level opcode after checking for requirements (see [`executeBatch`](#executebatch)). + +
+ +### \_executeCall + +```solidity +function _executeCall( + address target, + uint256 value, + bytes data +) internal nonpayable returns (bytes result); +``` + +Perform low-level call (operation type = 0) + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------- | +| `target` | `address` | The address on which call is executed | +| `value` | `uint256` | The value to be sent with the call | +| `data` | `bytes` | The data to be sent with the call | + +#### Returns + +| Name | Type | Description | +| -------- | :-----: | ---------------------- | +| `result` | `bytes` | The data from the call | + +
+ +### \_executeStaticCall + +```solidity +function _executeStaticCall( + address target, + bytes data +) internal nonpayable returns (bytes result); +``` + +Perform low-level staticcall (operation type = 3) + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------------- | +| `target` | `address` | The address on which staticcall is executed | +| `data` | `bytes` | The data to be sent with the staticcall | + +#### Returns + +| Name | Type | Description | +| -------- | :-----: | ------------------------------------- | +| `result` | `bytes` | The data returned from the staticcall | + +
+ +### \_executeDelegateCall + +:::caution Warning + +The `msg.value` should not be trusted for any method called with `operationType`: `DELEGATECALL` (4). + +::: + +```solidity +function _executeDelegateCall( + address target, + bytes data +) internal nonpayable returns (bytes result); +``` + +Perform low-level delegatecall (operation type = 4) + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | --------------------------------------------- | +| `target` | `address` | The address on which delegatecall is executed | +| `data` | `bytes` | The data to be sent with the delegatecall | + +#### Returns + +| Name | Type | Description | +| -------- | :-----: | --------------------------------------- | +| `result` | `bytes` | The data returned from the delegatecall | + +
+ +### \_deployCreate + +```solidity +function _deployCreate( + uint256 value, + bytes creationCode +) internal nonpayable returns (bytes newContract); +``` + +Deploy a contract using the `CREATE` opcode (operation type = 1) + +#### Parameters + +| Name | Type | Description | +| -------------- | :-------: | ---------------------------------------------------------------------------------- | +| `value` | `uint256` | The value to be sent to the contract created | +| `creationCode` | `bytes` | The contract creation bytecode to deploy appended with the constructor argument(s) | + +#### Returns + +| Name | Type | Description | +| ------------- | :-----: | -------------------------------------------- | +| `newContract` | `bytes` | The address of the contract created as bytes | + +
+ +### \_deployCreate2 + +```solidity +function _deployCreate2( + uint256 value, + bytes creationCode +) internal nonpayable returns (bytes newContract); +``` + +Deploy a contract using the `CREATE2` opcode (operation type = 2) + +#### Parameters + +| Name | Type | Description | +| -------------- | :-------: | ----------------------------------------------------------------------------------------------------- | +| `value` | `uint256` | The value to be sent to the contract created | +| `creationCode` | `bytes` | The contract creation bytecode to deploy appended with the constructor argument(s) and a bytes32 salt | + +#### Returns + +| Name | Type | Description | +| ------------- | :-----: | -------------------------------------------- | +| `newContract` | `bytes` | The address of the contract created as bytes | + +
+ +### \_getData + +```solidity +function _getData(bytes32 dataKey) internal view returns (bytes dataValue); +``` + +Read the value stored under a specific `dataKey` inside the underlying ERC725Y storage, +represented as a mapping of `bytes32` data keys mapped to their `bytes` data values. + +```solidity +mapping(bytes32 => bytes) _store +``` + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------------------------------------------------------------------- | +| `dataKey` | `bytes32` | A bytes32 data key to read the associated `bytes` value from the store. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ----------------------------------------------------------------------------- | +| `dataValue` | `bytes` | The `bytes` value associated with the given `dataKey` in the ERC725Y storage. | + +
+ +### \_setData + +```solidity +function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; +``` + +Write a `dataValue` to the underlying ERC725Y storage, represented as a mapping of +`bytes32` data keys mapped to their `bytes` data values. + +```solidity +mapping(bytes32 => bytes) _store +``` + +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event emitted after a successful `setData` call. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------------------------------------------- | +| `dataKey` | `bytes32` | A bytes32 data key to write the associated `bytes` value to the store. | +| `dataValue` | `bytes` | The `bytes` value to associate with the given `dataKey` in the ERC725Y storage. | + +
+ +### \_transferOwnership + +```solidity +function _transferOwnership(address newOwner) internal nonpayable; +``` + +Set the pending owner of the contract and cancel any renounce ownership process that was previously started. + +
+ +**Requirements:** + +- `newOwner` cannot be the address of the contract itself. + +
+ +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------- | +| `newOwner` | `address` | The address of the new pending owner. | + +
+ +### \_acceptOwnership + +```solidity +function _acceptOwnership() internal nonpayable; +``` + +Set the pending owner of the contract as the new owner. + +
+ +### \_renounceOwnership + +```solidity +function _renounceOwnership() internal nonpayable; +``` + +Initiate or confirm the process of renouncing ownership after a specific delay of blocks have passed. + +
+ +### \_supportsInterfaceInERC165Extension + +```solidity +function _supportsInterfaceInERC165Extension( + bytes4 interfaceId +) internal view returns (bool); +``` + +Returns whether the interfaceId being checked is supported in the extension of the +[`supportsInterface`](#supportsinterface) selector. +To be used by extendable contracts wishing to extend the ERC165 interfaceIds originally +supported by reading whether the interfaceId queried is supported in the `supportsInterface` +extension if the extension is set, if not it returns false. + +
+ +### \_getExtensionAndForwardValue + +```solidity +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); +``` + +Returns the extension address stored under the following data key: + +- [`_LSP17_EXTENSION_PREFIX`](#_lsp17_extension_prefix) + `` (Check [LSP2-ERC725YJSONSchema] for encoding the data key). + +- If no extension is stored, returns the address(0). + +
+ +### \_fallbackLSP17Extendable + +:::tip Hint + +This function does not forward to the extension contract the `msg.value` received by the contract that inherits `LSP17Extendable`. +If you would like to forward the `msg.value` to the extension contract, you can override the code of this internal function as follow: + +```solidity +(bool success, bytes memory result) = extension.call{value: msg.value}( + abi.encodePacked(callData, msg.sender, msg.value) +); +``` + +::: + +```solidity +function _fallbackLSP17Extendable( + bytes callData +) internal nonpayable returns (bytes); +``` + +Forwards the call to an extension mapped to a function selector. +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being +called on the account. If there is no extension, the `address(0)` will be returned. +Forwards the value if the extension is payable. +Reverts if there is no extension for the function being called, except for the `bytes4(0)` function selector, which passes even if there is no extension for it. +If there is an extension for the function selector being called, it calls the extension with the +`CALL` opcode, passing the `msg.data` appended with the 20 bytes of the [`msg.sender`](#msg.sender) and 32 bytes of the `msg.value`. + +
+ +### \_validateAndIdentifyCaller + +```solidity +function _validateAndIdentifyCaller() internal view returns (bool isURD); +``` + +Internal method restricting the call to the owner of the contract and the UniversalReceiverDelegate + +
+ +## Events + +### ContractCreated + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#contractcreated) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Event signature: `ContractCreated(uint256,address,uint256,bytes32)` +- Event topic hash: `0xa1fb700aaee2ae4a2ff6f91ce7eba292f89c2f5488b8ec4c5c5c8150692595c3` + +::: + +```solidity +event ContractCreated( + uint256 indexed operationType, + address indexed contractAddress, + uint256 value, + bytes32 indexed salt +); +``` + +_Deployed new contract at address `contractAddress` and funded with `value` wei (deployed using opcode: `operationType`)._ + +Emitted when a new contract was created and deployed. + +#### Parameters + +| Name | Type | Description | +| ------------------------------- | :-------: | ----------------------------------------------------------------------------------------------------------------------------------------- | +| `operationType` **`indexed`** | `uint256` | The opcode used to deploy the contract (`CREATE` or `CREATE2`). | +| `contractAddress` **`indexed`** | `address` | The created contract address. | +| `value` | `uint256` | The amount of native tokens (in Wei) sent to fund the created contract on deployment. | +| `salt` **`indexed`** | `bytes32` | The salt used to deterministically deploy the contract (`CREATE2` only). If `CREATE` opcode is used, the salt value will be `bytes32(0)`. | + +
+ +### DataChanged + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#datachanged) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_The following data key/value pair has been changed in the ERC725Y storage: Data key: `dataKey`, data value: `dataValue`._ + +Emitted when data at a specific `dataKey` was changed to a new value `dataValue`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------- | +| `dataKey` **`indexed`** | `bytes32` | The data key for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### Executed + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#executed) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Event signature: `Executed(uint256,address,uint256,bytes4)` +- Event topic hash: `0x4810874456b8e6487bd861375cf6abd8e1c8bb5858c8ce36a86a04dabfac199e` + +::: + +```solidity +event Executed( + uint256 indexed operationType, + address indexed target, + uint256 value, + bytes4 indexed selector +); +``` + +_Called address `target` using `operationType` with `value` wei and `data`._ + +Emitted when calling an address `target` (EOA or contract) with `value`. + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ---------------------------------------------------------------------------------------------------- | +| `operationType` **`indexed`** | `uint256` | The low-level call opcode used to call the `target` address (`CALL`, `STATICALL` or `DELEGATECALL`). | +| `target` **`indexed`** | `address` | The address to call. `target` will be unused if a contract is created (operation types 1 and 2). | +| `value` | `uint256` | The amount of native tokens transferred along the call (in Wei). | +| `selector` **`indexed`** | `bytes4` | The first 4 bytes (= function selector) of the data sent with the call. | + +
+ +### OwnershipRenounced + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#ownershiprenounced) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Event signature: `OwnershipRenounced()` +- Event topic hash: `0xd1f66c3d2bc1993a86be5e3d33709d98f0442381befcedd29f578b9b2506b1ce` + +::: + +```solidity +event OwnershipRenounced(); +``` + +_Successfully renounced ownership of the contract. This contract is now owned by anyone, it's owner is `address(0)`._ + +Emitted when the ownership of the contract has been renounced. + +
+ +### OwnershipTransferStarted + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#ownershiptransferstarted) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Event signature: `OwnershipTransferStarted(address,address)` +- Event topic hash: `0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700` + +::: + +```solidity +event OwnershipTransferStarted( + address indexed previousOwner, + address indexed newOwner +); +``` + +_The transfer of ownership of the contract was initiated. Pending new owner set to: `newOwner`._ + +Emitted when [`transferOwnership(..)`](#transferownership) was called and the first step of transferring ownership completed successfully which leads to [`pendingOwner`](#pendingowner) being updated. + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ---------------------------------- | +| `previousOwner` **`indexed`** | `address` | The address of the previous owner. | +| `newOwner` **`indexed`** | `address` | The address of the new owner. | + +
+ +### OwnershipTransferred + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#ownershiptransferred) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.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` | - | + +
+ +### RenounceOwnershipStarted + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#renounceownershipstarted) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Event signature: `RenounceOwnershipStarted()` +- Event topic hash: `0x81b7f830f1f0084db6497c486cbe6974c86488dcc4e3738eab94ab6d6b1653e7` + +::: + +```solidity +event RenounceOwnershipStarted(); +``` + +_Ownership renouncement initiated._ + +Emitted when starting the [`renounceOwnership(..)`](#renounceownership) 2-step process. + +
+ +### UniversalReceiver + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#universalreceiver) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Event signature: `UniversalReceiver(address,uint256,bytes32,bytes,bytes)` +- Event topic hash: `0x9c3ba68eb5742b8e3961aea0afc7371a71bf433c8a67a831803b64c064a178c2` + +::: + +```solidity +event UniversalReceiver( + address indexed from, + uint256 indexed value, + bytes32 indexed typeId, + bytes receivedData, + bytes returnedValue +); +``` + +\*Address `from` called the `universalReceiver(...)` function while sending `value` LYX. Notification type (typeId): `typeId` + +- Data received: `receivedData`.\* + +Emitted when the [`universalReceiver`](#universalreceiver) function was called with a specific `typeId` and some `receivedData` + +#### Parameters + +| Name | Type | Description | +| ---------------------- | :-------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` **`indexed`** | `address` | The address of the EOA or smart contract that called the [`universalReceiver(...)`](#universalreceiver) function. | +| `value` **`indexed`** | `uint256` | The amount sent to the [`universalReceiver(...)`](#universalreceiver) function. | +| `typeId` **`indexed`** | `bytes32` | A `bytes32` unique identifier (= _"hook"_)that describe the type of notification, information or transaction received by the contract. Can be related to a specific standard or a hook. | +| `receivedData` | `bytes` | Any arbitrary data that was sent to the [`universalReceiver(...)`](#universalreceiver) function. | +| `returnedValue` | `bytes` | The value returned by the [`universalReceiver(...)`](#universalreceiver) function. | + +
+ +## Errors + +### ERC725X_ContractDeploymentFailed + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#erc725x_contractdeploymentfailed) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Error signature: `ERC725X_ContractDeploymentFailed()` +- Error hash: `0x0b07489b` + +::: + +```solidity +error ERC725X_ContractDeploymentFailed(); +``` + +Reverts when contract deployment failed via [`execute`](#execute) or [`executeBatch`](#executebatch) functions, This error can occur using either operation type 1 (`CREATE`) or 2 (`CREATE2`). + +
+ +### ERC725X_CreateOperationsRequireEmptyRecipientAddress + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#erc725x_createoperationsrequireemptyrecipientaddress) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Error signature: `ERC725X_CreateOperationsRequireEmptyRecipientAddress()` +- Error hash: `0x3041824a` + +::: + +```solidity +error ERC725X_CreateOperationsRequireEmptyRecipientAddress(); +``` + +Reverts when passing a `to` address that is not `address(0)` (= address zero) while deploying a contract via [`execute`](#execute) or [`executeBatch`](#executebatch) functions. This error can occur using either operation type 1 (`CREATE`) or 2 (`CREATE2`). + +
+ +### ERC725X_ExecuteParametersEmptyArray + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#erc725x_executeparametersemptyarray) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Error signature: `ERC725X_ExecuteParametersEmptyArray()` +- Error hash: `0xe9ad2b5f` + +::: + +```solidity +error ERC725X_ExecuteParametersEmptyArray(); +``` + +Reverts when one of the array parameter provided to the [`executeBatch`](#executebatch) function is an empty array. + +
+ +### ERC725X_ExecuteParametersLengthMismatch + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#erc725x_executeparameterslengthmismatch) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Error signature: `ERC725X_ExecuteParametersLengthMismatch()` +- Error hash: `0x3ff55f4d` + +::: + +```solidity +error ERC725X_ExecuteParametersLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `operationTypes`, `targets` addresses, `values`, and `datas` array parameters provided when calling the [`executeBatch`](#executebatch) function. + +
+ +### ERC725X_InsufficientBalance + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#erc725x_insufficientbalance) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Error signature: `ERC725X_InsufficientBalance(uint256,uint256)` +- Error hash: `0x0df9a8f8` + +::: + +```solidity +error ERC725X_InsufficientBalance(uint256 balance, uint256 value); +``` + +Reverts when trying to send more native tokens `value` than available in current `balance`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------- | +| `balance` | `uint256` | The balance of native tokens of the ERC725X smart contract. | +| `value` | `uint256` | The amount of native tokens sent via `ERC725X.execute(...)`/`ERC725X.executeBatch(...)` that is greater than the contract's `balance`. | + +
+ +### ERC725X_MsgValueDisallowedInStaticCall + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#erc725x_msgvaluedisallowedinstaticcall) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Error signature: `ERC725X_MsgValueDisallowedInStaticCall()` +- Error hash: `0x72f2bc6a` + +::: + +```solidity +error ERC725X_MsgValueDisallowedInStaticCall(); +``` + +Reverts when trying to send native tokens (`value` / `values[]` parameter of [`execute`](#execute) or [`executeBatch`](#executebatch) functions) while making a `staticcall` (`operationType == 3`). Sending native tokens via `staticcall` is not allowed because it is a state changing operation. + +
+ +### ERC725X_NoContractBytecodeProvided + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#erc725x_nocontractbytecodeprovided) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Error signature: `ERC725X_NoContractBytecodeProvided()` +- Error hash: `0xb81cd8d9` + +::: + +```solidity +error ERC725X_NoContractBytecodeProvided(); +``` + +Reverts when no contract bytecode was provided as parameter when trying to deploy a contract via [`execute`](#execute) or [`executeBatch`](#executebatch). This error can occur using either operation type 1 (`CREATE`) or 2 (`CREATE2`). + +
+ +### ERC725X_UnknownOperationType + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#erc725x_unknownoperationtype) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Error signature: `ERC725X_UnknownOperationType(uint256)` +- Error hash: `0x7583b3bc` + +::: + +```solidity +error ERC725X_UnknownOperationType(uint256 operationTypeProvided); +``` + +Reverts when the `operationTypeProvided` is none of the default operation types available. (CALL = 0; CREATE = 1; CREATE2 = 2; STATICCALL = 3; DELEGATECALL = 4) + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ------------------------------------------------------------------------------------------------------ | +| `operationTypeProvided` | `uint256` | The unrecognised operation type number provided to `ERC725X.execute(...)`/`ERC725X.executeBatch(...)`. | + +
+ +### ERC725Y_DataKeysValuesLengthMismatch + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function. + +
+ +### ERC725Y_MsgValueDisallowed + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#erc725y_msgvaluedisallowed) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Error signature: `ERC725Y_MsgValueDisallowed()` +- Error hash: `0xf36ba737` + +::: + +```solidity +error ERC725Y_MsgValueDisallowed(); +``` + +Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#setdatabatch) function. + +
+ +### LSP14CallerNotPendingOwner + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#lsp14callernotpendingowner) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Error signature: `LSP14CallerNotPendingOwner(address)` +- Error hash: `0x451e4528` + +::: + +```solidity +error LSP14CallerNotPendingOwner(address caller); +``` + +Reverts when the `caller` that is trying to accept ownership of the contract is not the pending owner. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------------- | +| `caller` | `address` | The address that tried to accept ownership. | + +
+ +### LSP14CannotTransferOwnershipToSelf + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#lsp14cannottransferownershiptoself) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Error signature: `LSP14CannotTransferOwnershipToSelf()` +- Error hash: `0xe052a6f8` + +::: + +```solidity +error LSP14CannotTransferOwnershipToSelf(); +``` + +_Cannot transfer ownership to the address of the contract itself._ + +Reverts when trying to transfer ownership to the `address(this)`. + +
+ +### LSP14MustAcceptOwnershipInSeparateTransaction + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#lsp14mustacceptownershipinseparatetransaction) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Error signature: `LSP14MustAcceptOwnershipInSeparateTransaction()` +- Error hash: `0x5758dd07` + +::: + +```solidity +error LSP14MustAcceptOwnershipInSeparateTransaction(); +``` + +_Cannot accept ownership in the same transaction with [`transferOwnership(...)`](#transferownership)._ + +Reverts when pending owner accept ownership in the same transaction of transferring ownership. + +
+ +### LSP14NotInRenounceOwnershipInterval + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#lsp14notinrenounceownershipinterval) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Error signature: `LSP14NotInRenounceOwnershipInterval(uint256,uint256)` +- Error hash: `0x1b080942` + +::: + +```solidity +error LSP14NotInRenounceOwnershipInterval( + uint256 renounceOwnershipStart, + uint256 renounceOwnershipEnd +); +``` + +_Cannot confirm ownership renouncement yet. The ownership renouncement is allowed from: `renounceOwnershipStart` until: `renounceOwnershipEnd`._ + +Reverts when trying to renounce ownership before the initial confirmation delay. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ----------------------------------------------------------------------- | +| `renounceOwnershipStart` | `uint256` | The start timestamp when one can confirm the renouncement of ownership. | +| `renounceOwnershipEnd` | `uint256` | The end timestamp when one can confirm the renouncement of ownership. | + +
+ +### LSP1DelegateNotAllowedToSetDataKey + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#lsp1delegatenotallowedtosetdatakey) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Error signature: `LSP1DelegateNotAllowedToSetDataKey(bytes32)` +- Error hash: `0x199611f1` + +::: + +```solidity +error LSP1DelegateNotAllowedToSetDataKey(bytes32 dataKey); +``` + +_The `LSP1UniversalReceiverDelegate` is not allowed to set the following data key: `dataKey`._ + +Reverts when the Vault version of [LSP1UniversalReceiverDelegate] sets @lukso/lsp1-contracts/6/17 Data Keys. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------------------------------------------------------------------------------- | +| `dataKey` | `bytes32` | The data key that the Vault version of [LSP1UniversalReceiverDelegate] is not allowed to set. | + +
+ +### NoExtensionFoundForFunctionSelector + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#noextensionfoundforfunctionselector) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Error signature: `NoExtensionFoundForFunctionSelector(bytes4)` +- Error hash: `0xbb370b2b` + +::: + +```solidity +error NoExtensionFoundForFunctionSelector(bytes4 functionSelector); +``` + +reverts when there is no extension for the function selector being called with + +#### Parameters + +| Name | Type | Description | +| ------------------ | :------: | ----------- | +| `functionSelector` | `bytes4` | - | + +
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-9-Vault.md#ownablecallernottheowner) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp9-contracts/contracts/LSP9Vault.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
diff --git a/packages/lsp-smart-contracts/docs/contracts/UniversalProfile/UniversalProfile.md b/packages/lsp-smart-contracts/docs/contracts/UniversalProfile/UniversalProfile.md new file mode 100644 index 000000000..593901c01 --- /dev/null +++ b/packages/lsp-smart-contracts/docs/contracts/UniversalProfile/UniversalProfile.md @@ -0,0 +1,1869 @@ + + + +# UniversalProfile + +:::info Standard Specifications + +[`UniversalProfile`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md) + +::: +:::info Solidity implementation + +[`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) + +::: + +> implementation of a LUKSO's Universal Profile based on LSP3 + +Implementation of the ERC725Account + LSP1 universalReceiver + +## 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: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#constructor) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) + +::: + +```solidity +constructor(address initialOwner); +``` + +_Deploying a UniversalProfile contract with owner set to address `initialOwner`._ + +Set `initialOwner` as the contract owner and the `SupportedStandards:LSP3Profile` data key in the ERC725Y data key/value store. + +- The `constructor` is payable and allows funding the contract on deployment. + +- The `initialOwner` will then be allowed to call protected functions marked with the `onlyOwner` modifier. + +
+ +**Emitted events:** + +- [`UniversalReceiver`](#universalreceiver) event when funding the contract on deployment. +- [`OwnershipTransferred`](#ownershiptransferred) event when `initialOwner` is set as the contract [`owner`](#owner). +- [`DataChanged`](#datachanged) event when setting the [`_LSP3_SUPPORTED_STANDARDS_KEY`](#_lsp3_supported_standards_key). + +
+ +#### Parameters + +| Name | Type | Description | +| -------------- | :-------: | ------------------------- | +| `initialOwner` | `address` | the owner of the contract | + +
+ +### fallback + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#fallback) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) + +::: + +```solidity +fallback() external payable; +``` + +
+ +### receive + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#receive) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) + +::: + +```solidity +receive() external payable; +``` + +
+ +### RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#renounce_ownership_confirmation_delay) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Function signature: `RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY()` +- Function selector: `0xead3fbdf` + +::: + +```solidity +function RENOUNCE_OWNERSHIP_CONFIRMATION_DELAY() + external + view + returns (uint256); +``` + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `uint256` | - | + +
+ +### RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#renounce_ownership_confirmation_period) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Function signature: `RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD()` +- Function selector: `0x01bfba61` + +::: + +```solidity +function RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD() + external + view + returns (uint256); +``` + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `uint256` | - | + +
+ +### VERSION + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#version) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Function signature: `VERSION()` +- Function selector: `0xffa1ad74` + +::: + +```solidity +function VERSION() external view returns (string); +``` + +_Contract version._ + +#### Returns + +| Name | Type | Description | +| ---- | :------: | ----------- | +| `0` | `string` | - | + +
+ +### acceptOwnership + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#acceptownership) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Function signature: `acceptOwnership()` +- Function selector: `0x79ba5097` + +::: + +```solidity +function acceptOwnership() external nonpayable; +``` + +_`msg.sender` is accepting ownership of contract: `address(this)`._ + +Transfer ownership of the contract from the current [`owner()`](#owner) to the [`pendingOwner()`](#pendingowner). Once this function is called: + +- The current [`owner()`](#owner) will lose access to the functions restricted to the [`owner()`](#owner) only. + +- The [`pendingOwner()`](#pendingowner) will gain access to the functions restricted to the [`owner()`](#owner) only. + +
+ +**Requirements:** + +- Only the [`pendingOwner`](#pendingowner) can call this function. +- When notifying the previous owner via LSP1, the typeId used must be the `keccak256(...)` hash of [LSP0OwnershipTransferred_SenderNotification]. +- When notifying the new owner via LSP1, the typeId used must be the `keccak256(...)` hash of [LSP0OwnershipTransferred_RecipientNotification]. + +
+ +
+ +### batchCalls + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#batchcalls) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Function signature: `batchCalls(bytes[])` +- Function selector: `0x6963d438` + +::: + +:::info + +It's not possible to send value along the functions call due to the use of `delegatecall`. + +::: + +```solidity +function batchCalls(bytes[] data) external nonpayable returns (bytes[] results); +``` + +_Executing the following batch of abi-encoded function calls on the contract: `data`._ + +Allows a caller to batch different function calls in one call. Perform a `delegatecall` on self, to call different functions with preserving the context. + +#### Parameters + +| Name | Type | Description | +| ------ | :-------: | -------------------------------------------------------------------- | +| `data` | `bytes[]` | An array of ABI encoded function calls to be called on the contract. | + +#### Returns + +| Name | Type | Description | +| --------- | :-------: | ---------------------------------------------------------------- | +| `results` | `bytes[]` | An array of abi-encoded data returned by the functions executed. | + +
+ +### execute + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#execute) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Function signature: `execute(uint256,address,uint256,bytes)` +- Function selector: `0x44c028fe` + +::: + +```solidity +function execute( + uint256 operationType, + address target, + uint256 value, + bytes data +) external payable returns (bytes); +``` + +_Calling address `target` using `operationType`, transferring `value` wei and data: `data`._ + +Generic executor function to: + +- send native tokens to any address. + +- interact with any contract by passing an abi-encoded function call in the `data` parameter. + +- deploy a contract by providing its creation bytecode in the `data` parameter. + +
+ +**Requirements:** + +- Can be only called by the [`owner`](#owner) or by an authorised address that pass the verification check performed on the owner. +- If a `value` is provided, the contract must have at least this amount in its balance to execute successfully. +- If the operation type is `CREATE` (1) or `CREATE2` (2), `target` must be `address(0)`. +- If the operation type is `STATICCALL` (3) or `DELEGATECALL` (4), `value` transfer is disallowed and must be 0. + +
+ +
+ +**Emitted events:** + +- [`Executed`](#executed) event for each call that uses under `operationType`: `CALL` (0), `STATICCALL` (3) and `DELEGATECALL` (4). +- [`ContractCreated`](#contractcreated) event, when a contract is created under `operationType`: `CREATE` (1) and `CREATE2` (2). +- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens. + +
+ +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ----------------------------------------------------------------------------------------------------- | +| `operationType` | `uint256` | The operation type used: CALL = 0; CREATE = 1; CREATE2 = 2; STATICCALL = 3; DELEGATECALL = 4 | +| `target` | `address` | The address of the EOA or smart contract. (unused if a contract is created via operation type 1 or 2) | +| `value` | `uint256` | The amount of native tokens to transfer (in Wei) | +| `data` | `bytes` | The call data, or the creation bytecode of the contract to deploy if `operationType` is `1` or `2`. | + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ----------- | +| `0` | `bytes` | - | + +
+ +### executeBatch + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#executebatch) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Function signature: `executeBatch(uint256[],address[],uint256[],bytes[])` +- Function selector: `0x31858452` + +::: + +:::caution Warning + +- The `msg.value` should not be trusted for any method called within the batch with `operationType`: `DELEGATECALL` (4). + +::: + +```solidity +function executeBatch( + uint256[] operationsType, + address[] targets, + uint256[] values, + bytes[] datas +) external payable returns (bytes[]); +``` + +_Calling multiple addresses `targets` using `operationsType`, transferring `values` wei and data: `datas`._ + +Batch executor function that behaves the same as [`execute`](#execute) but allowing multiple operations in the same transaction. + +
+ +**Requirements:** + +- The length of the parameters provided must be equal. +- Can be only called by the [`owner`](#owner) or by an authorised address that pass the verification check performed on the owner. +- If a `value` is provided, the contract must have at least this amount in its balance to execute successfully. +- If the operation type is `CREATE` (1) or `CREATE2` (2), `target` must be `address(0)`. +- If the operation type is `STATICCALL` (3) or `DELEGATECALL` (4), `value` transfer is disallowed and must be 0. + +
+ +
+ +**Emitted events:** + +- [`Executed`](#executed) event for each call that uses under `operationType`: `CALL` (0), `STATICCALL` (3) and `DELEGATECALL` (4). (each iteration) +- [`ContractCreated`](#contractcreated) event, when a contract is created under `operationType`: `CREATE` (1) and `CREATE2` (2) (each iteration) +- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens. + +
+ +#### Parameters + +| Name | Type | Description | +| ---------------- | :---------: | --------------------------------------------------------------------------------------------------------------- | +| `operationsType` | `uint256[]` | The list of operations type used: `CALL = 0`; `CREATE = 1`; `CREATE2 = 2`; `STATICCALL = 3`; `DELEGATECALL = 4` | +| `targets` | `address[]` | The list of addresses to call. `targets` will be unused if a contract is created (operation types 1 and 2). | +| `values` | `uint256[]` | The list of native token amounts to transfer (in Wei). | +| `datas` | `bytes[]` | The list of calldata, or the creation bytecode of the contract to deploy if `operationType` is `1` or `2`. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `bytes[]` | - | + +
+ +### getData + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#getdata) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Function signature: `getData(bytes32)` +- Function selector: `0x54f6127f` + +::: + +```solidity +function getData(bytes32 dataKey) external view returns (bytes dataValue); +``` + +_Reading the ERC725Y storage for data key `dataKey` returned the following value: `dataValue`._ + +Get in the ERC725Y storage the bytes data stored at a specific data key `dataKey`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | --------------------------------------------- | +| `dataKey` | `bytes32` | The data key for which to retrieve the value. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ---------------------------------------------------- | +| `dataValue` | `bytes` | The bytes value stored under the specified data key. | + +
+ +### getDataBatch + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#getdatabatch) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Function signature: `getDataBatch(bytes32[])` +- Function selector: `0xdedff9c6` + +::: + +```solidity +function getDataBatch( + bytes32[] dataKeys +) external view returns (bytes[] dataValues); +``` + +_Reading the ERC725Y storage for data keys `dataKeys` returned the following values: `dataValues`._ + +Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys`. + +#### 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 | + +
+ +### isValidSignature + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#isvalidsignature) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Function signature: `isValidSignature(bytes32,bytes)` +- Function selector: `0x1626ba7e` + +::: + +:::caution Warning + +This function does not enforce by default the inclusion of the address of this contract in the signature digest. It is recommended that protocols or applications using this contract include the targeted address (= this contract) in the data to sign. To ensure that a signature is valid for a specific LSP0ERC725Account and prevent signatures from the same EOA to be replayed across different LSP0ERC725Accounts. + +::: + +```solidity +function isValidSignature( + bytes32 dataHash, + bytes signature +) external view returns (bytes4 returnedStatus); +``` + +_Achieves the goal of [EIP-1271] by validating signatures of smart contracts according to their own logic._ + +Handles two cases: + +1. If the owner is an EOA, recovers an address from the hash and the signature provided: + +- Returns the `_ERC1271_SUCCESSVALUE` if the address recovered is the same as the owner, indicating that it was a valid signature. + +- If the address is different, it returns the `_ERC1271_FAILVALUE` indicating that the signature is not valid. + +2. If the owner is a smart contract, it forwards the call of [`isValidSignature()`](#isvalidsignature) to the owner contract: + +- If the contract fails or returns the `_ERC1271_FAILVALUE`, the [`isValidSignature()`](#isvalidsignature) on the account returns the `_ERC1271_FAILVALUE`, indicating that the signature is not valid. + +- If the [`isValidSignature()`](#isvalidsignature) on the owner returned the `_ERC1271_SUCCESSVALUE`, the [`isValidSignature()`](#isvalidsignature) on the account returns the `_ERC1271_SUCCESSVALUE`, indicating that it's a valid signature. + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------------------------ | +| `dataHash` | `bytes32` | The hash of the data to be validated. | +| `signature` | `bytes` | A signature that can validate the previous parameter (Hash). | + +#### Returns + +| Name | Type | Description | +| ---------------- | :------: | ----------------------------------------------------------------- | +| `returnedStatus` | `bytes4` | A `bytes4` value that indicates if the signature is valid or not. | + +
+ +### owner + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#owner) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.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` | - | + +
+ +### pendingOwner + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#pendingowner) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Function signature: `pendingOwner()` +- Function selector: `0xe30c3978` + +::: + +:::info + +If no ownership transfer is in progress, the pendingOwner will be `address(0).`. + +::: + +```solidity +function pendingOwner() external view returns (address); +``` + +The address that ownership of the contract is transferred to. This address may use [`acceptOwnership()`](#acceptownership) to gain ownership of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------- | +| `0` | `address` | - | + +
+ +### renounceOwnership + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#renounceownership) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Function signature: `renounceOwnership()` +- Function selector: `0x715018a6` + +::: + +:::danger + +Leaves the contract without an owner. Once ownership of the contract has been renounced, any functions that are restricted to be called by the owner or an address allowed by the owner will be permanently inaccessible, making these functions not callable anymore and unusable. + +::: + +```solidity +function renounceOwnership() external nonpayable; +``` + +_`msg.sender` is renouncing ownership of contract `address(this)`._ + +Renounce ownership of the contract in a 2-step process. + +1. The first call will initiate the process of renouncing ownership. + +2. The second call is used as a confirmation and will leave the contract without an owner. + +
+ +**Requirements:** + +- Can be only called by the [`owner`](#owner) or by an authorised address that pass the verification check performed on the owner. + +
+ +
+ +### setData + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#setdata) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Function signature: `setData(bytes32,bytes)` +- Function selector: `0x7f23690c` + +::: + +```solidity +function setData(bytes32 dataKey, bytes dataValue) external payable; +``` + +_Setting the following data key value pair in the ERC725Y storage. Data key: `dataKey`, data value: `dataValue`._ + +Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data key `dataKey`. The function is marked as payable to enable flexibility on child contracts. For instance to implement a fee mechanism for setting specific data. + +
+ +**Requirements:** + +- Can be only called by the [`owner`](#owner) or by an authorised address that pass the verification check performed on the owner. + +
+ +
+ +**Emitted events:** + +- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens. +- [`DataChanged`](#datachanged) event. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------ | +| `dataKey` | `bytes32` | The data key for which to set a new value. | +| `dataValue` | `bytes` | The new bytes value to set. | + +
+ +### setDataBatch + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#setdatabatch) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Function signature: `setDataBatch(bytes32[],bytes[])` +- Function selector: `0x97902421` + +::: + +```solidity +function setDataBatch(bytes32[] dataKeys, bytes[] dataValues) external payable; +``` + +_Setting the following data key value pairs in the ERC725Y storage. Data keys: `dataKeys`, data values: `dataValues`._ + +Batch data setting function that behaves the same as [`setData`](#setdata) but allowing to set multiple data key/value pairs in the ERC725Y storage in the same transaction. + +
+ +**Requirements:** + +- Can be only called by the [`owner`](#owner) or by an authorised address that pass the verification check performed on the owner. + +
+ +
+ +**Emitted events:** + +- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens. +- [`DataChanged`](#datachanged) event. (on each iteration of setting data) + +
+ +#### Parameters + +| Name | Type | Description | +| ------------ | :---------: | ---------------------------------------------------- | +| `dataKeys` | `bytes32[]` | An array of data keys to set bytes values for. | +| `dataValues` | `bytes[]` | An array of bytes values to set for each `dataKeys`. | + +
+ +### supportsInterface + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#supportsinterface) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Function signature: `supportsInterface(bytes4)` +- Function selector: `0x01ffc9a7` + +::: + +```solidity +function supportsInterface(bytes4 interfaceId) external view returns (bool); +``` + +_Checking if this contract supports the interface defined by the `bytes4` interface ID `interfaceId`._ + +Achieves the goal of [ERC-165] to detect supported interfaces and [LSP-17-ContractExtension] by checking if the interfaceId being queried is supported on another linked extension. If the contract doesn't support the `interfaceId`, it forwards the call to the `supportsInterface` extension according to [LSP-17-ContractExtension], and checks if the extension implements the interface defined by `interfaceId`. + +#### Parameters + +| Name | Type | Description | +| ------------- | :------: | ------------------------------------------------------ | +| `interfaceId` | `bytes4` | The interface ID to check if the contract supports it. | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | --------------------------------------------------------------------------------------------- | +| `0` | `bool` | `true` if this contract implements the interface defined by `interfaceId`, `false` otherwise. | + +
+ +### transferOwnership + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#transferownership) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Function signature: `transferOwnership(address)` +- Function selector: `0xf2fde38b` + +::: + +```solidity +function transferOwnership(address pendingNewOwner) external nonpayable; +``` + +_Transfer ownership initiated by `newOwner`._ + +Initiate the process of transferring ownership of the contract by setting the new owner as the pending owner. If the new owner is a contract that supports + implements LSP1, this will also attempt to notify the new owner that ownership has been transferred to them by calling the [`universalReceiver()`](#universalreceiver) function on the `newOwner` contract. + +
+ +**Requirements:** + +- Can be only called by the [`owner`](#owner) or by an authorised address that pass the verification check performed on the owner. +- When notifying the new owner via LSP1, the `typeId` used must be the `keccak256(...)` hash of [LSP0OwnershipTransferStarted]. +- Pending owner cannot accept ownership in the same tx via the LSP1 hook. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------------- | :-------: | ----------- | +| `pendingNewOwner` | `address` | - | + +
+ +### universalReceiver + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#universalreceiver) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Function signature: `universalReceiver(bytes32,bytes)` +- Function selector: `0x6bb56a14` + +::: + +```solidity +function universalReceiver( + bytes32 typeId, + bytes receivedData +) external payable returns (bytes returnedValues); +``` + +_Notifying the contract by calling its `universalReceiver` function with the following informations: typeId: `typeId`; data: `data`._ + +Achieves the goal of [LSP-1-UniversalReceiver] by allowing the account to be notified about incoming/outgoing transactions and enabling reactions to these actions. The reaction is achieved by having two external contracts ([LSP1UniversalReceiverDelegate]) that react on the whole transaction and on the specific typeId, respectively. The function performs the following steps: + +1. Query the [ERC-725Y] storage with the data key [_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY]. + +- If there is an address stored under the data key, check if this address supports the LSP1 interfaceId. + +- If yes, call this address with the typeId and data (params), along with additional calldata consisting of 20 bytes of `msg.sender` and 32 bytes of `msg.value`. If not, continue the execution of the function. + +2. Query the [ERC-725Y] storage with the data key [_LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX] + `bytes32(typeId)`. (Check [LSP-2-ERC725YJSONSchema] for encoding the data key) + +- If there is an address stored under the data key, check if this address supports the LSP1 interfaceId. + +- If yes, call this address with the typeId and data (params), along with additional calldata consisting of 20 bytes of `msg.sender` and 32 bytes of `msg.value`. If not, continue the execution of the function. This function delegates internally the handling of native tokens to the [`universalReceiver`](#universalreceiver) function itself passing `_TYPEID_LSP0_VALUE_RECEIVED` as typeId and the calldata as received data. + +
+ +**Emitted events:** + +- [`UniversalReceiver`](#universalreceiver) when receiving native tokens. +- [`UniversalReceiver`](#universalreceiver) event with the function parameters, call options, and the response of the UniversalReceiverDelegates (URD) contract that was called. + +
+ +#### Parameters + +| Name | Type | Description | +| -------------- | :-------: | -------------------------- | +| `typeId` | `bytes32` | The type of call received. | +| `receivedData` | `bytes` | The data received. | + +#### Returns + +| Name | Type | Description | +| ---------------- | :-----: | ------------------------------------------------------------------------------------------------------- | +| `returnedValues` | `bytes` | The ABI encoded return value of the LSP1UniversalReceiverDelegate call and the LSP1TypeIdDelegate call. | + +
+ +## 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. + +
+ +### \_execute + +```solidity +function _execute( + uint256 operationType, + address target, + uint256 value, + bytes data +) internal nonpayable returns (bytes); +``` + +check the `operationType` provided and perform the associated low-level opcode after checking for requirements (see [`execute`](#execute)). + +
+ +### \_executeBatch + +```solidity +function _executeBatch( + uint256[] operationsType, + address[] targets, + uint256[] values, + bytes[] datas +) internal nonpayable returns (bytes[]); +``` + +check each `operationType` provided in the batch and perform the associated low-level opcode after checking for requirements (see [`executeBatch`](#executebatch)). + +
+ +### \_executeCall + +```solidity +function _executeCall( + address target, + uint256 value, + bytes data +) internal nonpayable returns (bytes result); +``` + +Perform low-level call (operation type = 0) + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------- | +| `target` | `address` | The address on which call is executed | +| `value` | `uint256` | The value to be sent with the call | +| `data` | `bytes` | The data to be sent with the call | + +#### Returns + +| Name | Type | Description | +| -------- | :-----: | ---------------------- | +| `result` | `bytes` | The data from the call | + +
+ +### \_executeStaticCall + +```solidity +function _executeStaticCall( + address target, + bytes data +) internal nonpayable returns (bytes result); +``` + +Perform low-level staticcall (operation type = 3) + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------------- | +| `target` | `address` | The address on which staticcall is executed | +| `data` | `bytes` | The data to be sent with the staticcall | + +#### Returns + +| Name | Type | Description | +| -------- | :-----: | ------------------------------------- | +| `result` | `bytes` | The data returned from the staticcall | + +
+ +### \_executeDelegateCall + +:::caution Warning + +The `msg.value` should not be trusted for any method called with `operationType`: `DELEGATECALL` (4). + +::: + +```solidity +function _executeDelegateCall( + address target, + bytes data +) internal nonpayable returns (bytes result); +``` + +Perform low-level delegatecall (operation type = 4) + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | --------------------------------------------- | +| `target` | `address` | The address on which delegatecall is executed | +| `data` | `bytes` | The data to be sent with the delegatecall | + +#### Returns + +| Name | Type | Description | +| -------- | :-----: | --------------------------------------- | +| `result` | `bytes` | The data returned from the delegatecall | + +
+ +### \_deployCreate + +```solidity +function _deployCreate( + uint256 value, + bytes creationCode +) internal nonpayable returns (bytes newContract); +``` + +Deploy a contract using the `CREATE` opcode (operation type = 1) + +#### Parameters + +| Name | Type | Description | +| -------------- | :-------: | ---------------------------------------------------------------------------------- | +| `value` | `uint256` | The value to be sent to the contract created | +| `creationCode` | `bytes` | The contract creation bytecode to deploy appended with the constructor argument(s) | + +#### Returns + +| Name | Type | Description | +| ------------- | :-----: | -------------------------------------------- | +| `newContract` | `bytes` | The address of the contract created as bytes | + +
+ +### \_deployCreate2 + +```solidity +function _deployCreate2( + uint256 value, + bytes creationCode +) internal nonpayable returns (bytes newContract); +``` + +Deploy a contract using the `CREATE2` opcode (operation type = 2) + +#### Parameters + +| Name | Type | Description | +| -------------- | :-------: | ----------------------------------------------------------------------------------------------------- | +| `value` | `uint256` | The value to be sent to the contract created | +| `creationCode` | `bytes` | The contract creation bytecode to deploy appended with the constructor argument(s) and a bytes32 salt | + +#### Returns + +| Name | Type | Description | +| ------------- | :-----: | -------------------------------------------- | +| `newContract` | `bytes` | The address of the contract created as bytes | + +
+ +### \_getData + +```solidity +function _getData(bytes32 dataKey) internal view returns (bytes dataValue); +``` + +Read the value stored under a specific `dataKey` inside the underlying ERC725Y storage, +represented as a mapping of `bytes32` data keys mapped to their `bytes` data values. + +```solidity +mapping(bytes32 => bytes) _store +``` + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | ----------------------------------------------------------------------- | +| `dataKey` | `bytes32` | A bytes32 data key to read the associated `bytes` value from the store. | + +#### Returns + +| Name | Type | Description | +| ----------- | :-----: | ----------------------------------------------------------------------------- | +| `dataValue` | `bytes` | The `bytes` value associated with the given `dataKey` in the ERC725Y storage. | + +
+ +### \_setData + +```solidity +function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; +``` + +Write a `dataValue` to the underlying ERC725Y storage, represented as a mapping of +`bytes32` data keys mapped to their `bytes` data values. + +```solidity +mapping(bytes32 => bytes) _store +``` + +
+ +**Emitted events:** + +- [`DataChanged`](#datachanged) event emitted after a successful `setData` call. + +
+ +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------------------------------------------- | +| `dataKey` | `bytes32` | A bytes32 data key to write the associated `bytes` value to the store. | +| `dataValue` | `bytes` | The `bytes` value to associate with the given `dataKey` in the ERC725Y storage. | + +
+ +### \_transferOwnership + +```solidity +function _transferOwnership(address newOwner) internal nonpayable; +``` + +Set the pending owner of the contract and cancel any renounce ownership process that was previously started. + +
+ +**Requirements:** + +- `newOwner` cannot be the address of the contract itself. + +
+ +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ------------------------------------- | +| `newOwner` | `address` | The address of the new pending owner. | + +
+ +### \_acceptOwnership + +```solidity +function _acceptOwnership() internal nonpayable; +``` + +Set the pending owner of the contract as the new owner. + +
+ +### \_renounceOwnership + +```solidity +function _renounceOwnership() internal nonpayable; +``` + +Initiate or confirm the process of renouncing ownership after a specific delay of blocks have passed. + +
+ +### \_supportsInterfaceInERC165Extension + +```solidity +function _supportsInterfaceInERC165Extension( + bytes4 interfaceId +) internal view returns (bool); +``` + +Returns whether the interfaceId being checked is supported in the extension of the +[`supportsInterface`](#supportsinterface) selector. +To be used by extendable contracts wishing to extend the ERC165 interfaceIds originally +supported by reading whether the interfaceId queried is supported in the `supportsInterface` +extension if the extension is set, if not it returns false. + +
+ +### \_getExtensionAndForwardValue + +```solidity +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); +``` + +Returns the extension address and the boolean indicating whether to forward the value received to the extension, stored under the following data key: + +- [`_LSP17_EXTENSION_PREFIX`](#_lsp17_extension_prefix) + `` (Check [LSP2-ERC725YJSONSchema] for encoding the data key). + +- If no extension is stored, returns the address(0). + +- If the stored value is 20 bytes, return false for the boolean + +
+ +### \_fallbackLSP17Extendable + +:::tip Hint + +If you would like to forward the `msg.value` to the extension contract, you should store an additional `0x01` byte after the address of the extension under the corresponding LSP17 data key. + +::: + +```solidity +function _fallbackLSP17Extendable( + bytes callData +) internal nonpayable returns (bytes); +``` + +Forwards the call to an extension mapped to a function selector. +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being +called on the account. If there is no extension, the `address(0)` will be returned. +Forwards the value sent with the call to the extension if the function selector is mapped to a payable extension. +Reverts if there is no extension for the function being called, except for the `bytes4(0)` function selector, which passes even if there is no extension for it. +If there is an extension for the function selector being called, it calls the extension with the +`CALL` opcode, passing the `msg.data` appended with the 20 bytes of the [`msg.sender`](#msg.sender) and 32 bytes of the `msg.value`. + +
+ +### \_verifyCall + +```solidity +function _verifyCall( + address logicVerifier +) internal nonpayable returns (bool verifyAfter); +``` + +Calls [`lsp20VerifyCall`](#lsp20verifycall) function on the logicVerifier. + +
+ +### \_verifyCallResult + +```solidity +function _verifyCallResult( + address logicVerifier, + bytes callResult +) internal nonpayable; +``` + +Calls [`lsp20VerifyCallResult`](#lsp20verifycallresult) function on the logicVerifier. + +
+ +### \_revertWithLSP20DefaultError + +```solidity +function _revertWithLSP20DefaultError( + bool postCall, + bytes returnedData +) internal pure; +``` + +
+ +## Events + +### ContractCreated + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#contractcreated) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Event signature: `ContractCreated(uint256,address,uint256,bytes32)` +- Event topic hash: `0xa1fb700aaee2ae4a2ff6f91ce7eba292f89c2f5488b8ec4c5c5c8150692595c3` + +::: + +```solidity +event ContractCreated( + uint256 indexed operationType, + address indexed contractAddress, + uint256 value, + bytes32 indexed salt +); +``` + +_Deployed new contract at address `contractAddress` and funded with `value` wei (deployed using opcode: `operationType`)._ + +Emitted when a new contract was created and deployed. + +#### Parameters + +| Name | Type | Description | +| ------------------------------- | :-------: | ----------------------------------------------------------------------------------------------------------------------------------------- | +| `operationType` **`indexed`** | `uint256` | The opcode used to deploy the contract (`CREATE` or `CREATE2`). | +| `contractAddress` **`indexed`** | `address` | The created contract address. | +| `value` | `uint256` | The amount of native tokens (in Wei) sent to fund the created contract on deployment. | +| `salt` **`indexed`** | `bytes32` | The salt used to deterministically deploy the contract (`CREATE2` only). If `CREATE` opcode is used, the salt value will be `bytes32(0)`. | + +
+ +### DataChanged + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#datachanged) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_The following data key/value pair has been changed in the ERC725Y storage: Data key: `dataKey`, data value: `dataValue`._ + +Emitted when data at a specific `dataKey` was changed to a new value `dataValue`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | -------------------------------------------- | +| `dataKey` **`indexed`** | `bytes32` | The data key for which a bytes value is set. | +| `dataValue` | `bytes` | The value to set for the given data key. | + +
+ +### Executed + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#executed) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Event signature: `Executed(uint256,address,uint256,bytes4)` +- Event topic hash: `0x4810874456b8e6487bd861375cf6abd8e1c8bb5858c8ce36a86a04dabfac199e` + +::: + +```solidity +event Executed( + uint256 indexed operationType, + address indexed target, + uint256 value, + bytes4 indexed selector +); +``` + +_Called address `target` using `operationType` with `value` wei and `data`._ + +Emitted when calling an address `target` (EOA or contract) with `value`. + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ---------------------------------------------------------------------------------------------------- | +| `operationType` **`indexed`** | `uint256` | The low-level call opcode used to call the `target` address (`CALL`, `STATICALL` or `DELEGATECALL`). | +| `target` **`indexed`** | `address` | The address to call. `target` will be unused if a contract is created (operation types 1 and 2). | +| `value` | `uint256` | The amount of native tokens transferred along the call (in Wei). | +| `selector` **`indexed`** | `bytes4` | The first 4 bytes (= function selector) of the data sent with the call. | + +
+ +### OwnershipRenounced + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#ownershiprenounced) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Event signature: `OwnershipRenounced()` +- Event topic hash: `0xd1f66c3d2bc1993a86be5e3d33709d98f0442381befcedd29f578b9b2506b1ce` + +::: + +```solidity +event OwnershipRenounced(); +``` + +_Successfully renounced ownership of the contract. This contract is now owned by anyone, it's owner is `address(0)`._ + +Emitted when the ownership of the contract has been renounced. + +
+ +### OwnershipTransferStarted + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#ownershiptransferstarted) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Event signature: `OwnershipTransferStarted(address,address)` +- Event topic hash: `0x38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700` + +::: + +```solidity +event OwnershipTransferStarted( + address indexed previousOwner, + address indexed newOwner +); +``` + +_The transfer of ownership of the contract was initiated. Pending new owner set to: `newOwner`._ + +Emitted when [`transferOwnership(..)`](#transferownership) was called and the first step of transferring ownership completed successfully which leads to [`pendingOwner`](#pendingowner) being updated. + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | :-------: | ---------------------------------- | +| `previousOwner` **`indexed`** | `address` | The address of the previous owner. | +| `newOwner` **`indexed`** | `address` | The address of the new owner. | + +
+ +### OwnershipTransferred + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#ownershiptransferred) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.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` | - | + +
+ +### RenounceOwnershipStarted + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#renounceownershipstarted) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Event signature: `RenounceOwnershipStarted()` +- Event topic hash: `0x81b7f830f1f0084db6497c486cbe6974c86488dcc4e3738eab94ab6d6b1653e7` + +::: + +```solidity +event RenounceOwnershipStarted(); +``` + +_Ownership renouncement initiated._ + +Emitted when starting the [`renounceOwnership(..)`](#renounceownership) 2-step process. + +
+ +### UniversalReceiver + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#universalreceiver) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Event signature: `UniversalReceiver(address,uint256,bytes32,bytes,bytes)` +- Event topic hash: `0x9c3ba68eb5742b8e3961aea0afc7371a71bf433c8a67a831803b64c064a178c2` + +::: + +```solidity +event UniversalReceiver( + address indexed from, + uint256 indexed value, + bytes32 indexed typeId, + bytes receivedData, + bytes returnedValue +); +``` + +\*Address `from` called the `universalReceiver(...)` function while sending `value` LYX. Notification type (typeId): `typeId` + +- Data received: `receivedData`.\* + +Emitted when the [`universalReceiver`](#universalreceiver) function was called with a specific `typeId` and some `receivedData` + +#### Parameters + +| Name | Type | Description | +| ---------------------- | :-------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `from` **`indexed`** | `address` | The address of the EOA or smart contract that called the [`universalReceiver(...)`](#universalreceiver) function. | +| `value` **`indexed`** | `uint256` | The amount sent to the [`universalReceiver(...)`](#universalreceiver) function. | +| `typeId` **`indexed`** | `bytes32` | A `bytes32` unique identifier (= _"hook"_)that describe the type of notification, information or transaction received by the contract. Can be related to a specific standard or a hook. | +| `receivedData` | `bytes` | Any arbitrary data that was sent to the [`universalReceiver(...)`](#universalreceiver) function. | +| `returnedValue` | `bytes` | The value returned by the [`universalReceiver(...)`](#universalreceiver) function. | + +
+ +## Errors + +### ERC725X_ContractDeploymentFailed + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#erc725x_contractdeploymentfailed) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Error signature: `ERC725X_ContractDeploymentFailed()` +- Error hash: `0x0b07489b` + +::: + +```solidity +error ERC725X_ContractDeploymentFailed(); +``` + +Reverts when contract deployment failed via [`execute`](#execute) or [`executeBatch`](#executebatch) functions, This error can occur using either operation type 1 (`CREATE`) or 2 (`CREATE2`). + +
+ +### ERC725X_CreateOperationsRequireEmptyRecipientAddress + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#erc725x_createoperationsrequireemptyrecipientaddress) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Error signature: `ERC725X_CreateOperationsRequireEmptyRecipientAddress()` +- Error hash: `0x3041824a` + +::: + +```solidity +error ERC725X_CreateOperationsRequireEmptyRecipientAddress(); +``` + +Reverts when passing a `to` address that is not `address(0)` (= address zero) while deploying a contract via [`execute`](#execute) or [`executeBatch`](#executebatch) functions. This error can occur using either operation type 1 (`CREATE`) or 2 (`CREATE2`). + +
+ +### ERC725X_ExecuteParametersEmptyArray + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#erc725x_executeparametersemptyarray) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Error signature: `ERC725X_ExecuteParametersEmptyArray()` +- Error hash: `0xe9ad2b5f` + +::: + +```solidity +error ERC725X_ExecuteParametersEmptyArray(); +``` + +Reverts when one of the array parameter provided to the [`executeBatch`](#executebatch) function is an empty array. + +
+ +### ERC725X_ExecuteParametersLengthMismatch + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#erc725x_executeparameterslengthmismatch) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Error signature: `ERC725X_ExecuteParametersLengthMismatch()` +- Error hash: `0x3ff55f4d` + +::: + +```solidity +error ERC725X_ExecuteParametersLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `operationTypes`, `targets` addresses, `values`, and `datas` array parameters provided when calling the [`executeBatch`](#executebatch) function. + +
+ +### ERC725X_InsufficientBalance + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#erc725x_insufficientbalance) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Error signature: `ERC725X_InsufficientBalance(uint256,uint256)` +- Error hash: `0x0df9a8f8` + +::: + +```solidity +error ERC725X_InsufficientBalance(uint256 balance, uint256 value); +``` + +Reverts when trying to send more native tokens `value` than available in current `balance`. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------------------------------------------------------------------------------------------------------- | +| `balance` | `uint256` | The balance of native tokens of the ERC725X smart contract. | +| `value` | `uint256` | The amount of native tokens sent via `ERC725X.execute(...)`/`ERC725X.executeBatch(...)` that is greater than the contract's `balance`. | + +
+ +### ERC725X_MsgValueDisallowedInDelegateCall + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#erc725x_msgvaluedisallowedindelegatecall) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Error signature: `ERC725X_MsgValueDisallowedInDelegateCall()` +- Error hash: `0x5ac83135` + +::: + +```solidity +error ERC725X_MsgValueDisallowedInDelegateCall(); +``` + +Reverts when trying to send native tokens (`value` / `values[]` parameter of [`execute`](#execute) or [`executeBatch`](#executebatch) functions) while making a `delegatecall` (`operationType == 4`). Sending native tokens via `staticcall` is not allowed because `msg.value` is persisting. + +
+ +### ERC725X_MsgValueDisallowedInStaticCall + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#erc725x_msgvaluedisallowedinstaticcall) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Error signature: `ERC725X_MsgValueDisallowedInStaticCall()` +- Error hash: `0x72f2bc6a` + +::: + +```solidity +error ERC725X_MsgValueDisallowedInStaticCall(); +``` + +Reverts when trying to send native tokens (`value` / `values[]` parameter of [`execute`](#execute) or [`executeBatch`](#executebatch) functions) while making a `staticcall` (`operationType == 3`). Sending native tokens via `staticcall` is not allowed because it is a state changing operation. + +
+ +### ERC725X_NoContractBytecodeProvided + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#erc725x_nocontractbytecodeprovided) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Error signature: `ERC725X_NoContractBytecodeProvided()` +- Error hash: `0xb81cd8d9` + +::: + +```solidity +error ERC725X_NoContractBytecodeProvided(); +``` + +Reverts when no contract bytecode was provided as parameter when trying to deploy a contract via [`execute`](#execute) or [`executeBatch`](#executebatch). This error can occur using either operation type 1 (`CREATE`) or 2 (`CREATE2`). + +
+ +### ERC725X_UnknownOperationType + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#erc725x_unknownoperationtype) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Error signature: `ERC725X_UnknownOperationType(uint256)` +- Error hash: `0x7583b3bc` + +::: + +```solidity +error ERC725X_UnknownOperationType(uint256 operationTypeProvided); +``` + +Reverts when the `operationTypeProvided` is none of the default operation types available. (CALL = 0; CREATE = 1; CREATE2 = 2; STATICCALL = 3; DELEGATECALL = 4) + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | ------------------------------------------------------------------------------------------------------ | +| `operationTypeProvided` | `uint256` | The unrecognised operation type number provided to `ERC725X.execute(...)`/`ERC725X.executeBatch(...)`. | + +
+ +### ERC725Y_DataKeysValuesEmptyArray + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#erc725y_datakeysvaluesemptyarray) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Error signature: `ERC725Y_DataKeysValuesEmptyArray()` +- Error hash: `0x97da5f95` + +::: + +```solidity +error ERC725Y_DataKeysValuesEmptyArray(); +``` + +Reverts when one of the array parameter provided to [`setDataBatch`](#setdatabatch) function is an empty array. + +
+ +### ERC725Y_DataKeysValuesLengthMismatch + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#erc725y_datakeysvalueslengthmismatch) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Error signature: `ERC725Y_DataKeysValuesLengthMismatch()` +- Error hash: `0x3bcc8979` + +::: + +```solidity +error ERC725Y_DataKeysValuesLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `datakeys` and `dataValues` array parameters provided when calling the [`setDataBatch`](#setdatabatch) function. + +
+ +### LSP14CallerNotPendingOwner + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#lsp14callernotpendingowner) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Error signature: `LSP14CallerNotPendingOwner(address)` +- Error hash: `0x451e4528` + +::: + +```solidity +error LSP14CallerNotPendingOwner(address caller); +``` + +Reverts when the `caller` that is trying to accept ownership of the contract is not the pending owner. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------------- | +| `caller` | `address` | The address that tried to accept ownership. | + +
+ +### LSP14CannotTransferOwnershipToSelf + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#lsp14cannottransferownershiptoself) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Error signature: `LSP14CannotTransferOwnershipToSelf()` +- Error hash: `0xe052a6f8` + +::: + +```solidity +error LSP14CannotTransferOwnershipToSelf(); +``` + +_Cannot transfer ownership to the address of the contract itself._ + +Reverts when trying to transfer ownership to the `address(this)`. + +
+ +### LSP14MustAcceptOwnershipInSeparateTransaction + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#lsp14mustacceptownershipinseparatetransaction) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Error signature: `LSP14MustAcceptOwnershipInSeparateTransaction()` +- Error hash: `0x5758dd07` + +::: + +```solidity +error LSP14MustAcceptOwnershipInSeparateTransaction(); +``` + +_Cannot accept ownership in the same transaction with [`transferOwnership(...)`](#transferownership)._ + +Reverts when pending owner accept ownership in the same transaction of transferring ownership. + +
+ +### LSP14NotInRenounceOwnershipInterval + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#lsp14notinrenounceownershipinterval) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Error signature: `LSP14NotInRenounceOwnershipInterval(uint256,uint256)` +- Error hash: `0x1b080942` + +::: + +```solidity +error LSP14NotInRenounceOwnershipInterval( + uint256 renounceOwnershipStart, + uint256 renounceOwnershipEnd +); +``` + +_Cannot confirm ownership renouncement yet. The ownership renouncement is allowed from: `renounceOwnershipStart` until: `renounceOwnershipEnd`._ + +Reverts when trying to renounce ownership before the initial confirmation delay. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ----------------------------------------------------------------------- | +| `renounceOwnershipStart` | `uint256` | The start timestamp when one can confirm the renouncement of ownership. | +| `renounceOwnershipEnd` | `uint256` | The end timestamp when one can confirm the renouncement of ownership. | + +
+ +### LSP20CallVerificationFailed + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#lsp20callverificationfailed) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Error signature: `LSP20CallVerificationFailed(bool,bytes4)` +- Error hash: `0x9d6741e3` + +::: + +```solidity +error LSP20CallVerificationFailed(bool postCall, bytes4 returnedStatus); +``` + +reverts when the call to the owner does not return the LSP20 success value + +#### Parameters + +| Name | Type | Description | +| ---------------- | :------: | ------------------------------------------------------- | +| `postCall` | `bool` | True if the execution call was done, False otherwise | +| `returnedStatus` | `bytes4` | The bytes4 decoded data returned by the logic verifier. | + +
+ +### LSP20CallingVerifierFailed + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#lsp20callingverifierfailed) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Error signature: `LSP20CallingVerifierFailed(bool)` +- Error hash: `0x8c6a8ae3` + +::: + +```solidity +error LSP20CallingVerifierFailed(bool postCall); +``` + +reverts when the call to the owner fail with no revert reason + +#### Parameters + +| Name | Type | Description | +| ---------- | :----: | ---------------------------------------------------- | +| `postCall` | `bool` | True if the execution call was done, False otherwise | + +
+ +### LSP20EOACannotVerifyCall + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#lsp20eoacannotverifycall) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Error signature: `LSP20EOACannotVerifyCall(address)` +- Error hash: `0x0c392301` + +::: + +```solidity +error LSP20EOACannotVerifyCall(address logicVerifier); +``` + +Reverts when the logic verifier is an Externally Owned Account (EOA) that cannot return the LSP20 success value. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | --------------------------------- | +| `logicVerifier` | `address` | The address of the logic verifier | + +
+ +### NoExtensionFoundForFunctionSelector + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#noextensionfoundforfunctionselector) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/universalprofile-contracts/contracts/UniversalProfile.sol) +- Error signature: `NoExtensionFoundForFunctionSelector(bytes4)` +- Error hash: `0xbb370b2b` + +::: + +```solidity +error NoExtensionFoundForFunctionSelector(bytes4 functionSelector); +``` + +reverts when there is no extension for the function selector being called with + +#### Parameters + +| Name | Type | Description | +| ------------------ | :------: | ----------- | +| `functionSelector` | `bytes4` | - | + +
diff --git a/packages/lsp-smart-contracts/docs/libraries/LSP10ReceivedVaults/LSP10Utils.md b/packages/lsp-smart-contracts/docs/libraries/LSP10ReceivedVaults/LSP10Utils.md new file mode 100644 index 000000000..c67a1a257 --- /dev/null +++ b/packages/lsp-smart-contracts/docs/libraries/LSP10ReceivedVaults/LSP10Utils.md @@ -0,0 +1,113 @@ + + + +# LSP10Utils + +:::info Standard Specifications + +[`LSP-10-ReceivedVaults`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-10-ReceivedVaults.md) + +::: +:::info Solidity implementation + +[`LSP10Utils.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp10-contracts/contracts/LSP10Utils.sol) + +::: + +> LSP10 Utility library. + +LSP5Utils is a library of functions that can be used to register and manage vaults received by an ERC725Y smart contract. Based on the LSP10 Received Vaults standard. + +## 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. + +### generateReceivedVaultKeys + +:::caution Warning + +This function returns empty arrays when encountering errors. Otherwise the arrays will contain 3 data keys and 3 data values. + +::: + +```solidity +function generateReceivedVaultKeys( + address receiver, + address vaultAddress +) internal view returns (bytes32[] lsp10DataKeys, bytes[] lsp10DataValues); +``` + +Generate an array of data keys/values pairs to be set on the receiver address after receiving vaults. + +#### Parameters + +| Name | Type | Description | +| -------------- | :-------: | ------------------------------------------------------------------------------ | +| `receiver` | `address` | The address receiving the vault and where the LSP10 data keys should be added. | +| `vaultAddress` | `address` | The address of the vault being received. | + +#### Returns + +| Name | Type | Description | +| ----------------- | :---------: | --------------------------------------------------------------------- | +| `lsp10DataKeys` | `bytes32[]` | An array data keys used to update the [LSP-10-ReceivedAssets] data. | +| `lsp10DataValues` | `bytes[]` | An array data values used to update the [LSP-10-ReceivedAssets] data. | + +
+ +### generateSentVaultKeys + +:::caution Warning + +Returns empty arrays when encountering errors. Otherwise the arrays must have at least 3 data keys and 3 data values. + +::: + +```solidity +function generateSentVaultKeys( + address sender, + address vaultAddress +) internal view returns (bytes32[] lsp10DataKeys, bytes[] lsp10DataValues); +``` + +Generate an array of data key/value pairs to be set on the sender address after sending vaults. + +#### Parameters + +| Name | Type | Description | +| -------------- | :-------: | ------------------------------------------------------------------------------ | +| `sender` | `address` | The address sending the vault and where the LSP10 data keys should be updated. | +| `vaultAddress` | `address` | The address of the vault that is being sent. | + +#### Returns + +| Name | Type | Description | +| ----------------- | :---------: | --------------------------------------------------------------------- | +| `lsp10DataKeys` | `bytes32[]` | An array data keys used to update the [LSP-10-ReceivedAssets] data. | +| `lsp10DataValues` | `bytes[]` | An array data values used to update the [LSP-10-ReceivedAssets] data. | + +
+ +### getLSP10ArrayLengthBytes + +```solidity +function getLSP10ArrayLengthBytes(contract IERC725Y erc725YContract) internal view returns (bytes); +``` + +Get the raw bytes value stored under the `_LSP10_VAULTS_ARRAY_KEY`. + +#### Parameters + +| Name | Type | Description | +| ----------------- | :-----------------: | ----------------------------------------------- | +| `erc725YContract` | `contract IERC725Y` | The contract to query the ERC725Y storage from. | + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ----------------------------------------------- | +| `0` | `bytes` | The raw bytes value stored under this data key. | + +
diff --git a/packages/lsp-smart-contracts/docs/libraries/LSP17ContractExtension/LSP17Utils.md b/packages/lsp-smart-contracts/docs/libraries/LSP17ContractExtension/LSP17Utils.md new file mode 100644 index 000000000..2a453dd95 --- /dev/null +++ b/packages/lsp-smart-contracts/docs/libraries/LSP17ContractExtension/LSP17Utils.md @@ -0,0 +1,38 @@ + + + +# LSP17Utils + +:::info Standard Specifications + +[`LSP-17-ContractExtension`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-17-ContractExtension.md) + +::: +:::info Solidity implementation + +[`LSP17Utils.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp17contractextension-contracts/contracts/LSP17Extendable.sol) + +::: + +> LSP17 Utility library to check an extension + +## 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. + +### isExtension + +```solidity +function isExtension( + uint256 parametersLengthWithOffset, + uint256 msgDataLength +) internal pure returns (bool); +``` + +Returns whether the call is a normal call or an extension call by checking if +the `parametersLengthWithOffset` with an additional of 52 bytes supposed msg.sender +and msg.value appended is equal to the msgDataLength + +
diff --git a/packages/lsp-smart-contracts/docs/libraries/LSP1UniversalReceiver/LSP1Utils.md b/packages/lsp-smart-contracts/docs/libraries/LSP1UniversalReceiver/LSP1Utils.md new file mode 100644 index 000000000..b57da1178 --- /dev/null +++ b/packages/lsp-smart-contracts/docs/libraries/LSP1UniversalReceiver/LSP1Utils.md @@ -0,0 +1,104 @@ + + + +# LSP1Utils + +:::info Standard Specifications + +[`LSP-1-UniversalReceiver`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-1-UniversalReceiver.md) + +::: +:::info Solidity implementation + +[`LSP1Utils.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp1-contracts/contracts/ILSP1UniversalReceiver.sol) + +::: + +> LSP1 Utility library. + +LSP1Utils is a library of utility functions that can be used to notify the `universalReceiver` function of a contract that implements LSP1 and retrieve informations related to LSP1 `typeId`. Based on LSP1 Universal Receiver standard. + +## 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. + +### notifyUniversalReceiver + +```solidity +function notifyUniversalReceiver( + address lsp1Implementation, + bytes32 typeId, + bytes data +) internal nonpayable; +``` + +Notify a contract at `lsp1Implementation` address by calling its `universalReceiver` function if this contract +supports the LSP1 interface. + +#### Parameters + +| Name | Type | Description | +| -------------------- | :-------: | -------------------------------------------------------------------------------------------------- | +| `lsp1Implementation` | `address` | The address of the contract to notify. | +| `typeId` | `bytes32` | A `bytes32` typeId. | +| `data` | `bytes` | Any optional data to send to the `universalReceiver` function to the `lsp1Implementation` address. | + +
+ +### getLSP1DelegateValue + +```solidity +function getLSP1DelegateValue( + mapping(bytes32 => bytes) erc725YStorage +) internal view returns (bytes); +``` + +_Retrieving the value stored under the ERC725Y data key `LSP1UniversalReceiverDelegate`._ + +Query internally the ERC725Y storage of a `ERC725Y` smart contract to retrieve +the value set under the `LSP1UniversalReceiverDelegate` data key. + +#### Parameters + +| Name | Type | Description | +| ---------------- | :-------------------------: | ----------------------------------------------------------- | +| `erc725YStorage` | `mapping(bytes32 => bytes)` | A reference to the ERC725Y storage mapping of the contract. | + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | -------------------------------------------------------------------------- | +| `0` | `bytes` | The bytes value stored under the `LSP1UniversalReceiverDelegate` data key. | + +
+ +### getLSP1DelegateValueForTypeId + +```solidity +function getLSP1DelegateValueForTypeId( + mapping(bytes32 => bytes) erc725YStorage, + bytes32 typeId +) internal view returns (bytes); +``` + +_Retrieving the value stored under the ERC725Y data key `LSP1UniversalReceiverDelegate:` for a specific `typeId`._ + +Query internally the ERC725Y storage of a `ERC725Y` smart contract to retrieve +the value set under the `LSP1UniversalReceiverDelegate:` data key for a specific LSP1 `typeId`. + +#### Parameters + +| Name | Type | Description | +| ---------------- | :-------------------------: | ----------------------------------------------------------- | +| `erc725YStorage` | `mapping(bytes32 => bytes)` | A reference to the ERC725Y storage mapping of the contract. | +| `typeId` | `bytes32` | A bytes32 LSP1 `typeId`; | + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ------------------------------------------------------------------------------------ | +| `0` | `bytes` | The bytes value stored under the `LSP1UniversalReceiverDelegate:` data key. | + +
diff --git a/packages/lsp-smart-contracts/docs/libraries/LSP2ERC725YJSONSchema/LSP2Utils.md b/packages/lsp-smart-contracts/docs/libraries/LSP2ERC725YJSONSchema/LSP2Utils.md new file mode 100644 index 000000000..d11ffe885 --- /dev/null +++ b/packages/lsp-smart-contracts/docs/libraries/LSP2ERC725YJSONSchema/LSP2Utils.md @@ -0,0 +1,439 @@ + + + +# LSP2Utils + +:::info Standard Specifications + +[`LSP-2-ERC725YJSONSchema`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-2-ERC725YJSONSchema.md) + +::: +:::info Solidity implementation + +[`LSP2Utils.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp2-contracts/contracts/LSP2Utils.sol) + +::: + +> LSP2 Utility library. + +LSP2Utils is a library of utility functions that can be used to encode data key of different key type defined on the LSP2 standard. Based on LSP2 ERC725Y JSON Schema standard. + +## 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. + +### generateSingletonKey + +```solidity +function generateSingletonKey(string keyName) internal pure returns (bytes32); +``` + +Generates a data key of keyType Singleton by hashing the string `keyName`. As: + +``` +keccak256("keyName") +``` + +#### Parameters + +| Name | Type | Description | +| --------- | :------: | ---------------------------------------------------- | +| `keyName` | `string` | The string to hash to generate a Singleton data key. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------------------- | +| `0` | `bytes32` | The generated `bytes32` data key of key type Singleton. | + +
+ +### generateArrayKey + +```solidity +function generateArrayKey(string arrayKeyName) internal pure returns (bytes32); +``` + +Generates a data key of keyType Array by hashing `arrayKeyName`. As: + +``` +keccak256("arrayKeyName[]") +``` + +#### Parameters + +| Name | Type | Description | +| -------------- | :------: | ---------------------------------------------------------------------- | +| `arrayKeyName` | `string` | The string that will be used to generate a data key of key type Array. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | --------------------------------------------------- | +| `0` | `bytes32` | The generated `bytes32` data key of key type Array. | + +
+ +### generateArrayElementKeyAtIndex + +```solidity +function generateArrayElementKeyAtIndex( + bytes32 arrayKey, + uint128 index +) internal pure returns (bytes32); +``` + +Generates an Array data key at a specific `index` by concatenating together the first 16 bytes of `arrayKey` +with the 16 bytes of `index`. As: + +``` +arrayKey[index] +``` + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------------------------------------------------------------------------------- | +| `arrayKey` | `bytes32` | The Array data key from which to generate the Array data key at a specific `index`. | +| `index` | `uint128` | The index number in the `arrayKey`. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------------------------------------- | +| `0` | `bytes32` | The generated `bytes32` data key of key type Array at a specific `index`. | + +
+ +### generateMappingKey + +```solidity +function generateMappingKey( + string firstWord, + string lastWord +) internal pure returns (bytes32); +``` + +Generates a data key of key type Mapping that map `firstWord` to `lastWord`. This is done by hashing two strings words `firstWord` and `lastWord`. As: + +``` +bytes10(firstWordHash):0000:bytes20(lastWordHash) +``` + +#### Parameters + +| Name | Type | Description | +| ----------- | :------: | ---------------------------------------------------- | +| `firstWord` | `string` | The word to retrieve the first 10 bytes of its hash. | +| `lastWord` | `string` | The word to retrieve the first 10 bytes of its hash. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | --------------------------------------------------------------------------------------------------- | +| `0` | `bytes32` | The generated `bytes32` data key of key type Mapping that map `firstWord` to a specific `lastWord`. | + +
+ +### generateMappingKey + +```solidity +function generateMappingKey( + string firstWord, + address addr +) internal pure returns (bytes32); +``` + +Generates a data key of key type Mapping that map `firstWord` to an address `addr`. +This is done by hashing the string word `firstWord` and concatenating its first 10 bytes with `addr`. As: + +``` +bytes10(firstWordHash):0000:
+``` + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ---------------------------------------------------- | +| `firstWord` | `string` | The word to retrieve the first 10 bytes of its hash. | +| `addr` | `address` | An address to map `firstWord` to. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------------------------------------------------------------------- | +| `0` | `bytes32` | The generated `bytes32` data key of key type Mapping that map `firstWord` to a specific address `addr`. | + +
+ +### generateMappingKey + +```solidity +function generateMappingKey( + bytes10 keyPrefix, + bytes20 bytes20Value +) internal pure returns (bytes32); +``` + +Generate a data key of key type Mapping that map a 10 bytes `keyPrefix` to a `bytes20Value`. As: + +``` +keyPrefix:bytes20Value +``` + +#### Parameters + +| Name | Type | Description | +| -------------- | :-------: | ---------------------------------------------------- | +| `keyPrefix` | `bytes10` | The first part of the data key of key type Mapping. | +| `bytes20Value` | `bytes20` | The second part of the data key of key type Mapping. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | --------------------------------------------------------------------------------------------------------- | +| `0` | `bytes32` | The generated `bytes32` data key of key type Mapping that map a `keyPrefix` to a specific `bytes20Value`. | + +
+ +### generateMappingWithGroupingKey + +```solidity +function generateMappingWithGroupingKey( + string firstWord, + string secondWord, + address addr +) internal pure returns (bytes32); +``` + +Generate a data key of key type MappingWithGrouping by using two strings `firstWord` +mapped to a `secondWord` mapped itself to a specific address `addr`. As: + +``` +bytes6(keccak256("firstWord")):bytes4(keccak256("secondWord")):0000:
+``` + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ---------------------------------------------------------------- | +| `firstWord` | `string` | The word to retrieve the first 6 bytes of its hash. | +| `secondWord` | `string` | The word to retrieve the first 4 bytes of its hash. | +| `addr` | `address` | The address that makes the last part of the MappingWithGrouping. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | --------------------------------------------------------------------------------------------------------------------------------------- | +| `0` | `bytes32` | The generated `bytes32` data key of key type MappingWithGrouping that map a `firstWord` to a `secondWord` to a specific address `addr`. | + +
+ +### generateMappingWithGroupingKey + +```solidity +function generateMappingWithGroupingKey( + bytes6 keyPrefix, + bytes4 mapPrefix, + bytes20 subMapKey +) internal pure returns (bytes32); +``` + +Generate a data key of key type MappingWithGrouping that map a `keyPrefix` to an other `mapPrefix` to a specific `subMapKey`. As: + +``` +keyPrefix:mapPrefix:0000:subMapKey +``` + +#### Parameters + +| Name | Type | Description | +| ----------- | :-------: | ------------------------------------------------------------------------- | +| `keyPrefix` | `bytes6` | The first part (6 bytes) of the data key of keyType MappingWithGrouping. | +| `mapPrefix` | `bytes4` | The second part (4 bytes) of the data key of keyType MappingWithGrouping. | +| `subMapKey` | `bytes20` | The last part (bytes20) of the data key of keyType MappingWithGrouping. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ----------------------------------------------------------------------------------------------------------------------------------- | +| `0` | `bytes32` | The generated `bytes32` data key of key type MappingWithGrouping that map a `keyPrefix` to a `mapPrefix` to a specific `subMapKey`. | + +
+ +### generateMappingWithGroupingKey + +```solidity +function generateMappingWithGroupingKey( + bytes10 keyPrefix, + bytes20 bytes20Value +) internal pure returns (bytes32); +``` + +Generate a data key of key type MappingWithGrouping that map a 10 bytes `keyPrefix` to a specific `bytes20Value`. As: + +#### Parameters + +| Name | Type | Description | +| -------------- | :-------: | -------------------------------------------------------------- | +| `keyPrefix` | `bytes10` | The first part of the data key of keyType MappingWithGrouping. | +| `bytes20Value` | `bytes20` | The last of the data key of keyType MappingWithGrouping. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | --------------------------------------------------------------------------------------- | +| `0` | `bytes32` | The generated `bytes32` data key of key type MappingWithGrouping that map a `keyPrefix` | + +
+ +### generateJSONURLValue + +```solidity +function generateJSONURLValue( + string hashFunction, + string json, + string url +) internal pure returns (bytes); +``` + +Generate a JSONURL value content. + +#### Parameters + +| Name | Type | Description | +| -------------- | :------: | ---------------------------------------- | +| `hashFunction` | `string` | The function used to hash the JSON file. | +| `json` | `string` | Bytes value of the JSON file. | +| `url` | `string` | The URL where the JSON file is hosted. | + +
+ +### generateASSETURLValue + +```solidity +function generateASSETURLValue( + string hashFunction, + string assetBytes, + string url +) internal pure returns (bytes); +``` + +Generate a ASSETURL value content. + +#### Parameters + +| Name | Type | Description | +| -------------- | :------: | ---------------------------------------- | +| `hashFunction` | `string` | The function used to hash the JSON file. | +| `assetBytes` | `string` | Bytes value of the JSON file. | +| `url` | `string` | The URL where the JSON file is hosted. | + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ----------------------------------- | +| `0` | `bytes` | The encoded value as an `ASSETURL`. | + +
+ +### isCompactBytesArray + +```solidity +function isCompactBytesArray( + bytes compactBytesArray +) internal pure returns (bool); +``` + +Verify if `data` is a valid array of value encoded as a `CompactBytesArray` according to the LSP2 `CompactBytesArray` valueType specification. + +#### Parameters + +| Name | Type | Description | +| ------------------- | :-----: | -------------------------- | +| `compactBytesArray` | `bytes` | The bytes value to verify. | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ------------------------------------------------------------------------------- | +| `0` | `bool` | `true` if the `data` is correctly encoded CompactBytesArray, `false` otherwise. | + +
+ +### isValidLSP2ArrayLengthValue + +```solidity +function isValidLSP2ArrayLengthValue( + bytes arrayLength +) internal pure returns (bool); +``` + +Validates if the bytes `arrayLength` are exactly 16 bytes long, and are of the exact size of an LSP2 Array length value + +#### Parameters + +| Name | Type | Description | +| ------------- | :-----: | ------------------------------------- | +| `arrayLength` | `bytes` | Plain bytes that should be validated. | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | -------------------------------------------------------- | +| `0` | `bool` | `true` if the value is 16 bytes long, `false` otherwise. | + +
+ +### removeLastElementFromArrayAndMap + +```solidity +function removeLastElementFromArrayAndMap( + bytes32 arrayKey, + uint128 newArrayLength, + bytes32 removedElementIndexKey, + bytes32 removedElementMapKey +) internal pure returns (bytes32[] dataKeys, bytes[] dataValues); +``` + +Generates Data Key/Value pairs for removing the last element from an LSP2 Array and a mapping Data Key. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ------------------------------------------------------------- | +| `arrayKey` | `bytes32` | The Data Key of Key Type Array. | +| `newArrayLength` | `uint128` | The new Array Length for the `arrayKey`. | +| `removedElementIndexKey` | `bytes32` | The Data Key of Key Type Array Index for the removed element. | +| `removedElementMapKey` | `bytes32` | The Data Key of a mapping to be removed. | + +
+ +### removeElementFromArrayAndMap + +:::info + +The function assumes that the Data Value stored under the mapping Data Key is of length 20 where the last 16 bytes are the index of the element in the array. + +::: + +```solidity +function removeElementFromArrayAndMap(contract IERC725Y erc725YContract, bytes32 arrayKey, uint128 newArrayLength, bytes32 removedElementIndexKey, uint128 removedElementIndex, bytes32 removedElementMapKey) internal view returns (bytes32[] dataKeys, bytes[] dataValues); +``` + +Generates Data Key/Value pairs for removing an element from an LSP2 Array and a mapping Data Key. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-----------------: | ------------------------------------------------------------- | +| `erc725YContract` | `contract IERC725Y` | The ERC725Y contract. | +| `arrayKey` | `bytes32` | The Data Key of Key Type Array. | +| `newArrayLength` | `uint128` | The new Array Length for the `arrayKey`. | +| `removedElementIndexKey` | `bytes32` | The Data Key of Key Type Array Index for the removed element. | +| `removedElementIndex` | `uint128` | the index of the removed element. | +| `removedElementMapKey` | `bytes32` | The Data Key of a mapping to be removed. | + +
diff --git a/packages/lsp-smart-contracts/docs/libraries/LSP5ReceivedAssets/LSP5Utils.md b/packages/lsp-smart-contracts/docs/libraries/LSP5ReceivedAssets/LSP5Utils.md new file mode 100644 index 000000000..527bb7622 --- /dev/null +++ b/packages/lsp-smart-contracts/docs/libraries/LSP5ReceivedAssets/LSP5Utils.md @@ -0,0 +1,115 @@ + + + +# LSP5Utils + +:::info Standard Specifications + +[`LSP-5-ReceivedAssets`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-5-ReceivedAssets.md) + +::: +:::info Solidity implementation + +[`LSP5Utils.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp5-contracts/contracts/LSP5Utils.sol) + +::: + +> LSP5 Utility library. + +LSP5Utils is a library of functions that can be used to register and manage assets under an ERC725Y smart contract. Based on the LSP5 Received Assets standard. + +## 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. + +### generateReceivedAssetKeys + +:::caution Warning + +Returns empty arrays when encountering errors. Otherwise the arrays must have 3 data keys and 3 data values. + +::: + +```solidity +function generateReceivedAssetKeys( + address receiver, + address assetAddress, + bytes4 assetInterfaceId +) internal view returns (bytes32[] lsp5DataKeys, bytes[] lsp5DataValues); +``` + +Generate an array of data key/value pairs to be set on the receiver address after receiving assets. + +#### Parameters + +| Name | Type | Description | +| ------------------ | :-------: | ----------------------------------------------------------------------------- | +| `receiver` | `address` | The address receiving the asset and where the LSP5 data keys should be added. | +| `assetAddress` | `address` | The address of the asset being received (_e.g: an LSP7 or LSP8 token_). | +| `assetInterfaceId` | `bytes4` | The interfaceID of the asset being received. | + +#### Returns + +| Name | Type | Description | +| ---------------- | :---------: | -------------------------------------------------------------------- | +| `lsp5DataKeys` | `bytes32[]` | An array Data Keys used to update the [LSP-5-ReceivedAssets] data. | +| `lsp5DataValues` | `bytes[]` | An array Data Values used to update the [LSP-5-ReceivedAssets] data. | + +
+ +### generateSentAssetKeys + +:::caution Warning + +Returns empty arrays when encountering errors. Otherwise the arrays must have at least 3 data keys and 3 data values. + +::: + +```solidity +function generateSentAssetKeys( + address sender, + address assetAddress +) internal view returns (bytes32[] lsp5DataKeys, bytes[] lsp5DataValues); +``` + +Generate an array of Data Key/Value pairs to be set on the sender address after sending assets. + +#### Parameters + +| Name | Type | Description | +| -------------- | :-------: | ----------------------------------------------------------------------------- | +| `sender` | `address` | The address sending the asset and where the LSP5 data keys should be updated. | +| `assetAddress` | `address` | The address of the asset that is being sent. | + +#### Returns + +| Name | Type | Description | +| ---------------- | :---------: | -------------------------------------------------------------------- | +| `lsp5DataKeys` | `bytes32[]` | An array Data Keys used to update the [LSP-5-ReceivedAssets] data. | +| `lsp5DataValues` | `bytes[]` | An array Data Values used to update the [LSP-5-ReceivedAssets] data. | + +
+ +### getLSP5ArrayLengthBytes + +```solidity +function getLSP5ArrayLengthBytes(contract IERC725Y erc725YContract) internal view returns (bytes); +``` + +Get the raw bytes value stored under the `_LSP5_RECEIVED_ASSETS_ARRAY_KEY`. + +#### Parameters + +| Name | Type | Description | +| ----------------- | :-----------------: | ----------------------------------------------- | +| `erc725YContract` | `contract IERC725Y` | The contract to query the ERC725Y storage from. | + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | ----------------------------------------------- | +| `0` | `bytes` | The raw bytes value stored under this data key. | + +
diff --git a/packages/lsp-smart-contracts/docs/libraries/LSP6KeyManager/LSP6Utils.md b/packages/lsp-smart-contracts/docs/libraries/LSP6KeyManager/LSP6Utils.md new file mode 100644 index 000000000..d0d1d8ec5 --- /dev/null +++ b/packages/lsp-smart-contracts/docs/libraries/LSP6KeyManager/LSP6Utils.md @@ -0,0 +1,254 @@ + + + +# LSP6Utils + +:::info Standard Specifications + +[`LSP-6-KeyManager`](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-6-KeyManager.md) + +::: +:::info Solidity implementation + +[`LSP6Utils.sol`](https://github.com/lukso-network/lsp-smart-contracts/tree/develop/packages/lsp6-contracts/contracts/LSP6KeyManager.sol) + +::: + +> LSP6 Utility library. + +LSP6Utils is a library of utility functions that can be used to retrieve, check and set LSP6 permissions stored under the ERC725Y storage of a smart contract. Based on the LSP6 Key Manager standard. + +## 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. + +### getPermissionsFor + +:::info + +If the raw value fetched from the ERC725Y storage of `target` is not 32 bytes long, this is considered +like _"no permissions are set"_ and will return 32 x `0x00` bytes as `bytes32(0)`. + +::: + +```solidity +function getPermissionsFor(contract IERC725Y target, address caller) internal view returns (bytes32); +``` + +Read the permissions of a `caller` on an ERC725Y `target` contract. + +#### Parameters + +| Name | Type | Description | +| -------- | :-----------------: | ----------------------------------------------------- | +| `target` | `contract IERC725Y` | An `IERC725Y` contract where to read the permissions. | +| `caller` | `address` | The controller address to read the permissions from. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------------------------------------ | +| `0` | `bytes32` | A `bytes32` BitArray containing the permissions of a controller address. | + +
+ +### getAllowedCallsFor + +```solidity +function getAllowedCallsFor(contract IERC725Y target, address from) internal view returns (bytes); +``` + +
+ +### getAllowedERC725YDataKeysFor + +```solidity +function getAllowedERC725YDataKeysFor(contract IERC725Y target, address caller) internal view returns (bytes); +``` + +Read the Allowed ERC725Y data keys of a `caller` on an ERC725Y `target` contract. + +#### Parameters + +| Name | Type | Description | +| -------- | :-----------------: | ----------------------------------------------------- | +| `target` | `contract IERC725Y` | An `IERC725Y` contract where to read the permissions. | +| `caller` | `address` | The controller address to read the permissions from. | + +#### Returns + +| Name | Type | Description | +| ---- | :-----: | --------------------------------------------------------------------------------------------------------- | +| `0` | `bytes` | An abi-encoded array of allowed ERC725 data keys that the controller address is allowed to interact with. | + +
+ +### hasPermission + +```solidity +function hasPermission( + bytes32 controllerPermissions, + bytes32 permissionToCheck +) internal pure returns (bool); +``` + +Compare the permissions `controllerPermissions` of a controller address to check if they includes the permissions `permissionToCheck`. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-------: | --------------------------------------------------------------------------------- | +| `controllerPermissions` | `bytes32` | The permissions of an address. | +| `permissionToCheck` | `bytes32` | The permissions to check if the controller has under its `controllerPermissions`. | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ---------------------------------------------------------------------------------- | +| `0` | `bool` | `true` if `controllerPermissions` includes `permissionToCheck`, `false` otherwise. | + +
+ +### isCompactBytesArrayOfAllowedCalls + +```solidity +function isCompactBytesArrayOfAllowedCalls( + bytes allowedCallsCompacted +) internal pure returns (bool); +``` + +Same as `LSP2Utils.isCompactBytesArray` with the additional requirement that each element must be 32 bytes long. + +#### Parameters + +| Name | Type | Description | +| ----------------------- | :-----: | --------------------------------------------------------------------------------------------------------------------------------------------------- | +| `allowedCallsCompacted` | `bytes` | A compact bytes array of tuples `(bytes4,address,bytes4,bytes4)` to check (defined as `(bytes4,address,bytes4,bytes4)[CompactBytesArray]` in LSP6). | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | -------------------------------------------------------------------------------------------------------------- | +| `0` | `bool` | `true` if the value passed is a valid compact bytes array of bytes32 AllowedCalls elements, `false` otherwise. | + +
+ +### isCompactBytesArrayOfAllowedERC725YDataKeys + +```solidity +function isCompactBytesArrayOfAllowedERC725YDataKeys( + bytes allowedERC725YDataKeysCompacted +) internal pure returns (bool); +``` + +Same as `LSP2Utils.isCompactBytesArray` with the additional requirement that each element must be from 1 to 32 bytes long. + +#### Parameters + +| Name | Type | Description | +| --------------------------------- | :-----: | -------------------------------------------------------------------------------------------------------------------------------------- | +| `allowedERC725YDataKeysCompacted` | `bytes` | a compact bytes array of ERC725Y data Keys (full bytes32 data keys or bytesN prefix) to check (defined as `bytes[CompactBytesArray]`). | + +#### Returns + +| Name | Type | Description | +| ---- | :----: | ------------------------------------------------------------------------------------------------------------------ | +| `0` | `bool` | `true` if the value passed is a valid compact bytes array of bytes32 Allowed ERC725Y data keys, `false` otherwise. | + +
+ +### setDataViaKeyManager + +```solidity +function setDataViaKeyManager( + address keyManagerAddress, + bytes32[] keys, + bytes[] values +) internal nonpayable returns (bytes result); +``` + +Use the `setData(bytes32[],bytes[])` function via the KeyManager on the target contract. + +#### Parameters + +| Name | Type | Description | +| ------------------- | :---------: | ----------------------------------- | +| `keyManagerAddress` | `address` | The address of the KeyManager. | +| `keys` | `bytes32[]` | The array of `bytes32[]` data keys. | +| `values` | `bytes[]` | The array of `bytes[]` data values. | + +
+ +### combinePermissions + +```solidity +function combinePermissions( + bytes32[] permissions +) internal pure returns (bytes32); +``` + +Combine multiple permissions into a single `bytes32`. +Make sure that the sum of the values of the input array is less than `2^256-1 to avoid overflow. + +#### Parameters + +| Name | Type | Description | +| ------------- | :---------: | ------------------------------------ | +| `permissions` | `bytes32[]` | The array of permissions to combine. | + +#### Returns + +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------------------ | +| `0` | `bytes32` | A `bytes32` value containing the combined permissions. | + +
+ +### generateNewPermissionsKeys + +```solidity +function generateNewPermissionsKeys(contract IERC725Y account, address controller, bytes32 permissions) internal view returns (bytes32[] keys, bytes[] values); +``` + +Generate a new set of 3 x LSP6 permission data keys to add a new `controller` on `account`. + +#### Parameters + +| Name | Type | Description | +| ------------- | :-----------------: | ----------------------------------------------------------------------------------------------- | +| `account` | `contract IERC725Y` | The ERC725Y contract to add the controller into (used to fetch the `LSP6Permissions[]` length). | +| `controller` | `address` | The address of the controller to grant permissions to. | +| `permissions` | `bytes32` | The `BitArray` of permissions to grant to the controller. | + +#### Returns + +| Name | Type | Description | +| -------- | :---------: | --------------------------------------- | +| `keys` | `bytes32[]` | An array of 3 x data keys containing: | +| `values` | `bytes[]` | An array of 3 x data values containing: | + +
+ +### getPermissionName + +```solidity +function getPermissionName(bytes32 permission) internal pure returns (string); +``` + +Returns the name of the permission as a string. + +#### Parameters + +| Name | Type | Description | +| ------------ | :-------: | ----------------------------------------------------------------------------------- | +| `permission` | `bytes32` | The low-level `bytes32` permission as a `BitArray` to get the permission name from. | + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------------------------- | +| `0` | `string` | The string name of the `bytes32` permission value. | + +