diff --git a/docs/contracts/_interface_ids_table.mdx b/docs/contracts/_interface_ids_table.mdx index f7dd19f4ad..acba017e97 100644 --- a/docs/contracts/_interface_ids_table.mdx +++ b/docs/contracts/_interface_ids_table.mdx @@ -8,8 +8,8 @@ | **LSP1UniversalReceiver** | `0x6bb56a14` | Interface of the LSP1 - Universal Receiver standard, an entry function for a contract to receive arbitrary information. | | **LSP1UniversalReceiverDelegate** | `0xa245bbda` | Interface of the LSP1 - Universal Receiver Delegate standard. | | **LSP6KeyManager** | `0x23f34c62` | Interface of the LSP6 - Key Manager standard, a contract acting as a controller of an ERC725 Account using predfined permissions. | -| **LSP7DigitalAsset** | `0xdaa746b7` | Interface of the LSP7 - Digital Asset standard, a fungible digital asset. | -| **LSP8IdentifiableDigitalAsset** | `0x30dc5278` | Interface of the LSP8 - Identifiable Digital Asset standard, a non-fungible digital asset. | +| **LSP7DigitalAsset** | `0xb3c4928f` | Interface of the LSP7 - Digital Asset standard, a fungible digital asset. | +| **LSP8IdentifiableDigitalAsset** | `0x3a271706` | Interface of the LSP8 - Identifiable Digital Asset standard, a non-fungible digital asset. | | **LSP9Vault** | `0x28af17e6` | Interface of LSP9 - Vault standard, a blockchain vault that can hold assets and interact with other smart contracts. | | **LSP11BasicSocialRecovery** | `0x049a28f1` | Interface of the LSP11 - Basic Social Recovery standard, a contract to recover access control into an account. | | **LSP14Ownable2Step** | `0x94be5999` | Interface of the LSP14 - Ownable 2-step standard, an extension of the [EIP173] (Ownable) standard with 2-step process to transfer or renounce ownership. | diff --git a/docs/contracts/contracts/ERC725/ERC725.md b/docs/contracts/contracts/ERC725/ERC725.md index 36739b3150..489649309d 100644 --- a/docs/contracts/contracts/ERC725/ERC725.md +++ b/docs/contracts/contracts/ERC725/ERC725.md @@ -723,7 +723,7 @@ mapping(bytes32 => bytes) _store ::: ```solidity -event ContractCreated(uint256 indexed operationType, address indexed contractAddress, uint256 indexed value, bytes32 salt); +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`)._ @@ -736,8 +736,8 @@ Emitted when a new contract was created and deployed. | ------------------------------- | :-------: | ----------------------------------------------------------------------------------------------------------------------------------------- | | `operationType` **`indexed`** | `uint256` | The opcode used to deploy the contract (`CREATE` or `CREATE2`). | | `contractAddress` **`indexed`** | `address` | The created contract address. | -| `value` **`indexed`** | `uint256` | The amount of native tokens (in Wei) sent to fund the created contract on deployment. | -| `salt` | `bytes32` | The salt used to deterministically deploy the contract (`CREATE2` only). If `CREATE` opcode is used, the salt value will be `bytes32(0)`. | +| `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)`. |
@@ -781,7 +781,7 @@ Emitted when data at a specific `dataKey` was changed to a new value `dataValue` ::: ```solidity -event Executed(uint256 indexed operationType, address indexed target, uint256 indexed value, bytes4 selector); +event Executed(uint256 indexed operationType, address indexed target, uint256 value, bytes4 indexed selector); ``` _Called address `target` using `operationType` with `value` wei and `data`._ @@ -794,8 +794,8 @@ Emitted when calling an address `target` (EOA or contract) with `value`. | ----------------------------- | :-------: | ---------------------------------------------------------------------------------------------------- | | `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` **`indexed`** | `uint256` | The amount of native tokens transferred along the call (in Wei). | -| `selector` | `bytes4` | The first 4 bytes (= function selector) of the data sent with the call. | +| `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. |
diff --git a/docs/contracts/contracts/LSP0ERC725Account/LSP0ERC725Account.md b/docs/contracts/contracts/LSP0ERC725Account/LSP0ERC725Account.md index 1f3b9ea8d6..01acdec05e 100644 --- a/docs/contracts/contracts/LSP0ERC725Account/LSP0ERC725Account.md +++ b/docs/contracts/contracts/LSP0ERC725Account/LSP0ERC725Account.md @@ -1115,22 +1115,27 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -This function overrides the [`ERC725YCore`](#erc725ycore) internal [`_setData`](#_setdata) function to optimize gas usage by emitting only the first 256 bytes of the `dataValue`. +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 with only the first 256 bytes of [`dataValue`](#datavalue). +- [`DataChanged`](#datachanged) event emitted after a successful `setData` call.
#### Parameters -| Name | Type | Description | -| ----------- | :-------: | -------------------------------------- | -| `dataKey` | `bytes32` | The key to store the data value under. | -| `dataValue` | `bytes` | The data value to be stored. | +| 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. |
@@ -1286,7 +1291,7 @@ function _revertWithLSP20DefaultError( ::: ```solidity -event ContractCreated(uint256 indexed operationType, address indexed contractAddress, uint256 indexed value, bytes32 salt); +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`)._ @@ -1299,8 +1304,8 @@ Emitted when a new contract was created and deployed. | ------------------------------- | :-------: | ----------------------------------------------------------------------------------------------------------------------------------------- | | `operationType` **`indexed`** | `uint256` | The opcode used to deploy the contract (`CREATE` or `CREATE2`). | | `contractAddress` **`indexed`** | `address` | The created contract address. | -| `value` **`indexed`** | `uint256` | The amount of native tokens (in Wei) sent to fund the created contract on deployment. | -| `salt` | `bytes32` | The salt used to deterministically deploy the contract (`CREATE2` only). If `CREATE` opcode is used, the salt value will be `bytes32(0)`. | +| `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)`. |
@@ -1344,7 +1349,7 @@ Emitted when data at a specific `dataKey` was changed to a new value `dataValue` ::: ```solidity -event Executed(uint256 indexed operationType, address indexed target, uint256 indexed value, bytes4 selector); +event Executed(uint256 indexed operationType, address indexed target, uint256 value, bytes4 indexed selector); ``` _Called address `target` using `operationType` with `value` wei and `data`._ @@ -1357,8 +1362,8 @@ Emitted when calling an address `target` (EOA or contract) with `value`. | ----------------------------- | :-------: | ---------------------------------------------------------------------------------------------------- | | `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` **`indexed`** | `uint256` | The amount of native tokens transferred along the call (in Wei). | -| `selector` | `bytes4` | The first 4 bytes (= function selector) of the data sent with the call. | +| `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. |
diff --git a/docs/contracts/contracts/LSP17Extensions/Extension4337.md b/docs/contracts/contracts/LSP17Extensions/Extension4337.md index c7632c1f7b..a525bd8eb4 100644 --- a/docs/contracts/contracts/LSP17Extensions/Extension4337.md +++ b/docs/contracts/contracts/LSP17Extensions/Extension4337.md @@ -209,3 +209,194 @@ function _extendableMsgValue() internal view returns (uint256); Returns the original `msg.value` sent to the extendable contract.
+ + + + + + + +[ERC-165]: https://eips.ethereum.org/EIPS/eip-165 +[EIP-165]: https://eips.ethereum.org/EIPS/eip-165 +[ERC-173]: https://eips.ethereum.org/EIPS/eip-173 +[EIP-173]: https://eips.ethereum.org/EIPS/eip-173 +[ERC-191]: https://eips.ethereum.org/EIPS/eip-191 +[EIP-191]: https://eips.ethereum.org/EIPS/eip-191 +[ERC-725X]: https://github.com/ERC725Alliance/ERC725/blob/main/docs/ERC-725.md#ERC725X +[ERC-725Y]: https://github.com/ERC725Alliance/ERC725/blob/main/docs/ERC-725.md#ERC725Y +[ERC-725]: https://github.com/ERC725Alliance/ERC725/blob/main/docs/ERC-725.md +[ERC-1271]: https://eips.ethereum.org/EIPS/eip-1271 +[EIP-1271]: https://eips.ethereum.org/EIPS/eip-1271 +[LSP-0-ERC725Account]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-0-ERC725Account.md +[LSP-1-UniversalReceiver]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-1-UniversalReceiver.md +[LSP-2-ERC725YJSONSchema]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-2-ERC725YJSONSchema.md +[LSP-3-UniversalProfile-Metadata]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-3-UniversalProfile-Metadata.md +[LSP-4-DigitalAsset-Metadata]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-4-DigitalAsset-Metadata.md +[LSP-5-ReceivedAssets]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-5-ReceivedAssets.md +[LSP-6-KeyManager]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-6-KeyManager.md +[LSP-7-DigitalAsset]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-7-DigitalAsset.md +[LSP-8-IdentifiableDigitalAsset]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md +[LSP-9-Vault.md]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-9-Vault.md.md +[LSP-10-ReceivedVaults]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-10-ReceivedVaults.md +[LSP-11-BasicSocialRecovery]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-11-BasicSocialRecovery.md +[LSP-12-IssuedAssets]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-12-IssuedAssets.md +[LSP-14-Ownable2Step]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-14-Ownable2Step.md +[LSP-15-TransactionRelayServiceAPI]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-15-TransactionRelayServiceAPI.md +[LSP-16-UniversalFactory]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-16-UniversalFactory.md +[LSP-17-ContractExtension]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-17-ContractExtension.md +[LSP-20-CallVerification]: https://github.com/lukso-network/LIPs/tree/main/LSPs/LSP-20-CallVerification.md + + + +[ERC725]: https://docs.lukso.tech/standards/lsp-background/erc725 +[UniversalProfile]: https://docs.lukso.tech/standards/universal-profile/introduction +[LSP0ERC725Account]: https://docs.lukso.tech/standards/universal-profile/lsp0-erc725account +[LSP1UniversalReceiver]: https://docs.lukso.tech/standards/generic-standards/lsp1-universal-receiver +[LSP1UniversalReceiverDelegate]: https://docs.lukso.tech/standards/generic-standards/lsp1-universal-receiver-delegate +[LSP2ERC725YJSONSchema]: https://docs.lukso.tech/standards/generic-standards/lsp2-json-schema +[LSP4DigitalAssetMetadata]: https://docs.lukso.tech/standards/tokens/LSP4-Digital-Asset-Metadata +[LSP5ReceivedVaults]: https://docs.lukso.tech/standards/universal-profile/lsp5-received-assets +[LSP6KeyManager]: https://docs.lukso.tech/standards/universal-profile/lsp6-key-manager +[LSP7DigitalAsset]: https://docs.lukso.tech/standards/tokens/LSP7-Digital-Asset +[LSP8IdentifiableDigitalAsset]: https://docs.lukso.tech/standards/tokens/LSP8-Identifiable-Digital-Asset +[LSP10ReceivedVaults]: https://docs.lukso.tech/standards/universal-profile/lsp10-received-vaults +[LSP14Ownable2Step]: https://docs.lukso.tech/standards/generic-standards/lsp14-ownable-2-step +[LSP17ContractExtension]: https://docs.lukso.tech/standards/generic-standards/lsp17-contract-extension +[LSP20CallVerification]: https://docs.lukso.tech/standards/generic-standards/lsp20-call-verification + + + +[_LSP17_EXTENSION_PREFIX]: https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-17-ContractExtension.md#lsp17extendable-specification +[_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY]: https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-1-UniversalReceiver.md#specification-1 +[_LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX]: https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-1-UniversalReceiver.md#specification-1 + + + +[LSP0OwnershipTransferStarted]: https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#transferownership +[LSP0OwnershipTransferred_SenderNotification]: https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#acceptownership +[LSP0OwnershipTransferred_RecipientNotification]: https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-0-ERC725Account.md#acceptownership + + + +[`ERC725.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/ERC725.sol +[`ERC725Init.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/ERC725Init.sol +[`ERC725InitAbstract.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/ERC725InitAbstract +[`IERC725X.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/interfaces/IERC725X.sol +[`ERC725X.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/ERC725X.sol +[`ERC725XCore.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/ERC725XCore.sol +[`ERC725XInit.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/ERC725XInit.sol +[`ERC725XInitAbstract.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/ERC725XInitAbstract.sol +[`IERC725Y.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/interfaces/IERC725Y.sol +[`ERC725Y.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/ERC725Y.sol +[`ERC725YCore.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/ERC725YCore.sol +[`ERC725YInit.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/ERC725YInit.sol +[`ERC725YInitAbstract.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/ERC725YInitAbstract.soll +[`OwnableUnset.sol`]: https://github.com/ERC725Alliance/ERC725/blob/v5.1.0/implementations/contracts/custom/OwnableUnset.sol + + + +[`Create2.sol`]: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.2/contracts/utils/Create2.sol +[`ECDSA.sol`]: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.2/contracts/utils/cryptography/ECDSA.sol +[`ERC165Checker.sol`]: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.2/contracts/utils/introspection/ERC165Checker.sol +[`Address.sol`]: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.2/contracts/utils/Address.sol +[`ERC165.sol`]: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.2/contracts/utils/introspection/ERC165.sol +[`EnumerableSet.sol`]: https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v4.9.2/contracts/utils/structs/EnumerableSet.so +[`Initializable.sol`]: https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable/blob/v4.9.2/contracts/proxy/utils/Initializable.sol +[`BytesLib.sol`]: https://github.com/GNSPS/solidity-bytes-utils/blob/v0.8.0/contracts/BytesLib.sol + + + +[`LSP0ERC725AccountCore.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +[`LSP0Utils.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP0ERC725Account/LSP0Utils.sol +[`LSP0ERC725AccountInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +[`ILSP0ERC725Account.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP0ERC725Account/ILSP0ERC725Account.sol +[`LSP0ERC725Account.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +[`LSP0ERC725AccountInit.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +[`LSP0Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP0ERC725Account/LSP0Constants.sol +[`UniversalProfileInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/UniversalProfileInitAbstract.sol +[`UniversalProfile.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/UniversalProfile.sol +[`UniversalProfileInit.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/UniversalProfileInit.sol +[`LSP1UniversalReceiverDelegateUP.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +[`LSP1Utils.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP1UniversalReceiver/LSP1Utils.sol +[`LSP1UniversalReceiverDelegateVault.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +[`ILSP1UniversalReceiver.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +[`LSP1Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP1UniversalReceiver/LSP1Constants.sol +[`LSP1Errors.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP1UniversalReceiver/LSP1Errors.sol +[`LSP4DigitalAssetMetadataInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +[`LSP4DigitalAssetMetadata.sol`]: chttps://github.com/code-423n4/2023-06-lukso/tree/main/ontracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +[`LSP4Compatibility.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP4DigitalAssetMetadata/LSP4Compatibility.sol +[`LSP4Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +[`ILSP4Compatibility.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP4DigitalAssetMetadata/ILSP4Compatibility.sol +[`LSP4Errors.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP4DigitalAssetMetadata/LSP4Errors.sol +[`LSP6SetDataModule.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +[`LSP6KeyManagerCore.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +[`LSP6ExecuteModule.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +[`LSP6Utils.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/LSP6Utils.sol +[`LSP6Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/LSP6Constants.sol +[`ILSP6KeyManager.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/ILSP6KeyManager.sol +[`LSP6Errors.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/LSP6Errors.sol +[`LSP6OwnershipModule.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/LSP6Modules/LSP6OwnershipModule.sol +[`LSP6KeyManagerInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +[`LSP6KeyManager.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/LSP6KeyManager.sol +[`LSP6KeyManagerInit.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP6KeyManager/LSP6KeyManagerInit.sol +[`LSP7DigitalAssetCore.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +[`LSP7CompatibleERC20InitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +[`LSP7CompatibleERC20.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +[`ILSP7DigitalAsset.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +[`LSP7DigitalAssetInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +[`LSP7CappedSupply.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +[`LSP7CappedSupplyInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +[`LSP7DigitalAsset.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +[`LSP7MintableInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +[`LSP7CompatibleERC20MintableInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +[`LSP7Mintable.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +[`LSP7CompatibleERC20Mintable.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +[`LSP7Errors.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/LSP7Errors.sol +[`LSP7CompatibleERC20MintableInit.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +[`LSP7MintableInit.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +[`ILSP7CompatibleERC20.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibleERC20.sol +[`ILSP7Mintable.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/presets/ILSP7Mintable.sol +[`LSP7Burnable.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +[`LSP7BurnableInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/extensions/LSP7BurnableInitAbstract.sol +[`LSP7Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP7DigitalAsset/LSP7Constants.sol +[`LSP8IdentifiableDigitalAssetCore.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +[`LSP8CompatibleERC721InitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +[`LSP8CompatibleERC721.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +[`ILSP8IdentifiableDigitalAsset.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +[`LSP8EnumerableInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +[`LSP8Enumerable.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +[`LSP8CappedSupplyInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +[`LSP8CappedSupply.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +[`LSP8IdentifiableDigitalAssetInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +[`LSP8MintableInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +[`ILSP8CompatibleERC721.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol +[`LSP8IdentifiableDigitalAsset.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +[`LSP8CompatibleERC721MintableInitAbstract.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.s +[`LSP8Mintable.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +[`LSP8CompatibleERC721Mintable.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +[`LSP8CompatibleERC721MintableInit.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +[`LSP8Errors.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +[`LSP8MintableInit.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +[`LSP8Burnable.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol +[`ILSP8Mintable.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/presets/ILSP8Mintable.sol +[`LSP8Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.s +[`LSP14Ownable2Step.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +[`ILSP14Ownable2Step.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +[`LSP14Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP14Ownable2Step/LSP14Constants.sol +[`LSP14Errors.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP14Ownable2Step/LSP14Errors.sol +[`LSP17Extendable.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP17ContractExtension/LSP17Extendable.sol +[`LSP17Extension.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP17ContractExtension/LSP17Extension.sol +[`LSP17Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP17ContractExtension/LSP17Constants.sol +[`LSP17Errors.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP17ContractExtension/LSP17Errors.sol +[`LSP17Utils.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP17ContractExtension/LSP17Utils.sol +[`LSP20CallVerification.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP20CallVerification/LSP20CallVerification.sol +[`ILSP20CallVerifier.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP20CallVerification/ILSP20CallVerifier.sol +[`LSP20Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP20CallVerification/LSP20Constants.sol +[`LSP20Errors.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP20CallVerification/LSP20Errors.sol +[`LSP2Utils.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +[`LSP5Utils.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP5ReceivedAssets/LSP5Utils.sol +[`LSP5Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP5ReceivedAssets/LSP5Constants.sol +[`LSP10Utils.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP10ReceivedVaults/LSP10Utils.sol +[`LSP10Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP10ReceivedVaults/LSP10Constants.sol + + diff --git a/docs/contracts/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.md b/docs/contracts/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.md index 17b81da38c..7cdc727132 100644 --- a/docs/contracts/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.md +++ b/docs/contracts/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.md @@ -351,7 +351,8 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -Save gas by emitting the [`DataChanged`](#datachanged) event with only the first 256 bytes of dataValue +The ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol` cannot be changed +via this function once the digital asset contract has been deployed.
@@ -483,7 +484,7 @@ Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#set error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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.
@@ -502,7 +503,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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-DigitalAssetMetadata**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-4-DigitalAssetMetadata.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP4DigitalAssetMetadata/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.
diff --git a/docs/contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md b/docs/contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md index 7071169cde..d3475ec9c0 100644 --- a/docs/contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md +++ b/docs/contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md @@ -180,6 +180,45 @@ Get the number of tokens owned by `tokenOwner`. If the token is divisible (the [
+### batchCalls + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/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 @@ -756,7 +795,8 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -Save gas by emitting the [`DataChanged`](#datachanged) event with only the first 256 bytes of dataValue +The ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol` cannot be changed +via this function once the digital asset contract has been deployed.
@@ -995,6 +1035,47 @@ Allows to run custom logic after updating balances, but **before notifiying send
+### \_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 @@ -1085,34 +1166,6 @@ CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of t ## Events -### AuthorizedOperator - -:::note References - -- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#authorizedoperator) -- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol) -- Event signature: `AuthorizedOperator(address,address,uint256,bytes)` -- Event topic hash: `0x0744b3de98efaff36606a0e67662fb8697adb0ed49d90730bdb4bbf885f30597` - -::: - -```solidity -event AuthorizedOperator(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. | - -
- ### DataChanged :::note References @@ -1141,43 +1194,47 @@ Emitted when data at a specific `dataKey` was changed to a new value `dataValue`
-### OwnershipTransferred +### OperatorAuthorizationChanged :::note References -- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#ownershiptransferred) +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#operatorauthorizationchanged) - Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol) -- Event signature: `OwnershipTransferred(address,address)` -- Event topic hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` +- Event signature: `OperatorAuthorizationChanged(address,address,uint256,bytes)` +- Event topic hash: `0xf772a43bfdf4729b196e3fb54a818b91a2ca6c49d10b2e16278752f9f515c25d` ::: ```solidity -event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); +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 | -| ----------------------------- | :-------: | ----------- | -| `previousOwner` **`indexed`** | `address` | - | -| `newOwner` **`indexed`** | `address` | - | +| 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. |
-### RevokedOperator +### OperatorRevoked :::note References -- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#revokedoperator) +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#operatorrevoked) - Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol) -- Event signature: `RevokedOperator(address,address,bool,bytes)` -- Event topic hash: `0x66015c8835ee443e5bc280176609215a5035da4bae05bdef994596d7e43aae22` +- Event signature: `OperatorRevoked(address,address,bool,bytes)` +- Event topic hash: `0x0ebf5762d8855cbe012d2ca42fb33a81175e17c8a8751f8859931ba453bd4167` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bool notified, bytes operatorNotificationData); +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`. @@ -1188,11 +1245,35 @@ Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [` | -------------------------- | :-------: | ------------------------------------------------------------- | | `operator` **`indexed`** | `address` | The address revoked from operating | | `tokenOwner` **`indexed`** | `address` | The token owner | -| `notified` | `bool` | Bool indicating whether the operator has been notified or not | +| `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/tree/main/LSPs/LSP-7-DigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/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 @@ -1347,7 +1428,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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.
@@ -1366,7 +1447,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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/tree/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/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.
@@ -1434,6 +1534,33 @@ reverts when sending an `amount` of tokens larger than the current `balance` of
+### LSP7BatchCallFailed + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#lsp7batchcallfailed) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/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` | - | + +
+ ### LSP7CannotSendToSelf :::note References diff --git a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md index 1979177df9..c53234b94b 100644 --- a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md +++ b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md @@ -178,6 +178,45 @@ Get the number of tokens owned by `tokenOwner`. If the token is divisible (the [
+### batchCalls + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.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 @@ -781,7 +820,8 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -Save gas by emitting the [`DataChanged`](#datachanged) event with only the first 256 bytes of dataValue +The ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol` cannot be changed +via this function once the digital asset contract has been deployed.
@@ -1020,6 +1060,47 @@ Allows to run custom logic after updating balances, but **before notifiying send
+### \_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 @@ -1110,34 +1191,6 @@ CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of t ## Events -### AuthorizedOperator - -:::note References - -- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#authorizedoperator) -- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol) -- Event signature: `AuthorizedOperator(address,address,uint256,bytes)` -- Event topic hash: `0x0744b3de98efaff36606a0e67662fb8697adb0ed49d90730bdb4bbf885f30597` - -::: - -```solidity -event AuthorizedOperator(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. | - -
- ### DataChanged :::note References @@ -1166,43 +1219,47 @@ Emitted when data at a specific `dataKey` was changed to a new value `dataValue`
-### OwnershipTransferred +### OperatorAuthorizationChanged :::note References -- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#ownershiptransferred) +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#operatorauthorizationchanged) - Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol) -- Event signature: `OwnershipTransferred(address,address)` -- Event topic hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` +- Event signature: `OperatorAuthorizationChanged(address,address,uint256,bytes)` +- Event topic hash: `0xf772a43bfdf4729b196e3fb54a818b91a2ca6c49d10b2e16278752f9f515c25d` ::: ```solidity -event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); +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 | -| ----------------------------- | :-------: | ----------- | -| `previousOwner` **`indexed`** | `address` | - | -| `newOwner` **`indexed`** | `address` | - | +| 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. |
-### RevokedOperator +### OperatorRevoked :::note References -- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#revokedoperator) +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#operatorrevoked) - Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol) -- Event signature: `RevokedOperator(address,address,bool,bytes)` -- Event topic hash: `0x66015c8835ee443e5bc280176609215a5035da4bae05bdef994596d7e43aae22` +- Event signature: `OperatorRevoked(address,address,bool,bytes)` +- Event topic hash: `0x0ebf5762d8855cbe012d2ca42fb33a81175e17c8a8751f8859931ba453bd4167` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bool notified, bytes operatorNotificationData); +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`. @@ -1213,11 +1270,35 @@ Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [` | -------------------------- | :-------: | ------------------------------------------------------------- | | `operator` **`indexed`** | `address` | The address revoked from operating | | `tokenOwner` **`indexed`** | `address` | The token owner | -| `notified` | `bool` | Bool indicating whether the operator has been notified or not | +| `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/tree/main/LSPs/LSP-7-DigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.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 @@ -1372,7 +1453,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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.
@@ -1391,7 +1472,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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/tree/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.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.
@@ -1459,6 +1559,33 @@ reverts when sending an `amount` of tokens larger than the current `balance` of
+### LSP7BatchCallFailed + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#lsp7batchcallfailed) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.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` | - | + +
+ ### LSP7CannotSendToSelf :::note References diff --git a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md index d69b08eff5..16a39f574f 100644 --- a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md +++ b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md @@ -178,6 +178,45 @@ Get the number of tokens owned by `tokenOwner`. If the token is divisible (the [
+### batchCalls + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.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 @@ -781,7 +820,8 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -Save gas by emitting the [`DataChanged`](#datachanged) event with only the first 256 bytes of dataValue +The ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol` cannot be changed +via this function once the digital asset contract has been deployed.
@@ -994,6 +1034,47 @@ Allows to run custom logic after updating balances, but **before notifiying send
+### \_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 @@ -1084,34 +1165,6 @@ CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of t ## Events -### AuthorizedOperator - -:::note References - -- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#authorizedoperator) -- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol) -- Event signature: `AuthorizedOperator(address,address,uint256,bytes)` -- Event topic hash: `0x0744b3de98efaff36606a0e67662fb8697adb0ed49d90730bdb4bbf885f30597` - -::: - -```solidity -event AuthorizedOperator(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. | - -
- ### DataChanged :::note References @@ -1140,43 +1193,47 @@ Emitted when data at a specific `dataKey` was changed to a new value `dataValue`
-### OwnershipTransferred +### OperatorAuthorizationChanged :::note References -- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#ownershiptransferred) +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#operatorauthorizationchanged) - Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol) -- Event signature: `OwnershipTransferred(address,address)` -- Event topic hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` +- Event signature: `OperatorAuthorizationChanged(address,address,uint256,bytes)` +- Event topic hash: `0xf772a43bfdf4729b196e3fb54a818b91a2ca6c49d10b2e16278752f9f515c25d` ::: ```solidity -event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); +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 | -| ----------------------------- | :-------: | ----------- | -| `previousOwner` **`indexed`** | `address` | - | -| `newOwner` **`indexed`** | `address` | - | +| 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. |
-### RevokedOperator +### OperatorRevoked :::note References -- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#revokedoperator) +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#operatorrevoked) - Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol) -- Event signature: `RevokedOperator(address,address,bool,bytes)` -- Event topic hash: `0x66015c8835ee443e5bc280176609215a5035da4bae05bdef994596d7e43aae22` +- Event signature: `OperatorRevoked(address,address,bool,bytes)` +- Event topic hash: `0x0ebf5762d8855cbe012d2ca42fb33a81175e17c8a8751f8859931ba453bd4167` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bool notified, bytes operatorNotificationData); +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`. @@ -1187,11 +1244,35 @@ Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [` | -------------------------- | :-------: | ------------------------------------------------------------- | | `operator` **`indexed`** | `address` | The address revoked from operating | | `tokenOwner` **`indexed`** | `address` | The token owner | -| `notified` | `bool` | Bool indicating whether the operator has been notified or not | +| `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/tree/main/LSPs/LSP-7-DigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.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 @@ -1346,7 +1427,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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.
@@ -1365,7 +1446,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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/tree/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.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.
@@ -1433,6 +1533,33 @@ reverts when sending an `amount` of tokens larger than the current `balance` of
+### LSP7BatchCallFailed + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#lsp7batchcallfailed) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.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` | - | + +
+ ### LSP7CannotSendToSelf :::note References diff --git a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md index b1669e7d61..0e36d9b66d 100644 --- a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md +++ b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md @@ -248,6 +248,45 @@ Get the number of tokens owned by `tokenOwner`. If the token is divisible (the [
+### batchCalls + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP7CompatibleERC20.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.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 @@ -958,7 +997,8 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -Save gas by emitting the [`DataChanged`](#datachanged) event with only the first 256 bytes of dataValue +The ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol` cannot be changed +via this function once the digital asset contract has been deployed.
@@ -1083,6 +1123,47 @@ Allows to run custom logic after updating balances, but **before notifiying send
+### \_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 @@ -1200,34 +1281,6 @@ Emitted when the allowance of a `spender` for an `owner` is set by a call to [`a
-### AuthorizedOperator - -:::note References - -- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#authorizedoperator) -- Solidity implementation: [`LSP7CompatibleERC20.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol) -- Event signature: `AuthorizedOperator(address,address,uint256,bytes)` -- Event topic hash: `0x0744b3de98efaff36606a0e67662fb8697adb0ed49d90730bdb4bbf885f30597` - -::: - -```solidity -event AuthorizedOperator(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. | - -
- ### DataChanged :::note References @@ -1256,43 +1309,47 @@ Emitted when data at a specific `dataKey` was changed to a new value `dataValue`
-### OwnershipTransferred +### OperatorAuthorizationChanged :::note References -- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#ownershiptransferred) +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#operatorauthorizationchanged) - Solidity implementation: [`LSP7CompatibleERC20.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol) -- Event signature: `OwnershipTransferred(address,address)` -- Event topic hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` +- Event signature: `OperatorAuthorizationChanged(address,address,uint256,bytes)` +- Event topic hash: `0xf772a43bfdf4729b196e3fb54a818b91a2ca6c49d10b2e16278752f9f515c25d` ::: ```solidity -event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); +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 | -| ----------------------------- | :-------: | ----------- | -| `previousOwner` **`indexed`** | `address` | - | -| `newOwner` **`indexed`** | `address` | - | +| 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. |
-### RevokedOperator +### OperatorRevoked :::note References -- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#revokedoperator) +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#operatorrevoked) - Solidity implementation: [`LSP7CompatibleERC20.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol) -- Event signature: `RevokedOperator(address,address,bool,bytes)` -- Event topic hash: `0x66015c8835ee443e5bc280176609215a5035da4bae05bdef994596d7e43aae22` +- Event signature: `OperatorRevoked(address,address,bool,bytes)` +- Event topic hash: `0x0ebf5762d8855cbe012d2ca42fb33a81175e17c8a8751f8859931ba453bd4167` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bool notified, bytes operatorNotificationData); +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`. @@ -1303,11 +1360,35 @@ Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [` | -------------------------- | :-------: | ------------------------------------------------------------- | | `operator` **`indexed`** | `address` | The address revoked from operating | | `tokenOwner` **`indexed`** | `address` | The token owner | -| `notified` | `bool` | Bool indicating whether the operator has been notified or not | +| `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/tree/main/LSPs/LSP-7-DigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP7CompatibleERC20.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.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 @@ -1489,7 +1570,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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.
@@ -1508,7 +1589,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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/tree/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP7CompatibleERC20.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.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.
@@ -1576,6 +1676,33 @@ reverts when sending an `amount` of tokens larger than the current `balance` of
+### LSP7BatchCallFailed + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#lsp7batchcallfailed) +- Solidity implementation: [`LSP7CompatibleERC20.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.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` | - | + +
+ ### LSP7CannotSendToSelf :::note References diff --git a/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md b/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md index 3cb8ba241c..7ef5aeaf34 100644 --- a/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md +++ b/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md @@ -31,18 +31,24 @@ When marked as 'public', a method can be called both externally and internally, ::: ```solidity -constructor(string name_, string symbol_, address newOwner_); +constructor( + string name_, + string symbol_, + address newOwner_, + uint256 lsp4TokenType_ +); ``` _Deploying a `LSP7CompatibleERC20Mintable` 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. | +| 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). |
@@ -249,6 +255,45 @@ Get the number of tokens owned by `tokenOwner`. If the token is divisible (the [
+### batchCalls + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP7CompatibleERC20Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.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 @@ -992,7 +1037,8 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -Save gas by emitting the [`DataChanged`](#datachanged) event with only the first 256 bytes of dataValue +The ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol` cannot be changed +via this function once the digital asset contract has been deployed.
@@ -1117,6 +1163,47 @@ Allows to run custom logic after updating balances, but **before notifiying send
+### \_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 @@ -1234,34 +1321,6 @@ Emitted when the allowance of a `spender` for an `owner` is set by a call to [`a
-### AuthorizedOperator - -:::note References - -- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#authorizedoperator) -- Solidity implementation: [`LSP7CompatibleERC20Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol) -- Event signature: `AuthorizedOperator(address,address,uint256,bytes)` -- Event topic hash: `0x0744b3de98efaff36606a0e67662fb8697adb0ed49d90730bdb4bbf885f30597` - -::: - -```solidity -event AuthorizedOperator(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. | - -
- ### DataChanged :::note References @@ -1290,43 +1349,47 @@ Emitted when data at a specific `dataKey` was changed to a new value `dataValue`
-### OwnershipTransferred +### OperatorAuthorizationChanged :::note References -- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#ownershiptransferred) +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#operatorauthorizationchanged) - Solidity implementation: [`LSP7CompatibleERC20Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol) -- Event signature: `OwnershipTransferred(address,address)` -- Event topic hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` +- Event signature: `OperatorAuthorizationChanged(address,address,uint256,bytes)` +- Event topic hash: `0xf772a43bfdf4729b196e3fb54a818b91a2ca6c49d10b2e16278752f9f515c25d` ::: ```solidity -event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); +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 | -| ----------------------------- | :-------: | ----------- | -| `previousOwner` **`indexed`** | `address` | - | -| `newOwner` **`indexed`** | `address` | - | +| 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. |
-### RevokedOperator +### OperatorRevoked :::note References -- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#revokedoperator) +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#operatorrevoked) - Solidity implementation: [`LSP7CompatibleERC20Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol) -- Event signature: `RevokedOperator(address,address,bool,bytes)` -- Event topic hash: `0x66015c8835ee443e5bc280176609215a5035da4bae05bdef994596d7e43aae22` +- Event signature: `OperatorRevoked(address,address,bool,bytes)` +- Event topic hash: `0x0ebf5762d8855cbe012d2ca42fb33a81175e17c8a8751f8859931ba453bd4167` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bool notified, bytes operatorNotificationData); +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`. @@ -1337,11 +1400,35 @@ Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [` | -------------------------- | :-------: | ------------------------------------------------------------- | | `operator` **`indexed`** | `address` | The address revoked from operating | | `tokenOwner` **`indexed`** | `address` | The token owner | -| `notified` | `bool` | Bool indicating whether the operator has been notified or not | +| `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/tree/main/LSPs/LSP-7-DigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP7CompatibleERC20Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.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 @@ -1523,7 +1610,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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.
@@ -1542,7 +1629,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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/tree/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP7CompatibleERC20Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.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.
@@ -1610,6 +1716,33 @@ reverts when sending an `amount` of tokens larger than the current `balance` of
+### LSP7BatchCallFailed + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#lsp7batchcallfailed) +- Solidity implementation: [`LSP7CompatibleERC20Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.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` | - | + +
+ ### LSP7CannotSendToSelf :::note References diff --git a/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md b/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md index 4998d6f025..74d5eaed59 100644 --- a/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md +++ b/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md @@ -35,6 +35,7 @@ constructor( string name_, string symbol_, address newOwner_, + uint256 lsp4TokenType_, bool isNonDivisible_ ); ``` @@ -43,12 +44,13 @@ _Deploying a `LSP7Mintable` token contract with: token name = `name_`, token sym #### 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. | -| `isNonDivisible_` | `bool` | - | +| 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. |
@@ -209,6 +211,45 @@ Get the number of tokens owned by `tokenOwner`. If the token is divisible (the [
+### batchCalls + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7Mintable.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 @@ -818,7 +859,8 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -Save gas by emitting the [`DataChanged`](#datachanged) event with only the first 256 bytes of dataValue +The ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol` cannot be changed +via this function once the digital asset contract has been deployed.
@@ -1057,6 +1099,47 @@ Allows to run custom logic after updating balances, but **before notifiying send
+### \_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 @@ -1147,34 +1230,6 @@ CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of t ## Events -### AuthorizedOperator - -:::note References - -- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#authorizedoperator) -- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol) -- Event signature: `AuthorizedOperator(address,address,uint256,bytes)` -- Event topic hash: `0x0744b3de98efaff36606a0e67662fb8697adb0ed49d90730bdb4bbf885f30597` - -::: - -```solidity -event AuthorizedOperator(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. | - -
- ### DataChanged :::note References @@ -1203,43 +1258,47 @@ Emitted when data at a specific `dataKey` was changed to a new value `dataValue`
-### OwnershipTransferred +### OperatorAuthorizationChanged :::note References -- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#ownershiptransferred) +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#operatorauthorizationchanged) - Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol) -- Event signature: `OwnershipTransferred(address,address)` -- Event topic hash: `0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0` +- Event signature: `OperatorAuthorizationChanged(address,address,uint256,bytes)` +- Event topic hash: `0xf772a43bfdf4729b196e3fb54a818b91a2ca6c49d10b2e16278752f9f515c25d` ::: ```solidity -event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); +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 | -| ----------------------------- | :-------: | ----------- | -| `previousOwner` **`indexed`** | `address` | - | -| `newOwner` **`indexed`** | `address` | - | +| 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. |
-### RevokedOperator +### OperatorRevoked :::note References -- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#revokedoperator) +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#operatorrevoked) - Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol) -- Event signature: `RevokedOperator(address,address,bool,bytes)` -- Event topic hash: `0x66015c8835ee443e5bc280176609215a5035da4bae05bdef994596d7e43aae22` +- Event signature: `OperatorRevoked(address,address,bool,bytes)` +- Event topic hash: `0x0ebf5762d8855cbe012d2ca42fb33a81175e17c8a8751f8859931ba453bd4167` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bool notified, bytes operatorNotificationData); +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`. @@ -1250,11 +1309,35 @@ Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [` | -------------------------- | :-------: | ------------------------------------------------------------- | | `operator` **`indexed`** | `address` | The address revoked from operating | | `tokenOwner` **`indexed`** | `address` | The token owner | -| `notified` | `bool` | Bool indicating whether the operator has been notified or not | +| `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/tree/main/LSPs/LSP-7-DigitalAsset.md#ownershiptransferred) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7Mintable.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 @@ -1409,7 +1492,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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.
@@ -1428,7 +1511,26 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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/tree/main/LSPs/LSP-7-DigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7Mintable.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.
@@ -1496,6 +1598,33 @@ reverts when sending an `amount` of tokens larger than the current `balance` of
+### LSP7BatchCallFailed + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#lsp7batchcallfailed) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7Mintable.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` | - | + +
+ ### LSP7CannotSendToSelf :::note References diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md index 9a162cb7a8..5cbd8014a9 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md @@ -139,6 +139,45 @@ Get the number of token IDs owned by `tokenOwner`.
+### batchCalls + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/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 @@ -207,6 +246,76 @@ Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys
+### getDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatchfortokenids) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatafortokenid) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/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 @@ -450,6 +559,68 @@ Batch data setting function that behaves the same as [`setData`](#setdata) but a
+### setDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatchfortokenids) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatafortokenid) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/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 @@ -723,7 +894,7 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -The ERC725Y data key `_LSP8_TOKENID_TYPE_KEY` cannot be changed +The ERC725Y data key `_LSP8_TOKENID_FORMAT_KEY` cannot be changed once the identifiable digital asset contract has been deployed.
@@ -944,6 +1115,64 @@ all the parameters in the calldata packed encoded.
+### \_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 @@ -994,6 +1223,47 @@ Allows to run custom logic after updating balances, but **before notifiying send
+### \_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 @@ -1004,9 +1274,21 @@ function _notifyTokenReceiver( ) internal nonpayable; ``` -An attempt is made to notify the token receiver about the `tokenId` changing owners -using LSP1 interface. When force is FALSE the token receiver MUST support LSP1. -The receiver may revert when the token being sent is not wanted. +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. |
@@ -1070,19 +1352,47 @@ CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of t ## Events -### AuthorizedOperator +### DataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizedoperator) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorauthorizationchanged) - Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol) -- Event signature: `AuthorizedOperator(address,address,bytes32,bytes)` -- Event topic hash: `0x0052e433f2d4225671bc164dd1cdc9a76044356091f27ad234798bd0cbf08349` +- Event signature: `OperatorAuthorizationChanged(address,address,bytes32,bytes)` +- Event topic hash: `0x1b1b58aa2ec0cec2228b2d37124556d41f5a1f7b12f089171f896cc236671215` ::: ```solidity -event AuthorizedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); +event OperatorAuthorizationChanged(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); ``` Emitted when `tokenOwner` enables `operator` to transfer or burn the `tokenId`. @@ -1098,31 +1408,32 @@ Emitted when `tokenOwner` enables `operator` to transfer or burn the `tokenId`.
-### DataChanged +### OperatorRevoked :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorrevoked) - Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol) -- Event signature: `DataChanged(bytes32,bytes)` -- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` +- Event signature: `OperatorRevoked(address,address,bytes32,bool,bytes)` +- Event topic hash: `0xc78cd419d6136f9f1c1c6aec1d3fae098cffaf8bc86314a8f2685e32fe574e3c` ::: ```solidity -event DataChanged(bytes32 indexed dataKey, bytes dataValue); +event OperatorRevoked(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); ``` -_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`. +Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. #### 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. | +| 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. |
@@ -1150,32 +1461,30 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn
-### RevokedOperator +### TokenIdDataChanged :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokedoperator) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokeniddatachanged) - Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol) -- Event signature: `RevokedOperator(address,address,bytes32,bool,bytes)` -- Event topic hash: `0x3ee932cea40ebbbfd8577d47156cc17cce8683802c57bbd1fb8c131c6f07af0a` +- Event signature: `TokenIdDataChanged(bytes32,bytes32,bytes)` +- Event topic hash: `0xa6e4251f855f750545fe414f120db91c76b88def14d120969e5bb2d3f05debbb` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); +event TokenIdDataChanged(bytes32 indexed tokenId, bytes32 indexed dataKey, bytes dataValue); ``` -Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. +Emitted when setting data for `tokenId`. #### 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. | +| 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. |
@@ -1333,7 +1642,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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.
@@ -1352,7 +1661,53 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8batchcallfailed) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/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` | - |
@@ -1635,22 +1990,60 @@ Error occurs when sending native tokens to the LSP8 contract without sending any
-### LSP8TokenIdTypeNotEditable +### LSP8TokenIdFormatNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidformatnoteditable) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdataemptyarray) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidtypenoteditable) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdatalengthmismatch) - Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol) -- Error signature: `LSP8TokenIdTypeNotEditable()` -- Error hash: `0x53bc1122` +- Error signature: `LSP8TokenIdsDataLengthMismatch()` +- Error hash: `0x2fa71dfe` ::: ```solidity -error LSP8TokenIdTypeNotEditable(); +error LSP8TokenIdsDataLengthMismatch(); ``` -Reverts when trying to edit the data key `LSP8TokenIdType` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdType` 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. +Reverts when the length of the token IDs data arrays is not equal
diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md index 444e18139c..b6ac5fb1b0 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md @@ -137,6 +137,45 @@ Get the number of token IDs owned by `tokenOwner`.
+### batchCalls + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.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 @@ -233,6 +272,76 @@ Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys
+### getDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatchfortokenids) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatafortokenid) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.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 @@ -476,6 +585,68 @@ Batch data setting function that behaves the same as [`setData`](#setdata) but a
+### setDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatchfortokenids) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatafortokenid) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.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 @@ -749,7 +920,7 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -The ERC725Y data key `_LSP8_TOKENID_TYPE_KEY` cannot be changed +The ERC725Y data key `_LSP8_TOKENID_FORMAT_KEY` cannot be changed once the identifiable digital asset contract has been deployed.
@@ -970,6 +1141,64 @@ all the parameters in the calldata packed encoded.
+### \_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 @@ -1020,6 +1249,47 @@ Allows to run custom logic after updating balances, but **before notifiying send
+### \_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 @@ -1030,9 +1300,21 @@ function _notifyTokenReceiver( ) internal nonpayable; ``` -An attempt is made to notify the token receiver about the `tokenId` changing owners -using LSP1 interface. When force is FALSE the token receiver MUST support LSP1. -The receiver may revert when the token being sent is not wanted. +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. |
@@ -1096,19 +1378,47 @@ CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of t ## Events -### AuthorizedOperator +### DataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizedoperator) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorauthorizationchanged) - Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) -- Event signature: `AuthorizedOperator(address,address,bytes32,bytes)` -- Event topic hash: `0x0052e433f2d4225671bc164dd1cdc9a76044356091f27ad234798bd0cbf08349` +- Event signature: `OperatorAuthorizationChanged(address,address,bytes32,bytes)` +- Event topic hash: `0x1b1b58aa2ec0cec2228b2d37124556d41f5a1f7b12f089171f896cc236671215` ::: ```solidity -event AuthorizedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); +event OperatorAuthorizationChanged(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); ``` Emitted when `tokenOwner` enables `operator` to transfer or burn the `tokenId`. @@ -1124,31 +1434,32 @@ Emitted when `tokenOwner` enables `operator` to transfer or burn the `tokenId`.
-### DataChanged +### OperatorRevoked :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorrevoked) - Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) -- Event signature: `DataChanged(bytes32,bytes)` -- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` +- Event signature: `OperatorRevoked(address,address,bytes32,bool,bytes)` +- Event topic hash: `0xc78cd419d6136f9f1c1c6aec1d3fae098cffaf8bc86314a8f2685e32fe574e3c` ::: ```solidity -event DataChanged(bytes32 indexed dataKey, bytes dataValue); +event OperatorRevoked(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); ``` -_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`. +Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. #### 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. | +| 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. |
@@ -1176,32 +1487,30 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn
-### RevokedOperator +### TokenIdDataChanged :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokedoperator) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokeniddatachanged) - Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) -- Event signature: `RevokedOperator(address,address,bytes32,bool,bytes)` -- Event topic hash: `0x3ee932cea40ebbbfd8577d47156cc17cce8683802c57bbd1fb8c131c6f07af0a` +- Event signature: `TokenIdDataChanged(bytes32,bytes32,bytes)` +- Event topic hash: `0xa6e4251f855f750545fe414f120db91c76b88def14d120969e5bb2d3f05debbb` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); +event TokenIdDataChanged(bytes32 indexed tokenId, bytes32 indexed dataKey, bytes dataValue); ``` -Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. +Emitted when setting data for `tokenId`. #### 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. | +| 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. |
@@ -1359,7 +1668,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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.
@@ -1378,7 +1687,53 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8batchcallfailed) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.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` | - |
@@ -1661,22 +2016,60 @@ Error occurs when sending native tokens to the LSP8 contract without sending any
-### LSP8TokenIdTypeNotEditable +### LSP8TokenIdFormatNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidformatnoteditable) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdataemptyarray) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidtypenoteditable) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdatalengthmismatch) - Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) -- Error signature: `LSP8TokenIdTypeNotEditable()` -- Error hash: `0x53bc1122` +- Error signature: `LSP8TokenIdsDataLengthMismatch()` +- Error hash: `0x2fa71dfe` ::: ```solidity -error LSP8TokenIdTypeNotEditable(); +error LSP8TokenIdsDataLengthMismatch(); ``` -Reverts when trying to edit the data key `LSP8TokenIdType` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdType` 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. +Reverts when the length of the token IDs data arrays is not equal
diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md index 8ff5da68ed..cd7d4f6bd3 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md @@ -137,6 +137,45 @@ Get the number of token IDs owned by `tokenOwner`.
+### batchCalls + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.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 @@ -205,6 +244,76 @@ Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys
+### getDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatchfortokenids) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatafortokenid) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.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 @@ -448,6 +557,68 @@ Batch data setting function that behaves the same as [`setData`](#setdata) but a
+### setDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatchfortokenids) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatafortokenid) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.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 @@ -748,7 +919,7 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -The ERC725Y data key `_LSP8_TOKENID_TYPE_KEY` cannot be changed +The ERC725Y data key `_LSP8_TOKENID_FORMAT_KEY` cannot be changed once the identifiable digital asset contract has been deployed.
@@ -944,6 +1115,64 @@ all the parameters in the calldata packed encoded.
+### \_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 @@ -994,6 +1223,47 @@ Allows to run custom logic after updating balances, but **before notifiying send
+### \_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 @@ -1004,9 +1274,21 @@ function _notifyTokenReceiver( ) internal nonpayable; ``` -An attempt is made to notify the token receiver about the `tokenId` changing owners -using LSP1 interface. When force is FALSE the token receiver MUST support LSP1. -The receiver may revert when the token being sent is not wanted. +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. |
@@ -1070,19 +1352,47 @@ CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of t ## Events -### AuthorizedOperator +### DataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizedoperator) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorauthorizationchanged) - Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) -- Event signature: `AuthorizedOperator(address,address,bytes32,bytes)` -- Event topic hash: `0x0052e433f2d4225671bc164dd1cdc9a76044356091f27ad234798bd0cbf08349` +- Event signature: `OperatorAuthorizationChanged(address,address,bytes32,bytes)` +- Event topic hash: `0x1b1b58aa2ec0cec2228b2d37124556d41f5a1f7b12f089171f896cc236671215` ::: ```solidity -event AuthorizedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); +event OperatorAuthorizationChanged(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); ``` Emitted when `tokenOwner` enables `operator` to transfer or burn the `tokenId`. @@ -1098,31 +1408,32 @@ Emitted when `tokenOwner` enables `operator` to transfer or burn the `tokenId`.
-### DataChanged +### OperatorRevoked :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorrevoked) - Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) -- Event signature: `DataChanged(bytes32,bytes)` -- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` +- Event signature: `OperatorRevoked(address,address,bytes32,bool,bytes)` +- Event topic hash: `0xc78cd419d6136f9f1c1c6aec1d3fae098cffaf8bc86314a8f2685e32fe574e3c` ::: ```solidity -event DataChanged(bytes32 indexed dataKey, bytes dataValue); +event OperatorRevoked(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); ``` -_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`. +Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. #### 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. | +| 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. |
@@ -1150,32 +1461,30 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn
-### RevokedOperator +### TokenIdDataChanged :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokedoperator) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokeniddatachanged) - Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) -- Event signature: `RevokedOperator(address,address,bytes32,bool,bytes)` -- Event topic hash: `0x3ee932cea40ebbbfd8577d47156cc17cce8683802c57bbd1fb8c131c6f07af0a` +- Event signature: `TokenIdDataChanged(bytes32,bytes32,bytes)` +- Event topic hash: `0xa6e4251f855f750545fe414f120db91c76b88def14d120969e5bb2d3f05debbb` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); +event TokenIdDataChanged(bytes32 indexed tokenId, bytes32 indexed dataKey, bytes dataValue); ``` -Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. +Emitted when setting data for `tokenId`. #### 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. | +| 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. |
@@ -1333,7 +1642,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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.
@@ -1352,7 +1661,53 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8batchcallfailed) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.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` | - |
@@ -1677,22 +2032,60 @@ Error occurs when sending native tokens to the LSP8 contract without sending any
-### LSP8TokenIdTypeNotEditable +### LSP8TokenIdFormatNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidformatnoteditable) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdataemptyarray) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidtypenoteditable) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdatalengthmismatch) - Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) -- Error signature: `LSP8TokenIdTypeNotEditable()` -- Error hash: `0x53bc1122` +- Error signature: `LSP8TokenIdsDataLengthMismatch()` +- Error hash: `0x2fa71dfe` ::: ```solidity -error LSP8TokenIdTypeNotEditable(); +error LSP8TokenIdsDataLengthMismatch(); ``` -Reverts when trying to edit the data key `LSP8TokenIdType` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdType` 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. +Reverts when the length of the token IDs data arrays is not equal
diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.md index dda3eb65b2..885463cc7e 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.md @@ -128,7 +128,7 @@ Allow an `operator` address to transfer or burn a specific `tokenId` on behalf o **Emitted events:** -- LSP7 [`AuthorizedOperator`](#authorizedoperator) event. +- LSP7 [`OperatorAuthorizationChanged`](#operatorauthorizationchanged) event. - ERC721 [`Approval`](#approval) event. @@ -174,6 +174,45 @@ Get the number of token IDs owned by `tokenOwner`.
+### batchCalls + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.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. | + +
+ ### getApproved :::note References @@ -275,6 +314,76 @@ Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys
+### getDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatchfortokenids) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatafortokenid) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.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 @@ -729,6 +838,68 @@ Batch data setting function that behaves the same as [`setData`](#setdata) but a
+### setDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatchfortokenids) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatafortokenid) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.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 @@ -1099,7 +1270,7 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -The ERC725Y data key `_LSP8_TOKENID_TYPE_KEY` cannot be changed +The ERC725Y data key `_LSP8_TOKENID_FORMAT_KEY` cannot be changed once the identifiable digital asset contract has been deployed.
@@ -1215,6 +1386,64 @@ function _transfer(
+### \_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 @@ -1265,6 +1494,47 @@ Allows to run custom logic after updating balances, but **before notifiying send
+### \_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 @@ -1275,9 +1545,21 @@ function _notifyTokenReceiver( ) internal nonpayable; ``` -An attempt is made to notify the token receiver about the `tokenId` changing owners -using LSP1 interface. When force is FALSE the token receiver MUST support LSP1. -The receiver may revert when the token being sent is not wanted. +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. |
@@ -1434,19 +1716,47 @@ Emitted when `account` grants or revokes permission to `operator` to transfer th
-### AuthorizedOperator +### DataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizedoperator) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorauthorizationchanged) - Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) -- Event signature: `AuthorizedOperator(address,address,bytes32,bytes)` -- Event topic hash: `0x0052e433f2d4225671bc164dd1cdc9a76044356091f27ad234798bd0cbf08349` +- Event signature: `OperatorAuthorizationChanged(address,address,bytes32,bytes)` +- Event topic hash: `0x1b1b58aa2ec0cec2228b2d37124556d41f5a1f7b12f089171f896cc236671215` ::: ```solidity -event AuthorizedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); +event OperatorAuthorizationChanged(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); ``` Emitted when `tokenOwner` enables `operator` to transfer or burn the `tokenId`. @@ -1462,31 +1772,32 @@ Emitted when `tokenOwner` enables `operator` to transfer or burn the `tokenId`.
-### DataChanged +### OperatorRevoked :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorrevoked) - Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) -- Event signature: `DataChanged(bytes32,bytes)` -- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` +- Event signature: `OperatorRevoked(address,address,bytes32,bool,bytes)` +- Event topic hash: `0xc78cd419d6136f9f1c1c6aec1d3fae098cffaf8bc86314a8f2685e32fe574e3c` ::: ```solidity -event DataChanged(bytes32 indexed dataKey, bytes dataValue); +event OperatorRevoked(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); ``` -_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`. +Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. #### 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. | +| 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. |
@@ -1514,32 +1825,30 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn
-### RevokedOperator +### TokenIdDataChanged :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokedoperator) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokeniddatachanged) - Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) -- Event signature: `RevokedOperator(address,address,bytes32,bool,bytes)` -- Event topic hash: `0x3ee932cea40ebbbfd8577d47156cc17cce8683802c57bbd1fb8c131c6f07af0a` +- Event signature: `TokenIdDataChanged(bytes32,bytes32,bytes)` +- Event topic hash: `0xa6e4251f855f750545fe414f120db91c76b88def14d120969e5bb2d3f05debbb` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); +event TokenIdDataChanged(bytes32 indexed tokenId, bytes32 indexed dataKey, bytes dataValue); ``` -Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. +Emitted when setting data for `tokenId`. #### 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. | +| 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. |
@@ -1724,7 +2033,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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.
@@ -1743,7 +2052,53 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8batchcallfailed) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.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` | - |
@@ -2026,22 +2381,60 @@ Error occurs when sending native tokens to the LSP8 contract without sending any
-### LSP8TokenIdTypeNotEditable +### LSP8TokenIdFormatNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidformatnoteditable) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdataemptyarray) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidtypenoteditable) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdatalengthmismatch) - Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) -- Error signature: `LSP8TokenIdTypeNotEditable()` -- Error hash: `0x53bc1122` +- Error signature: `LSP8TokenIdsDataLengthMismatch()` +- Error hash: `0x2fa71dfe` ::: ```solidity -error LSP8TokenIdTypeNotEditable(); +error LSP8TokenIdsDataLengthMismatch(); ``` -Reverts when trying to edit the data key `LSP8TokenIdType` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdType` 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. +Reverts when the length of the token IDs data arrays is not equal
diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md index 24136c3e94..f04d2e4b6b 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md @@ -137,6 +137,45 @@ Get the number of token IDs owned by `tokenOwner`.
+### batchCalls + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.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 @@ -205,6 +244,76 @@ Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys
+### getDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatchfortokenids) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatafortokenid) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.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 @@ -448,6 +557,68 @@ Batch data setting function that behaves the same as [`setData`](#setdata) but a
+### setDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatchfortokenids) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatafortokenid) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.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 @@ -754,7 +925,7 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -The ERC725Y data key `_LSP8_TOKENID_TYPE_KEY` cannot be changed +The ERC725Y data key `_LSP8_TOKENID_FORMAT_KEY` cannot be changed once the identifiable digital asset contract has been deployed.
@@ -975,6 +1146,64 @@ all the parameters in the calldata packed encoded.
+### \_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 @@ -1022,6 +1251,47 @@ Allows to run custom logic after updating balances, but **before notifiying send
+### \_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 @@ -1032,9 +1302,21 @@ function _notifyTokenReceiver( ) internal nonpayable; ``` -An attempt is made to notify the token receiver about the `tokenId` changing owners -using LSP1 interface. When force is FALSE the token receiver MUST support LSP1. -The receiver may revert when the token being sent is not wanted. +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. |
@@ -1098,19 +1380,47 @@ CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of t ## Events -### AuthorizedOperator +### DataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizedoperator) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorauthorizationchanged) - Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) -- Event signature: `AuthorizedOperator(address,address,bytes32,bytes)` -- Event topic hash: `0x0052e433f2d4225671bc164dd1cdc9a76044356091f27ad234798bd0cbf08349` +- Event signature: `OperatorAuthorizationChanged(address,address,bytes32,bytes)` +- Event topic hash: `0x1b1b58aa2ec0cec2228b2d37124556d41f5a1f7b12f089171f896cc236671215` ::: ```solidity -event AuthorizedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); +event OperatorAuthorizationChanged(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); ``` Emitted when `tokenOwner` enables `operator` to transfer or burn the `tokenId`. @@ -1126,31 +1436,32 @@ Emitted when `tokenOwner` enables `operator` to transfer or burn the `tokenId`.
-### DataChanged +### OperatorRevoked :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorrevoked) - Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) -- Event signature: `DataChanged(bytes32,bytes)` -- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` +- Event signature: `OperatorRevoked(address,address,bytes32,bool,bytes)` +- Event topic hash: `0xc78cd419d6136f9f1c1c6aec1d3fae098cffaf8bc86314a8f2685e32fe574e3c` ::: ```solidity -event DataChanged(bytes32 indexed dataKey, bytes dataValue); +event OperatorRevoked(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); ``` -_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`. +Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. #### 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. | +| 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. |
@@ -1178,32 +1489,30 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn
-### RevokedOperator +### TokenIdDataChanged :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokedoperator) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokeniddatachanged) - Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) -- Event signature: `RevokedOperator(address,address,bytes32,bool,bytes)` -- Event topic hash: `0x3ee932cea40ebbbfd8577d47156cc17cce8683802c57bbd1fb8c131c6f07af0a` +- Event signature: `TokenIdDataChanged(bytes32,bytes32,bytes)` +- Event topic hash: `0xa6e4251f855f750545fe414f120db91c76b88def14d120969e5bb2d3f05debbb` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); +event TokenIdDataChanged(bytes32 indexed tokenId, bytes32 indexed dataKey, bytes dataValue); ``` -Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. +Emitted when setting data for `tokenId`. #### 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. | +| 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. |
@@ -1361,7 +1670,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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.
@@ -1380,7 +1689,53 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8batchcallfailed) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.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` | - |
@@ -1663,22 +2018,60 @@ Error occurs when sending native tokens to the LSP8 contract without sending any
-### LSP8TokenIdTypeNotEditable +### LSP8TokenIdFormatNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidformatnoteditable) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdataemptyarray) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidtypenoteditable) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdatalengthmismatch) - Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) -- Error signature: `LSP8TokenIdTypeNotEditable()` -- Error hash: `0x53bc1122` +- Error signature: `LSP8TokenIdsDataLengthMismatch()` +- Error hash: `0x2fa71dfe` ::: ```solidity -error LSP8TokenIdTypeNotEditable(); +error LSP8TokenIdsDataLengthMismatch(); ``` -Reverts when trying to edit the data key `LSP8TokenIdType` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdType` 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. +Reverts when the length of the token IDs data arrays is not equal
diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.md index 27faa9f0de..01b0bfd1f7 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.md @@ -35,7 +35,8 @@ constructor( string name_, string symbol_, address newOwner_, - uint256 tokenIdType_ + uint256 lsp4TokenType_, + uint256 lsp8TokenIdFormat_ ); ``` @@ -43,12 +44,13 @@ _Deploying a `LSP8CompatibleERC721Mintable` token contract with: token name = `n #### 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. | -| `tokenIdType_` | `uint256` | - | +| 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. |
@@ -135,7 +137,7 @@ Allow an `operator` address to transfer or burn a specific `tokenId` on behalf o **Emitted events:** -- LSP7 [`AuthorizedOperator`](#authorizedoperator) event. +- LSP7 [`OperatorAuthorizationChanged`](#operatorauthorizationchanged) event. - ERC721 [`Approval`](#approval) event. @@ -181,6 +183,45 @@ Get the number of token IDs owned by `tokenOwner`.
+### batchCalls + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.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. | + +
+ ### getApproved :::note References @@ -282,6 +323,76 @@ Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys
+### getDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatchfortokenids) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatafortokenid) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.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 @@ -771,6 +882,68 @@ Batch data setting function that behaves the same as [`setData`](#setdata) but a
+### setDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatchfortokenids) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatafortokenid) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.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 @@ -1141,7 +1314,7 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -The ERC725Y data key `_LSP8_TOKENID_TYPE_KEY` cannot be changed +The ERC725Y data key `_LSP8_TOKENID_FORMAT_KEY` cannot be changed once the identifiable digital asset contract has been deployed.
@@ -1257,6 +1430,64 @@ function _transfer(
+### \_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 @@ -1307,6 +1538,47 @@ Allows to run custom logic after updating balances, but **before notifiying send
+### \_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 @@ -1317,9 +1589,21 @@ function _notifyTokenReceiver( ) internal nonpayable; ``` -An attempt is made to notify the token receiver about the `tokenId` changing owners -using LSP1 interface. When force is FALSE the token receiver MUST support LSP1. -The receiver may revert when the token being sent is not wanted. +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. |
@@ -1476,19 +1760,47 @@ Emitted when `account` grants or revokes permission to `operator` to transfer th
-### AuthorizedOperator +### DataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizedoperator) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorauthorizationchanged) - Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) -- Event signature: `AuthorizedOperator(address,address,bytes32,bytes)` -- Event topic hash: `0x0052e433f2d4225671bc164dd1cdc9a76044356091f27ad234798bd0cbf08349` +- Event signature: `OperatorAuthorizationChanged(address,address,bytes32,bytes)` +- Event topic hash: `0x1b1b58aa2ec0cec2228b2d37124556d41f5a1f7b12f089171f896cc236671215` ::: ```solidity -event AuthorizedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); +event OperatorAuthorizationChanged(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); ``` Emitted when `tokenOwner` enables `operator` to transfer or burn the `tokenId`. @@ -1504,31 +1816,32 @@ Emitted when `tokenOwner` enables `operator` to transfer or burn the `tokenId`.
-### DataChanged +### OperatorRevoked :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorrevoked) - Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) -- Event signature: `DataChanged(bytes32,bytes)` -- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` +- Event signature: `OperatorRevoked(address,address,bytes32,bool,bytes)` +- Event topic hash: `0xc78cd419d6136f9f1c1c6aec1d3fae098cffaf8bc86314a8f2685e32fe574e3c` ::: ```solidity -event DataChanged(bytes32 indexed dataKey, bytes dataValue); +event OperatorRevoked(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); ``` -_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`. +Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. #### 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. | +| 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. |
@@ -1556,32 +1869,30 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn
-### RevokedOperator +### TokenIdDataChanged :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokedoperator) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokeniddatachanged) - Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) -- Event signature: `RevokedOperator(address,address,bytes32,bool,bytes)` -- Event topic hash: `0x3ee932cea40ebbbfd8577d47156cc17cce8683802c57bbd1fb8c131c6f07af0a` +- Event signature: `TokenIdDataChanged(bytes32,bytes32,bytes)` +- Event topic hash: `0xa6e4251f855f750545fe414f120db91c76b88def14d120969e5bb2d3f05debbb` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); +event TokenIdDataChanged(bytes32 indexed tokenId, bytes32 indexed dataKey, bytes dataValue); ``` -Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. +Emitted when setting data for `tokenId`. #### 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. | +| 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. |
@@ -1766,7 +2077,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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.
@@ -1785,7 +2096,53 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8batchcallfailed) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.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` | - |
@@ -2093,22 +2450,60 @@ Reverts when `tokenId` has already been minted.
-### LSP8TokenIdTypeNotEditable +### LSP8TokenIdFormatNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidformatnoteditable) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdataemptyarray) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidtypenoteditable) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdatalengthmismatch) - Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) -- Error signature: `LSP8TokenIdTypeNotEditable()` -- Error hash: `0x53bc1122` +- Error signature: `LSP8TokenIdsDataLengthMismatch()` +- Error hash: `0x2fa71dfe` ::: ```solidity -error LSP8TokenIdTypeNotEditable(); +error LSP8TokenIdsDataLengthMismatch(); ``` -Reverts when trying to edit the data key `LSP8TokenIdType` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdType` 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. +Reverts when the length of the token IDs data arrays is not equal
diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md index 12cc1672a9..e5d4d8dd9e 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md @@ -35,7 +35,8 @@ constructor( string name_, string symbol_, address newOwner_, - uint256 tokenIdType_ + uint256 lsp4TokenType_, + uint256 lsp8TokenIdFormat_ ); ``` @@ -43,12 +44,13 @@ _Deploying a `LSP8Mintable` token contract with: token name = `name_`, token sym #### 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. | -| `tokenIdType_` | `uint256` | - | +| 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. |
@@ -168,6 +170,45 @@ Get the number of token IDs owned by `tokenOwner`.
+### batchCalls + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#batchcalls) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.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 @@ -236,6 +277,76 @@ Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys
+### getDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatabatchfortokenids) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#getdatafortokenid) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.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 @@ -514,6 +625,68 @@ Batch data setting function that behaves the same as [`setData`](#setdata) but a
+### setDataBatchForTokenIds + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatabatchfortokenids) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#setdatafortokenid) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.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 @@ -787,7 +960,7 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -The ERC725Y data key `_LSP8_TOKENID_TYPE_KEY` cannot be changed +The ERC725Y data key `_LSP8_TOKENID_FORMAT_KEY` cannot be changed once the identifiable digital asset contract has been deployed.
@@ -1008,6 +1181,64 @@ all the parameters in the calldata packed encoded.
+### \_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 @@ -1058,6 +1289,47 @@ Allows to run custom logic after updating balances, but **before notifiying send
+### \_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 @@ -1068,9 +1340,21 @@ function _notifyTokenReceiver( ) internal nonpayable; ``` -An attempt is made to notify the token receiver about the `tokenId` changing owners -using LSP1 interface. When force is FALSE the token receiver MUST support LSP1. -The receiver may revert when the token being sent is not wanted. +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. |
@@ -1134,19 +1418,47 @@ CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of t ## Events -### AuthorizedOperator +### DataChanged + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Event signature: `DataChanged(bytes32,bytes)` +- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` + +::: + +```solidity +event DataChanged(bytes32 indexed dataKey, bytes dataValue); +``` + +_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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#authorizedoperator) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorauthorizationchanged) - Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) -- Event signature: `AuthorizedOperator(address,address,bytes32,bytes)` -- Event topic hash: `0x0052e433f2d4225671bc164dd1cdc9a76044356091f27ad234798bd0cbf08349` +- Event signature: `OperatorAuthorizationChanged(address,address,bytes32,bytes)` +- Event topic hash: `0x1b1b58aa2ec0cec2228b2d37124556d41f5a1f7b12f089171f896cc236671215` ::: ```solidity -event AuthorizedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); +event OperatorAuthorizationChanged(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); ``` Emitted when `tokenOwner` enables `operator` to transfer or burn the `tokenId`. @@ -1162,31 +1474,32 @@ Emitted when `tokenOwner` enables `operator` to transfer or burn the `tokenId`.
-### DataChanged +### OperatorRevoked :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#datachanged) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#operatorrevoked) - Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) -- Event signature: `DataChanged(bytes32,bytes)` -- Event topic hash: `0xece574603820d07bc9b91f2a932baadf4628aabcb8afba49776529c14a6104b2` +- Event signature: `OperatorRevoked(address,address,bytes32,bool,bytes)` +- Event topic hash: `0xc78cd419d6136f9f1c1c6aec1d3fae098cffaf8bc86314a8f2685e32fe574e3c` ::: ```solidity -event DataChanged(bytes32 indexed dataKey, bytes dataValue); +event OperatorRevoked(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); ``` -_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`. +Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. #### 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. | +| 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. |
@@ -1214,32 +1527,30 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn
-### RevokedOperator +### TokenIdDataChanged :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokedoperator) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokeniddatachanged) - Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) -- Event signature: `RevokedOperator(address,address,bytes32,bool,bytes)` -- Event topic hash: `0x3ee932cea40ebbbfd8577d47156cc17cce8683802c57bbd1fb8c131c6f07af0a` +- Event signature: `TokenIdDataChanged(bytes32,bytes32,bytes)` +- Event topic hash: `0xa6e4251f855f750545fe414f120db91c76b88def14d120969e5bb2d3f05debbb` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); +event TokenIdDataChanged(bytes32 indexed tokenId, bytes32 indexed dataKey, bytes dataValue); ``` -Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. +Emitted when setting data for `tokenId`. #### 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. | +| 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. |
@@ -1397,7 +1708,7 @@ reverts when the contract is called with a function selector not valid (less tha error LSP4TokenNameNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenName` after the digital asset contract has been deployed. The `LSP4TokenName` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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.
@@ -1416,7 +1727,53 @@ Reverts when trying to edit the data key `LSP4TokenName` after the digital asset error LSP4TokenSymbolNotEditable(); ``` -Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital asset contract has been deployed. The `LSP4TokenSymbol` data key is located inside the ERC725Y Data key-value store of the digital asset contract. It can be set only once inside the constructor/initializer when the digital asset contract is being deployed. +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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp4tokentypenoteditable) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8batchcallfailed) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.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` | - |
@@ -1724,22 +2081,60 @@ Reverts when `tokenId` has already been minted.
-### LSP8TokenIdTypeNotEditable +### LSP8TokenIdFormatNotEditable + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidformatnoteditable) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdataemptyarray) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.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/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidtypenoteditable) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#lsp8tokenidsdatalengthmismatch) - Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) -- Error signature: `LSP8TokenIdTypeNotEditable()` -- Error hash: `0x53bc1122` +- Error signature: `LSP8TokenIdsDataLengthMismatch()` +- Error hash: `0x2fa71dfe` ::: ```solidity -error LSP8TokenIdTypeNotEditable(); +error LSP8TokenIdsDataLengthMismatch(); ``` -Reverts when trying to edit the data key `LSP8TokenIdType` after the identifiable digital asset contract has been deployed. The `LSP8TokenIdType` 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. +Reverts when the length of the token IDs data arrays is not equal
diff --git a/docs/contracts/contracts/LSP9Vault/LSP9Vault.md b/docs/contracts/contracts/LSP9Vault/LSP9Vault.md index 9d5972f5c6..da88fdca9e 100644 --- a/docs/contracts/contracts/LSP9Vault/LSP9Vault.md +++ b/docs/contracts/contracts/LSP9Vault/LSP9Vault.md @@ -1046,22 +1046,27 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -This function overrides the [`ERC725YCore`](#erc725ycore) internal [`_setData`](#_setdata) function to optimize gas usage by emitting only the first 256 bytes of the `dataValue`. +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 with only the first 256 bytes of [`dataValue`](#datavalue). +- [`DataChanged`](#datachanged) event emitted after a successful `setData` call.
#### Parameters -| Name | Type | Description | -| ----------- | :-------: | -------------------------------------- | -| `dataKey` | `bytes32` | The key to store the data value under. | -| `dataValue` | `bytes` | The data value to be stored. | +| 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. |
@@ -1196,7 +1201,7 @@ Internal method restricting the call to the owner of the contract and the Univer ::: ```solidity -event ContractCreated(uint256 indexed operationType, address indexed contractAddress, uint256 indexed value, bytes32 salt); +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`)._ @@ -1209,8 +1214,8 @@ Emitted when a new contract was created and deployed. | ------------------------------- | :-------: | ----------------------------------------------------------------------------------------------------------------------------------------- | | `operationType` **`indexed`** | `uint256` | The opcode used to deploy the contract (`CREATE` or `CREATE2`). | | `contractAddress` **`indexed`** | `address` | The created contract address. | -| `value` **`indexed`** | `uint256` | The amount of native tokens (in Wei) sent to fund the created contract on deployment. | -| `salt` | `bytes32` | The salt used to deterministically deploy the contract (`CREATE2` only). If `CREATE` opcode is used, the salt value will be `bytes32(0)`. | +| `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)`. |
@@ -1254,7 +1259,7 @@ Emitted when data at a specific `dataKey` was changed to a new value `dataValue` ::: ```solidity -event Executed(uint256 indexed operationType, address indexed target, uint256 indexed value, bytes4 selector); +event Executed(uint256 indexed operationType, address indexed target, uint256 value, bytes4 indexed selector); ``` _Called address `target` using `operationType` with `value` wei and `data`._ @@ -1267,8 +1272,8 @@ Emitted when calling an address `target` (EOA or contract) with `value`. | ----------------------------- | :-------: | ---------------------------------------------------------------------------------------------------- | | `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` **`indexed`** | `uint256` | The amount of native tokens transferred along the call (in Wei). | -| `selector` | `bytes4` | The first 4 bytes (= function selector) of the data sent with the call. | +| `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. |
diff --git a/docs/contracts/contracts/UniversalProfile.md b/docs/contracts/contracts/UniversalProfile.md index 5cb62121b7..0af3ab61c4 100644 --- a/docs/contracts/contracts/UniversalProfile.md +++ b/docs/contracts/contracts/UniversalProfile.md @@ -1044,22 +1044,27 @@ mapping(bytes32 => bytes) _store function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` -This function overrides the [`ERC725YCore`](#erc725ycore) internal [`_setData`](#_setdata) function to optimize gas usage by emitting only the first 256 bytes of the `dataValue`. +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 with only the first 256 bytes of [`dataValue`](#datavalue). +- [`DataChanged`](#datachanged) event emitted after a successful `setData` call.
#### Parameters -| Name | Type | Description | -| ----------- | :-------: | -------------------------------------- | -| `dataKey` | `bytes32` | The key to store the data value under. | -| `dataValue` | `bytes` | The data value to be stored. | +| 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. |
@@ -1215,7 +1220,7 @@ function _revertWithLSP20DefaultError( ::: ```solidity -event ContractCreated(uint256 indexed operationType, address indexed contractAddress, uint256 indexed value, bytes32 salt); +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`)._ @@ -1228,8 +1233,8 @@ Emitted when a new contract was created and deployed. | ------------------------------- | :-------: | ----------------------------------------------------------------------------------------------------------------------------------------- | | `operationType` **`indexed`** | `uint256` | The opcode used to deploy the contract (`CREATE` or `CREATE2`). | | `contractAddress` **`indexed`** | `address` | The created contract address. | -| `value` **`indexed`** | `uint256` | The amount of native tokens (in Wei) sent to fund the created contract on deployment. | -| `salt` | `bytes32` | The salt used to deterministically deploy the contract (`CREATE2` only). If `CREATE` opcode is used, the salt value will be `bytes32(0)`. | +| `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)`. |
@@ -1273,7 +1278,7 @@ Emitted when data at a specific `dataKey` was changed to a new value `dataValue` ::: ```solidity -event Executed(uint256 indexed operationType, address indexed target, uint256 indexed value, bytes4 selector); +event Executed(uint256 indexed operationType, address indexed target, uint256 value, bytes4 indexed selector); ``` _Called address `target` using `operationType` with `value` wei and `data`._ @@ -1286,8 +1291,8 @@ Emitted when calling an address `target` (EOA or contract) with `value`. | ----------------------------- | :-------: | ---------------------------------------------------------------------------------------------------- | | `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` **`indexed`** | `uint256` | The amount of native tokens transferred along the call (in Wei). | -| `selector` | `bytes4` | The first 4 bytes (= function selector) of the data sent with the call. | +| `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. |
diff --git a/docs/contracts/overview/KeyManager.md b/docs/contracts/overview/KeyManager.md index dd1b30df9b..34097e8521 100644 --- a/docs/contracts/overview/KeyManager.md +++ b/docs/contracts/overview/KeyManager.md @@ -73,6 +73,30 @@ It can be decoded as: | First allowed call | **Call Types** - `0x00000002` (Call)
**Address** - `0xcafecafecafecafecafecafecafecafecafecafe`
**Standard** - `0x24871b3d` (LSP0)
**Function** - `0x7f23690c` (`setData(bytes32,bytes)`) | - This allowed call permits the controller to use the function `setData(bytes32,bytes)` in the contract deployed at address `0xcafecafecafecafecafecafecafecafecafecafe`.
- When calling that function the operation type has to be `CALL` with no value being sent.
- The address `0xcafecafecafecafecafecafecafecafecafecafe` has to return true to `ERC165.supportsInterface(0x24871b3d)`. | | Second allowed call | **Call Types** - `0x00000003` (Transfervalue & Call)
**Address** - `0xcafecafecafecafecafecafecafecafecafecafe`
**Standard** - `0x24871b3d` (LSP0)
**Function** - `0x44c028fe` (`execute(uint256,address,uint256,bytes)`) | - This allowed call permits the controller to use the function `execute(uint256,address,uint256,bytes)` in the contract deployed at address `0xcafecafecafecafecafecafecafecafecafecafe`.
- When calling that function the operation type has to be `CALL`, you can send value as well.
- The address `0xcafecafecafecafecafecafecafecafecafecafe` has to return true to `ERC165.supportsInterface(0x24871b3d)`. | +## Sequential relay calls in the same channel + +When executing 3 sequential relay calls with sequential nonces in a single channel (= nonces from the KeyManager retrieved via [`getNonce`](../contracts/LSP6KeyManager/LSP6KeyManager.md#getnonce), keep in mind that **if the first transaction does revert, the next 2 will revert in turns**. That happens because a Key Manager nonce is assigned to each relay call. + +E.g.: + +- First relay call - nonce is 4 +- Second relay call - nonce is 5 +- Third relay call - nonce is 6 + +One of the requirements for executing a relay call is that **the latest nonce (for a specific signer) stored on-chain in the Key Manager contract must be the same as the one used when signing the executed relay call**. After each successful execution, the on-chain nonce is incremented. + +Given the example above, the on-chain nonce is 4 and we are executing the relay calls. + +**If the first relay call pass ✅** +- First relay call: nonce was 4 -> incremented to 5 +- Second relay call: nonce was 5 -> incremented to 6 +- Third relay call: nonce was 6 -> incremented to 7 + +**If the first relay call fails ❌** +- **First relay call reverts ❌** nonce was 4 -> nonce remains 4 +- Second relay call: nonce on-chain is 4 -> nonce used to sign was 5 = reverts ❌ with [`InvalidRelayNonce`](../contracts//LSP6KeyManager/LSP6KeyManager.md#invalidrelaynonce) +- Third relay call: nonce on-chain is 5 -> nonce used to sign was 6 = reverts ❌ with [`InvalidRelayNonce`](../contracts//LSP6KeyManager/LSP6KeyManager.md#invalidrelaynonce) + ## Further Reading - [The Bytecode episode #4 (Youtube) - overview of the Solidity code of the `LSP6KeyManagerCore.sol` by Jean Cavallera](https://www.youtube.com/watch?v=2Sm9LsCPjdE) \ No newline at end of file diff --git a/docs/contracts/overview/LSP17ContractExtension.md b/docs/contracts/overview/LSP17ContractExtension.md index 857917c362..c2698e2971 100644 --- a/docs/contracts/overview/LSP17ContractExtension.md +++ b/docs/contracts/overview/LSP17ContractExtension.md @@ -3,6 +3,9 @@ title: Extendable Contracts & Extensions Contracts sidebar_position: 4 --- +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + # Extendable & Extension Contracts Contracts that use the LSP17 standard are called **Extendable Contracts**. Meaning they can extend their functionalities by linking **Extension Contracts** to them for specific functionalities that they do not support natively. @@ -14,6 +17,59 @@ The list of extensions for specific functions are stored under the specific data You can inherit the [`LSP17Extendable.sol`](../contracts/LSP17ContractExtension/LSP17Extendable.md) contract to create an extendable contract. +To add an extension handler for a specific function selector, you can set the address of the extension contract under the `LSP17Extension:` data key as follow: +- 10 bytes (= 20 hexadecimal characters): `LSP17Extension` Mapping data key prefix +- 20 bytes (= 40 hexadecimal characters): the `bytes4` function selector right padded with 16 zero bytes. + +Now whenever a call is made to this function selector on the extendable contract, it will land in its `fallback` function. From there, the calldata will be forwarded to the retrieved extension contract address set above. + + + + + +```solidity +// SPDX-License-Identifier: MIT +pragma solidity ~0.8.4; + +// libraries +import { + LSP2Utils +} from "@lukso/lsp-smart-contracts/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol"; + +// constants +import { + _LSP17_EXTENSION_PREFIX +} from "@lukso/lsp-smart-contracts/contracts/LSP17ContractExtension/LSP17Constants.sol"; + +function generateLSP17ExtensionDataKey(bytes4 extensionSelector) pure returns (bytes32) { + return + LSP2Utils.generateMappingKey( + _LSP17_EXTENSION_PREFIX, + bytes20(extensionSelector) + ); +} +``` + + + + + +```js +import { ERC725YDataKeys } from "@lukso/lsp-smart-contracts"; +import { concat, zeroPadBytes } from "ethers" + +const extensionSelector = zeroPadBytes("0xcafecafe", 20); + +const dataKey = concat([ + ERC725YDataKeys.LSP17.LSP17ExtensionPrefix, + extensionSelector +]); +``` + + + + + :::warning Be aware that adding an extension that can `selfdestruct` itself can be dangerous. This can make the [`LSP17Extendable`](../contracts/LSP17ContractExtension/LSP17Extendable.md) contract vulnerable to [metamorphic contracts](https://twitter.com/samczsun/status/1660012956632104960). diff --git a/docs/learn/dapp-developer/connect-profile.md b/docs/learn/dapp-developer/connect-profile.md index 9e9aa05c33..4367c17e46 100644 --- a/docs/learn/dapp-developer/connect-profile.md +++ b/docs/learn/dapp-developer/connect-profile.md @@ -3,36 +3,26 @@ sidebar_label: '🔗 Connect a Universal Profile' sidebar_position: 1 --- -# Connect Your Universal Profile to a dApp +# Connect a Universal Profile -To allow your users to connect to your dApp with their [Universal Profile](../../standards/universal-profile/introduction.md), they need to: +To interact with a [Universal Profile](../../standards/universal-profile/introduction.md), your dApp can call the `window.ethereum` object, similar to other wallets. Before a connection can be established, users have to create their Universal Profile by: -- install the 🖥️ [Universal Profile Browser Extension](/install-up-browser-extension) -- and ✨ [create a Universal Profile](https://my.universalprofile.cloud) +1. [Installing the Universal Profile Browser Extension](/install-up-browser-extension) +2. [Deploying their Universal Profile](https://my.universalprofile.cloud) :::note Manual Deployment -Optionally you can ⚒️ [deploy a Universal Profile programmatically](../../learn/expert-guides/universal-profile/create-profile.md) for your users, but then they will not benefit from free transactions through the LUKSO Transaction Relay Service. +Optionally, you can create new [Universal Profiles](../../standards/universal-profile/introduction.md) by ⚒️ [deploying them programmatically](../../learn/expert-guides/universal-profile/create-profile.md). Please keep in mind that you would also have to deploy your own [Transaction Relay Service](../../standards/relayer-api.md) to allow gasless onboarding, as customly deployed profiles will not receive free monthly transaction quota through the LUKSO Transaction Relay Service. ::: -:::note - -If you expect your users to have MetaMask or other similar browser extensions installed, you can also connect to the Universal Profile Browser Extension directly, using the `window.lukso` object. - -::: - -
+## Connect to a dApp -Example of Sign-In with Ethereum screen +:::success Request Handling -
+The [Universal Profile Extension](/install-up-browser-extension) automatically manages incoming requests and returns the address of the connected [Universal Profile](../../standards/universal-profile/introduction.md). To get the conrolling EOAs of the [smart contract account](../../standards/universal-profile/lsp0-erc725account.md), you can manually [fetch it's controllers](../expert-guides/key-manager/get-controller-permissions.md). -## Connect to a dApp +::: ```js import Web3 from 'web3'; @@ -50,3 +40,19 @@ async function connect() { } connect(); ``` + +
+ +Example of Sign-In with Ethereum screen + +
+ +:::info + +If you expect your users to have multiple browser wallets or extensions, we recommend installing [Web3 Onboard](https://onboard.blocknative.com/) by following our [Web3 Onboard Configuration](./web3-onboard.md). The library will allow users to manage multiple browser providers in parallel. + +::: diff --git a/docs/learn/dapp-developer/read-profile-data.md b/docs/learn/dapp-developer/read-profile-data.md index 8cfef0f79e..408d4a0907 100644 --- a/docs/learn/dapp-developer/read-profile-data.md +++ b/docs/learn/dapp-developer/read-profile-data.md @@ -54,7 +54,7 @@ npm install @erc725/erc725.js
-- `SupportedStandards:LSP3Profile` Verifies that the ERC725Y contract contains [LSP3UniversalProfile](../../standards/universal-profile/lsp3-profile-metadata) data keys +- `SupportedStandards:LSP3Profile` Verifies that the ERC725Y contract contains [LSP3Profile](../../standards/universal-profile/lsp3-profile-metadata#supportedstandardslsp3profile) data keys - `LSP3Profile` contains the JSON file with profile descriptions and images - `LSP12IssuedAssets[]` contains assets the profile issued - `LSP5ReceivedAssets[]` contains assets the profile received @@ -74,7 +74,7 @@ The [`getData()`](../../tools/erc725js/classes/ERC725.md#getdata) function allow ```js import { ERC725 } from '@erc725/erc725.js'; -import lsp3ProfileSchema from '@erc725/erc725.js/schemas/LSP3ProfileMetadata.json' assert { type: 'json' }; +import lsp3ProfileSchema from '@erc725/erc725.js/schemas/LSP3ProfileMetadata.json'; const erc725js = new ERC725(lsp3ProfileSchema, '', 'https://rpc.testnet.lukso.gateway.fm', { @@ -96,7 +96,7 @@ console.log(profileData); ```js import { ERC725, ERC725JSONSchema } from '@erc725/erc725.js'; -import lsp3ProfileSchema from '@erc725/erc725.js/schemas/LSP3ProfileMetadata.json' assert { type: 'json' }; +import lsp3ProfileSchema from '@erc725/erc725.js/schemas/LSP3ProfileMetadata.json'; const erc725js = new ERC725(lsp3ProfileSchema as ERC725JSONSchema[], '', 'https://rpc.testnet.lukso.gateway.fm', { diff --git a/docs/learn/dapp-developer/standard-detection.md b/docs/learn/dapp-developer/standard-detection.md index acc842f2f2..997c036ad4 100644 --- a/docs/learn/dapp-developer/standard-detection.md +++ b/docs/learn/dapp-developer/standard-detection.md @@ -43,7 +43,7 @@ Similar to the [Read Profile Data Guide](./read-profile-data.md), you can use th ```js import { ERC725 } from '@erc725/erc725.js'; -import lsp3ProfileSchema from '@erc725/erc725.js/schemas/LSP3ProfileMetadata.json' assert { type: 'json' }; +import lsp3ProfileSchema from '@erc725/erc725.js/schemas/LSP3ProfileMetadata.json'; const erc725js = new ERC725(lsp3ProfileSchema, '', 'https://rpc.testnet.lukso.gateway.fm', { @@ -65,7 +65,7 @@ console.log(isLSP3); ```js import { ERC725 } from '@erc725/erc725.js'; -import lsp9VaultSchema from '@erc725/erc725.js/schemas/LSP9Vault.json' assert { type: 'json' }; +import lsp9VaultSchema from '@erc725/erc725.js/schemas/LSP9Vault.json'; const erc725js = new ERC725( lsp9VaultSchema, @@ -90,7 +90,7 @@ console.log(isLSP9); ```js import { ERC725 } from '@erc725/erc725.js'; -import lsp3ProfileSchema from '@erc725/erc725.js/schemas/LSP4DigitalAsset.json' assert { type: 'json' }; +import lsp3ProfileSchema from '@erc725/erc725.js/schemas/LSP4DigitalAsset.json'; const erc725js = new ERC725( lsp3ProfileSchema, @@ -133,7 +133,7 @@ A **[Universal Profile](../../standards/universal-profile/lsp3-profile-metadata. ```javascript -import UniversalProfile from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json' assert { type: 'json' }; +import UniversalProfile from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json'; import { INTERFACE_IDS } from '@lukso/lsp-smart-contracts/dist/constants.cjs.js'; import Web3 from 'web3'; diff --git a/docs/learn/dapp-developer/transfer-lyx.md b/docs/learn/dapp-developer/transfer-lyx.md index bdb60bc3de..a880effd27 100644 --- a/docs/learn/dapp-developer/transfer-lyx.md +++ b/docs/learn/dapp-developer/transfer-lyx.md @@ -74,6 +74,7 @@ await web3.eth.sendTransaction({ }) ``` + diff --git a/docs/learn/dapp-developer/web3-onboard.md b/docs/learn/dapp-developer/web3-onboard.md new file mode 100644 index 0000000000..e9ae9dfaad --- /dev/null +++ b/docs/learn/dapp-developer/web3-onboard.md @@ -0,0 +1,168 @@ +--- +sidebar_label: '🛳️ Connect Web3-Onboard' +sidebar_position: 9 +--- + +# Universal Profile Integration for Web3-Onboard + +The [Web3-Onboard](https://onboard.blocknative.com/) library is an open-source, framework-agnostic JavaScript tool to onboard users to Web3 apps. Developers can integrate it into their dApp to handle the routing for the different extensions and wallets, simultaneously docking onto the Ethereum provider. + +![web3-onboard-view](/img/extension/web3-onboard.png) + +Our [Web3-Onboard configuration](https://github.com/lukso-network/web3-onboard-config) can be used to integrate the [Universal Profile Browser Extension](https://chrome.google.com/webstore/detail/universal-profiles/abpickdkkbnbcoepogfhkhennhfhehfn?hl) into Web3-Onboard's connection module. If the [Universal Profile Browser Extension](https://chrome.google.com/webstore/detail/universal-profiles/abpickdkkbnbcoepogfhkhennhfhehfn?hl) is not installed, the user will be taken to its download page. + +## Installation + +You can install Web3-Onboard on the dApp using the related [NPM package](https://www.npmjs.com/package/@lukso/web3-onboard-config) + +```shell +npm i @web3-onboard/core @lukso/web3-onboard-config @web3-onboard/injected-wallets +``` + +## Setup + +After installation, you can proceed to configure your extension that you want to dock onto your dApp. + +:::caution Referral Links + +Be aware that anyone implementing Web3-Onboard can modify the download link to the extension. + +::: + +:::success + +The Web3-Onboard configuration and calls should be set up as a global `context` or `component`, accessible to every page or component of your application layout that is interacting with the blockchain. + +::: + +```js +// Import the necessary components +import Onboard, { OnboardAPI } from "@web3-onboard/core"; +import { ConnectModalOptions } from "@web3-onboard/core/dist/types"; +import injectedModule from "@web3-onboard/injected-wallets"; +import luksoModule from "@lukso/web3-onboard-config"; + +// Initialize the LUKSO provider from this library +const luksoProvider = luksoModule(); + +// Define the download link for the extension +const UP_BROWSER_EXTENSION_URL = + "https://chrome.google.com/webstore/detail/universal-profiles/abpickdkkbnbcoepogfhkhennhfhehfn?hl"; + +// Set up the injected wallet interface +const injectedWallets = injectedModule({ + /** + * Add custom wallets here that you want + * to inject into Web3-Onboard + */ + custom: [luksoProvider], + + // OPTIONAL: Add sorting for supported wallets + sort: (wallets) => { + const sorted = wallets.reduce((sorted, wallet) => { + /** + * Universal Profiles will be placed at the + * top of the wallet connection screen + * + * Add other injected wallet names here + * to adjust their order + */ + if (wallet.label === "Universal Profiles") { + sorted.unshift(wallet); + } else { + sorted.push(wallet); + } + return sorted; + }, []); + return sorted; + }, + + /** + * OPTIONAL: Specify wallets that should still be displayed + * in the list, even when unavailable in the browser + */ + displayUnavailable: ["Universal Profiles"], +}); + +/** + * Define at least one blockchain network that is able to + * interact with the Universal Profile Browser Extension + */ +const supportedChains = [ + // https://docs.lukso.tech/networks/mainnet/parameters + { + id: 42, + token: "LYX", + label: "LUKSO Mainnet", + rpcUrl: "https://rpc.lukso.gateway.fm/", + }, + // https://docs.lukso.tech/networks/testnet/parameters + { + id: 4021, + token: "LYXt", + label: "LUKSO Testnet", + rpcUrl: "https://rpc.testnet.lukso.gateway.fm/", + }, +]; + +/** + * OPTIONAL: Set up the app description of the + * Web3-Onboard connection window + */ +const appInfo = { + name: "My LUKSO App", + /** + * Pictures can either be a valid + * Image URL or SVG as string + * + * The icon shows behind the extension picture + * on the right side, while the connection + * is being established + */ + icon: "/my_app_icon.svg", + /** + * The logo shows left of the wallet list, + * indicating the used app + */ + logo: " ... ", + description: "My LUKSO App using Web3-Onboard", + recommendedInjectedWallets: [ + /** + * Add other injected wallets and their download links + * to directly take users to the installation screen + */ + { + name: "Universal Profiles", + url: UP_BROWSER_EXTENSION_URL, + }, + ], +}; + +// OPTIONAL: Set up global installation notices +const connectionOptions: ConnectModalOptions = { + iDontHaveAWalletLink: UP_BROWSER_EXTENSION_URL, + removeWhereIsMyWalletWarning: true, +}; + +// Create the Web3-Onboard Component +const web3OnboardComponent: OnboardAPI = Onboard({ + wallets: [injectedWallets], + chains: supportedChains, + + // OPTIONAL COMPONENTS: + appMetadata: appInfo, + connect: connectionOptions, +}); + +// Calling the connect functionality, +const connectedWallets = await web3OnboardComponent.connectWallet(); + +// Debug +console.log(connectedWallets); +``` + +## Sample Implementations + +- Check our sample integration for NextJS on the [dApp Boilerplate](https://github.com/lukso-network/tools-dapp-boilerplate) repository. +- Test Web3-Onboard in our sandbox environment using [up-test-dapp.lukso.tech](https://up-test-dapp.lukso.tech/). +- Find further information in the [Web3-Onboard Documentation](https://onboard.blocknative.com/docs/getting-started). diff --git a/docs/learn/expert-guides/key-manager/execute-relay-transactions.md b/docs/learn/expert-guides/key-manager/execute-relay-transactions.md index a2d67ba038..95a3cba279 100644 --- a/docs/learn/expert-guides/key-manager/execute-relay-transactions.md +++ b/docs/learn/expert-guides/key-manager/execute-relay-transactions.md @@ -452,12 +452,12 @@ let encodedMessage = web3.utils.encodePacked( { value: chainId, type: 'uint256' }, // `0x0000000000000000000000000000000000000000000000000000000000001069` // e.g: nonce nb 5 { value: nonce, type: 'uint256' }, // `0x0000000000000000000000000000000000000000000000000000000000000005` - // e.g: valid until 1st January 2025 at midnight (GMT). + // e.g: valid until 1st January 2025 at midnight (GMT). // Timestamp = 1735689600 { value: validityTimestamps, type: 'uint256' }, // `0x0000000000000000000000000000000000000000000000000000000067748580` // e.g: not funding the contract with any LYX (0) { value: msgValue, type: 'uint256' }, // `0x0000000000000000000000000000000000000000000000000000000000000000` - // e.g: execute(uint256,address,uint256,bytes) + // e.g: execute(uint256,address,uint256,bytes) // send 3 LYX to address `0xcafecafecafecafeafecafecafecafeafecafecafecafeafecafecafecafe` { value: abiPayload, type: 'bytes' }, // `0x44c028fe0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000cafecafecafecafecafecafecafecafecafecafe00000000000000000000000000000000000000000000000029a2241af62c000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000` ); diff --git a/docs/learn/expert-guides/read-asset-data.md b/docs/learn/expert-guides/read-asset-data.md index cfa983a459..c89a0fe866 100644 --- a/docs/learn/expert-guides/read-asset-data.md +++ b/docs/learn/expert-guides/read-asset-data.md @@ -66,7 +66,7 @@ If using erc725.js in a NodeJS environment you may need to install and import [` ```javascript title="read_assets.js" // Import and network setup import { ERC725 } from '@erc725/erc725.js'; -import UniversalProfileSchema from '@erc725/erc725.js/schemas/LSP3UniversalProfileMetadata.json'; +import LSP3ProfileSchema from '@erc725/erc725.js/schemas/LSP3ProfileMetadata.json'; import Web3 from 'web3'; // Static variables @@ -80,7 +80,7 @@ const config = { ipfsGateway: IPFS_GATEWAY }; // Fetch the LSP5 data of the Universal Profile to get its owned assets const profile = new ERC725( - UniversalProfileSchema, + LSP3ProfileSchema, SAMPLE_PROFILE_ADDRESS, provider, config, @@ -106,7 +106,7 @@ If using erc725.js in a NodeJS environment you may need to install and import [` ```javascript title="read_assets.js" // Import and network setup import { ERC725 } from '@erc725/erc725.js'; -import UniversalProfileSchema from '@erc725/erc725.js/schemas/LSP3UniversalProfileMetadata.json'; +import LSP3ProfileSchema from '@erc725/erc725.js/schemas/LSP3ProfileMetadata.json'; import Web3 from 'web3'; // Static variables @@ -120,7 +120,7 @@ const config = { ipfsGateway: IPFS_GATEWAY }; // Fetch the LSP1 data of the Universal Profile to get its Universal Receiver const profile = new ERC725( - UniversalProfileSchema, + LSP3ProfileSchema, SAMPLE_PROFILE_ADDRESS, provider, config, @@ -230,7 +230,7 @@ Below is the complete code snippet of this guide, with all the steps compiled to ```javascript title="read_assets.js" // Import and network setup import { ERC725 } from '@erc725/erc725.js'; -import UniversalProfileSchema from '@erc725/erc725.js/schemas/LSP3UniversalProfileMetadata.json'; +import LSP3ProfileSchema from '@erc725/erc725.js/schemas/LSP3ProfileMetadata.json'; import LSP4Schema from '@erc725/erc725.js/schemas/LSP4DigitalAsset.json'; import Web3 from 'web3'; @@ -245,7 +245,7 @@ const config = { ipfsGateway: IPFS_GATEWAY }; // Fetch the LSP5 data of the Universal Profile to get its owned assets const profile = new ERC725( - UniversalProfileSchema, + LSP3ProfileSchema, SAMPLE_PROFILE_ADDRESS, provider, config, @@ -295,7 +295,7 @@ console.log(ownedAssetsMetadata); ```javascript title="read_assets.js" // Import and network setup import { ERC725 } from '@erc725/erc725.js'; -import UniversalProfileSchema from '@erc725/erc725.js/schemas/LSP3UniversalProfileMetadata.json'; +import LSP3ProfileSchema from '@erc725/erc725.js/schemas/LSP3ProfileMetadata.json'; import LSP4Schema from '@erc725/erc725.js/schemas/LSP4DigitalAsset.json'; import Web3 from 'web3'; import LSP1MinimalABI from './lsp1_legacy_minimal_abi.json'; @@ -311,7 +311,7 @@ const config = { ipfsGateway: IPFS_GATEWAY }; // Fetch the LSP1 data of the Universal Profile to get its Universal Receiver const profile = new ERC725( - UniversalProfileSchema, + LSP3ProfileSchema, SAMPLE_PROFILE_ADDRESS, provider, config, diff --git a/docs/learn/expert-guides/vault/edit-vault-data.md b/docs/learn/expert-guides/vault/edit-vault-data.md index 3772691586..fcd016ac43 100644 --- a/docs/learn/expert-guides/vault/edit-vault-data.md +++ b/docs/learn/expert-guides/vault/edit-vault-data.md @@ -28,23 +28,20 @@ Make sure you have the following dependencies installed before beginning this tu - [`@lukso/lsp-smart-contracts`](https://github.com/lukso-network/lsp-smart-contracts/) - -```shell title="Install the dependencies" +```shell npm install web3 @lukso/lsp-smart-contracts ``` - -```shell title="Install the dependencies" +```shell npm install ethers @lukso/lsp-smart-contracts ``` - ## Step 1 - Imports, constants and EOA @@ -54,14 +51,13 @@ After that we need to store the address of our LSP9 Vault and our Universal Prof Then we will initialize the EOA that we will further use. - -```typescript title="Imports, Constants & EOA" +```typescript import LSP1UniversalReceiverDelegateVault from '@lukso/lsp-smart-contracts/artifacts/LSP1UniversalReceiverDelegateVault.json'; import UniversalProfile from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json'; import LSP9Vault from '@lukso/lsp-smart-contracts/artifacts/LSP9Vault.json'; -import { ERC725YDataKeys } from '@lukso/lsp-smart-contracts/constants.js'; +import { ERC725YDataKeys } from '@lukso/lsp-smart-contracts'; import Web3 from 'web3'; // constants @@ -75,14 +71,13 @@ const myEOA = web3.eth.accounts.wallet.add(privateKey); ``` - -```typescript title="Imports, Constants & EOA" +```typescript import LSP1UniversalReceiverDelegateVault from '@lukso/lsp-smart-contracts/artifacts/LSP1UniversalReceiverDelegateVault.json'; import UniversalProfile from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json'; import LSP9Vault from '@lukso/lsp-smart-contracts/artifacts/LSP9Vault.json'; -import { ERC725YDataKeys } from '@lukso/lsp-smart-contracts/constants.js'; +import { ERC725YDataKeys } from '@lukso/lsp-smart-contracts'; import { ethers } from 'ethers'; // constants @@ -98,7 +93,6 @@ const myEOA = new ethers.Wallet(privateKey).connect(provider); ``` - ## Step 2 - Deploying Universal Receiver Delegate (URD) @@ -113,19 +107,17 @@ The **Universal Profile** and the **Vault** don't use the same implementation of At this step we will create an instance of the Vault URD that we will further be used to deploy one. - -```typescript title="Contract instance of the LSP9 Vault URD" +```typescript // create an instance of the LSP1UniversalReceiverDelegateVault const vaultURD = new web3.eth.Contract(LSP1UniversalReceiverDelegateVault.abi); ``` - -```typescript title="Contract instance of the LSP9 Vault URD" +```typescript // create a LSP1UniversalReceiverDelegateVault Contract Factory const vaultURDFactory = new ethers.ContractFactory( LSP1UniversalReceiverDelegateVault.abi, @@ -134,7 +126,6 @@ const vaultURDFactory = new ethers.ContractFactory( ``` - ### Send the contract deployment transaction @@ -142,10 +133,9 @@ const vaultURDFactory = new ethers.ContractFactory( Send the deployment transaction and in a few seconds you will get a new deployed Vault URD. - -```typescript title="Send the transaction for deploying a new LSP9 Vault URD" +```typescript // deploy the Universal Receiver Delegate Vault contract await vaultURD .deploy({ @@ -153,31 +143,28 @@ await vaultURD }) .send({ from: myEOA.address, - gas: 5_000_000, + gas: '5000000', gasPrice: '1000000000', }); ``` - -```typescript title="Send the transaction for deploying a new LSP9 Vault URD" +```typescript // deploy the Universal Receiver Delegate Vault contract const vaultURD = await vaultURDFactory.connect(myEOA).deploy(); ``` - ### Final code - -```typescript title="Deploy a new LSP9 Vault Universal Receive Delegate" +```typescript const deployVaultURD = async () => { // create an instance of the LSP1UniversalReceiverDelegateVault const vaultURD = new web3.eth.Contract( @@ -192,7 +179,7 @@ const deployVaultURD = async () => { }) .send({ from: myEOA.address, - gas: 5_000_000, + gas: '5000000', gasPrice: '1000000000', }) .on('receipt', (receipt) => (vaultURDAddress = receipt.contractAddress)); @@ -205,10 +192,9 @@ const vaultURDAddress = await deployVaultURD(); ``` - -```typescript title="Deploy a new LSP9 Vault Universal Receive Delegate" +```typescript const deployVaultURD = async () => { // create a LSP1UniversalReceiverDelegateVault Contract Factory const vaultURDFactory = new ethers.ContractFactory( @@ -219,7 +205,11 @@ const deployVaultURD = async () => { // deploy the Universal Receiver Delegate Vault contract const vaultURD = await vaultURDFactory.connect(myEOA).deploy(); - return vaultURD.target; + // get back the transaction data when deployed + const transactionReceipt = await vaultURD.deployTransaction.wait(); + + // return the address of the Vault URD + return transactionReceipt.contractAddress; }; // deploy a new Vault URD and retrieve its address @@ -227,7 +217,6 @@ const vaultURDAddress = await deployVaultURD(); ``` - ## Step 3 - Setting the URD address in the storage @@ -242,10 +231,9 @@ Firstly we need to create instances for the following contracts: - [**Universal Profile**](../../../standards/universal-profile/lsp0-erc725account.md) - -```typescript title="Contract instances for the Universal Profile and Vault" +```typescript // create an instance of the LSP9Vault const vault = new web3.eth.Contract(LSP9Vault.abi, vaultAddress); // create an instance of the Universal Profile @@ -256,10 +244,9 @@ const universalProfile = new web3.eth.Contract( ``` - -```typescript title="Contract instances for the Universal Profile and Vault" +```typescript // create an instance of the LSP9Vault const vault = new ethers.Contract(vaultAddress, LSP9Vault.abi); // create an instance of the Universal Profile @@ -270,7 +257,6 @@ const universalProfile = new ethers.Contract( ``` - ### Encode `setData(..)` calldata @@ -278,10 +264,9 @@ const universalProfile = new ethers.Contract( Secondly, we need to encode a calldata that will update the address of the Vault URD. - -```typescript title="Calldata for updating the LSP9 Vault URD" +```typescript // encode setData Calldata on the Vault const setDataCalldata = await vault.methods .setData(ERC725YDataKeys.LSP1.LSP1UniversalReceiverDelegate, vaultURDAddress) @@ -289,10 +274,9 @@ const setDataCalldata = await vault.methods ``` - -```typescript title="Calldata for updating the LSP9 Vault URD" +```typescript // encode setData Calldata on the Vault const setDataCalldata = vault.interface.encodeFunctionData('setData', [ ERC725YDataKeys.LSP1.LSP1UniversalReceiverDelegate, @@ -301,7 +285,6 @@ const setDataCalldata = vault.interface.encodeFunctionData('setData', [ ``` - ### Update the Vault data @@ -309,10 +292,9 @@ const setDataCalldata = vault.interface.encodeFunctionData('setData', [ Lastly, we need to send the transaction that will update the Vault data through the Universal Profile's `execute(..)`. - -```typescript title="Execute the calldata on the Universal Profile" +```typescript // execute the `setData(bytes32,bytes)` calldata that updates the Vault data await universalProfile.methods .execute( @@ -331,7 +313,7 @@ await universalProfile.methods -```typescript title="Execute the calldata on the Universal Profile" +```typescript // execute the `setData(bytes32,bytes)` calldata that updates the Vault data await universalProfile.connect(myEOA).execute( 0, // OPERATION CALL @@ -342,16 +324,14 @@ await universalProfile.connect(myEOA).execute( ``` - ### Final code - -```typescript title="Update Vault's URD to the one newly deployed" +```typescript const updateVaultURD = async (vaultURDAddress) => { // create an instance of the LSP9Vault const vault = new web3.eth.Contract(LSP9Vault.abi, vaultAddress); @@ -388,10 +368,9 @@ await updateVaultURD(vaultURDAddress); ``` - -```typescript title="Update Vault's URD to the one newly deployed" +```typescript const updateVaultURD = async (vaultURDAddress) => { // create an instance of the LSP9Vault const vault = new ethers.Contract(vaultAddress, LSP9Vault.abi); @@ -421,20 +400,18 @@ await updateVaultURD(vaultURDAddress); ``` - ## Final code - Deploy & Update - ```typescript title="Deploy new Vault URD and update Vault's URD" import LSP1UniversalReceiverDelegateVault from '@lukso/lsp-smart-contracts/artifacts/LSP1UniversalReceiverDelegateVault.json'; import UniversalProfile from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json'; import LSP9Vault from '@lukso/lsp-smart-contracts/artifacts/LSP9Vault.json'; -import { ERC725YDataKeys } from '@lukso/lsp-smart-contracts/constants.js'; +import { ERC725YDataKeys } from '@lukso/lsp-smart-contracts'; import Web3 from 'web3'; const web3 = new Web3('https://rpc.testnet.lukso.network'); @@ -459,7 +436,7 @@ const deployVaultURD = async () => { }) .send({ from: myEOA.address, - gas: 5_000_000, + gas: '5000000', gasPrice: '1000000000', }) .on('receipt', (receipt) => (vaultURDAddress = receipt.contractAddress)); @@ -505,14 +482,14 @@ await updateVaultURD(vaultURDAddress); ``` - + -```typescript title="Deploy new Vault URD and update Vault's URD" +```typescript import LSP1UniversalReceiverDelegateVault from '@lukso/lsp-smart-contracts/artifacts/LSP1UniversalReceiverDelegateVault.json'; import UniversalProfile from '@lukso/lsp-smart-contracts/artifacts/UniversalProfile.json'; import LSP9Vault from '@lukso/lsp-smart-contracts/artifacts/LSP9Vault.json'; -import { ERC725YDataKeys } from '@lukso/lsp-smart-contracts/constants.js'; +import { ERC725YDataKeys } from '@lukso/lsp-smart-contracts'; import { ethers } from 'ethers'; const provider = new ethers.providers.JsonRpcProvider( @@ -571,7 +548,6 @@ await updateVaultURD(vaultURDAddress); ``` - ## Reading Data diff --git a/docs/learn/expert-guides/web3-onboard.md b/docs/learn/expert-guides/web3-onboard.md deleted file mode 100644 index aedcffbf50..0000000000 --- a/docs/learn/expert-guides/web3-onboard.md +++ /dev/null @@ -1,28 +0,0 @@ ---- -sidebar_label: '🛳️ Connect Web3-Onboard' -sidebar_position: 5 ---- - -# Connect users' wallets to your dApp with web3-onboard - -## The easiest way to connect a wallet 🚀 - -![web3-onboard-view](/img/extension/web3-onboard.png) - -Web3-onboard configuration allows the detection of the [Universal Profile (UP) Browser Extension](https://chrome.google.com/webstore/search/lukso%20blockchain), along with any other installed browser extensions. Developers can integrate it into their Dapp to handle the routing for the different browser extensions. - -Web3-onboard is an open-source, framework-agnostic JavaScript library to onboard users to web3 apps. This package can be used to integrate LUKSO [Universal Profiles Extension](https://chrome.google.com/webstore/detail/universal-profiles/abpickdkkbnbcoepogfhkhennhfhehfn?hl=en) support into web3-onboard's "Connect Wallet" modal. With this module, **the LUKSO Universal Profile Extension option will be shown even if the extension is not installed on the user's browser**. If selected the user will be taken to a download screen where they can install the extension. - -## Installation - -Developers can install web3-onboard in their Dapp using npm, from the [following package](https://www.npmjs.com/package/@lukso/web3-onboard-config). The implementation can be found in the [web3-onboard-config LUKSO GitHub repo](https://github.com/lukso-network/web3-onboard-config). - -```shell -npm i @web3-onboard/core @lukso/web3-onboard-config @web3-onboard/injected-wallets -``` - -You can find a link to web3-onboard's official npm documentation here: [@web3-onboard/core official npm documentation](https://www.npmjs.com/package/@web3-onboard/core) - -## Where can I test it out? - -Users can experiment with LUKSO's web3-onboard implementation in a sandbox environment using [up-test-dapp.lukso.tech](https://up-test-dapp.lukso.tech/). diff --git a/docs/learn/smart-contract-developers/retrieve-token-type.md b/docs/learn/smart-contract-developers/retrieve-token-type.md index 76e09c15c9..6c19e5bacf 100644 --- a/docs/learn/smart-contract-developers/retrieve-token-type.md +++ b/docs/learn/smart-contract-developers/retrieve-token-type.md @@ -29,7 +29,7 @@ The `LSP4TokenType` is not changeable and it is set during the token's initializ | Value | Type | Description | | :---: | :----------: | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `0` | `Token` | Only valid for LSP7, meaning its a generic token, where the `LSP4Metadata` represents the token information. | -| `1` | `NFT` | If the contract is LSP7 or LSP8, then the `LSP4Metadata` represents the information of a **single** NFT, that has multiple ownable amounts or IDs. If it's an LSP8, each individual token ID can have its own custom metadata specific for that toekn, but is not a different NFT. It is still the the same NFT but just has different metadata. Metadata can be set using `LSP8TokenIdType` and `LSP8MetadataTokenURI`. [See LSP8 for details](../../standards/tokens/LSP8-Identifiable-Digital-Asset.md). If its an LSP7 contract, the `decimals` function MUST return `0`. | +| `1` | `NFT` | If the contract is LSP7 or LSP8, then the `LSP4Metadata` represents the information of a **single** NFT, that has multiple ownable amounts or IDs. If it's an LSP8, each individual token ID can have its own custom metadata specific for that token, but is not a different NFT. It is still the the same NFT but just has different metadata. Metadata can be set using `LSP8TokenIdType` and `LSP8MetadataTokenURI`. [See LSP8 for details](../../standards/tokens/LSP8-Identifiable-Digital-Asset.md). If its an LSP7 contract, the `decimals` function MUST return `0`. | | `2` | `Collection` | Only valid for LSP8. The `LSP4Metadata` represents the information of a the collection, and each individual token ID represents its own NFT and MUST have its own metadata set using `LSP8TokenIdType` and `LSP8MetadataTokenURI`. [See LSP8 for details](../../standards/tokens/LSP8-Identifiable-Digital-Asset.md). | ## Implementation diff --git a/docs/networks/advanced-guides/exit-validators.md b/docs/networks/advanced-guides/exit-validators.md new file mode 100644 index 0000000000..d3f4b8227d --- /dev/null +++ b/docs/networks/advanced-guides/exit-validators.md @@ -0,0 +1,54 @@ +--- +sidebar_label: 'Exit Validators' +sidebar_position: 5 +--- + +# Exit Validators + +In order to fully exit validator keys and all the staked LYX/LYXt, make sure to: + +- Have the latest [LUKSO CLI](https://github.com/lukso-network/tools-lukso-cli) installed. If not, you should [update your node](./update-the-node.md). +- Have the Withdrawal Credential set. If not, you should [perform an withdrawal update](./withdrawal-update.md). + +If you are not using the LUKSO CLI, please check the [Further Reads](#further-reads) section below. + +## Perform the withdrawal + +After your node is synced up and running, you will be able to go through the complete exit process using the following command: + +```bash +lukso validator exit +``` + +The exit setup will be different depending on your consensus client. Within [Prysm](https://docs.prylabs.network/docs/getting-started), you can select all or a specific number of validators by navigating the user interface in the terminal and selecting the public keys. For [Lighthouse](https://lighthouse-book.sigmaprime.io/intro.html), you have to input your validator and exit one at a time. + +:::info Exit Submission + +After the setup is completed, the validator exit credential is submitted to the blockchain without interruption. You can use `Ctrl+C` to stop the exit process anytime. + +::: + +## Check the withdrawal status + +A maximum of 16 validator keys can exit per block. Depending on the number of exits in the queue, the change might take several hours to be included in a block. If the exit is not showing up after several hours, consider re-doing the exit within the terminal. + +1. Open the Validator withdrawal page of the related network: + - [LUKSO Mainnet Validator withdrawals](https://explorer.consensus.mainnet.lukso.network/validators/withdrawals) + - [LUKSO Testnet Validator withdrawals](https://explorer.consensus.testnet.lukso.network/validators/withdrawals) +2. Input your validator's public key or index as described in the [withdrawal Update Guide](./withdrawal-update.md) +3. If the exit has been successfully submitted, the page will show an estimated exit time + +:::info + +Your validators stay active until the full withdrawal exit time. Ensure your node runs to this point to gain further rewards and fees. If your node is offline, you will get penalized and lose your stake. + +::: + +## Further Reads + +If you are using Dappnode or a custom client, please refer to the following sources: + +- [Exit Dappnode Validators](https://discourse.dappnode.io/t/how-to-exit-your-validator-from-the-ui/1745) +- [Prysm Validator Exit Documentation](https://docs.prylabs.network/docs/wallet/exiting-a-validator) +- [Lighthouse Withdrawal Guide](https://lighthouse-book.sigmaprime.io/voluntary-exit.html) +- [How to exit Teku Validators](https://docs.teku.consensys.io/how-to/voluntarily-exit) diff --git a/docs/networks/mainnet/parameters.md b/docs/networks/mainnet/parameters.md index 9e4d47090d..47bc0f17ab 100644 --- a/docs/networks/mainnet/parameters.md +++ b/docs/networks/mainnet/parameters.md @@ -7,18 +7,19 @@ import AddNetworkButton from '../../../src/components/AddNetworkButton' # Network Parameters -| Setting | Value | -| ------------------------ | ---------------------------------------------------------------------------------------------------- | -| Network Name | Mainnet | -| Genesis Fork Version | 0x42000001 | -| Chain ID / Network ID | 42 | -| Currency Symbol | LYX | -| Execution Block Explorer | [https://explorer.execution.mainnet.lukso.network](https://explorer.execution.mainnet.lukso.network) | -| Execution Status Page | [https://stats.execution.mainnet.lukso.network](https://stats.execution.mainnet.lukso.network) | -| Consensus Block Explorer | [https://explorer.consensus.mainnet.lukso.network](https://explorer.consensus.mainnet.lukso.network) | -| Consensus Status Page | [https://stats.consensus.mainnet.lukso.network](https://stats.consensus.mainnet.lukso.network) | -| Launchpad | [https://deposit.mainnet.lukso.network](https://deposit.mainnet.lukso.network) | -| Checkpoints | [https://checkpoints.mainnet.lukso.network](https://checkpoints.mainnet.lukso.network) | +| Setting | Value | +| ------------------------ | ------------------------------------------------------------------------------------------------------------ | +| Network Name | Mainnet | +| Genesis Fork Version | 0x42000001 | +| Chain ID / Network ID | 42 | +| Currency Symbol | LYX | +| Execution Block Explorer | [https://explorer.execution.mainnet.lukso.network](https://explorer.execution.mainnet.lukso.network) | +| Blockscout API | [https://explorer.execution.mainnet.lukso.network/api](https://explorer.execution.mainnet.lukso.network/api) | +| Execution Status Page | [https://stats.execution.mainnet.lukso.network](https://stats.execution.mainnet.lukso.network) | +| Consensus Block Explorer | [https://explorer.consensus.mainnet.lukso.network](https://explorer.consensus.mainnet.lukso.network) | +| Consensus Status Page | [https://stats.consensus.mainnet.lukso.network](https://stats.consensus.mainnet.lukso.network) | +| Launchpad | [https://deposit.mainnet.lukso.network](https://deposit.mainnet.lukso.network) | +| Checkpoints | [https://checkpoints.mainnet.lukso.network](https://checkpoints.mainnet.lukso.network) | The mainnet network configs are defined or the [`lukso-network/network-configs`](https://github.com/lukso-network/network-configs/tree/main/mainnet/shared) repo. diff --git a/docs/networks/testnet/parameters.md b/docs/networks/testnet/parameters.md index 1be8c943b4..0387bd51b2 100644 --- a/docs/networks/testnet/parameters.md +++ b/docs/networks/testnet/parameters.md @@ -9,21 +9,22 @@ The Public Testnet runs alongside the LUKSO mainnet for developers to test dApps ## Network Parameters -| Setting | Value | -| ------------------------ | ---------------------------------------------------------------------------------------------------- | -| Network Name | Testnet | -| Fork Version | 0x42010001 | -| Chain ID / Network ID | 4201 | -| Currency Symbol | LYXt | -| RPC URL | [https://rpc.testnet.lukso.network](https://rpc.testnet.lukso.network) | -| Websocket RPC URL | [wss://ws-rpc.testnet.lukso.network](wss://ws-rpc.testnet.lukso.network) | -| Execution Block Explorer | [https://explorer.execution.testnet.lukso.network](https://explorer.execution.testnet.lukso.network) | -| Execution Status Page | [https://stats.execution.testnet.lukso.network](https://stats.execution.testnet.lukso.network) | -| Consensus Block Explorer | [https://explorer.consensus.testnet.lukso.network](https://explorer.consensus.testnet.lukso.network) | -| Consensus Status Page | [https://stats.consensus.testnet.lukso.network](https://stats.consensus.testnet.lukso.network) | -| Faucet | [https://faucet.testnet.lukso.network](https://faucet.testnet.lukso.network) | -| Launchpad | [https://deposit.testnet.lukso.network](https://deposit.testnet.lukso.network) | -| Checkpoints | [https://checkpoints.testnet.lukso.network](https://checkpoints.testnet.lukso.network) | +| Setting | Value | +| ------------------------ | ------------------------------------------------------------------------------------------------------------ | +| Network Name | Testnet | +| Fork Version | 0x42010001 | +| Chain ID / Network ID | 4201 | +| Currency Symbol | LYXt | +| RPC URL | [https://rpc.testnet.lukso.network](https://rpc.testnet.lukso.network) | +| Websocket RPC URL | [wss://ws-rpc.testnet.lukso.network](wss://ws-rpc.testnet.lukso.network) | +| Execution Block Explorer | [https://explorer.execution.testnet.lukso.network](https://explorer.execution.testnet.lukso.network) | +| Blockscout API | [https://explorer.execution.testnet.lukso.network/api](https://explorer.execution.testnet.lukso.network/api) | +| Execution Status Page | [https://stats.execution.testnet.lukso.network](https://stats.execution.testnet.lukso.network) | +| Consensus Block Explorer | [https://explorer.consensus.testnet.lukso.network](https://explorer.consensus.testnet.lukso.network) | +| Consensus Status Page | [https://stats.consensus.testnet.lukso.network](https://stats.consensus.testnet.lukso.network) | +| Faucet | [https://faucet.testnet.lukso.network](https://faucet.testnet.lukso.network) | +| Launchpad | [https://deposit.testnet.lukso.network](https://deposit.testnet.lukso.network) | +| Checkpoints | [https://checkpoints.testnet.lukso.network](https://checkpoints.testnet.lukso.network) | The testnet network configs are defined or the [`lukso-network/network-configs`](https://github.com/lukso-network/network-configs/tree/main/testnet/shared) repo. diff --git a/docs/standards/generic-standards/lsp2-json-schema.md b/docs/standards/generic-standards/lsp2-json-schema.md index 6ffb1d2adb..f81eb795c5 100644 --- a/docs/standards/generic-standards/lsp2-json-schema.md +++ b/docs/standards/generic-standards/lsp2-json-schema.md @@ -137,7 +137,7 @@ The data being mapped can be words that have a specific meaning for the protocol Below are some examples of the **Mapping** key type. -- mapping to **words:** `SupportedStandards:LSP3UniversalProfile`, `SupportedStandards:LSP4DigitalAsset`, `SupportedStandards:LSP{N}{StandardName}`, etc... +- mapping to **words:** `SupportedStandards:LSP3Profile`, `SupportedStandards:LSP4DigitalAsset`, `SupportedStandards:LSP{N}{StandardName}`, etc... - mapping to **``**, like an `address`: `LSP5ReceivedAssetsMap:
` - mapping to **``**, like a `bytes32`: `LSP8MetadataAddress:` @@ -145,8 +145,8 @@ Below are some examples of the **Mapping** key type. ```json { - "name": "SupportedStandards:LSP3UniversalProfile", - "key": "0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38", + "name": "SupportedStandards:LSP3Profile", + "key": "0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347", "keyType": "Mapping", "valueType": "bytes4", "valueContent": "0xabe425d6" diff --git a/docs/standards/tokens/LSP7-Digital-Asset.md b/docs/standards/tokens/LSP7-Digital-Asset.md index 5edd48092c..c3d2bd3f5a 100644 --- a/docs/standards/tokens/LSP7-Digital-Asset.md +++ b/docs/standards/tokens/LSP7-Digital-Asset.md @@ -31,7 +31,7 @@ Fungible assets such as **[ERC20](https://eips.ethereum.org/EIPS/eip-20)**, **[E LSP7-DigitalAsset is an interface standard which describes a set of methods that fungible asset contracts should implement which other contracts and clients can call. -This standard was based on **[ERC20](https://eips.ethereum.org/EIPS/eip-20)** and **[ERC777](https://eips.ethereum.org/EIPS/eip-777)** with additional features mentioned below: +This standard was based on the ideas of **[ERC20](https://eips.ethereum.org/EIPS/eip-20)** and **[ERC777](https://eips.ethereum.org/EIPS/eip-777)**. While it does not integrate all the functionality from [ERC777](https://eips.ethereum.org/EIPS/eip-777), LSP7 comes with the additional features mentioned below: ### Divisible _vs_ Non-Divisible diff --git a/docs/standards/universal-profile/lsp3-profile-metadata.md b/docs/standards/universal-profile/lsp3-profile-metadata.md index 108a70be9a..47394557aa 100644 --- a/docs/standards/universal-profile/lsp3-profile-metadata.md +++ b/docs/standards/universal-profile/lsp3-profile-metadata.md @@ -28,19 +28,19 @@ Make sure to understand the **[ERC725Y Generic Key/Value Store](../lsp-backgroun ::: -### `SupportedStandards:LSP3UniversalProfile` +### `SupportedStandards:LSP3Profile` ```json { - "name": "SupportedStandards:LSP3UniversalProfile", - "key": "0xeafec4d89fa9619884b60000abe425d64acd861a49b8ddf5c0b6962110481f38", + "name": "SupportedStandards:LSP3Profile", + "key": "0xeafec4d89fa9619884b600005ef83ad9559033e6e941db7d7c495acdce616347", "keyType": "Mapping", "valueType": "bytes4", - "valueContent": "0xabe425d6" + "valueContent": "0x5ef83ad9" } ``` -This data key is used to know if the contract represents a **Universal Profile**. +This data key is used to know if the contract contains some metadata to display as a profile. ### `LSP3Profile` diff --git a/docs/standards/universal-profile/lsp6-key-manager.md b/docs/standards/universal-profile/lsp6-key-manager.md index 28a561ba7c..363ab35e4e 100644 --- a/docs/standards/universal-profile/lsp6-key-manager.md +++ b/docs/standards/universal-profile/lsp6-key-manager.md @@ -886,7 +886,7 @@ The relay transactions are signed using the [**version 0 of EIP191**](https://gi ### Out of order execution -Since the Key Manager offers **relay execution** via signed message, it's important to provide security measurements to ensure that the signed message can't be repeated once executed. **[Nonces](https://www.techtarget.com/searchsecurity/definition/nonce#:~:text=A%20nonce%20is%20a%20random,to%20as%20a%20cryptographic%20nonce.)** existed to solve this problem, but with the following drawback: +Since the Key Manager offers **relay execution** via signed message, it's important to provide security measurements to ensure that the signed message can't be repeated once executed. **[Nonces](https://www.techtarget.com/searchsecurity/definition/nonce#:~:text=A%20nonce%20is%20a%20random,to%20as%20a%20cryptographic%20nonce.)** exist to solve this problem, but with the following drawback: - Signed messages with sequential nonces should be **executed in order**, meaning a signed message with nonce 4 can't be executed before the signed message with nonce 3. This is a critical problem which can limit the usage of relay execution. diff --git a/docs/tools/erc725js/classes/ERC725.md b/docs/tools/erc725js/classes/ERC725.md index bca09a3409..8bce7c8ecf 100644 --- a/docs/tools/erc725js/classes/ERC725.md +++ b/docs/tools/erc725js/classes/ERC725.md @@ -342,6 +342,67 @@ myErc725.decodePermissions('0x00000000000000000000000000000000000000000000000000 --- +## decodeValueType + +```js +myErc725.decodeValueType(type, data); +``` + +```js +ERC725.decodeValueType(type, data); +``` + +Decode some data according to a provided value type. + +#### Parameters + +| Name | Type | Description | +| :----- | :----- | :---------------------------------------------------------------------------- | +| `type` | string | The value type to decode the data (i.e. `uint256`, `bool`, `bytes4`, etc...). | +| `data` | string | A hex encoded string starting with `0x` to decode | + +#### Returns + +| Name | Type | Description | +| :------------- | :--------------------- | :----------------------------------- | +| `decodedValue` | string or
number | A value decoded according to `type`. | + +#### Examples + +```javascript +myErc725.decodeValueType('uint128', '0x0000000000000000000000000000000a'); +// 10 + +myErc725.decodeValueType('bool', '0x01'); +// true + +myErc725.decodeValueType('string', '0x48656c6c6f21'); +// 'Hello!'; + +// also available for ABI encoded array + CompactBytesArray +myErc725.decodeValueType( + 'uint256[]', + '0x00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001e', +); +// [ 10, 20, 30 ] + +myErc725.decodeValueType( + 'uint256[CompactBytesArray]'', + '0x0020000000000000000000000000000000000000000000000000000000000000000500200000000000000000000000000000000000000000000000000000000000000008' +) +// [ 5, 8 ] +``` + +This method is also available as a static method: + +```js +ERC725.decodeValueType( + 'uint256', + '0x000000000000000000000000000000000000000000000000000000000000002a', +); +// 42 +``` + ## encodeData ```js @@ -615,6 +676,178 @@ myErc725.encodeData([ +
+ Encode array length + +If the key is of type Array and you pass an integer as a value (for instance, the array length), it will be encoded accordingly. + +```javascript title="Encode the length of an array" +myErc725.encodeData([ + { + keyName: 'LSP3IssuedAssets[]', + value: 5, + }, +]); +/** +{ + keys: [ + '0x3a47ab5bd3a594c3a8995f8fa58d0876c96819ca4516bd76100c92462f2f9dc0', + ], + values: ['0x00000000000000000000000000000005'], +} +*/ +``` + +
+ +--- + +## encodePermissions + +```js +ERC725.encodePermissions(permissions); +``` + +Encodes permissions into a hexadecimal string as defined by the [LSP6 KeyManager Standard](https://docs.lukso.tech/standards/universal-profile/lsp6-key-manager). + +:::info + +`encodePermissions` is available as either a static or non-static method so can be called without instantiating an ERC725 object. + +::: + +#### Parameters + +##### 1. `permissions` - Object + +An object with [LSP6 KeyManager Permissions] as keys and a `boolean` as value. Any ommited permissions will default to `false`. + +#### Returns + +| Type | Description | +| :----- | :---------------------------------------------------------------------------------------- | +| string | The permissions encoded as a hexadecimal string defined by the [LSP6 KeyManager Standard] | + +#### Example + +```javascript title="Encoding permissions" +ERC725.encodePermissions({ + CHANGEOWNER: false, + ADDCONTROLLER: false, + EDITPERMISSIONS: false, + ADDEXTENSIONS: false, + CHANGEEXTENSIONS: true, + ADDUNIVERSALRECEIVERDELEGATE: false, + CHANGEUNIVERSALRECEIVERDELEGATE: false, + REENTRANCY: false, + SUPER_TRANSFERVALUE: true, + TRANSFERVALUE: true, + SUPER_CALL: false, + CALL: true, + SUPER_STATICCALL: false, + STATICCALL: false, + SUPER_DELEGATECALL: false, + DELEGATECALL: false, + DEPLOY: false, + SUPER_SETDATA: false, + SETDATA: false, + ENCRYPT: false, + DECRYPT: false, + SIGN: false, + EXECUTE_RELAY_CALL: false +}), +// '0x0000000000000000000000000000000000000000000000000000000000000110' + +// Any ommited Permissions will default to false +ERC725.encodePermissions({ + ADDCONTROLLER: true, + ADDEXTENSIONS: true, +}), +// '0x000000000000000000000000000000000000000000000000000000000000000a' +ERC725.encodePermissions({ + EDITPERMISSIONS: true, + CHANGEEXTENSIONS: true, + CHANGEUNIVERSALRECEIVERDELEGATE: true, + SETDATA: true, +}), +// '0x0000000000000000000000000000000000000000000000000000000000040054' + + +// This method is also available on the instance: +myErc725.encodePermissions({ + EDITPERMISSIONS: true, + SETDATA: true, +}), +``` + +--- + +## encodeValueType + +```js +myErc725.encodeValueType(type, value); +``` + +```js +ERC725.encodeValueType(type, value); +``` + +#### Parameters + +| Name | Type | Description | +| :------ | :--------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------- | +| `type` | string | The value type to encode the value (i.e. `uint256`, `bool`, `bytes4`, etc...). | +| `value` | string or
string[ ] or
number or
number[ ] or
boolean or
boolean[] | The value that should be encoded as `type` | + +#### Returns + +| Name | Type | Description | +| :----------------- | :----- | :------------------------------------------------------- | +| `encodedValueType` | string | A hex string representing the `value` encoded as `type`. | + +After the `value` is encoded, the hex string can be used to be stored inside the ERC725Y smart contract. + +#### Examples + +```javascript +myErc725.encodeValueType('uint256', 5); +// '0x0000000000000000000000000000000000000000000000000000000000000005' + +myErc725.encodeValueType('bool', true); +// '0x01' + +// the word `boolean` (Name of the Typescript type) is also available +myErc725.encodeValueType('boolean', true); +// '0x01' + +// `bytesN` type will pad on the right if the value contains less than N bytes +myErc725.encodeValueType('bytes4', '0xcafe'); +// '0xcafe0000' +myErc725.encodeValueType('bytes32', '0xcafe'); +// '0xcafe000000000000000000000000000000000000000000000000000000000000' + +// `bytesN` type will throw an error if the value contains more than N bytes +myERC725.encodeValueType('bytes4', '0xcafecafebeef'); +// Error: Can't convert 0xcafecafebeef to bytes4. Too many bytes, expected at most 4 bytes, received 6. + +// Can also be used to encode arrays as `CompactBytesArray` +myERC725.encodeValueType('uint256[CompactBytesArray]', [1, 2, 3]); +// '0x002000000000000000000000000000000000000000000000000000000000000000010020000000000000000000000000000000000000000000000000000000000000000200200000000000000000000000000000000000000000000000000000000000000003' + +myERC725.encodeValueType('bytes[CompactBytesArray]', [ + '0xaaaaaaaa', + '0xbbbbbbbbbbbbbbbbbb', +]); +// '0x0004aaaaaaaa0009bbbbbbbbbbbbbbbbbb' +``` + +This method is also available as a static method. + +```javascript +ERC725.encodeValueType('string', 'Hello'); +// '0x48656c6c6f' +``` + --- ## encodeKeyName @@ -766,86 +999,6 @@ myErc725.decodeMappingKey( --- -## encodePermissions - -```js -ERC725.encodePermissions(permissions); -``` - -Encodes permissions into a hexadecimal string as defined by the [LSP6 KeyManager Standard](https://docs.lukso.tech/standards/universal-profile/lsp6-key-manager). - -:::info - -`encodePermissions` is available as either a static or non-static method so can be called without instantiating an ERC725 object. - -::: - -#### Parameters - -##### 1. `permissions` - Object - -An object with [LSP6 KeyManager Permissions] as keys and a `boolean` as value. Any ommited permissions will default to `false`. - -#### Returns - -| Type | Description | -| :----- | :---------------------------------------------------------------------------------------- | -| string | The permissions encoded as a hexadecimal string defined by the [LSP6 KeyManager Standard] | - -#### Example - -```javascript title="Encoding permissions" -ERC725.encodePermissions({ - CHANGEOWNER: false, - ADDCONTROLLER: false, - EDITPERMISSIONS: false, - ADDEXTENSIONS: false, - CHANGEEXTENSIONS: true, - ADDUNIVERSALRECEIVERDELEGATE: false, - CHANGEUNIVERSALRECEIVERDELEGATE: false, - REENTRANCY: false, - SUPER_TRANSFERVALUE: true, - TRANSFERVALUE: true, - SUPER_CALL: false, - CALL: true, - SUPER_STATICCALL: false, - STATICCALL: false, - SUPER_DELEGATECALL: false, - DELEGATECALL: false, - DEPLOY: false, - SUPER_SETDATA: false, - SETDATA: false, - ENCRYPT: false, - DECRYPT: false, - SIGN: false, - EXECUTE_RELAY_CALL: false -}), -// '0x0000000000000000000000000000000000000000000000000000000000000110' - -// Any ommited Permissions will default to false -ERC725.encodePermissions({ - ADDCONTROLLER: true, - ADDEXTENSIONS: true, -}), -// '0x000000000000000000000000000000000000000000000000000000000000000a' -ERC725.encodePermissions({ - EDITPERMISSIONS: true, - CHANGEEXTENSIONS: true, - CHANGEUNIVERSALRECEIVERDELEGATE: true, - SETDATA: true, -}), -// '0x0000000000000000000000000000000000000000000000000000000000040054' - - -// This method is also available on the instance: -myErc725.encodePermissions({ - EDITPERMISSIONS: true, - SETDATA: true, -}), -``` - ---- - ## fetchData ```js @@ -1450,8 +1603,8 @@ Either a string of the hexadecimal `interfaceID` as defined by [ERC165](https:// | `LSP1UniversalReceiver` | [LSP-1: Universal Receiver](https://docs.lukso.tech/standards/generic-standards/lsp1-universal-receiver) | | `LSP1UniversalReceiverDelegate` | [LSP-1: Universal Receiver Delegate](https://docs.lukso.tech/standards/universal-profile/lsp1-universal-receiver-delegate) | | `LSP6KeyManager` | [LSP-6: Key Manager](https://docs.lukso.tech/standards/universal-profile/lsp6-key-manager) | -| `LSP7DigitalAsset` | [LSP-7: Digital Asset](https://docs.lukso.tech/standards/tokens/LSP7-Digital-Asset) | -| `LSP8IdentifiableDigitalAsset` | [LSP-8: Identifiable Digital Asset](https://docs.lukso.tech/standards/tokens/LSP8-Identifiable-Digital-Asset) | +| `LSP7DigitalAsset` | [LSP-7: Digital Asset](https://docs.lukso.tech/standards/nft-2.0/LSP7-Digital-Asset) | +| `LSP8IdentifiableDigitalAsset` | [LSP-8: Identifiable Digital Asset](https://docs.lukso.tech/standards/nft-2.0/LSP8-Identifiable-Digital-Asset) | | `LSP9Vault` | [LSP-9: Vault](https://docs.lukso.tech/standards/universal-profile/lsp9-vault) | :::info diff --git a/docs/tools/erc725js/getting-started.md b/docs/tools/erc725js/getting-started.md index 68abf9ff5e..1cb5477980 100644 --- a/docs/tools/erc725js/getting-started.md +++ b/docs/tools/erc725js/getting-started.md @@ -29,7 +29,6 @@ If you install it on the backend side, you may need to also install [`isomorphic ```js import { ERC725 } from '@erc725/erc725.js'; -import Web3 from 'web3'; // Part of LSP3-UniversalProfile Schema // https://github.com/lukso-network/LIPs/blob/master/LSPs/LSP-3-UniversalProfile.md diff --git a/docs/tools/lsp-factoryjs/deployment/digital-asset.md b/docs/tools/lsp-factoryjs/deployment/digital-asset.md index 53c38f7f17..c1cf203f9c 100644 --- a/docs/tools/lsp-factoryjs/deployment/digital-asset.md +++ b/docs/tools/lsp-factoryjs/deployment/digital-asset.md @@ -36,10 +36,10 @@ The [LSP7] standard can be useful for NFT collections where you want all tokens ```javascript await lspFactory.LSP7DigitalAsset.deploy({ - isNFT: true, - controllerAddress: '0x56fE4E7dc2bc0b6397E4609B07b4293482E3F72B', - name: 'MYTOKEN', - symbol: 'DEMO', + isNFT: true, + controllerAddress: '0x56fE4E7dc2bc0b6397E4609B07b4293482E3F72B', + name: 'MYTOKEN' + symbol: 'DEMO', }); ``` diff --git a/docs/tools/lsp-factoryjs/deployment/universal-profile.md b/docs/tools/lsp-factoryjs/deployment/universal-profile.md index 7b1fe0be7f..b6d4b356f7 100644 --- a/docs/tools/lsp-factoryjs/deployment/universal-profile.md +++ b/docs/tools/lsp-factoryjs/deployment/universal-profile.md @@ -5,7 +5,7 @@ title: Universal Profile # Deploying a Universal Profile -LSPFactory allows you to quickly deploy and configure a Universal Profile consisting of an [LSP0 ERC725 Account](../../../standards/universal-profile/lsp0-erc725account), an [LSP6 Key Manager](../../../standards/universal-profile/lsp6-key-manager), and an [LSP1-UniversalReceiver](../../../standards/generic-standards/lsp1-universal-receiver.md) smart contract: +LSPFactory allows you to quickly deploy and configure a Universal Profile consisting of an [LSP0 ERC725 Account](../../../standards/universal-profile/lsp0-erc725account.md), an [LSP6 Key Manager](../../../standards/universal-profile/lsp6-key-manager.md), and an [LSP1-UniversalReceiver](../../../standards/generic-standards/lsp1-universal-receiver.md) smart contract: ```javascript await lspFactory.UniversalProfile.deploy(profileProperties [, options]); @@ -13,21 +13,21 @@ await lspFactory.UniversalProfile.deploy(profileProperties [, options]); This will deploy the following contracts: -- [LSP0 ERC725 Account](../../../standards/universal-profile/lsp0-erc725account) -- [LSP6 Key Manager](../../../standards/universal-profile/lsp6-key-manager) +- [LSP0 ERC725 Account](../../../standards/universal-profile/lsp0-erc725account.md) +- [LSP6 Key Manager](../../../standards/universal-profile/lsp6-key-manager.md) - And link to a pre-deployed [LSP1 Universal Receiver](../../../standards/generic-standards/lsp1-universal-receiver.md) After, it will: -- upload metadata to IPFS and set the [LSP3 Profile](../../../standards/universal-profile/lsp3-profile-metadata) metadata, +- upload metadata to IPFS and set the [LSP3 Profile](../../../standards/universal-profile/lsp3-profile-metadata.md) metadata, - attach the Universal Receiver Delegate to the ERC725 Account, - set the Key Manager as the owner of the ERC725 Account, and -- set all [permissions](../../../standards/universal-profile/lsp6-key-manager#-types-of-permissions) for the `controllerAddresses` except `DELEGATECALL`. +- set all [permissions](../../../standards/universal-profile/lsp6-key-manager#-types-of-permissions.md) for the `controllerAddresses` except `DELEGATECALL`. -These smart contracts linked with some [LSP3 Profile Metadata](../../../standards/universal-profile/lsp3-profile-metadata) form a Universal Profile. The metadata is the 'face' of your profile and contains information such as your name, description, and profile image. +These smart contracts linked with some [LSP3 Profile Metadata](../../../standards/universal-profile/lsp3-profile-metadata.md) form a Universal Profile. The metadata is the 'face' of your profile and contains information such as your name, description, and profile image. :::caution -The deployment key passed to LSPFactory will be given `CHANGEOWNER` and `EDITPERMISSIONS` [LSP6 permissions](../../../standards/universal-profile/lsp6-key-manager#-types-of-permissions) in order to carry out the Universal Profile deployment. +The deployment key passed to LSPFactory will be given `CHANGEOWNER` and `EDITPERMISSIONS` [LSP6 permissions](../../../standards/universal-profile/lsp6-key-manager#-types-of-permissions.md) in order to carry out the Universal Profile deployment. These permisisons are revoked as the final step of deployment. It is important this step is completed correctly to avoid security risks. @@ -64,13 +64,13 @@ await lspFactory.UniversalProfile.deploy({ ``` :::info Info -Profile Metadata can be passed as either a JSON object containing the [LSP3Metadata](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-UniversalProfile-Metadata.md#lsp3profile) you want to upload or a URL of your previously uploaded metadata. +Profile Metadata can be passed as either a JSON object containing the [LSP3Metadata](https://github.com/lukso-network/LIPs/blob/main/LSPs/LSP-3-Profile-Metadata.md) you want to upload or a URL of your previously uploaded metadata. ::: If an LSP3MetaData object is passed, LSPFactory will process and upload your metadata to IPFS. :::info -See [Upload Options](././universal-profile#ipfs-upload-options) for details on how to specify a custom IPFS gateway. +See [Upload Options](././universal-profile#ipfs-upload-options.md) for details on how to specify a custom IPFS gateway. ::: ```javascript title='Uploading an LSP3 metadata automatically' @@ -320,13 +320,13 @@ await lspFactory.UniversalProfile.deploy({ ### Uploading LSP3 metadata to IPFS -You can upload your LSP3 metadata before deploying a Universal Profile using the `uploadProfileData()` method. The function uses the same [`lsp3Profile` object schema](./universal-profile#adding-lsp3-metadata) defined above when deploying a Universal Profile. Returns an object containing the IPFS upload location of your metadata and your `lsp3Metdata` as a javascript object. +You can upload your LSP3 metadata before deploying a Universal Profile using the `uploadProfileData()` method. The function uses the same [`lsp3Profile` object schema](./universal-profile#adding-lsp3-metadata.md) defined above when deploying a Universal Profile. Returns an object containing the IPFS upload location of your metadata and your `lsp3Metdata` as a javascript object. ```javascript await myLSPFactory.UniversalProfile.uploadProfileData(lsp3Profile [, options]); ``` -To upload using a custom IPFS gateway, pass the `options` object. The field is the same `options` object used when deploying a Universal Profile. [Read more](./universal-profile#ipfs-upload-options). +To upload using a custom IPFS gateway, pass the `options` object. The field is the same `options` object used when deploying a Universal Profile. [Read more](./universal-profile#ipfs-upload-options.md). The `uploadProfileData()` function is available as a static or non-static method to be called without instantiating an `LSPFactory` object. diff --git a/docs/tools/lsp-smart-contracts/constants.md b/docs/tools/lsp-smart-contracts/constants.md index 95487e5d30..4e8e749448 100644 --- a/docs/tools/lsp-smart-contracts/constants.md +++ b/docs/tools/lsp-smart-contracts/constants.md @@ -4,21 +4,42 @@ sidebar_position: 4 # Constants -The [`constants.js`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/constants.js) file exposes many useful variables. +The [`constants.ts`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/constants.ts) file exposes many useful variables. -```javascript +```ts import { INTERFACE_IDS, ERC1271, OPERATIONS, SupportedStandards, ERC725YDataKeys, - BasicUPSetup_Schema, PERMISSIONS, ALL_PERMISSIONS, - Errors, - EventSignatures, -} from '@lukso/lsp-smart-contracts/constants.js'; + LSP8_TOKEN_ID_TYPES, + LSP25_VERSION, + ErrorSelectors, + EventSigHashes, + FunctionSelectors, + ContractsDocs, + StateVariables, +} from '@lukso/lsp-smart-contracts'; +``` + +The following additional typescript types are also available, including types for the JSON format of the LSP3 Profile and LSP4 Digital Asset metadata. + +```ts +import { + LSP2ArrayKey, + LSPSupportedStandard, + LSP6PermissionName, + LSP3ProfileMetadataJSON, + LSP3ProfileMetadata, + LSP4DigitalAssetMetadataJSON, + LSP4DigitalAssetMetadata, + ImageMetadata, + LinkMetadata, + AssetMetadata, +} from '@lukso/lsp-smart-contracts'; ``` You can find the [interface IDs](../../contracts/interface-ids) of the smart contracts in or more information in the [`README.md`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/README.md). diff --git a/docusaurus.config.js b/docusaurus.config.js index bcc4605f06..7f7adefa4a 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -226,7 +226,7 @@ export default { }, { from: '/guides/browser-extension/web3-onboard', - to: '/learn/expert-guides/web3-onboard', + to: '/learn/dapp-developer/web3-onboard', }, { from: '/guides/browser-extension/install-browser-extension', diff --git a/scripts/tools-sync.sh b/scripts/tools-sync.sh index 629cc38937..05a9d17275 100644 --- a/scripts/tools-sync.sh +++ b/scripts/tools-sync.sh @@ -13,7 +13,7 @@ rsync -av --progress erc725.js/docs/. ../docs/tools/erc725js --exclude technical # Pull lsp-factory repo -git clone --depth 1 --branch main https://github.com/lukso-network/tools-lsp-factory.git +git clone --depth 1 --branch develop https://github.com/lukso-network/tools-lsp-factory.git # Copy Docs rsync -av --progress tools-lsp-factory/docs/. ../docs/tools/lsp-factoryjs --exclude=technical-reference diff --git a/src/pages/index.js b/src/pages/index.js index 4a01df20d4..ee12d4043d 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -25,13 +25,6 @@ function Index() { text="START BUILDING WITH LUKSO STANDARDS" />
- -