diff --git a/docs/contracts/_interface_ids_table.mdx b/docs/contracts/_interface_ids_table.mdx index 674870dac8..fbfb9856df 100644 --- a/docs/contracts/_interface_ids_table.mdx +++ b/docs/contracts/_interface_ids_table.mdx @@ -1,19 +1,20 @@ -| Contract | Interface ID | Description | -| :------------------------------- | :----------: | :------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **ERC165** | `0x01ffc9a7` | Standard Interface Detection. | -| **ERC1271** | `0x1626ba7e` | Standard Signature Validation Method for Contracts. | -| **ERC725X** | `0x7545acac` | General executor. | -| **ERC725Y** | `0x629aa694` | General Data key-value store. | -| **LSP0ERC725Account** | `0x24871b3d` | Interface of the [LSP-0-ERC725Account] standard, an account based smart contract that represents an identity on-chain. | -| **LSP1UniversalReceiver** | `0x6bb56a14` | Interface of the LSP1 - Universal Receiver standard, an entry function for a contract to receive arbitrary information. | -| **LSP6KeyManager** | `0xe7424397` | Interface of the LSP6 - Key Manager standard, a contract acting as a controller of an ERC725 Account using predfined permissions. | -| **LSP7DigitalAsset** | `0x05519512` | Interface of the LSP7 - Digital Asset standard, a fungible digital asset. | -| **LSP8IdentifiableDigitalAsset** | `0x1ae9ba1f` | 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. | -| **LSP17Extendable** | `0xa918fa6b` | Module to add more functionalities to a contract using extensions. | -| **LSP17Extension** | `0xcee78b40` | Module to create a contract that can act as an extension. | -| **LSP20CallVerification** | `0x1a0eb6a5` | Implementation of a contract calling the verification functions according to LSP20 - Call Verification standard. | -| **LSP20CallVerifier** | `0xc9dfc532` | Interface for the LSP20 Call Verification standard, a set of functions intended to perform verifications on behalf of another contract. | -| **LSP25ExecuteRelayCall** | `0x5ac79908` | | +| Contract | Interface ID | Description | +| :-------------------------------- | :----------: | :------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **ERC165** | `0x01ffc9a7` | Standard Interface Detection. | +| **ERC1271** | `0x1626ba7e` | Standard Signature Validation Method for Contracts. | +| **ERC725X** | `0x7545acac` | General executor. | +| **ERC725Y** | `0x629aa694` | General Data key-value store. | +| **LSP0ERC725Account** | `0x24871b3d` | Interface of the [LSP-0-ERC725Account] standard, an account based smart contract that represents an identity on-chain. | +| **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** | `0x05519512` | Interface of the LSP7 - Digital Asset standard, a fungible digital asset. | +| **LSP8IdentifiableDigitalAsset** | `0x1ae9ba1f` | 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. | +| **LSP17Extendable** | `0xa918fa6b` | Module to add more functionalities to a contract using extensions. | +| **LSP17Extension** | `0xcee78b40` | Module to create a contract that can act as an extension. | +| **LSP20CallVerification** | `0x1a0eb6a5` | Implementation of a contract calling the verification functions according to LSP20 - Call Verification standard. | +| **LSP20CallVerifier** | `0x0d6ecac7` | Interface for the LSP20 Call Verification standard, a set of functions intended to perform verifications on behalf of another contract. | +| **LSP25ExecuteRelayCall** | `0x5ac79908` | | diff --git a/docs/contracts/contracts/ERC725/ERC725.md b/docs/contracts/contracts/ERC725/ERC725.md index 25a5634ed3..06e477a5db 100644 --- a/docs/contracts/contracts/ERC725/ERC725.md +++ b/docs/contracts/contracts/ERC725/ERC725.md @@ -134,6 +134,12 @@ Generic executor function to: ::: +:::caution Warning + +- The `msg.value` should not be trusted for any method called with `operationType`: `DELEGATECALL` (4). + +::: + ```solidity function executeBatch( uint256[] operationsType, @@ -564,6 +570,12 @@ Perform low-level staticcall (operation type = 3) ### \_executeDelegateCall +:::caution Warning + +The `msg.value` should not be trusted for any method called with `operationType`: `DELEGATECALL` (4). + +::: + ```solidity function _executeDelegateCall( address target, @@ -1054,6 +1066,50 @@ Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#set
+### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#ownablecallernottheowner) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**ERC-725**](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-725.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`ERC725.sol`](https://github.com/ERC725Alliance/ERC725/blob/main/implementations/contracts/ERC725.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
+ diff --git a/docs/contracts/contracts/LSP0ERC725Account/LSP0ERC725Account.md b/docs/contracts/contracts/LSP0ERC725Account/LSP0ERC725Account.md index e2f1825bb4..05343bbf4b 100644 --- a/docs/contracts/contracts/LSP0ERC725Account/LSP0ERC725Account.md +++ b/docs/contracts/contracts/LSP0ERC725Account/LSP0ERC725Account.md @@ -491,7 +491,7 @@ Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys function isValidSignature( bytes32 dataHash, bytes signature -) external view returns (bytes4 magicValue); +) external view returns (bytes4 returnedStatus); ``` _Achieves the goal of [EIP-1271] by validating signatures of smart contracts according to their own logic._ @@ -500,15 +500,15 @@ Handles two cases: 1. If the owner is an EOA, recovers an address from the hash and the signature provided: -- Returns the `magicValue` if the address recovered is the same as the owner, indicating that it was a valid signature. +- Returns the `_ERC1271_SUCCESSVALUE` if the address recovered is the same as the owner, indicating that it was a valid signature. -- If the address is different, it returns the fail value indicating that the signature is not valid. +- If the address is different, it returns the `_ERC1271_FAILVALUE` indicating that the signature is not valid. 2. If the owner is a smart contract, it forwards the call of [`isValidSignature()`](#isvalidsignature) to the owner contract: -- If the contract fails or returns the fail value, the [`isValidSignature()`](#isvalidsignature) on the account returns the fail value, indicating that the signature is not valid. +- If the contract fails or returns the `_ERC1271_FAILVALUE`, the [`isValidSignature()`](#isvalidsignature) on the account returns the `_ERC1271_FAILVALUE`, indicating that the signature is not valid. -- If the [`isValidSignature()`](#isvalidsignature) on the owner returned the `magicValue`, the [`isValidSignature()`](#isvalidsignature) on the account returns the `magicValue`, indicating that it's a valid signature. +- If the [`isValidSignature()`](#isvalidsignature) on the owner returned the `_ERC1271_SUCCESSVALUE`, the [`isValidSignature()`](#isvalidsignature) on the account returns the `_ERC1271_SUCCESSVALUE`, indicating that it's a valid signature. #### Parameters @@ -519,9 +519,9 @@ Handles two cases: #### Returns -| Name | Type | Description | -| ------------ | :------: | ----------------------------------------------------------------- | -| `magicValue` | `bytes4` | A `bytes4` value that indicates if the signature is valid or not. | +| Name | Type | Description | +| ---------------- | :------: | ----------------------------------------------------------------- | +| `returnedStatus` | `bytes4` | A `bytes4` value that indicates if the signature is valid or not. |
@@ -951,6 +951,12 @@ Perform low-level staticcall (operation type = 3) ### \_executeDelegateCall +:::caution Warning + +The `msg.value` should not be trusted for any method called with `operationType`: `DELEGATECALL` (4). + +::: + ```solidity function _executeDelegateCall( address target, @@ -1192,8 +1198,8 @@ function _verifyCall( ``` Calls [`lsp20VerifyCall`](#lsp20verifycall) function on the logicVerifier. -Reverts in case the value returned does not match the magic value (lsp20VerifyCall selector) -Returns whether a verification after the execution should happen based on the last byte of the magicValue +Reverts in case the value returned does not match the success value (lsp20VerifyCall selector) +Returns whether a verification after the execution should happen based on the last byte of the returnedStatus
@@ -1207,7 +1213,7 @@ function _verifyCallResult( ``` Calls [`lsp20VerifyCallResult`](#lsp20verifycallresult) function on the logicVerifier. -Reverts in case the value returned does not match the magic value (lsp20VerifyCallResult selector) +Reverts in case the value returned does not match the success value (lsp20VerifyCallResult selector)
@@ -1437,7 +1443,7 @@ event UniversalReceiver(address indexed from, uint256 indexed value, bytes32 ind - Data received: `receivedData`.\* -Emitted when the [`universalReceiver`](#universalreceiver) function was called with a specific `typeId` and some `receivedData` s +Emitted when the [`universalReceiver`](#universalreceiver) function was called with a specific `typeId` and some `receivedData` #### Parameters @@ -1481,27 +1487,6 @@ Emitted when receiving native tokens. ## Errors -### CannotTransferOwnershipToSelf - -:::note References - -- Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-0-ERC725Account.md#cannottransferownershiptoself) -- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP0ERC725Account/LSP0ERC725Account.sol) -- Error signature: `CannotTransferOwnershipToSelf()` -- Error hash: `0x43b248cd` - -::: - -```solidity -error CannotTransferOwnershipToSelf(); -``` - -_Cannot transfer ownership to the address of the contract itself._ - -Reverts when trying to transfer ownership to the `address(this)`. - -
- ### ERC725X_ContractDeploymentFailed :::note References @@ -1724,6 +1709,52 @@ Reverts when there is not the same number of elements in the `datakeys` and `dat
+### LSP14CallerNotPendingOwner + +:::note References + +- Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-0-ERC725Account.md#lsp14callernotpendingowner) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP0ERC725Account/LSP0ERC725Account.sol) +- Error signature: `LSP14CallerNotPendingOwner(address)` +- Error hash: `0x451e4528` + +::: + +```solidity +error LSP14CallerNotPendingOwner(address caller); +``` + +Reverts when the `caller` that is trying to accept ownership of the contract is not the pending owner. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------------- | +| `caller` | `address` | The address that tried to accept ownership. | + +
+ +### LSP14CannotTransferOwnershipToSelf + +:::note References + +- Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-0-ERC725Account.md#lsp14cannottransferownershiptoself) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP0ERC725Account/LSP0ERC725Account.sol) +- Error signature: `LSP14CannotTransferOwnershipToSelf()` +- Error hash: `0xe052a6f8` + +::: + +```solidity +error LSP14CannotTransferOwnershipToSelf(); +``` + +_Cannot transfer ownership to the address of the contract itself._ + +Reverts when trying to transfer ownership to the `address(this)`. + +
+ ### LSP14MustAcceptOwnershipInSeparateTransaction :::note References @@ -1745,135 +1776,135 @@ Reverts when pending owner accept ownership in the same transaction of transferr
-### LSP20CallingVerifierFailed +### LSP14NotInRenounceOwnershipInterval :::note References -- Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-0-ERC725Account.md#lsp20callingverifierfailed) +- Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-0-ERC725Account.md#lsp14notinrenounceownershipinterval) - Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP0ERC725Account/LSP0ERC725Account.sol) -- Error signature: `LSP20CallingVerifierFailed(bool)` -- Error hash: `0x8c6a8ae3` +- Error signature: `LSP14NotInRenounceOwnershipInterval(uint256,uint256)` +- Error hash: `0x1b080942` ::: ```solidity -error LSP20CallingVerifierFailed(bool postCall); +error LSP14NotInRenounceOwnershipInterval( + uint256 renounceOwnershipStart, + uint256 renounceOwnershipEnd +); ``` -reverts when the call to the owner fail with no revert reason +_Cannot confirm ownership renouncement yet. The ownership renouncement is allowed from: `renounceOwnershipStart` until: `renounceOwnershipEnd`._ + +Reverts when trying to renounce ownership before the initial confirmation delay. #### Parameters -| Name | Type | Description | -| ---------- | :----: | ---------------------------------------------------- | -| `postCall` | `bool` | True if the execution call was done, False otherwise | +| Name | Type | Description | +| ------------------------ | :-------: | ----------------------------------------------------------------------- | +| `renounceOwnershipStart` | `uint256` | The start timestamp when one can confirm the renouncement of ownership. | +| `renounceOwnershipEnd` | `uint256` | The end timestamp when one can confirm the renouncement of ownership. |
-### LSP20EOACannotVerifyCall +### LSP20CallVerificationFailed :::note References -- Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-0-ERC725Account.md#lsp20eoacannotverifycall) +- Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-0-ERC725Account.md#lsp20callverificationfailed) - Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP0ERC725Account/LSP0ERC725Account.sol) -- Error signature: `LSP20EOACannotVerifyCall(address)` -- Error hash: `0x0c392301` +- Error signature: `LSP20CallVerificationFailed(bool,bytes)` +- Error hash: `0x00c28d0f` ::: ```solidity -error LSP20EOACannotVerifyCall(address logicVerifier); +error LSP20CallVerificationFailed(bool postCall, bytes returnedData); ``` -Reverts when the logic verifier is an Externally Owned Account (EOA) that cannot return the LSP20 magic value. +reverts when the call to the owner does not return the LSP20 success value #### Parameters -| Name | Type | Description | -| --------------- | :-------: | --------------------------------- | -| `logicVerifier` | `address` | The address of the logic verifier | +| Name | Type | Description | +| -------------- | :-----: | ---------------------------------------------------- | +| `postCall` | `bool` | True if the execution call was done, False otherwise | +| `returnedData` | `bytes` | The data returned by the call to the logic verifier |
-### LSP20InvalidMagicValue +### LSP20CallingVerifierFailed :::note References -- Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-0-ERC725Account.md#lsp20invalidmagicvalue) +- Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-0-ERC725Account.md#lsp20callingverifierfailed) - Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP0ERC725Account/LSP0ERC725Account.sol) -- Error signature: `LSP20InvalidMagicValue(bool,bytes)` -- Error hash: `0xd088ec40` +- Error signature: `LSP20CallingVerifierFailed(bool)` +- Error hash: `0x8c6a8ae3` ::: ```solidity -error LSP20InvalidMagicValue(bool postCall, bytes returnedData); +error LSP20CallingVerifierFailed(bool postCall); ``` -reverts when the call to the owner does not return the magic value +reverts when the call to the owner fail with no revert reason #### Parameters -| Name | Type | Description | -| -------------- | :-----: | ---------------------------------------------------- | -| `postCall` | `bool` | True if the execution call was done, False otherwise | -| `returnedData` | `bytes` | The data returned by the call to the logic verifier | +| Name | Type | Description | +| ---------- | :----: | ---------------------------------------------------- | +| `postCall` | `bool` | True if the execution call was done, False otherwise |
-### NoExtensionFoundForFunctionSelector +### LSP20EOACannotVerifyCall :::note References -- Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-0-ERC725Account.md#noextensionfoundforfunctionselector) +- Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-0-ERC725Account.md#lsp20eoacannotverifycall) - Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP0ERC725Account/LSP0ERC725Account.sol) -- Error signature: `NoExtensionFoundForFunctionSelector(bytes4)` -- Error hash: `0xbb370b2b` +- Error signature: `LSP20EOACannotVerifyCall(address)` +- Error hash: `0x0c392301` ::: ```solidity -error NoExtensionFoundForFunctionSelector(bytes4 functionSelector); +error LSP20EOACannotVerifyCall(address logicVerifier); ``` -reverts when there is no extension for the function selector being called with +Reverts when the logic verifier is an Externally Owned Account (EOA) that cannot return the LSP20 success value. #### Parameters -| Name | Type | Description | -| ------------------ | :------: | ----------- | -| `functionSelector` | `bytes4` | - | +| Name | Type | Description | +| --------------- | :-------: | --------------------------------- | +| `logicVerifier` | `address` | The address of the logic verifier |
-### NotInRenounceOwnershipInterval +### NoExtensionFoundForFunctionSelector :::note References -- Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-0-ERC725Account.md#notinrenounceownershipinterval) +- Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-0-ERC725Account.md#noextensionfoundforfunctionselector) - Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP0ERC725Account/LSP0ERC725Account.sol) -- Error signature: `NotInRenounceOwnershipInterval(uint256,uint256)` -- Error hash: `0x8b9bf507` +- Error signature: `NoExtensionFoundForFunctionSelector(bytes4)` +- Error hash: `0xbb370b2b` ::: ```solidity -error NotInRenounceOwnershipInterval( - uint256 renounceOwnershipStart, - uint256 renounceOwnershipEnd -); +error NoExtensionFoundForFunctionSelector(bytes4 functionSelector); ``` -_Cannot confirm ownership renouncement yet. The ownership renouncement is allowed from: `renounceOwnershipStart` until: `renounceOwnershipEnd`._ - -Reverts when trying to renounce ownership before the initial confirmation delay. +reverts when there is no extension for the function selector being called with #### Parameters -| Name | Type | Description | -| ------------------------ | :-------: | ----------------------------------------------------------------------- | -| `renounceOwnershipStart` | `uint256` | The start timestamp when one can confirm the renouncement of ownership. | -| `renounceOwnershipEnd` | `uint256` | The end timestamp when one can confirm the renouncement of ownership. | +| Name | Type | Description | +| ------------------ | :------: | ----------- | +| `functionSelector` | `bytes4` | - |
diff --git a/docs/contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.md b/docs/contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.md index 59056ac3a3..3e0f634b2f 100644 --- a/docs/contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.md +++ b/docs/contracts/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.md @@ -866,6 +866,50 @@ reverts when removing a guardian and the threshold is equal to the number of gua
+### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-11-BasicSocialRecovery.md#ownablecallernottheowner) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-11-BasicSocialRecovery**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-11-BasicSocialRecovery.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP11BasicSocialRecovery.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
+ ### SecretHashCannotBeZero :::note References diff --git a/docs/contracts/contracts/LSP14Ownable2Step/LSP14Ownable2Step.md b/docs/contracts/contracts/LSP14Ownable2Step/LSP14Ownable2Step.md index 89e2ed2d23..e058307dc8 100644 --- a/docs/contracts/contracts/LSP14Ownable2Step/LSP14Ownable2Step.md +++ b/docs/contracts/contracts/LSP14Ownable2Step/LSP14Ownable2Step.md @@ -403,19 +403,44 @@ Emitted when starting the [`renounceOwnership(..)`](#renounceownership) 2-step p ## Errors -### CannotTransferOwnershipToSelf +### LSP14CallerNotPendingOwner :::note References -- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md#cannottransferownershiptoself) +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md#lsp14callernotpendingowner) - Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol) -- Error signature: `CannotTransferOwnershipToSelf()` -- Error hash: `0x43b248cd` +- Error signature: `LSP14CallerNotPendingOwner(address)` +- Error hash: `0x451e4528` ::: ```solidity -error CannotTransferOwnershipToSelf(); +error LSP14CallerNotPendingOwner(address caller); +``` + +Reverts when the `caller` that is trying to accept ownership of the contract is not the pending owner. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------------- | +| `caller` | `address` | The address that tried to accept ownership. | + +
+ +### LSP14CannotTransferOwnershipToSelf + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md#lsp14cannottransferownershiptoself) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol) +- Error signature: `LSP14CannotTransferOwnershipToSelf()` +- Error hash: `0xe052a6f8` + +::: + +```solidity +error LSP14CannotTransferOwnershipToSelf(); ``` _Cannot transfer ownership to the address of the contract itself._ @@ -445,19 +470,19 @@ Reverts when pending owner accept ownership in the same transaction of transferr
-### NotInRenounceOwnershipInterval +### LSP14NotInRenounceOwnershipInterval :::note References -- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md#notinrenounceownershipinterval) +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md#lsp14notinrenounceownershipinterval) - Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol) -- Error signature: `NotInRenounceOwnershipInterval(uint256,uint256)` -- Error hash: `0x8b9bf507` +- Error signature: `LSP14NotInRenounceOwnershipInterval(uint256,uint256)` +- Error hash: `0x1b080942` ::: ```solidity -error NotInRenounceOwnershipInterval( +error LSP14NotInRenounceOwnershipInterval( uint256 renounceOwnershipStart, uint256 renounceOwnershipEnd ); @@ -476,6 +501,31 @@ Reverts when trying to renounce ownership before the initial confirmation delay.
+### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-14-Ownable2Step**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-14-Ownable2Step.md#ownablecallernottheowner) +- Solidity implementation: [`LSP14Ownable2Step.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ diff --git a/docs/contracts/contracts/LSP17Extensions/Extension4337.md b/docs/contracts/contracts/LSP17Extensions/Extension4337.md index d613277355..4c11ab9945 100644 --- a/docs/contracts/contracts/LSP17Extensions/Extension4337.md +++ b/docs/contracts/contracts/LSP17Extensions/Extension4337.md @@ -102,8 +102,8 @@ See [`IERC165-supportsInterface`](#ierc165-supportsinterface). - Specification details: [**LSP-17-Extensions**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-17-Extensions.md#validateuserop) - Solidity implementation: [`Extension4337.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP17Extensions/Extension4337.sol) -- Function signature: `validateUserOp(UserOperation,bytes32,)` -- Function selector: `0x68159319` +- Function signature: `validateUserOp(UserOperation,bytes32,uint256)` +- Function selector: `0xe86fc51e` ::: diff --git a/docs/contracts/contracts/LSP17Extensions/OnERC721ReceivedExtension.md b/docs/contracts/contracts/LSP17Extensions/OnERC721ReceivedExtension.md index 8a0d7d8905..ff4c331880 100644 --- a/docs/contracts/contracts/LSP17Extensions/OnERC721ReceivedExtension.md +++ b/docs/contracts/contracts/LSP17Extensions/OnERC721ReceivedExtension.md @@ -25,10 +25,10 @@ When marked as 'public', a method can be called both externally and internally, :::note References -- Specification details: [**LSP-17-Extensions**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-17-Extensions.md#,,,)) +- Specification details: [**LSP-17-Extensions**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-17-Extensions.md#onerc721received) - Solidity implementation: [`OnERC721ReceivedExtension.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP17Extensions/OnERC721ReceivedExtension.sol) -- Function signature: `,,,)` -- Function selector: `0x940e0af1` +- Function signature: `onERC721Received(address,address,uint256,bytes)` +- Function selector: `0x150b7a02` ::: diff --git a/docs/contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.md b/docs/contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.md index 04af77971f..adb4cc5cd7 100644 --- a/docs/contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.md +++ b/docs/contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.md @@ -58,14 +58,14 @@ See [`IERC165-supportsInterface`](#ierc165-supportsinterface).
-### universalReceiver +### universalReceiverDelegate :::note References -- Specification details: [**LSP-1-UniversalReceiver**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-1-UniversalReceiver.md#universalreceiver) +- Specification details: [**LSP-1-UniversalReceiver**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-1-UniversalReceiver.md#universalreceiverdelegate) - Solidity implementation: [`LSP1UniversalReceiverDelegateUP.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol) -- Function signature: `universalReceiver(bytes32,)` -- Function selector: `0x534e72c8` +- Function signature: `universalReceiverDelegate(address,uint256,bytes32,bytes)` +- Function selector: `0xa245bbda` ::: @@ -83,10 +83,12 @@ When the data stored in the ERC725Y storage of the LSP0 contract is corrupted (\ ::: ```solidity -function universalReceiver( +function universalReceiverDelegate( + address notifier, + uint256, bytes32 typeId, bytes -) external payable returns (bytes); +) external nonpayable returns (bytes); ``` _Reacted on received notification with `typeId`._ @@ -106,10 +108,12 @@ _Reacted on received notification with `typeId`._ #### Parameters -| Name | Type | Description | -| -------- | :-------: | ---------------------------------------------- | -| `typeId` | `bytes32` | Unique identifier for a specific notification. | -| `_1` | `bytes` | - | +| Name | Type | Description | +| ---------- | :-------: | ---------------------------------------------- | +| `notifier` | `address` | - | +| `_1` | `uint256` | - | +| `typeId` | `bytes32` | Unique identifier for a specific notification. | +| `_3` | `bytes` | - | #### Returns @@ -219,41 +223,6 @@ Calls `bytes4(keccak256(setDataBatch(bytes32[],bytes[])))` without checking for
-## Events - -### UniversalReceiver - -:::note References - -- Specification details: [**LSP-1-UniversalReceiver**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-1-UniversalReceiver.md#universalreceiver) -- Solidity implementation: [`LSP1UniversalReceiverDelegateUP.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol) -- Event signature: `UniversalReceiver(address,uint256,bytes32,bytes,bytes)` -- Event topic hash: `0x9c3ba68eb5742b8e3961aea0afc7371a71bf433c8a67a831803b64c064a178c2` - -::: - -```solidity -event UniversalReceiver(address indexed from, uint256 indexed value, bytes32 indexed typeId, bytes receivedData, bytes returnedValue); -``` - -\*Address `from` called the `universalReceiver(...)` function while sending `value` LYX. Notification type (typeId): `typeId` - -- Data received: `receivedData`.\* - -Emitted when the [`universalReceiver`](#universalreceiver) function was called with a specific `typeId` and some `receivedData` s - -#### Parameters - -| Name | Type | Description | -| ---------------------- | :-------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `from` **`indexed`** | `address` | The address of the EOA or smart contract that called the {universalReceiver(...)} function. | -| `value` **`indexed`** | `uint256` | The amount sent to the {universalReceiver(...)} function. | -| `typeId` **`indexed`** | `bytes32` | A `bytes32` unique identifier (= _"hook"_)that describe the type of notification, information or transaction received by the contract. Can be related to a specific standard or a hook. | -| `receivedData` | `bytes` | Any arbitrary data that was sent to the {universalReceiver(...)} function. | -| `returnedValue` | `bytes` | The value returned by the {universalReceiver(...)} function. | - -
- ## Errors ### CannotRegisterEOAsAsAssets @@ -282,24 +251,3 @@ Reverts when EOA calls the [`universalReceiver(..)`](#universalreceiver) functio | `caller` | `address` | The address of the EOA |
- -### NativeTokensNotAccepted - -:::note References - -- Specification details: [**LSP-1-UniversalReceiver**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-1-UniversalReceiver.md#nativetokensnotaccepted) -- Solidity implementation: [`LSP1UniversalReceiverDelegateUP.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol) -- Error signature: `NativeTokensNotAccepted()` -- Error hash: `0x114b721a` - -::: - -```solidity -error NativeTokensNotAccepted(); -``` - -_Cannot send native tokens to [`universalReceiver(...)`](#universalreceiver) function of the delegated contract._ - -Reverts when the [`universalReceiver`](#universalreceiver) function in the LSP1 Universal Receiver Delegate contract is called while sending some native tokens along the call (`msg.value` different than `0`) - -
diff --git a/docs/contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.md b/docs/contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.md index ddedeaae36..3e50d0f829 100644 --- a/docs/contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.md +++ b/docs/contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.md @@ -56,14 +56,14 @@ See [`IERC165-supportsInterface`](#ierc165-supportsinterface).
-### universalReceiver +### universalReceiverDelegate :::note References -- Specification details: [**LSP-1-UniversalReceiver**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-1-UniversalReceiver.md#universalreceiver) +- Specification details: [**LSP-1-UniversalReceiver**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-1-UniversalReceiver.md#universalreceiverdelegate) - Solidity implementation: [`LSP1UniversalReceiverDelegateVault.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol) -- Function signature: `universalReceiver(bytes32,)` -- Function selector: `0x534e72c8` +- Function signature: `universalReceiverDelegate(address,uint256,bytes32,bytes)` +- Function selector: `0xa245bbda` ::: @@ -75,10 +75,12 @@ See [`IERC165-supportsInterface`](#ierc165-supportsinterface). ::: ```solidity -function universalReceiver( +function universalReceiverDelegate( + address notifier, + uint256, bytes32 typeId, bytes -) external payable returns (bytes); +) external nonpayable returns (bytes); ``` _Reacted on received notification with `typeId`._ @@ -95,10 +97,12 @@ Handles two cases: Writes the received [LSP-7-DigitalAsset] or [LSP-8-Identifiab #### Parameters -| Name | Type | Description | -| -------- | :-------: | ---------------------------------------------- | -| `typeId` | `bytes32` | Unique identifier for a specific notification. | -| `_1` | `bytes` | - | +| Name | Type | Description | +| ---------- | :-------: | ---------------------------------------------- | +| `notifier` | `address` | - | +| `_1` | `uint256` | - | +| `typeId` | `bytes32` | Unique identifier for a specific notification. | +| `_3` | `bytes` | - | #### Returns @@ -176,41 +180,6 @@ Calls `bytes4(keccak256(setDataBatch(bytes32[],bytes[])))` without checking for
-## Events - -### UniversalReceiver - -:::note References - -- Specification details: [**LSP-1-UniversalReceiver**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-1-UniversalReceiver.md#universalreceiver) -- Solidity implementation: [`LSP1UniversalReceiverDelegateVault.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol) -- Event signature: `UniversalReceiver(address,uint256,bytes32,bytes,bytes)` -- Event topic hash: `0x9c3ba68eb5742b8e3961aea0afc7371a71bf433c8a67a831803b64c064a178c2` - -::: - -```solidity -event UniversalReceiver(address indexed from, uint256 indexed value, bytes32 indexed typeId, bytes receivedData, bytes returnedValue); -``` - -\*Address `from` called the `universalReceiver(...)` function while sending `value` LYX. Notification type (typeId): `typeId` - -- Data received: `receivedData`.\* - -Emitted when the [`universalReceiver`](#universalreceiver) function was called with a specific `typeId` and some `receivedData` s - -#### Parameters - -| Name | Type | Description | -| ---------------------- | :-------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `from` **`indexed`** | `address` | The address of the EOA or smart contract that called the {universalReceiver(...)} function. | -| `value` **`indexed`** | `uint256` | The amount sent to the {universalReceiver(...)} function. | -| `typeId` **`indexed`** | `bytes32` | A `bytes32` unique identifier (= _"hook"_)that describe the type of notification, information or transaction received by the contract. Can be related to a specific standard or a hook. | -| `receivedData` | `bytes` | Any arbitrary data that was sent to the {universalReceiver(...)} function. | -| `returnedValue` | `bytes` | The value returned by the {universalReceiver(...)} function. | - -
- ## Errors ### CannotRegisterEOAsAsAssets @@ -239,24 +208,3 @@ Reverts when EOA calls the [`universalReceiver(..)`](#universalreceiver) functio | `caller` | `address` | The address of the EOA |
- -### NativeTokensNotAccepted - -:::note References - -- Specification details: [**LSP-1-UniversalReceiver**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-1-UniversalReceiver.md#nativetokensnotaccepted) -- Solidity implementation: [`LSP1UniversalReceiverDelegateVault.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol) -- Error signature: `NativeTokensNotAccepted()` -- Error hash: `0x114b721a` - -::: - -```solidity -error NativeTokensNotAccepted(); -``` - -_Cannot send native tokens to [`universalReceiver(...)`](#universalreceiver) function of the delegated contract._ - -Reverts when the [`universalReceiver`](#universalreceiver) function in the LSP1 Universal Receiver Delegate contract is called while sending some native tokens along the call (`msg.value` different than `0`) - -
diff --git a/docs/contracts/contracts/LSP20CallVerification/LSP20CallVerification.md b/docs/contracts/contracts/LSP20CallVerification/LSP20CallVerification.md index 1ecf08daa8..8a9a28acf6 100644 --- a/docs/contracts/contracts/LSP20CallVerification/LSP20CallVerification.md +++ b/docs/contracts/contracts/LSP20CallVerification/LSP20CallVerification.md @@ -16,7 +16,7 @@ > Implementation of a contract calling the verification functions according to LSP20 - Call Verification standard. -Module to be inherited used to verify the execution of functions according to a verifier address. Verification can happen before or after execution based on a magicValue. +Module to be inherited used to verify the execution of functions according to a verifier address. Verification can happen before or after execution based on a returnedStatus. ## Internal Methods @@ -33,8 +33,8 @@ function _verifyCall( ``` Calls [`lsp20VerifyCall`](#lsp20verifycall) function on the logicVerifier. -Reverts in case the value returned does not match the magic value (lsp20VerifyCall selector) -Returns whether a verification after the execution should happen based on the last byte of the magicValue +Reverts in case the value returned does not match the success value (lsp20VerifyCall selector) +Returns whether a verification after the execution should happen based on the last byte of the returnedStatus
@@ -48,7 +48,7 @@ function _verifyCallResult( ``` Calls [`lsp20VerifyCallResult`](#lsp20verifycallresult) function on the logicVerifier. -Reverts in case the value returned does not match the magic value (lsp20VerifyCallResult selector) +Reverts in case the value returned does not match the success value (lsp20VerifyCallResult selector)
diff --git a/docs/contracts/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.md b/docs/contracts/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.md index 99a49bc78d..f00f8248b4 100644 --- a/docs/contracts/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.md +++ b/docs/contracts/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.md @@ -506,6 +506,50 @@ Reverts when trying to edit the data key `LSP4TokenSymbol` after the digital ass
+### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-4-DigitalAssetMetadata**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-4-DigitalAssetMetadata.md#ownablecallernottheowner) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-4-DigitalAssetMetadata**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-4-DigitalAssetMetadata.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP4DigitalAssetMetadata.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
+ diff --git a/docs/contracts/contracts/LSP6KeyManager/LSP6KeyManager.md b/docs/contracts/contracts/LSP6KeyManager/LSP6KeyManager.md index 5248a1ed9f..d9d23d12d1 100644 --- a/docs/contracts/contracts/LSP6KeyManager/LSP6KeyManager.md +++ b/docs/contracts/contracts/LSP6KeyManager/LSP6KeyManager.md @@ -306,10 +306,10 @@ Get the nonce for a specific `from` address that can be used for signing relay t function isValidSignature( bytes32 dataHash, bytes signature -) external view returns (bytes4 magicValue); +) external view returns (bytes4 returnedStatus); ``` -Checks if a signature was signed by a controller that has the permission `SIGN`. If the signer is a controller with the permission `SIGN`, it will return the ERC1271 magic value. +Checks if a signature was signed by a controller that has the permission `SIGN`. If the signer is a controller with the permission `SIGN`, it will return the ERC1271 success value. #### Parameters @@ -320,9 +320,9 @@ Checks if a signature was signed by a controller that has the permission `SIGN`. #### Returns -| Name | Type | Description | -| ------------ | :------: | ---------------------------------------------------- | -| `magicValue` | `bytes4` | `0x1626ba7e` on success, or `0xffffffff` on failure. | +| Name | Type | Description | +| ---------------- | :------: | ---------------------------------------------------- | +| `returnedStatus` | `bytes4` | `0x1626ba7e` on success, or `0xffffffff` on failure. |
@@ -332,37 +332,39 @@ Checks if a signature was signed by a controller that has the permission `SIGN`. - Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-6-KeyManager.md#lsp20verifycall) - Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP6KeyManager/LSP6KeyManager.sol) -- Function signature: `lsp20VerifyCall(address,address,uint256,bytes)` -- Function selector: `0x1a2380e1` +- Function signature: `lsp20VerifyCall(address,address,address,uint256,bytes)` +- Function selector: `0xde928f14` ::: :::tip Hint -This function can call by any other address than the {`target`}. This allows to verify permissions in a _"read-only"_ manner. Anyone can call this function to verify if the `caller` has the right permissions to perform the abi-encoded function call `data` on the {`target`} contract (while sending `msgValue` alongside the call). If the permissions have been verified successfully and `caller` is authorized, one of the following two LSP20 magic value will be returned: +This function can call by any other address than the {`target`}. This allows to verify permissions in a _"read-only"_ manner. Anyone can call this function to verify if the `caller` has the right permissions to perform the abi-encoded function call `data` on the {`target`} contract (while sending `msgValue` alongside the call). If the permissions have been verified successfully and `caller` is authorized, one of the following two LSP20 success value will be returned: -- `0x1a238000`: LSP20 magic value **without** post verification (last byte is `0x00`). -- `0x1a238001`: LSP20 magic value **with** post-verification (last byte is `0x01`). +- `0x1a238000`: LSP20 success value **without** post verification (last byte is `0x00`). +- `0x1a238001`: LSP20 success value **with** post-verification (last byte is `0x01`). ::: ```solidity function lsp20VerifyCall( + address, address targetContract, address caller, uint256 msgValue, - bytes data + bytes callData ) external nonpayable returns (bytes4); ``` #### Parameters -| Name | Type | Description | -| ---------------- | :-------: | ----------------------------------------------------- | -| `targetContract` | `address` | - | -| `caller` | `address` | The address who called the function on the msg.sender | -| `msgValue` | `uint256` | - | -| `data` | `bytes` | - | +| Name | Type | Description | +| ---------------- | :-------: | ------------------------------------------------------------- | +| `_0` | `address` | - | +| `targetContract` | `address` | - | +| `caller` | `address` | The address who called the function on the `target` contract. | +| `msgValue` | `uint256` | - | +| `callData` | `bytes` | The calldata sent by the caller to the msg.sender | #### Returns @@ -376,10 +378,10 @@ function lsp20VerifyCall( :::note References -- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-6-KeyManager.md#,)) +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-6-KeyManager.md#lsp20verifycallresult) - Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP6KeyManager/LSP6KeyManager.sol) -- Function signature: `,)` -- Function selector: `0x9f47dbd3` +- Function signature: `lsp20VerifyCallResult(bytes32,bytes)` +- Function selector: `0xd3fc45d3` ::: @@ -1401,10 +1403,12 @@ Reverts when trying to call a function on the linked [`target`](#target), that i - `execute(uint256,address,uint256,bytes)` (ERC725X) -- `transferOwnership(address)` +- `transferOwnership(address)` (LSP14) - `acceptOwnership()` (LSP14) +- `renounceOwnership()` (LSP14) + #### Parameters | Name | Type | Description | diff --git a/docs/contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md b/docs/contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md index 062a1511e9..5100c4e80d 100644 --- a/docs/contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md +++ b/docs/contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md @@ -833,6 +833,16 @@ If the amount is zero then the operator is being revoked, otherwise the operator ### \_mint +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances. + +- {\_afterTokenTransfer} function will run after updating the balances, **but before notifying the recipient via LSP1**. + +::: + ```solidity function _mint( address to, @@ -865,6 +875,16 @@ Mints `amount` of tokens and transfers it to `to`. ### \_burn +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances. + +- {\_afterTokenTransfer} function will run after updating the balances, **but before notifying the sender via LSP1**. + +::: + :::tip Hint In dApps, you can know which address is burning tokens by listening for the `Transfer` event and filter with the zero address as `to`. @@ -879,7 +899,6 @@ Burns (= destroys) `amount` of tokens, decrease the `from` balance. This is done Both the sender and recipient will be notified of the token transfer through the LSP1 [`universalReceiver`](#universalreceiver) function, if they are contracts that support the LSP1 interface. Their `universalReceiver` function will receive all the parameters in the calldata packed encoded. -Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances.
@@ -923,6 +942,16 @@ Spend `amountToSpend` from the `operator`'s authorized on behalf of the `tokenOw ### \_transfer +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances. + +- {\_afterTokenTransfer} function will run after updating the balances, **but before notifying the sender/recipient via LSP1**. + +::: + ```solidity function _transfer( address from, @@ -938,7 +967,6 @@ of `to` by `+amount`. Both the sender and recipient will be notified of the token transfer through the LSP1 [`universalReceiver`](#universalreceiver) function, if they are contracts that support the LSP1 interface. Their `universalReceiver` function will receive all the parameters in the calldata packed encoded. -Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances.
@@ -966,7 +994,8 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r function _beforeTokenTransfer( address from, address to, - uint256 amount + uint256 amount, + bytes data ) internal nonpayable; ``` @@ -975,11 +1004,37 @@ Allows to run custom logic before updating balances and notifiying sender/recipi #### Parameters -| Name | Type | Description | -| -------- | :-------: | ------------------------------- | -| `from` | `address` | The sender address | -| `to` | `address` | The recipient address | -| `amount` | `uint256` | The amount of token to transfer | +| Name | Type | Description | +| -------- | :-------: | ------------------------------------ | +| `from` | `address` | The sender address | +| `to` | `address` | The recipient address | +| `amount` | `uint256` | The amount of token to transfer | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + uint256 amount, + bytes data +) internal nonpayable; +``` + +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient** by overriding this function. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------ | +| `from` | `address` | The sender address | +| `to` | `address` | The recipient address | +| `amount` | `uint256` | The amount of token to transfer | +| `data` | `bytes` | The data sent alongside the transfer |
@@ -1675,6 +1730,50 @@ reverts when there is no extension for the function selector being called with
+### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
+ diff --git a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md index 2a26527317..f0c7d2b967 100644 --- a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md +++ b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md @@ -858,6 +858,16 @@ If the amount is zero then the operator is being revoked, otherwise the operator ### \_mint +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances. + +- {\_afterTokenTransfer} function will run after updating the balances, **but before notifying the recipient via LSP1**. + +::: + ```solidity function _mint( address to, @@ -890,6 +900,16 @@ Mints `amount` of tokens and transfers it to `to`. ### \_burn +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances. + +- {\_afterTokenTransfer} function will run after updating the balances, **but before notifying the sender via LSP1**. + +::: + :::tip Hint In dApps, you can know which address is burning tokens by listening for the `Transfer` event and filter with the zero address as `to`. @@ -904,7 +924,6 @@ Burns (= destroys) `amount` of tokens, decrease the `from` balance. This is done Both the sender and recipient will be notified of the token transfer through the LSP1 [`universalReceiver`](#universalreceiver) function, if they are contracts that support the LSP1 interface. Their `universalReceiver` function will receive all the parameters in the calldata packed encoded. -Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances.
@@ -948,6 +967,16 @@ Spend `amountToSpend` from the `operator`'s authorized on behalf of the `tokenOw ### \_transfer +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances. + +- {\_afterTokenTransfer} function will run after updating the balances, **but before notifying the sender/recipient via LSP1**. + +::: + ```solidity function _transfer( address from, @@ -963,7 +992,6 @@ of `to` by `+amount`. Both the sender and recipient will be notified of the token transfer through the LSP1 [`universalReceiver`](#universalreceiver) function, if they are contracts that support the LSP1 interface. Their `universalReceiver` function will receive all the parameters in the calldata packed encoded. -Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances.
@@ -991,7 +1019,8 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r function _beforeTokenTransfer( address from, address to, - uint256 amount + uint256 amount, + bytes data ) internal nonpayable; ``` @@ -1000,11 +1029,37 @@ Allows to run custom logic before updating balances and notifiying sender/recipi #### Parameters -| Name | Type | Description | -| -------- | :-------: | ------------------------------- | -| `from` | `address` | The sender address | -| `to` | `address` | The recipient address | -| `amount` | `uint256` | The amount of token to transfer | +| Name | Type | Description | +| -------- | :-------: | ------------------------------------ | +| `from` | `address` | The sender address | +| `to` | `address` | The recipient address | +| `amount` | `uint256` | The amount of token to transfer | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + uint256 amount, + bytes data +) internal nonpayable; +``` + +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient** by overriding this function. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------ | +| `from` | `address` | The sender address | +| `to` | `address` | The recipient address | +| `amount` | `uint256` | The amount of token to transfer | +| `data` | `bytes` | The data sent alongside the transfer |
@@ -1699,3 +1754,47 @@ reverts when there is no extension for the function selector being called with | `functionSelector` | `bytes4` | - |
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md index cc2501eae4..028cf0a491 100644 --- a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md +++ b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md @@ -874,6 +874,16 @@ after `amount` of tokens have been minted. ### \_burn +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances. + +- {\_afterTokenTransfer} function will run after updating the balances, **but before notifying the sender via LSP1**. + +::: + :::tip Hint In dApps, you can know which address is burning tokens by listening for the `Transfer` event and filter with the zero address as `to`. @@ -888,7 +898,6 @@ Burns (= destroys) `amount` of tokens, decrease the `from` balance. This is done Both the sender and recipient will be notified of the token transfer through the LSP1 [`universalReceiver`](#universalreceiver) function, if they are contracts that support the LSP1 interface. Their `universalReceiver` function will receive all the parameters in the calldata packed encoded. -Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances.
@@ -932,6 +941,16 @@ Spend `amountToSpend` from the `operator`'s authorized on behalf of the `tokenOw ### \_transfer +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances. + +- {\_afterTokenTransfer} function will run after updating the balances, **but before notifying the sender/recipient via LSP1**. + +::: + ```solidity function _transfer( address from, @@ -947,7 +966,6 @@ of `to` by `+amount`. Both the sender and recipient will be notified of the token transfer through the LSP1 [`universalReceiver`](#universalreceiver) function, if they are contracts that support the LSP1 interface. Their `universalReceiver` function will receive all the parameters in the calldata packed encoded. -Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances.
@@ -975,7 +993,8 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r function _beforeTokenTransfer( address from, address to, - uint256 amount + uint256 amount, + bytes data ) internal nonpayable; ``` @@ -984,11 +1003,37 @@ Allows to run custom logic before updating balances and notifiying sender/recipi #### Parameters -| Name | Type | Description | -| -------- | :-------: | ------------------------------- | -| `from` | `address` | The sender address | -| `to` | `address` | The recipient address | -| `amount` | `uint256` | The amount of token to transfer | +| Name | Type | Description | +| -------- | :-------: | ------------------------------------ | +| `from` | `address` | The sender address | +| `to` | `address` | The recipient address | +| `amount` | `uint256` | The amount of token to transfer | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + uint256 amount, + bytes data +) internal nonpayable; +``` + +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient** by overriding this function. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------ | +| `from` | `address` | The sender address | +| `to` | `address` | The recipient address | +| `amount` | `uint256` | The amount of token to transfer | +| `data` | `bytes` | The data sent alongside the transfer |
@@ -1725,3 +1770,47 @@ reverts when there is no extension for the function selector being called with | `functionSelector` | `bytes4` | - |
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md index b5892952b0..3792dc3990 100644 --- a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md +++ b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md @@ -93,18 +93,20 @@ function allowance( ) external view returns (uint256); ``` +Function to get operator allowance allowed to spend on behalf of `tokenOwner` from the ERC20 standard interface. + #### Parameters -| Name | Type | Description | -| ------------ | :-------: | ----------- | -| `tokenOwner` | `address` | - | -| `operator` | `address` | - | +| Name | Type | Description | +| ------------ | :-------: | ---------------------------------------- | +| `tokenOwner` | `address` | The address of the token owner | +| `operator` | `address` | The address approved by the `tokenOwner` | #### Returns -| Name | Type | Description | -| ---- | :-------: | ----------- | -| `0` | `uint256` | - | +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------------- | +| `0` | `uint256` | The amount `operator` is approved by `tokenOwner` |
@@ -126,18 +128,20 @@ function approve( ) external nonpayable returns (bool); ``` +Approval function from th ERC20 standard interface. + #### Parameters -| Name | Type | Description | -| ---------- | :-------: | ----------- | -| `operator` | `address` | - | -| `amount` | `uint256` | - | +| Name | Type | Description | +| ---------- | :-------: | ----------------------------------- | +| `operator` | `address` | The address to approve for `amount` | +| `amount` | `uint256` | The amount to approve. | #### Returns -| Name | Type | Description | -| ---- | :----: | ----------- | -| `0` | `bool` | - | +| Name | Type | Description | +| ---- | :----: | ------------------------------ | +| `0` | `bool` | `true` on successful approval. |
@@ -496,7 +500,7 @@ Atomically increases the allowance granted to `operator` by the caller. This is function name() external view returns (string); ``` -Returns the name of the token. +Returns the name of the token. For compatibility with clients & tools that expect ERC20. #### Returns @@ -725,7 +729,7 @@ Returns true if this contract implements the interface defined by `interfaceId`. function symbol() external view returns (string); ``` -Returns the symbol of the token, usually a shorter version of the name. +Returns the symbol of the token, usually a shorter version of the name. For compatibility with clients & tools that expect ERC20. #### Returns @@ -819,18 +823,20 @@ function transfer( ) external nonpayable returns (bool); ``` +Transfer function from the ERC20 standard interface. + #### Parameters -| Name | Type | Description | -| -------- | :-------: | ----------- | -| `to` | `address` | - | -| `amount` | `uint256` | - | +| Name | Type | Description | +| -------- | :-------: | --------------------------------- | +| `to` | `address` | The address receiving tokens. | +| `amount` | `uint256` | The amount of tokens to transfer. | #### Returns -| Name | Type | Description | -| ---- | :----: | ----------- | -| `0` | `bool` | - | +| Name | Type | Description | +| ---- | :----: | ------------------------------ | +| `0` | `bool` | `true` on successful transfer. |
@@ -894,19 +900,21 @@ function transferFrom( ) external nonpayable returns (bool); ``` +Transfer functions for operators from the ERC20 standard interface. + #### Parameters -| Name | Type | Description | -| -------- | :-------: | ----------- | -| `from` | `address` | - | -| `to` | `address` | - | -| `amount` | `uint256` | - | +| Name | Type | Description | +| -------- | :-------: | --------------------------------- | +| `from` | `address` | The address sending tokens. | +| `to` | `address` | The address receiving tokens. | +| `amount` | `uint256` | The amount of tokens to transfer. | #### Returns -| Name | Type | Description | -| ---- | :----: | ----------- | -| `0` | `bool` | - | +| Name | Type | Description | +| ---- | :----: | ------------------------------ | +| `0` | `bool` | `true` on successful transfer. |
@@ -992,9 +1000,11 @@ mapping(bytes32 => bytes) _store ### \_setData ```solidity -function _setData(bytes32 key, bytes value) internal nonpayable; +function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` +Save gas by emitting the [`DataChanged`](#datachanged) event with only the first 256 bytes of dataValue +
### \_updateOperator @@ -1073,7 +1083,8 @@ function _transfer( function _beforeTokenTransfer( address from, address to, - uint256 amount + uint256 amount, + bytes data ) internal nonpayable; ``` @@ -1082,11 +1093,37 @@ Allows to run custom logic before updating balances and notifiying sender/recipi #### Parameters -| Name | Type | Description | -| -------- | :-------: | ------------------------------- | -| `from` | `address` | The sender address | -| `to` | `address` | The recipient address | -| `amount` | `uint256` | The amount of token to transfer | +| Name | Type | Description | +| -------- | :-------: | ------------------------------------ | +| `from` | `address` | The sender address | +| `to` | `address` | The recipient address | +| `amount` | `uint256` | The amount of token to transfer | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + uint256 amount, + bytes data +) internal nonpayable; +``` + +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient** by overriding this function. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------ | +| `from` | `address` | The sender address | +| `to` | `address` | The recipient address | +| `amount` | `uint256` | The amount of token to transfer | +| `data` | `bytes` | The data sent alongside the transfer |
@@ -1235,11 +1272,11 @@ Emitted when the allowance of a `spender` for an `owner` is set by a call to [`a #### Parameters -| Name | Type | Description | -| ----------------------- | :-------: | --------------------------------------------------------- | -| `owner` **`indexed`** | `address` | The account giving approval | -| `spender` **`indexed`** | `address` | The account receiving approval | -| `value` | `uint256` | The amount of tokens `spender` has access to from `owner` | +| Name | Type | Description | +| ----------------------- | :-------: | ----------- | +| `owner` **`indexed`** | `address` | - | +| `spender` **`indexed`** | `address` | - | +| `value` | `uint256` | - |
@@ -1356,24 +1393,27 @@ Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [` - Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#transfer) - Solidity implementation: [`LSP7CompatibleERC20.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol) -- Event signature: `Transfer(address,address,uint256)` -- Event topic hash: `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` +- Event signature: `Transfer(address,address,address,uint256,bool,bytes)` +- Event topic hash: `0x3997e418d2cef0b3b0e907b1e39605c3f7d32dbd061e82ea5b4a770d46a160a6` ::: ```solidity -event Transfer(address indexed from, address indexed to, uint256 value); +event Transfer(address indexed operator, address indexed from, address indexed to, uint256 amount, bool force, bytes data); ``` -Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero. +Emitted when the `from` transferred successfully `amount` of tokens to `to`. #### Parameters -| Name | Type | Description | -| -------------------- | :-------: | -------------------------------- | -| `from` **`indexed`** | `address` | The sending address | -| `to` **`indexed`** | `address` | The receiving address | -| `value` | `uint256` | The amount of tokens transfered. | +| Name | Type | Description | +| ------------------------ | :-------: | ---------------------------------------------------------------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address of the operator that executed the transfer. | +| `from` **`indexed`** | `address` | The address which tokens were sent from (balance decreased by `-amount`). | +| `to` **`indexed`** | `address` | The address that received the tokens (balance increased by `+amount`). | +| `amount` | `uint256` | The amount of tokens transferred. | +| `force` | `bool` | if the transferred enforced the `to` recipient address to be a contract that implements the LSP1 standard or not. | +| `data` | `bytes` | Any additional data included by the caller during the transfer, and sent in the LSP1 hooks to the `from` and `to` addresses. |
@@ -1383,27 +1423,24 @@ Emitted when `value` tokens are moved from one account (`from`) to another (`to` - Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#transfer) - Solidity implementation: [`LSP7CompatibleERC20.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol) -- Event signature: `Transfer(address,address,address,uint256,bool,bytes)` -- Event topic hash: `0x3997e418d2cef0b3b0e907b1e39605c3f7d32dbd061e82ea5b4a770d46a160a6` +- Event signature: `Transfer(address,address,uint256)` +- Event topic hash: `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` ::: ```solidity -event Transfer(address indexed operator, address indexed from, address indexed to, uint256 amount, bool force, bytes data); +event Transfer(address indexed from, address indexed to, uint256 value); ``` -Emitted when the `from` transferred successfully `amount` of tokens to `to`. +Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero. #### Parameters -| Name | Type | Description | -| ------------------------ | :-------: | ---------------------------------------------------------------------------------------------------------------------------- | -| `operator` **`indexed`** | `address` | The address of the operator that executed the transfer. | -| `from` **`indexed`** | `address` | The address which tokens were sent from (balance decreased by `-amount`). | -| `to` **`indexed`** | `address` | The address that received the tokens (balance increased by `+amount`). | -| `amount` | `uint256` | The amount of tokens transferred. | -| `force` | `bool` | if the transferred enforced the `to` recipient address to be a contract that implements the LSP1 standard or not. | -| `data` | `bytes` | Any additional data included by the caller during the transfer, and sent in the LSP1 hooks to the `from` and `to` addresses. | +| Name | Type | Description | +| -------------------- | :-------: | ----------- | +| `from` **`indexed`** | `address` | - | +| `to` **`indexed`** | `address` | - | +| `value` | `uint256` | - |
@@ -1835,3 +1872,47 @@ reverts when there is no extension for the function selector being called with | `functionSelector` | `bytes4` | - |
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP7CompatibleERC20.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP7CompatibleERC20.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md b/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md index 8a5d97d562..63ac7291f1 100644 --- a/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md +++ b/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md @@ -94,18 +94,20 @@ function allowance( ) external view returns (uint256); ``` +Function to get operator allowance allowed to spend on behalf of `tokenOwner` from the ERC20 standard interface. + #### Parameters -| Name | Type | Description | -| ------------ | :-------: | ----------- | -| `tokenOwner` | `address` | - | -| `operator` | `address` | - | +| Name | Type | Description | +| ------------ | :-------: | ---------------------------------------- | +| `tokenOwner` | `address` | The address of the token owner | +| `operator` | `address` | The address approved by the `tokenOwner` | #### Returns -| Name | Type | Description | -| ---- | :-------: | ----------- | -| `0` | `uint256` | - | +| Name | Type | Description | +| ---- | :-------: | ------------------------------------------------- | +| `0` | `uint256` | The amount `operator` is approved by `tokenOwner` |
@@ -127,18 +129,20 @@ function approve( ) external nonpayable returns (bool); ``` +Approval function from th ERC20 standard interface. + #### Parameters -| Name | Type | Description | -| ---------- | :-------: | ----------- | -| `operator` | `address` | - | -| `amount` | `uint256` | - | +| Name | Type | Description | +| ---------- | :-------: | ----------------------------------- | +| `operator` | `address` | The address to approve for `amount` | +| `amount` | `uint256` | The amount to approve. | #### Returns -| Name | Type | Description | -| ---- | :----: | ----------- | -| `0` | `bool` | - | +| Name | Type | Description | +| ---- | :----: | ------------------------------ | +| `0` | `bool` | `true` on successful approval. |
@@ -530,7 +534,7 @@ Public [`_mint`](#_mint) function only callable by the [`owner`](#owner). function name() external view returns (string); ``` -Returns the name of the token. +Returns the name of the token. For compatibility with clients & tools that expect ERC20. #### Returns @@ -759,7 +763,7 @@ Returns true if this contract implements the interface defined by `interfaceId`. function symbol() external view returns (string); ``` -Returns the symbol of the token, usually a shorter version of the name. +Returns the symbol of the token, usually a shorter version of the name. For compatibility with clients & tools that expect ERC20. #### Returns @@ -853,18 +857,20 @@ function transfer( ) external nonpayable returns (bool); ``` +Transfer function from the ERC20 standard interface. + #### Parameters -| Name | Type | Description | -| -------- | :-------: | ----------- | -| `to` | `address` | - | -| `amount` | `uint256` | - | +| Name | Type | Description | +| -------- | :-------: | --------------------------------- | +| `to` | `address` | The address receiving tokens. | +| `amount` | `uint256` | The amount of tokens to transfer. | #### Returns -| Name | Type | Description | -| ---- | :----: | ----------- | -| `0` | `bool` | - | +| Name | Type | Description | +| ---- | :----: | ------------------------------ | +| `0` | `bool` | `true` on successful transfer. |
@@ -928,19 +934,21 @@ function transferFrom( ) external nonpayable returns (bool); ``` +Transfer functions for operators from the ERC20 standard interface. + #### Parameters -| Name | Type | Description | -| -------- | :-------: | ----------- | -| `from` | `address` | - | -| `to` | `address` | - | -| `amount` | `uint256` | - | +| Name | Type | Description | +| -------- | :-------: | --------------------------------- | +| `from` | `address` | The address sending tokens. | +| `to` | `address` | The address receiving tokens. | +| `amount` | `uint256` | The amount of tokens to transfer. | #### Returns -| Name | Type | Description | -| ---- | :----: | ----------- | -| `0` | `bool` | - | +| Name | Type | Description | +| ---- | :----: | ------------------------------ | +| `0` | `bool` | `true` on successful transfer. |
@@ -1026,9 +1034,11 @@ mapping(bytes32 => bytes) _store ### \_setData ```solidity -function _setData(bytes32 key, bytes value) internal nonpayable; +function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` +Save gas by emitting the [`DataChanged`](#datachanged) event with only the first 256 bytes of dataValue +
### \_updateOperator @@ -1107,7 +1117,8 @@ function _transfer( function _beforeTokenTransfer( address from, address to, - uint256 amount + uint256 amount, + bytes data ) internal nonpayable; ``` @@ -1116,11 +1127,37 @@ Allows to run custom logic before updating balances and notifiying sender/recipi #### Parameters -| Name | Type | Description | -| -------- | :-------: | ------------------------------- | -| `from` | `address` | The sender address | -| `to` | `address` | The recipient address | -| `amount` | `uint256` | The amount of token to transfer | +| Name | Type | Description | +| -------- | :-------: | ------------------------------------ | +| `from` | `address` | The sender address | +| `to` | `address` | The recipient address | +| `amount` | `uint256` | The amount of token to transfer | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + uint256 amount, + bytes data +) internal nonpayable; +``` + +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient** by overriding this function. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------ | +| `from` | `address` | The sender address | +| `to` | `address` | The recipient address | +| `amount` | `uint256` | The amount of token to transfer | +| `data` | `bytes` | The data sent alongside the transfer |
@@ -1269,11 +1306,11 @@ Emitted when the allowance of a `spender` for an `owner` is set by a call to [`a #### Parameters -| Name | Type | Description | -| ----------------------- | :-------: | --------------------------------------------------------- | -| `owner` **`indexed`** | `address` | The account giving approval | -| `spender` **`indexed`** | `address` | The account receiving approval | -| `value` | `uint256` | The amount of tokens `spender` has access to from `owner` | +| Name | Type | Description | +| ----------------------- | :-------: | ----------- | +| `owner` **`indexed`** | `address` | - | +| `spender` **`indexed`** | `address` | - | +| `value` | `uint256` | - |
@@ -1390,24 +1427,27 @@ Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [` - Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#transfer) - Solidity implementation: [`LSP7CompatibleERC20Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol) -- Event signature: `Transfer(address,address,uint256)` -- Event topic hash: `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` +- Event signature: `Transfer(address,address,address,uint256,bool,bytes)` +- Event topic hash: `0x3997e418d2cef0b3b0e907b1e39605c3f7d32dbd061e82ea5b4a770d46a160a6` ::: ```solidity -event Transfer(address indexed from, address indexed to, uint256 value); +event Transfer(address indexed operator, address indexed from, address indexed to, uint256 amount, bool force, bytes data); ``` -Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero. +Emitted when the `from` transferred successfully `amount` of tokens to `to`. #### Parameters -| Name | Type | Description | -| -------------------- | :-------: | -------------------------------- | -| `from` **`indexed`** | `address` | The sending address | -| `to` **`indexed`** | `address` | The receiving address | -| `value` | `uint256` | The amount of tokens transfered. | +| Name | Type | Description | +| ------------------------ | :-------: | ---------------------------------------------------------------------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address of the operator that executed the transfer. | +| `from` **`indexed`** | `address` | The address which tokens were sent from (balance decreased by `-amount`). | +| `to` **`indexed`** | `address` | The address that received the tokens (balance increased by `+amount`). | +| `amount` | `uint256` | The amount of tokens transferred. | +| `force` | `bool` | if the transferred enforced the `to` recipient address to be a contract that implements the LSP1 standard or not. | +| `data` | `bytes` | Any additional data included by the caller during the transfer, and sent in the LSP1 hooks to the `from` and `to` addresses. |
@@ -1417,27 +1457,24 @@ Emitted when `value` tokens are moved from one account (`from`) to another (`to` - Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#transfer) - Solidity implementation: [`LSP7CompatibleERC20Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol) -- Event signature: `Transfer(address,address,address,uint256,bool,bytes)` -- Event topic hash: `0x3997e418d2cef0b3b0e907b1e39605c3f7d32dbd061e82ea5b4a770d46a160a6` +- Event signature: `Transfer(address,address,uint256)` +- Event topic hash: `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` ::: ```solidity -event Transfer(address indexed operator, address indexed from, address indexed to, uint256 amount, bool force, bytes data); +event Transfer(address indexed from, address indexed to, uint256 value); ``` -Emitted when the `from` transferred successfully `amount` of tokens to `to`. +Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero. #### Parameters -| Name | Type | Description | -| ------------------------ | :-------: | ---------------------------------------------------------------------------------------------------------------------------- | -| `operator` **`indexed`** | `address` | The address of the operator that executed the transfer. | -| `from` **`indexed`** | `address` | The address which tokens were sent from (balance decreased by `-amount`). | -| `to` **`indexed`** | `address` | The address that received the tokens (balance increased by `+amount`). | -| `amount` | `uint256` | The amount of tokens transferred. | -| `force` | `bool` | if the transferred enforced the `to` recipient address to be a contract that implements the LSP1 standard or not. | -| `data` | `bytes` | Any additional data included by the caller during the transfer, and sent in the LSP1 hooks to the `from` and `to` addresses. | +| Name | Type | Description | +| -------------------- | :-------: | ----------- | +| `from` **`indexed`** | `address` | - | +| `to` **`indexed`** | `address` | - | +| `value` | `uint256` | - |
@@ -1869,3 +1906,47 @@ reverts when there is no extension for the function selector being called with | `functionSelector` | `bytes4` | - |
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP7CompatibleERC20Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP7CompatibleERC20Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md b/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md index b9de110e43..a178eff9e9 100644 --- a/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md +++ b/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md @@ -895,6 +895,16 @@ If the amount is zero then the operator is being revoked, otherwise the operator ### \_mint +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances. + +- {\_afterTokenTransfer} function will run after updating the balances, **but before notifying the recipient via LSP1**. + +::: + ```solidity function _mint( address to, @@ -927,6 +937,16 @@ Mints `amount` of tokens and transfers it to `to`. ### \_burn +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances. + +- {\_afterTokenTransfer} function will run after updating the balances, **but before notifying the sender via LSP1**. + +::: + :::tip Hint In dApps, you can know which address is burning tokens by listening for the `Transfer` event and filter with the zero address as `to`. @@ -941,7 +961,6 @@ Burns (= destroys) `amount` of tokens, decrease the `from` balance. This is done Both the sender and recipient will be notified of the token transfer through the LSP1 [`universalReceiver`](#universalreceiver) function, if they are contracts that support the LSP1 interface. Their `universalReceiver` function will receive all the parameters in the calldata packed encoded. -Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances.
@@ -985,6 +1004,16 @@ Spend `amountToSpend` from the `operator`'s authorized on behalf of the `tokenOw ### \_transfer +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances. + +- {\_afterTokenTransfer} function will run after updating the balances, **but before notifying the sender/recipient via LSP1**. + +::: + ```solidity function _transfer( address from, @@ -1000,7 +1029,6 @@ of `to` by `+amount`. Both the sender and recipient will be notified of the token transfer through the LSP1 [`universalReceiver`](#universalreceiver) function, if they are contracts that support the LSP1 interface. Their `universalReceiver` function will receive all the parameters in the calldata packed encoded. -Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before updating the balances.
@@ -1028,7 +1056,8 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r function _beforeTokenTransfer( address from, address to, - uint256 amount + uint256 amount, + bytes data ) internal nonpayable; ``` @@ -1037,11 +1066,37 @@ Allows to run custom logic before updating balances and notifiying sender/recipi #### Parameters -| Name | Type | Description | -| -------- | :-------: | ------------------------------- | -| `from` | `address` | The sender address | -| `to` | `address` | The recipient address | -| `amount` | `uint256` | The amount of token to transfer | +| Name | Type | Description | +| -------- | :-------: | ------------------------------------ | +| `from` | `address` | The sender address | +| `to` | `address` | The recipient address | +| `amount` | `uint256` | The amount of token to transfer | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + uint256 amount, + bytes data +) internal nonpayable; +``` + +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient** by overriding this function. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------ | +| `from` | `address` | The sender address | +| `to` | `address` | The recipient address | +| `amount` | `uint256` | The amount of token to transfer | +| `data` | `bytes` | The data sent alongside the transfer |
@@ -1736,3 +1791,47 @@ reverts when there is no extension for the function selector being called with | `functionSelector` | `bytes4` | - |
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md index df5fc75593..a2f2b60a54 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md @@ -803,6 +803,16 @@ When `tokenId` does not exist then revert with an error. ### \_mint +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances and ownership of `tokenId`s. + +- {\_afterTokenTransfer} function will run after updating the balances and ownership of `tokenId`s, **but before notifying the recipient via LSP1**. + +::: + ```solidity function _mint( address to, @@ -835,6 +845,16 @@ Create `tokenId` by minting it and transfers it to `to`. ### \_burn +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances and ownership of `tokenId`s. + +- {\_afterTokenTransfer} function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender via LSP1**. + +::: + :::tip Hint In dApps, you can know which addresses are burning tokens by listening for the `Transfer` event and filter with the zero address as `to`. @@ -850,7 +870,6 @@ This will also clear all the operators allowed to transfer the `tokenId`. The owner of the `tokenId` will be notified about the `tokenId` being transferred through its LSP1 [`universalReceiver`](#universalreceiver) function, if it is a contract that supports the LSP1 interface. Its [`universalReceiver`](#universalreceiver) function will receive all the parameters in the calldata packed encoded. -Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before burning `tokenId` and updating the balances.
@@ -871,6 +890,16 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r ### \_transfer +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances and ownership of `tokenId`s. + +- {\_afterTokenTransfer} function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender/recipient via LSP1**. + +::: + :::danger This internal function does not check if the sender is authorized or not to operate on the `tokenId`. @@ -891,7 +920,6 @@ Change the owner of the `tokenId` from `from` to `to`. Both the sender and recipient will be notified of the `tokenId` being transferred through their LSP1 [`universalReceiver`](#universalreceiver) function, if they are contracts that support the LSP1 interface. Their `universalReceiver` function will receive all the parameters in the calldata packed encoded. -Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before changing the owner of `tokenId`.
@@ -919,13 +947,38 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r function _beforeTokenTransfer( address from, address to, - bytes32 tokenId + bytes32 tokenId, + bytes data ) internal nonpayable; ``` Hook that is called before any token transfer, including minting and burning. +Allows to run custom logic before updating balances and notifiying sender/recipient by overriding this function. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------- | +| `from` | `address` | The sender address | +| `to` | `address` | @param tokenId The tokenId to transfer | +| `tokenId` | `bytes32` | The tokenId to transfer | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + bytes32 tokenId, + bytes data +) internal nonpayable; +``` -- Allows to run custom logic before updating balances and notifiying sender/recipient by overriding this function. +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient via LSP1** by overriding this function. #### Parameters @@ -934,6 +987,7 @@ Hook that is called before any token transfer, including minting and burning. | `from` | `address` | The sender address | | `to` | `address` | @param tokenId The tokenId to transfer | | `tokenId` | `bytes32` | The tokenId to transfer | +| `data` | `bytes` | The data sent alongside the transfer |
@@ -1670,6 +1724,50 @@ reverts when there is no extension for the function selector being called with
+### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
+ diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md index acfdb68cd9..181bbd5b7f 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md @@ -829,6 +829,16 @@ When `tokenId` does not exist then revert with an error. ### \_mint +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances and ownership of `tokenId`s. + +- {\_afterTokenTransfer} function will run after updating the balances and ownership of `tokenId`s, **but before notifying the recipient via LSP1**. + +::: + ```solidity function _mint( address to, @@ -861,6 +871,16 @@ Create `tokenId` by minting it and transfers it to `to`. ### \_burn +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances and ownership of `tokenId`s. + +- {\_afterTokenTransfer} function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender via LSP1**. + +::: + :::tip Hint In dApps, you can know which addresses are burning tokens by listening for the `Transfer` event and filter with the zero address as `to`. @@ -876,7 +896,6 @@ This will also clear all the operators allowed to transfer the `tokenId`. The owner of the `tokenId` will be notified about the `tokenId` being transferred through its LSP1 [`universalReceiver`](#universalreceiver) function, if it is a contract that supports the LSP1 interface. Its [`universalReceiver`](#universalreceiver) function will receive all the parameters in the calldata packed encoded. -Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before burning `tokenId` and updating the balances.
@@ -897,6 +916,16 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r ### \_transfer +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances and ownership of `tokenId`s. + +- {\_afterTokenTransfer} function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender/recipient via LSP1**. + +::: + :::danger This internal function does not check if the sender is authorized or not to operate on the `tokenId`. @@ -917,7 +946,6 @@ Change the owner of the `tokenId` from `from` to `to`. Both the sender and recipient will be notified of the `tokenId` being transferred through their LSP1 [`universalReceiver`](#universalreceiver) function, if they are contracts that support the LSP1 interface. Their `universalReceiver` function will receive all the parameters in the calldata packed encoded. -Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before changing the owner of `tokenId`.
@@ -945,13 +973,38 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r function _beforeTokenTransfer( address from, address to, - bytes32 tokenId + bytes32 tokenId, + bytes data ) internal nonpayable; ``` Hook that is called before any token transfer, including minting and burning. +Allows to run custom logic before updating balances and notifiying sender/recipient by overriding this function. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------- | +| `from` | `address` | The sender address | +| `to` | `address` | @param tokenId The tokenId to transfer | +| `tokenId` | `bytes32` | The tokenId to transfer | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + bytes32 tokenId, + bytes data +) internal nonpayable; +``` -- Allows to run custom logic before updating balances and notifiying sender/recipient by overriding this function. +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient via LSP1** by overriding this function. #### Parameters @@ -960,6 +1013,7 @@ Hook that is called before any token transfer, including minting and burning. | `from` | `address` | The sender address | | `to` | `address` | @param tokenId The tokenId to transfer | | `tokenId` | `bytes32` | The tokenId to transfer | +| `data` | `bytes` | The data sent alongside the transfer |
@@ -1695,3 +1749,47 @@ reverts when there is no extension for the function selector being called with | `functionSelector` | `bytes4` | - |
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md index 5946dd474a..53a5b5f124 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md @@ -845,6 +845,16 @@ after a new `tokenId` has of tokens have been minted. ### \_burn +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances and ownership of `tokenId`s. + +- {\_afterTokenTransfer} function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender via LSP1**. + +::: + :::tip Hint In dApps, you can know which addresses are burning tokens by listening for the `Transfer` event and filter with the zero address as `to`. @@ -860,7 +870,6 @@ This will also clear all the operators allowed to transfer the `tokenId`. The owner of the `tokenId` will be notified about the `tokenId` being transferred through its LSP1 [`universalReceiver`](#universalreceiver) function, if it is a contract that supports the LSP1 interface. Its [`universalReceiver`](#universalreceiver) function will receive all the parameters in the calldata packed encoded. -Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before burning `tokenId` and updating the balances.
@@ -881,6 +890,16 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r ### \_transfer +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances and ownership of `tokenId`s. + +- {\_afterTokenTransfer} function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender/recipient via LSP1**. + +::: + :::danger This internal function does not check if the sender is authorized or not to operate on the `tokenId`. @@ -901,7 +920,6 @@ Change the owner of the `tokenId` from `from` to `to`. Both the sender and recipient will be notified of the `tokenId` being transferred through their LSP1 [`universalReceiver`](#universalreceiver) function, if they are contracts that support the LSP1 interface. Their `universalReceiver` function will receive all the parameters in the calldata packed encoded. -Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before changing the owner of `tokenId`.
@@ -929,13 +947,38 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r function _beforeTokenTransfer( address from, address to, - bytes32 tokenId + bytes32 tokenId, + bytes data ) internal nonpayable; ``` Hook that is called before any token transfer, including minting and burning. +Allows to run custom logic before updating balances and notifiying sender/recipient by overriding this function. -- Allows to run custom logic before updating balances and notifiying sender/recipient by overriding this function. +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------- | +| `from` | `address` | The sender address | +| `to` | `address` | @param tokenId The tokenId to transfer | +| `tokenId` | `bytes32` | The tokenId to transfer | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + bytes32 tokenId, + bytes data +) internal nonpayable; +``` + +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient via LSP1** by overriding this function. #### Parameters @@ -944,6 +987,7 @@ Hook that is called before any token transfer, including minting and burning. | `from` | `address` | The sender address | | `to` | `address` | @param tokenId The tokenId to transfer | | `tokenId` | `bytes32` | The tokenId to transfer | +| `data` | `bytes` | The data sent alongside the transfer |
@@ -1721,3 +1765,47 @@ reverts when there is no extension for the function selector being called with | `functionSelector` | `bytes4` | - |
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.md index d1693dda6e..d821242109 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.md @@ -90,7 +90,7 @@ Reverts whenever someone tries to send native tokens to a LSP8 contract. function approve(address operator, uint256 tokenId) external nonpayable; ``` -_Calling `approve` function on `ILSP8CompatibleERC721` contract. Approving operator at address `operator` to transfer tokenId `tokenId` on behalf of its owner._ +_Calling `approve` function to approve operator at address `operator` to transfer tokenId `tokenId` on behalf of its owner._ Approval function compatible with ERC721 `approve(address,uint256)`. @@ -324,18 +324,22 @@ function isApprovedForAll( ) external view returns (bool); ``` +_Checking if address `operator` is approved to transfer any tokenId owned by address `owner`._ + +Compatible with ERC721 isApprovedForAll. + #### Parameters -| Name | Type | Description | -| ------------ | :-------: | ----------- | -| `tokenOwner` | `address` | - | -| `operator` | `address` | - | +| Name | Type | Description | +| ------------ | :-------: | -------------------------------- | +| `tokenOwner` | `address` | The tokenOwner address to query. | +| `operator` | `address` | The operator address to query. | #### Returns -| Name | Type | Description | -| ---- | :----: | ----------- | -| `0` | `bool` | - | +| Name | Type | Description | +| ---- | :----: | --------------------------------------------------------------------------- | +| `0` | `bool` | Returns if the `operator` is allowed to manage all of the assets of `owner` |
@@ -389,7 +393,7 @@ Returns whether `operator` address is an operator for a given `tokenId`. function name() external view returns (string); ``` -Returns the name of the token. +Returns the name of the token. For compatibility with clients & tools that expect ERC721. #### Returns @@ -532,7 +536,7 @@ function safeTransferFrom( ) external nonpayable; ``` -_Calling `safeTransferFrom` function on `ILSP8CompatibleERC721` contract. Transferring tokenId `tokenId` from address `from` to address `to`._ +_Calling `safeTransferFrom` function to transfer tokenId `tokenId` from address `from` to address `to`._ Safe Transfer function without optional data from the ERC721 standard interface. @@ -572,7 +576,7 @@ function safeTransferFrom( ) external nonpayable; ``` -_Calling `safeTransferFrom` function with `data` on `ILSP8CompatibleERC721` contract. Transferring tokenId `tokenId` from address `from` to address `to`._ +_Calling `safeTransferFrom` function to transfer tokenId `tokenId` from address `from` to address `to`._ Safe Transfer function with optional data from the ERC721 standard interface. @@ -602,14 +606,24 @@ Safe Transfer function with optional data from the ERC721 standard interface. function setApprovalForAll(address operator, bool approved) external nonpayable; ``` -See [`_setApprovalForAll`](#_setapprovalforall) +_Setting the "approval for all" status of operator `_operator` to `_approved` to allow it to transfer any tokenIds on behalf of `msg.sender`._ + +Enable or disable approval for a third party ("operator") to manage all of `msg.sender`'s assets. The contract MUST allow multiple operators per owner. See [`_setApprovalForAll`](#_setapprovalforall) + +
+ +**Emitted events:** + +- [`ApprovalForAll`](#approvalforall) event + +
#### Parameters -| Name | Type | Description | -| ---------- | :-------: | ----------- | -| `operator` | `address` | - | -| `approved` | `bool` | - | +| Name | Type | Description | +| ---------- | :-------: | ----------------------------------------------------------- | +| `operator` | `address` | Address to add to the set of authorized operators. | +| `approved` | `bool` | True if the operator is approved, false to revoke approval. |
@@ -759,7 +773,7 @@ Returns true if this contract implements the interface defined by `interfaceId`. function symbol() external view returns (string); ``` -Returns the symbol of the token, usually a shorter version of the name. +Returns the symbol of the token, usually a shorter version of the name. For compatibility with clients & tools that expect ERC721. #### Returns @@ -835,10 +849,10 @@ Returns the list of `tokenIds` for the `tokenOwner` address. :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#)) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenuri) - Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) -- Function signature: `)` -- Function selector: `0x59d76dc3` +- Function signature: `tokenURI(uint256)` +- Function selector: `0xc87b56dd` ::: @@ -846,6 +860,10 @@ Returns the list of `tokenIds` for the `tokenOwner` address. function tokenURI(uint256) external view returns (string); ``` +_Retrieving the token URI of tokenId `tokenId`._ + +Compatible with ERC721Metadata tokenURI. Retrieve the tokenURI for a specific `tokenId`. + #### Parameters | Name | Type | Description | @@ -854,9 +872,9 @@ function tokenURI(uint256) external view returns (string); #### Returns -| Name | Type | Description | -| ---- | :------: | ----------- | -| `0` | `string` | - | +| Name | Type | Description | +| ---- | :------: | -------------- | +| `0` | `string` | The token URI. |
@@ -980,7 +998,7 @@ function transferFrom( ) external nonpayable; ``` -_Calling `transferFrom` function on `ILSP8CompatibleERC721` contract. Transferring tokenId `tokenId` from address `from` to address `to`._ +_Calling `transferFrom` function to transfer tokenId `tokenId` from address `from` to address `to`._ Transfer functions from the ERC721 standard interface. @@ -1076,9 +1094,12 @@ mapping(bytes32 => bytes) _store ### \_setData ```solidity -function _setData(bytes32 key, bytes value) internal nonpayable; +function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` +The ERC725Y data key `_LSP8_TOKENID_TYPE_KEY` cannot be changed +once the identifiable digital asset contract has been deployed. +
### \_isOperatorOrOwner @@ -1197,13 +1218,38 @@ function _transfer( function _beforeTokenTransfer( address from, address to, - bytes32 tokenId + bytes32 tokenId, + bytes data ) internal nonpayable; ``` Hook that is called before any token transfer, including minting and burning. +Allows to run custom logic before updating balances and notifiying sender/recipient by overriding this function. + +#### Parameters -- Allows to run custom logic before updating balances and notifiying sender/recipient by overriding this function. +| Name | Type | Description | +| --------- | :-------: | -------------------------------------- | +| `from` | `address` | The sender address | +| `to` | `address` | @param tokenId The tokenId to transfer | +| `tokenId` | `bytes32` | The tokenId to transfer | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + bytes32 tokenId, + bytes data +) internal nonpayable; +``` + +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient via LSP1** by overriding this function. #### Parameters @@ -1212,6 +1258,7 @@ Hook that is called before any token transfer, including minting and burning. | `from` | `address` | The sender address | | `to` | `address` | @param tokenId The tokenId to transfer | | `tokenId` | `bytes32` | The tokenId to transfer | +| `data` | `bytes` | The data sent alongside the transfer |
@@ -1346,7 +1393,7 @@ function _setApprovalForAll( ) internal nonpayable; ``` -Approve `operator` to operate on all tokens of `tokensOwner` +Approve `operator` to operate on all tokens of `tokensOwner`.
@@ -1372,20 +1419,18 @@ Approve `operator` to operate on all tokens of `tokensOwner` ::: ```solidity -event Approval(address indexed owner, address indexed operator, uint256 indexed tokenId); +event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); ``` -_ERC721 `Approval` compatible event emitted. Successfully approved operator `operator` to operate on tokenId `tokenId` on behalf of token owner `owner`._ - Emitted when the allowance of a `spender` for an `owner` is set by a call to [`approve`](#approve). `value` is the new allowance. #### Parameters -| Name | Type | Description | -| ------------------------ | :-------: | ---------------------------- | -| `owner` **`indexed`** | `address` | The account giving approval | -| `operator` **`indexed`** | `address` | The address set as operator. | -| `tokenId` **`indexed`** | `uint256` | The approved tokenId. | +| Name | Type | Description | +| ------------------------ | :-------: | ----------- | +| `owner` **`indexed`** | `address` | - | +| `approved` **`indexed`** | `address` | - | +| `tokenId` **`indexed`** | `uint256` | - |
@@ -1404,17 +1449,15 @@ Emitted when the allowance of a `spender` for an `owner` is set by a call to [`a event ApprovalForAll(address indexed owner, address indexed operator, bool approved); ``` -_ERC721 `ApprovalForAll` compatible event emitted. Successfully set "approved for all" status to `approved` for operator `operator` for token owner `owner`._ - Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to `approved`. #### Parameters -| Name | Type | Description | -| ------------------------ | :-------: | ---------------------------------------------- | -| `owner` **`indexed`** | `address` | The address of the owner of tokenIds. | -| `operator` **`indexed`** | `address` | The address set as operator. | -| `approved` | `bool` | If `operator` is approved for all NFTs or not. | +| Name | Type | Description | +| ------------------------ | :-------: | ----------- | +| `owner` **`indexed`** | `address` | - | +| `operator` **`indexed`** | `address` | - | +| `approved` | `bool` | - |
@@ -1532,26 +1575,27 @@ Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on i - Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) - Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) -- Event signature: `Transfer(address,address,uint256)` -- Event topic hash: `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` +- Event signature: `Transfer(address,address,address,bytes32,bool,bytes)` +- Event topic hash: `0xb333c813a7426a7a11e2b190cad52c44119421594b47f6f32ace6d8c7207b2bf` ::: ```solidity -event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); +event Transfer(address operator, address indexed from, address indexed to, bytes32 indexed tokenId, bool force, bytes data); ``` -_ERC721 `Transfer` compatible event emitted. Successfully transferred tokenId `tokenId` from `from` to `to`._ - -Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero. +Emitted when `tokenId` token is transferred from the `from` to the `to` address. #### Parameters -| Name | Type | Description | -| ----------------------- | :-------: | ------------------------ | -| `from` **`indexed`** | `address` | The sending address | -| `to` **`indexed`** | `address` | The receiving address | -| `tokenId` **`indexed`** | `uint256` | The tokenId to transfer. | +| Name | Type | Description | +| ----------------------- | :-------: | ---------------------------------------------------------------------------------------------------------------------------------- | +| `operator` | `address` | The address of operator that sent the `tokenId` | +| `from` **`indexed`** | `address` | The previous owner of the `tokenId` | +| `to` **`indexed`** | `address` | The new owner of `tokenId` | +| `tokenId` **`indexed`** | `bytes32` | The tokenId that was transferred | +| `force` | `bool` | If the token transfer enforces the `to` recipient address to be a contract that implements the LSP1 standard or not. | +| `data` | `bytes` | Any additional data the caller included by the caller during the transfer, and sent in the hooks to the `from` and `to` addresses. |
@@ -1561,27 +1605,24 @@ Emitted when `value` tokens are moved from one account (`from`) to another (`to` - Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) - Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) -- Event signature: `Transfer(address,address,address,bytes32,bool,bytes)` -- Event topic hash: `0xb333c813a7426a7a11e2b190cad52c44119421594b47f6f32ace6d8c7207b2bf` +- Event signature: `Transfer(address,address,uint256)` +- Event topic hash: `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` ::: ```solidity -event Transfer(address operator, address indexed from, address indexed to, bytes32 indexed tokenId, bool force, bytes data); +event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); ``` -Emitted when `tokenId` token is transferred from the `from` to the `to` address. +Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero. #### Parameters -| Name | Type | Description | -| ----------------------- | :-------: | ---------------------------------------------------------------------------------------------------------------------------------- | -| `operator` | `address` | The address of operator that sent the `tokenId` | -| `from` **`indexed`** | `address` | The previous owner of the `tokenId` | -| `to` **`indexed`** | `address` | The new owner of `tokenId` | -| `tokenId` **`indexed`** | `bytes32` | The tokenId that was transferred | -| `force` | `bool` | If the token transfer enforces the `to` recipient address to be a contract that implements the LSP1 standard or not. | -| `data` | `bytes` | Any additional data the caller included by the caller during the transfer, and sent in the hooks to the `from` and `to` addresses. | +| Name | Type | Description | +| ----------------------- | :-------: | ----------- | +| `from` **`indexed`** | `address` | - | +| `to` **`indexed`** | `address` | - | +| `tokenId` **`indexed`** | `uint256` | - |
@@ -2073,3 +2114,47 @@ reverts when there is no extension for the function selector being called with | `functionSelector` | `bytes4` | - |
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md index 36bc2804e1..eea20e1d98 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md @@ -834,6 +834,16 @@ When `tokenId` does not exist then revert with an error. ### \_mint +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances and ownership of `tokenId`s. + +- {\_afterTokenTransfer} function will run after updating the balances and ownership of `tokenId`s, **but before notifying the recipient via LSP1**. + +::: + ```solidity function _mint( address to, @@ -866,6 +876,16 @@ Create `tokenId` by minting it and transfers it to `to`. ### \_burn +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances and ownership of `tokenId`s. + +- {\_afterTokenTransfer} function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender via LSP1**. + +::: + :::tip Hint In dApps, you can know which addresses are burning tokens by listening for the `Transfer` event and filter with the zero address as `to`. @@ -881,7 +901,6 @@ This will also clear all the operators allowed to transfer the `tokenId`. The owner of the `tokenId` will be notified about the `tokenId` being transferred through its LSP1 [`universalReceiver`](#universalreceiver) function, if it is a contract that supports the LSP1 interface. Its [`universalReceiver`](#universalreceiver) function will receive all the parameters in the calldata packed encoded. -Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before burning `tokenId` and updating the balances.
@@ -902,6 +921,16 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r ### \_transfer +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances and ownership of `tokenId`s. + +- {\_afterTokenTransfer} function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender/recipient via LSP1**. + +::: + :::danger This internal function does not check if the sender is authorized or not to operate on the `tokenId`. @@ -922,7 +951,6 @@ Change the owner of the `tokenId` from `from` to `to`. Both the sender and recipient will be notified of the `tokenId` being transferred through their LSP1 [`universalReceiver`](#universalreceiver) function, if they are contracts that support the LSP1 interface. Their `universalReceiver` function will receive all the parameters in the calldata packed encoded. -Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before changing the owner of `tokenId`.
@@ -950,7 +978,8 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r function _beforeTokenTransfer( address from, address to, - bytes32 tokenId + bytes32 tokenId, + bytes data ) internal nonpayable; ``` @@ -961,6 +990,32 @@ function _beforeTokenTransfer( | `from` | `address` | The address sending the `tokenId` (`address(0)` when `tokenId` is being minted). | | `to` | `address` | @param tokenId The bytes32 identifier of the token being transferred. | | `tokenId` | `bytes32` | The bytes32 identifier of the token being transferred. | +| `data` | `bytes` | The data sent alongside the the token transfer. | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + bytes32 tokenId, + bytes data +) internal nonpayable; +``` + +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient via LSP1** by overriding this function. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------- | +| `from` | `address` | The sender address | +| `to` | `address` | @param tokenId The tokenId to transfer | +| `tokenId` | `bytes32` | The tokenId to transfer | +| `data` | `bytes` | The data sent alongside the transfer |
@@ -1696,3 +1751,47 @@ reverts when there is no extension for the function selector being called with | `functionSelector` | `bytes4` | - |
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.md index 33d19c009a..232dbd9d5d 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.md @@ -97,7 +97,7 @@ receive() external payable; function approve(address operator, uint256 tokenId) external nonpayable; ``` -_Calling `approve` function on `ILSP8CompatibleERC721` contract. Approving operator at address `operator` to transfer tokenId `tokenId` on behalf of its owner._ +_Calling `approve` function to approve operator at address `operator` to transfer tokenId `tokenId` on behalf of its owner._ Approval function compatible with ERC721 `approve(address,uint256)`. @@ -331,18 +331,22 @@ function isApprovedForAll( ) external view returns (bool); ``` +_Checking if address `operator` is approved to transfer any tokenId owned by address `owner`._ + +Compatible with ERC721 isApprovedForAll. + #### Parameters -| Name | Type | Description | -| ------------ | :-------: | ----------- | -| `tokenOwner` | `address` | - | -| `operator` | `address` | - | +| Name | Type | Description | +| ------------ | :-------: | -------------------------------- | +| `tokenOwner` | `address` | The tokenOwner address to query. | +| `operator` | `address` | The operator address to query. | #### Returns -| Name | Type | Description | -| ---- | :----: | ----------- | -| `0` | `bool` | - | +| Name | Type | Description | +| ---- | :----: | --------------------------------------------------------------------------- | +| `0` | `bool` | Returns if the `operator` is allowed to manage all of the assets of `owner` |
@@ -431,7 +435,7 @@ Public [`_mint`](#_mint) function only callable by the [`owner`](#owner). function name() external view returns (string); ``` -Returns the name of the token. +Returns the name of the token. For compatibility with clients & tools that expect ERC721. #### Returns @@ -574,7 +578,7 @@ function safeTransferFrom( ) external nonpayable; ``` -_Calling `safeTransferFrom` function on `ILSP8CompatibleERC721` contract. Transferring tokenId `tokenId` from address `from` to address `to`._ +_Calling `safeTransferFrom` function to transfer tokenId `tokenId` from address `from` to address `to`._ Safe Transfer function without optional data from the ERC721 standard interface. @@ -614,7 +618,7 @@ function safeTransferFrom( ) external nonpayable; ``` -_Calling `safeTransferFrom` function with `data` on `ILSP8CompatibleERC721` contract. Transferring tokenId `tokenId` from address `from` to address `to`._ +_Calling `safeTransferFrom` function to transfer tokenId `tokenId` from address `from` to address `to`._ Safe Transfer function with optional data from the ERC721 standard interface. @@ -644,14 +648,24 @@ Safe Transfer function with optional data from the ERC721 standard interface. function setApprovalForAll(address operator, bool approved) external nonpayable; ``` -See [`_setApprovalForAll`](#_setapprovalforall) +_Setting the "approval for all" status of operator `_operator` to `_approved` to allow it to transfer any tokenIds on behalf of `msg.sender`._ + +Enable or disable approval for a third party ("operator") to manage all of `msg.sender`'s assets. The contract MUST allow multiple operators per owner. See [`_setApprovalForAll`](#_setapprovalforall) + +
+ +**Emitted events:** + +- [`ApprovalForAll`](#approvalforall) event + +
#### Parameters -| Name | Type | Description | -| ---------- | :-------: | ----------- | -| `operator` | `address` | - | -| `approved` | `bool` | - | +| Name | Type | Description | +| ---------- | :-------: | ----------------------------------------------------------- | +| `operator` | `address` | Address to add to the set of authorized operators. | +| `approved` | `bool` | True if the operator is approved, false to revoke approval. |
@@ -801,7 +815,7 @@ Returns true if this contract implements the interface defined by `interfaceId`. function symbol() external view returns (string); ``` -Returns the symbol of the token, usually a shorter version of the name. +Returns the symbol of the token, usually a shorter version of the name. For compatibility with clients & tools that expect ERC721. #### Returns @@ -877,10 +891,10 @@ Returns the list of `tokenIds` for the `tokenOwner` address. :::note References -- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#)) +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#tokenuri) - Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) -- Function signature: `)` -- Function selector: `0x59d76dc3` +- Function signature: `tokenURI(uint256)` +- Function selector: `0xc87b56dd` ::: @@ -888,6 +902,10 @@ Returns the list of `tokenIds` for the `tokenOwner` address. function tokenURI(uint256) external view returns (string); ``` +_Retrieving the token URI of tokenId `tokenId`._ + +Compatible with ERC721Metadata tokenURI. Retrieve the tokenURI for a specific `tokenId`. + #### Parameters | Name | Type | Description | @@ -896,9 +914,9 @@ function tokenURI(uint256) external view returns (string); #### Returns -| Name | Type | Description | -| ---- | :------: | ----------- | -| `0` | `string` | - | +| Name | Type | Description | +| ---- | :------: | -------------- | +| `0` | `string` | The token URI. |
@@ -1022,7 +1040,7 @@ function transferFrom( ) external nonpayable; ``` -_Calling `transferFrom` function on `ILSP8CompatibleERC721` contract. Transferring tokenId `tokenId` from address `from` to address `to`._ +_Calling `transferFrom` function to transfer tokenId `tokenId` from address `from` to address `to`._ Transfer functions from the ERC721 standard interface. @@ -1118,9 +1136,12 @@ mapping(bytes32 => bytes) _store ### \_setData ```solidity -function _setData(bytes32 key, bytes value) internal nonpayable; +function _setData(bytes32 dataKey, bytes dataValue) internal nonpayable; ``` +The ERC725Y data key `_LSP8_TOKENID_TYPE_KEY` cannot be changed +once the identifiable digital asset contract has been deployed. +
### \_isOperatorOrOwner @@ -1239,13 +1260,38 @@ function _transfer( function _beforeTokenTransfer( address from, address to, - bytes32 tokenId + bytes32 tokenId, + bytes data ) internal nonpayable; ``` Hook that is called before any token transfer, including minting and burning. +Allows to run custom logic before updating balances and notifiying sender/recipient by overriding this function. + +#### Parameters -- Allows to run custom logic before updating balances and notifiying sender/recipient by overriding this function. +| Name | Type | Description | +| --------- | :-------: | -------------------------------------- | +| `from` | `address` | The sender address | +| `to` | `address` | @param tokenId The tokenId to transfer | +| `tokenId` | `bytes32` | The tokenId to transfer | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + bytes32 tokenId, + bytes data +) internal nonpayable; +``` + +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient via LSP1** by overriding this function. #### Parameters @@ -1254,6 +1300,7 @@ Hook that is called before any token transfer, including minting and burning. | `from` | `address` | The sender address | | `to` | `address` | @param tokenId The tokenId to transfer | | `tokenId` | `bytes32` | The tokenId to transfer | +| `data` | `bytes` | The data sent alongside the transfer |
@@ -1388,7 +1435,7 @@ function _setApprovalForAll( ) internal nonpayable; ``` -Approve `operator` to operate on all tokens of `tokensOwner` +Approve `operator` to operate on all tokens of `tokensOwner`.
@@ -1414,20 +1461,18 @@ Approve `operator` to operate on all tokens of `tokensOwner` ::: ```solidity -event Approval(address indexed owner, address indexed operator, uint256 indexed tokenId); +event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); ``` -_ERC721 `Approval` compatible event emitted. Successfully approved operator `operator` to operate on tokenId `tokenId` on behalf of token owner `owner`._ - Emitted when the allowance of a `spender` for an `owner` is set by a call to [`approve`](#approve). `value` is the new allowance. #### Parameters -| Name | Type | Description | -| ------------------------ | :-------: | ---------------------------- | -| `owner` **`indexed`** | `address` | The account giving approval | -| `operator` **`indexed`** | `address` | The address set as operator. | -| `tokenId` **`indexed`** | `uint256` | The approved tokenId. | +| Name | Type | Description | +| ------------------------ | :-------: | ----------- | +| `owner` **`indexed`** | `address` | - | +| `approved` **`indexed`** | `address` | - | +| `tokenId` **`indexed`** | `uint256` | - |
@@ -1446,17 +1491,15 @@ Emitted when the allowance of a `spender` for an `owner` is set by a call to [`a event ApprovalForAll(address indexed owner, address indexed operator, bool approved); ``` -_ERC721 `ApprovalForAll` compatible event emitted. Successfully set "approved for all" status to `approved` for operator `operator` for token owner `owner`._ - Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to `approved`. #### Parameters -| Name | Type | Description | -| ------------------------ | :-------: | ---------------------------------------------- | -| `owner` **`indexed`** | `address` | The address of the owner of tokenIds. | -| `operator` **`indexed`** | `address` | The address set as operator. | -| `approved` | `bool` | If `operator` is approved for all NFTs or not. | +| Name | Type | Description | +| ------------------------ | :-------: | ----------- | +| `owner` **`indexed`** | `address` | - | +| `operator` **`indexed`** | `address` | - | +| `approved` | `bool` | - |
@@ -1574,26 +1617,27 @@ Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on i - Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) - Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) -- Event signature: `Transfer(address,address,uint256)` -- Event topic hash: `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` +- Event signature: `Transfer(address,address,address,bytes32,bool,bytes)` +- Event topic hash: `0xb333c813a7426a7a11e2b190cad52c44119421594b47f6f32ace6d8c7207b2bf` ::: ```solidity -event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); +event Transfer(address operator, address indexed from, address indexed to, bytes32 indexed tokenId, bool force, bytes data); ``` -_ERC721 `Transfer` compatible event emitted. Successfully transferred tokenId `tokenId` from `from` to `to`._ - -Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero. +Emitted when `tokenId` token is transferred from the `from` to the `to` address. #### Parameters -| Name | Type | Description | -| ----------------------- | :-------: | ------------------------ | -| `from` **`indexed`** | `address` | The sending address | -| `to` **`indexed`** | `address` | The receiving address | -| `tokenId` **`indexed`** | `uint256` | The tokenId to transfer. | +| Name | Type | Description | +| ----------------------- | :-------: | ---------------------------------------------------------------------------------------------------------------------------------- | +| `operator` | `address` | The address of operator that sent the `tokenId` | +| `from` **`indexed`** | `address` | The previous owner of the `tokenId` | +| `to` **`indexed`** | `address` | The new owner of `tokenId` | +| `tokenId` **`indexed`** | `bytes32` | The tokenId that was transferred | +| `force` | `bool` | If the token transfer enforces the `to` recipient address to be a contract that implements the LSP1 standard or not. | +| `data` | `bytes` | Any additional data the caller included by the caller during the transfer, and sent in the hooks to the `from` and `to` addresses. |
@@ -1603,27 +1647,24 @@ Emitted when `value` tokens are moved from one account (`from`) to another (`to` - Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#transfer) - Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) -- Event signature: `Transfer(address,address,address,bytes32,bool,bytes)` -- Event topic hash: `0xb333c813a7426a7a11e2b190cad52c44119421594b47f6f32ace6d8c7207b2bf` +- Event signature: `Transfer(address,address,uint256)` +- Event topic hash: `0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef` ::: ```solidity -event Transfer(address operator, address indexed from, address indexed to, bytes32 indexed tokenId, bool force, bytes data); +event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); ``` -Emitted when `tokenId` token is transferred from the `from` to the `to` address. +Emitted when `value` tokens are moved from one account (`from`) to another (`to`). Note that `value` may be zero. #### Parameters -| Name | Type | Description | -| ----------------------- | :-------: | ---------------------------------------------------------------------------------------------------------------------------------- | -| `operator` | `address` | The address of operator that sent the `tokenId` | -| `from` **`indexed`** | `address` | The previous owner of the `tokenId` | -| `to` **`indexed`** | `address` | The new owner of `tokenId` | -| `tokenId` **`indexed`** | `bytes32` | The tokenId that was transferred | -| `force` | `bool` | If the token transfer enforces the `to` recipient address to be a contract that implements the LSP1 standard or not. | -| `data` | `bytes` | Any additional data the caller included by the caller during the transfer, and sent in the hooks to the `from` and `to` addresses. | +| Name | Type | Description | +| ----------------------- | :-------: | ----------- | +| `from` **`indexed`** | `address` | - | +| `to` **`indexed`** | `address` | - | +| `tokenId` **`indexed`** | `uint256` | - |
@@ -2140,3 +2181,47 @@ reverts when there is no extension for the function selector being called with | `functionSelector` | `bytes4` | - |
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md index e71fb2a68c..8f61176f72 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md @@ -867,6 +867,16 @@ When `tokenId` does not exist then revert with an error. ### \_mint +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances and ownership of `tokenId`s. + +- {\_afterTokenTransfer} function will run after updating the balances and ownership of `tokenId`s, **but before notifying the recipient via LSP1**. + +::: + ```solidity function _mint( address to, @@ -899,6 +909,16 @@ Create `tokenId` by minting it and transfers it to `to`. ### \_burn +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances and ownership of `tokenId`s. + +- {\_afterTokenTransfer} function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender via LSP1**. + +::: + :::tip Hint In dApps, you can know which addresses are burning tokens by listening for the `Transfer` event and filter with the zero address as `to`. @@ -914,7 +934,6 @@ This will also clear all the operators allowed to transfer the `tokenId`. The owner of the `tokenId` will be notified about the `tokenId` being transferred through its LSP1 [`universalReceiver`](#universalreceiver) function, if it is a contract that supports the LSP1 interface. Its [`universalReceiver`](#universalreceiver) function will receive all the parameters in the calldata packed encoded. -Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before burning `tokenId` and updating the balances.
@@ -935,6 +954,16 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r ### \_transfer +:::info + +Any logic in the: + +- {\_beforeTokenTransfer} function will run before updating the balances and ownership of `tokenId`s. + +- {\_afterTokenTransfer} function will run after updating the balances and ownership of `tokenId`s, **but before notifying the sender/recipient via LSP1**. + +::: + :::danger This internal function does not check if the sender is authorized or not to operate on the `tokenId`. @@ -955,7 +984,6 @@ Change the owner of the `tokenId` from `from` to `to`. Both the sender and recipient will be notified of the `tokenId` being transferred through their LSP1 [`universalReceiver`](#universalreceiver) function, if they are contracts that support the LSP1 interface. Their `universalReceiver` function will receive all the parameters in the calldata packed encoded. -Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will run before changing the owner of `tokenId`.
@@ -983,13 +1011,38 @@ Any logic in the [`_beforeTokenTransfer`](#_beforetokentransfer) function will r function _beforeTokenTransfer( address from, address to, - bytes32 tokenId + bytes32 tokenId, + bytes data ) internal nonpayable; ``` Hook that is called before any token transfer, including minting and burning. +Allows to run custom logic before updating balances and notifiying sender/recipient by overriding this function. + +#### Parameters + +| Name | Type | Description | +| --------- | :-------: | -------------------------------------- | +| `from` | `address` | The sender address | +| `to` | `address` | @param tokenId The tokenId to transfer | +| `tokenId` | `bytes32` | The tokenId to transfer | +| `data` | `bytes` | The data sent alongside the transfer | + +
+ +### \_afterTokenTransfer + +```solidity +function _afterTokenTransfer( + address from, + address to, + bytes32 tokenId, + bytes data +) internal nonpayable; +``` -- Allows to run custom logic before updating balances and notifiying sender/recipient by overriding this function. +Hook that is called after any token transfer, including minting and burning. +Allows to run custom logic after updating balances, but **before notifiying sender/recipient via LSP1** by overriding this function. #### Parameters @@ -998,6 +1051,7 @@ Hook that is called before any token transfer, including minting and burning. | `from` | `address` | The sender address | | `to` | `address` | @param tokenId The tokenId to transfer | | `tokenId` | `bytes32` | The tokenId to transfer | +| `data` | `bytes` | The data sent alongside the transfer |
@@ -1758,3 +1812,47 @@ reverts when there is no extension for the function selector being called with | `functionSelector` | `bytes4` | - |
+ +### OwnableCallerNotTheOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecallernottheowner) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` + +::: + +```solidity +error OwnableCallerNotTheOwner(address callerAddress); +``` + +Reverts when only the owner is allowed to call the function. + +#### Parameters + +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. | + +
+ +### OwnableCannotSetZeroAddressAsOwner + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#ownablecannotsetzeroaddressasowner) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Error signature: `OwnableCannotSetZeroAddressAsOwner()` +- Error hash: `0x1ad8836c` + +::: + +```solidity +error OwnableCannotSetZeroAddressAsOwner(); +``` + +Reverts when trying to set `address(0)` as the contract owner when deploying the contract, initializing it or transferring ownership of the contract. + +
diff --git a/docs/contracts/contracts/LSP9Vault/LSP9Vault.md b/docs/contracts/contracts/LSP9Vault/LSP9Vault.md index bb898ed226..4f89b90f45 100644 --- a/docs/contracts/contracts/LSP9Vault/LSP9Vault.md +++ b/docs/contracts/contracts/LSP9Vault/LSP9Vault.md @@ -909,6 +909,12 @@ Perform low-level staticcall (operation type = 3) ### \_executeDelegateCall +:::caution Warning + +The `msg.value` should not be trusted for any method called with `operationType`: `DELEGATECALL` (4). + +::: + ```solidity function _executeDelegateCall( address target, @@ -1354,7 +1360,7 @@ event UniversalReceiver(address indexed from, uint256 indexed value, bytes32 ind - Data received: `receivedData`.\* -Emitted when the [`universalReceiver`](#universalreceiver) function was called with a specific `typeId` and some `receivedData` s +Emitted when the [`universalReceiver`](#universalreceiver) function was called with a specific `typeId` and some `receivedData` #### Parameters @@ -1398,27 +1404,6 @@ Emitted when receiving native tokens. ## Errors -### CannotTransferOwnershipToSelf - -:::note References - -- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#cannottransferownershiptoself) -- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP9Vault/LSP9Vault.sol) -- Error signature: `CannotTransferOwnershipToSelf()` -- Error hash: `0x43b248cd` - -::: - -```solidity -error CannotTransferOwnershipToSelf(); -``` - -_Cannot transfer ownership to the address of the contract itself._ - -Reverts when trying to transfer ownership to the `address(this)`. - -
- ### ERC725X_ContractDeploymentFailed :::note References @@ -1622,6 +1607,52 @@ Reverts when sending value to the [`setData`](#setdata) or [`setDataBatch`](#set
+### LSP14CallerNotPendingOwner + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#lsp14callernotpendingowner) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP9Vault/LSP9Vault.sol) +- Error signature: `LSP14CallerNotPendingOwner(address)` +- Error hash: `0x451e4528` + +::: + +```solidity +error LSP14CallerNotPendingOwner(address caller); +``` + +Reverts when the `caller` that is trying to accept ownership of the contract is not the pending owner. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------------- | +| `caller` | `address` | The address that tried to accept ownership. | + +
+ +### LSP14CannotTransferOwnershipToSelf + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#lsp14cannottransferownershiptoself) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP9Vault/LSP9Vault.sol) +- Error signature: `LSP14CannotTransferOwnershipToSelf()` +- Error hash: `0xe052a6f8` + +::: + +```solidity +error LSP14CannotTransferOwnershipToSelf(); +``` + +_Cannot transfer ownership to the address of the contract itself._ + +Reverts when trying to transfer ownership to the `address(this)`. + +
+ ### LSP14MustAcceptOwnershipInSeparateTransaction :::note References @@ -1643,6 +1674,37 @@ Reverts when pending owner accept ownership in the same transaction of transferr
+### LSP14NotInRenounceOwnershipInterval + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#lsp14notinrenounceownershipinterval) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP9Vault/LSP9Vault.sol) +- Error signature: `LSP14NotInRenounceOwnershipInterval(uint256,uint256)` +- Error hash: `0x1b080942` + +::: + +```solidity +error LSP14NotInRenounceOwnershipInterval( + uint256 renounceOwnershipStart, + uint256 renounceOwnershipEnd +); +``` + +_Cannot confirm ownership renouncement yet. The ownership renouncement is allowed from: `renounceOwnershipStart` until: `renounceOwnershipEnd`._ + +Reverts when trying to renounce ownership before the initial confirmation delay. + +#### Parameters + +| Name | Type | Description | +| ------------------------ | :-------: | ----------------------------------------------------------------------- | +| `renounceOwnershipStart` | `uint256` | The start timestamp when one can confirm the renouncement of ownership. | +| `renounceOwnershipEnd` | `uint256` | The end timestamp when one can confirm the renouncement of ownership. | + +
+ ### LSP1DelegateNotAllowedToSetDataKey :::note References @@ -1695,34 +1757,28 @@ reverts when there is no extension for the function selector being called with
-### NotInRenounceOwnershipInterval +### OwnableCallerNotTheOwner :::note References -- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#notinrenounceownershipinterval) +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#ownablecallernottheowner) - Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP9Vault/LSP9Vault.sol) -- Error signature: `NotInRenounceOwnershipInterval(uint256,uint256)` -- Error hash: `0x8b9bf507` +- Error signature: `OwnableCallerNotTheOwner(address)` +- Error hash: `0xbf1169c5` ::: ```solidity -error NotInRenounceOwnershipInterval( - uint256 renounceOwnershipStart, - uint256 renounceOwnershipEnd -); +error OwnableCallerNotTheOwner(address callerAddress); ``` -_Cannot confirm ownership renouncement yet. The ownership renouncement is allowed from: `renounceOwnershipStart` until: `renounceOwnershipEnd`._ - -Reverts when trying to renounce ownership before the initial confirmation delay. +Reverts when only the owner is allowed to call the function. #### Parameters -| Name | Type | Description | -| ------------------------ | :-------: | ----------------------------------------------------------------------- | -| `renounceOwnershipStart` | `uint256` | The start timestamp when one can confirm the renouncement of ownership. | -| `renounceOwnershipEnd` | `uint256` | The end timestamp when one can confirm the renouncement of ownership. | +| Name | Type | Description | +| --------------- | :-------: | ---------------------------------------- | +| `callerAddress` | `address` | The address that tried to make the call. |
diff --git a/docs/contracts/contracts/UniversalProfile.md b/docs/contracts/contracts/UniversalProfile.md index 1516eb39e0..180c43ddc0 100644 --- a/docs/contracts/contracts/UniversalProfile.md +++ b/docs/contracts/contracts/UniversalProfile.md @@ -434,7 +434,7 @@ Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys function isValidSignature( bytes32 dataHash, bytes signature -) external view returns (bytes4 magicValue); +) external view returns (bytes4 returnedStatus); ``` _Achieves the goal of [EIP-1271] by validating signatures of smart contracts according to their own logic._ @@ -443,15 +443,15 @@ Handles two cases: 1. If the owner is an EOA, recovers an address from the hash and the signature provided: -- Returns the `magicValue` if the address recovered is the same as the owner, indicating that it was a valid signature. +- Returns the `_ERC1271_SUCCESSVALUE` if the address recovered is the same as the owner, indicating that it was a valid signature. -- If the address is different, it returns the fail value indicating that the signature is not valid. +- If the address is different, it returns the `_ERC1271_FAILVALUE` indicating that the signature is not valid. 2. If the owner is a smart contract, it forwards the call of [`isValidSignature()`](#isvalidsignature) to the owner contract: -- If the contract fails or returns the fail value, the [`isValidSignature()`](#isvalidsignature) on the account returns the fail value, indicating that the signature is not valid. +- If the contract fails or returns the `_ERC1271_FAILVALUE`, the [`isValidSignature()`](#isvalidsignature) on the account returns the `_ERC1271_FAILVALUE`, indicating that the signature is not valid. -- If the [`isValidSignature()`](#isvalidsignature) on the owner returned the `magicValue`, the [`isValidSignature()`](#isvalidsignature) on the account returns the `magicValue`, indicating that it's a valid signature. +- If the [`isValidSignature()`](#isvalidsignature) on the owner returned the `_ERC1271_SUCCESSVALUE`, the [`isValidSignature()`](#isvalidsignature) on the account returns the `_ERC1271_SUCCESSVALUE`, indicating that it's a valid signature. #### Parameters @@ -462,9 +462,9 @@ Handles two cases: #### Returns -| Name | Type | Description | -| ------------ | :------: | ----------------------------------------------------------------- | -| `magicValue` | `bytes4` | A `bytes4` value that indicates if the signature is valid or not. | +| Name | Type | Description | +| ---------------- | :------: | ----------------------------------------------------------------- | +| `returnedStatus` | `bytes4` | A `bytes4` value that indicates if the signature is valid or not. |
@@ -894,6 +894,12 @@ Perform low-level staticcall (operation type = 3) ### \_executeDelegateCall +:::caution Warning + +The `msg.value` should not be trusted for any method called with `operationType`: `DELEGATECALL` (4). + +::: + ```solidity function _executeDelegateCall( address target, @@ -1135,8 +1141,8 @@ function _verifyCall( ``` Calls [`lsp20VerifyCall`](#lsp20verifycall) function on the logicVerifier. -Reverts in case the value returned does not match the magic value (lsp20VerifyCall selector) -Returns whether a verification after the execution should happen based on the last byte of the magicValue +Reverts in case the value returned does not match the success value (lsp20VerifyCall selector) +Returns whether a verification after the execution should happen based on the last byte of the returnedStatus
@@ -1150,7 +1156,7 @@ function _verifyCallResult( ``` Calls [`lsp20VerifyCallResult`](#lsp20verifycallresult) function on the logicVerifier. -Reverts in case the value returned does not match the magic value (lsp20VerifyCallResult selector) +Reverts in case the value returned does not match the success value (lsp20VerifyCallResult selector)
@@ -1380,7 +1386,7 @@ event UniversalReceiver(address indexed from, uint256 indexed value, bytes32 ind - Data received: `receivedData`.\* -Emitted when the [`universalReceiver`](#universalreceiver) function was called with a specific `typeId` and some `receivedData` s +Emitted when the [`universalReceiver`](#universalreceiver) function was called with a specific `typeId` and some `receivedData` #### Parameters @@ -1424,27 +1430,6 @@ Emitted when receiving native tokens. ## Errors -### CannotTransferOwnershipToSelf - -:::note References - -- Specification details: [**UniversalProfile**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-3-UniversalProfile-Metadata.md#cannottransferownershiptoself) -- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/UniversalProfile.sol) -- Error signature: `CannotTransferOwnershipToSelf()` -- Error hash: `0x43b248cd` - -::: - -```solidity -error CannotTransferOwnershipToSelf(); -``` - -_Cannot transfer ownership to the address of the contract itself._ - -Reverts when trying to transfer ownership to the `address(this)`. - -
- ### ERC725X_ContractDeploymentFailed :::note References @@ -1667,6 +1652,52 @@ Reverts when there is not the same number of elements in the `datakeys` and `dat
+### LSP14CallerNotPendingOwner + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-3-UniversalProfile-Metadata.md#lsp14callernotpendingowner) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/UniversalProfile.sol) +- Error signature: `LSP14CallerNotPendingOwner(address)` +- Error hash: `0x451e4528` + +::: + +```solidity +error LSP14CallerNotPendingOwner(address caller); +``` + +Reverts when the `caller` that is trying to accept ownership of the contract is not the pending owner. + +#### Parameters + +| Name | Type | Description | +| -------- | :-------: | ------------------------------------------- | +| `caller` | `address` | The address that tried to accept ownership. | + +
+ +### LSP14CannotTransferOwnershipToSelf + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-3-UniversalProfile-Metadata.md#lsp14cannottransferownershiptoself) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/UniversalProfile.sol) +- Error signature: `LSP14CannotTransferOwnershipToSelf()` +- Error hash: `0xe052a6f8` + +::: + +```solidity +error LSP14CannotTransferOwnershipToSelf(); +``` + +_Cannot transfer ownership to the address of the contract itself._ + +Reverts when trying to transfer ownership to the `address(this)`. + +
+ ### LSP14MustAcceptOwnershipInSeparateTransaction :::note References @@ -1688,134 +1719,134 @@ Reverts when pending owner accept ownership in the same transaction of transferr
-### LSP20CallingVerifierFailed +### LSP14NotInRenounceOwnershipInterval :::note References -- Specification details: [**UniversalProfile**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-3-UniversalProfile-Metadata.md#lsp20callingverifierfailed) +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-3-UniversalProfile-Metadata.md#lsp14notinrenounceownershipinterval) - Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/UniversalProfile.sol) -- Error signature: `LSP20CallingVerifierFailed(bool)` -- Error hash: `0x8c6a8ae3` +- Error signature: `LSP14NotInRenounceOwnershipInterval(uint256,uint256)` +- Error hash: `0x1b080942` ::: ```solidity -error LSP20CallingVerifierFailed(bool postCall); +error LSP14NotInRenounceOwnershipInterval( + uint256 renounceOwnershipStart, + uint256 renounceOwnershipEnd +); ``` -reverts when the call to the owner fail with no revert reason +_Cannot confirm ownership renouncement yet. The ownership renouncement is allowed from: `renounceOwnershipStart` until: `renounceOwnershipEnd`._ + +Reverts when trying to renounce ownership before the initial confirmation delay. #### Parameters -| Name | Type | Description | -| ---------- | :----: | ---------------------------------------------------- | -| `postCall` | `bool` | True if the execution call was done, False otherwise | +| Name | Type | Description | +| ------------------------ | :-------: | ----------------------------------------------------------------------- | +| `renounceOwnershipStart` | `uint256` | The start timestamp when one can confirm the renouncement of ownership. | +| `renounceOwnershipEnd` | `uint256` | The end timestamp when one can confirm the renouncement of ownership. |
-### LSP20EOACannotVerifyCall +### LSP20CallVerificationFailed :::note References -- Specification details: [**UniversalProfile**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-3-UniversalProfile-Metadata.md#lsp20eoacannotverifycall) +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-3-UniversalProfile-Metadata.md#lsp20callverificationfailed) - Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/UniversalProfile.sol) -- Error signature: `LSP20EOACannotVerifyCall(address)` -- Error hash: `0x0c392301` +- Error signature: `LSP20CallVerificationFailed(bool,bytes)` +- Error hash: `0x00c28d0f` ::: ```solidity -error LSP20EOACannotVerifyCall(address logicVerifier); +error LSP20CallVerificationFailed(bool postCall, bytes returnedData); ``` -Reverts when the logic verifier is an Externally Owned Account (EOA) that cannot return the LSP20 magic value. +reverts when the call to the owner does not return the LSP20 success value #### Parameters -| Name | Type | Description | -| --------------- | :-------: | --------------------------------- | -| `logicVerifier` | `address` | The address of the logic verifier | +| Name | Type | Description | +| -------------- | :-----: | ---------------------------------------------------- | +| `postCall` | `bool` | True if the execution call was done, False otherwise | +| `returnedData` | `bytes` | The data returned by the call to the logic verifier |
-### LSP20InvalidMagicValue +### LSP20CallingVerifierFailed :::note References -- Specification details: [**UniversalProfile**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-3-UniversalProfile-Metadata.md#lsp20invalidmagicvalue) +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-3-UniversalProfile-Metadata.md#lsp20callingverifierfailed) - Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/UniversalProfile.sol) -- Error signature: `LSP20InvalidMagicValue(bool,bytes)` -- Error hash: `0xd088ec40` +- Error signature: `LSP20CallingVerifierFailed(bool)` +- Error hash: `0x8c6a8ae3` ::: ```solidity -error LSP20InvalidMagicValue(bool postCall, bytes returnedData); +error LSP20CallingVerifierFailed(bool postCall); ``` -reverts when the call to the owner does not return the magic value +reverts when the call to the owner fail with no revert reason #### Parameters -| Name | Type | Description | -| -------------- | :-----: | ---------------------------------------------------- | -| `postCall` | `bool` | True if the execution call was done, False otherwise | -| `returnedData` | `bytes` | The data returned by the call to the logic verifier | +| Name | Type | Description | +| ---------- | :----: | ---------------------------------------------------- | +| `postCall` | `bool` | True if the execution call was done, False otherwise |
-### NoExtensionFoundForFunctionSelector +### LSP20EOACannotVerifyCall :::note References -- Specification details: [**UniversalProfile**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-3-UniversalProfile-Metadata.md#noextensionfoundforfunctionselector) +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-3-UniversalProfile-Metadata.md#lsp20eoacannotverifycall) - Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/UniversalProfile.sol) -- Error signature: `NoExtensionFoundForFunctionSelector(bytes4)` -- Error hash: `0xbb370b2b` +- Error signature: `LSP20EOACannotVerifyCall(address)` +- Error hash: `0x0c392301` ::: ```solidity -error NoExtensionFoundForFunctionSelector(bytes4 functionSelector); +error LSP20EOACannotVerifyCall(address logicVerifier); ``` -reverts when there is no extension for the function selector being called with +Reverts when the logic verifier is an Externally Owned Account (EOA) that cannot return the LSP20 success value. #### Parameters -| Name | Type | Description | -| ------------------ | :------: | ----------- | -| `functionSelector` | `bytes4` | - | +| Name | Type | Description | +| --------------- | :-------: | --------------------------------- | +| `logicVerifier` | `address` | The address of the logic verifier |
-### NotInRenounceOwnershipInterval +### NoExtensionFoundForFunctionSelector :::note References -- Specification details: [**UniversalProfile**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-3-UniversalProfile-Metadata.md#notinrenounceownershipinterval) +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-3-UniversalProfile-Metadata.md#noextensionfoundforfunctionselector) - Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/UniversalProfile.sol) -- Error signature: `NotInRenounceOwnershipInterval(uint256,uint256)` -- Error hash: `0x8b9bf507` +- Error signature: `NoExtensionFoundForFunctionSelector(bytes4)` +- Error hash: `0xbb370b2b` ::: ```solidity -error NotInRenounceOwnershipInterval( - uint256 renounceOwnershipStart, - uint256 renounceOwnershipEnd -); +error NoExtensionFoundForFunctionSelector(bytes4 functionSelector); ``` -_Cannot confirm ownership renouncement yet. The ownership renouncement is allowed from: `renounceOwnershipStart` until: `renounceOwnershipEnd`._ - -Reverts when trying to renounce ownership before the initial confirmation delay. +reverts when there is no extension for the function selector being called with #### Parameters -| Name | Type | Description | -| ------------------------ | :-------: | ----------------------------------------------------------------------- | -| `renounceOwnershipStart` | `uint256` | The start timestamp when one can confirm the renouncement of ownership. | -| `renounceOwnershipEnd` | `uint256` | The end timestamp when one can confirm the renouncement of ownership. | +| Name | Type | Description | +| ------------------ | :------: | ----------- | +| `functionSelector` | `bytes4` | - |
diff --git a/docs/contracts/libraries/LSP1Utils.md b/docs/contracts/libraries/LSP1Utils.md index ff5954fab1..c116ad6c8a 100644 --- a/docs/contracts/libraries/LSP1Utils.md +++ b/docs/contracts/libraries/LSP1Utils.md @@ -47,39 +47,6 @@ supports the LSP1 interface.
-### callUniversalReceiverWithCallerInfos - -```solidity -function callUniversalReceiverWithCallerInfos( - address universalReceiverDelegate, - bytes32 typeId, - bytes receivedData, - address msgSender, - uint256 msgValue -) internal nonpayable returns (bytes); -``` - -Call a LSP1UniversalReceiverDelegate contract at `universalReceiverDelegate` address and append `msgSender` and `msgValue` -as additional informations in the calldata. - -#### Parameters - -| Name | Type | Description | -| --------------------------- | :-------: | ------------------------------------------------------------------------------------------------- | -| `universalReceiverDelegate` | `address` | The address of the LSP1UniversalReceiverDelegate to delegate the `universalReceiver` function to. | -| `typeId` | `bytes32` | A `bytes32` typeId. | -| `receivedData` | `bytes` | The data sent initially to the `universalReceiver` function. | -| `msgSender` | `address` | The address that initially called the `universalReceiver` function. | -| `msgValue` | `uint256` | The amount of native token received initially by the `universalReceiver` function. | - -#### Returns - -| Name | Type | Description | -| ---- | :-----: | ---------------------------------------------------------------- | -| `0` | `bytes` | The data returned by the LSP1UniversalReceiverDelegate contract. | - -
- ### getLSP1DelegateValue ```solidity diff --git a/docs/contracts/libraries/LSP2Utils.md b/docs/contracts/libraries/LSP2Utils.md index 34debe8732..b6a5f5b8e2 100644 --- a/docs/contracts/libraries/LSP2Utils.md +++ b/docs/contracts/libraries/LSP2Utils.md @@ -339,28 +339,6 @@ Generate a ASSETURL value content.
-### isEncodedArray - -```solidity -function isEncodedArray(bytes data) internal pure returns (bool); -``` - -Verify if `data` is an abi-encoded array. - -#### Parameters - -| Name | Type | Description | -| ------ | :-----: | -------------------------- | -| `data` | `bytes` | The bytes value to verify. | - -#### Returns - -| Name | Type | Description | -| ---- | :----: | ------------------------------------------------------------------------ | -| `0` | `bool` | `true` if the `data` represents an abi-encoded array, `false` otherwise. | - -
- ### isCompactBytesArray ```solidity