diff --git a/docs/contracts/_interface_ids_table.mdx b/docs/contracts/_interface_ids_table.mdx index fbfb9856df..f7dd19f4ad 100644 --- a/docs/contracts/_interface_ids_table.mdx +++ b/docs/contracts/_interface_ids_table.mdx @@ -8,8 +8,8 @@ | **LSP1UniversalReceiver** | `0x6bb56a14` | Interface of the LSP1 - Universal Receiver standard, an entry function for a contract to receive arbitrary information. | | **LSP1UniversalReceiverDelegate** | `0xa245bbda` | Interface of the LSP1 - Universal Receiver Delegate standard. | | **LSP6KeyManager** | `0x23f34c62` | Interface of the LSP6 - Key Manager standard, a contract acting as a controller of an ERC725 Account using predfined permissions. | -| **LSP7DigitalAsset** | `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. | +| **LSP7DigitalAsset** | `0xdaa746b7` | Interface of the LSP7 - Digital Asset standard, a fungible digital asset. | +| **LSP8IdentifiableDigitalAsset** | `0x30dc5278` | Interface of the LSP8 - Identifiable Digital Asset standard, a non-fungible digital asset. | | **LSP9Vault** | `0x28af17e6` | Interface of LSP9 - Vault standard, a blockchain vault that can hold assets and interact with other smart contracts. | | **LSP11BasicSocialRecovery** | `0x049a28f1` | Interface of the LSP11 - Basic Social Recovery standard, a contract to recover access control into an account. | | **LSP14Ownable2Step** | `0x94be5999` | Interface of the LSP14 - Ownable 2-step standard, an extension of the [EIP173] (Ownable) standard with 2-step process to transfer or renounce ownership. | diff --git a/docs/contracts/contracts/LSP0ERC725Account/LSP0ERC725Account.md b/docs/contracts/contracts/LSP0ERC725Account/LSP0ERC725Account.md index 3b13b3824d..2bfaa0d8a6 100644 --- a/docs/contracts/contracts/LSP0ERC725Account/LSP0ERC725Account.md +++ b/docs/contracts/contracts/LSP0ERC725Account/LSP0ERC725Account.md @@ -60,7 +60,7 @@ Set `initialOwner` as the contract owner. The `constructor` also allows funding **Emitted events:** -- [`ValueReceived`](#valuereceived) event when funding the contract on deployment. +- [`UniversalReceiver`](#universalreceiver) event when funding the contract on deployment. - [`OwnershipTransferred`](#ownershiptransferred) event when `initialOwner` is set as the contract [`owner`](#owner). @@ -110,7 +110,7 @@ This function is executed when: **Emitted events:** -- [`ValueReceived`](#valuereceived) event when receiving native tokens. +- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens and extension function selector is not found or not payable. @@ -139,7 +139,7 @@ Executed: **Emitted events:** -- [`ValueReceived`](#valuereceived) event when receiving native tokens. +- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens. @@ -318,7 +318,7 @@ Generic executor function to: - [`Executed`](#executed) event for each call that uses under `operationType`: `CALL` (0), `STATICCALL` (3) and `DELEGATECALL` (4). - [`ContractCreated`](#contractcreated) event, when a contract is created under `operationType`: `CREATE` (1) and `CREATE2` (2). -- [`ValueReceived`](#valuereceived) event when receiving native tokens. +- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens. @@ -387,7 +387,7 @@ Batch executor function that behaves the same as [`execute`](#execute) but allow - [`Executed`](#executed) event for each call that uses under `operationType`: `CALL` (0), `STATICCALL` (3) and `DELEGATECALL` (4). (each iteration) - [`ContractCreated`](#contractcreated) event, when a contract is created under `operationType`: `CREATE` (1) and `CREATE2` (2) (each iteration) -- [`ValueReceived`](#valuereceived) event when receiving native tokens. +- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens. @@ -651,7 +651,7 @@ Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data **Emitted events:** -- [`ValueReceived`](#valuereceived) event when receiving native tokens. +- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens. - [`DataChanged`](#datachanged) event. @@ -696,7 +696,7 @@ Batch data setting function that behaves the same as [`setData`](#setdata) but a **Emitted events:** -- [`ValueReceived`](#valuereceived) event when receiving native tokens. +- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens. - [`DataChanged`](#datachanged) event. (on each iteration of setting data) @@ -818,7 +818,7 @@ Achieves the goal of [LSP-1-UniversalReceiver] by allowing the account to be not **Emitted events:** -- [`ValueReceived`](#valuereceived) when receiving native tokens. +- [`UniversalReceiver`](#universalreceiver) when receiving native tokens. - [`UniversalReceiver`](#universalreceiver) event with the function parameters, call options, and the response of the UniversalReceiverDelegates (URD) contract that was called. @@ -838,6 +838,33 @@ Achieves the goal of [LSP-1-UniversalReceiver] by allowing the account to be not
+### version + +:::note References + +- Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-0-ERC725Account.md#version) +- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP0ERC725Account/LSP0ERC725Account.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. @@ -1145,10 +1172,12 @@ extension if the extension is set, if not it returns false.
-### \_getExtension +### \_getExtensionAndForwardValue ```solidity -function _getExtension(bytes4 functionSelector) internal view returns (address); +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); ``` Returns the extension address stored under the following data key: @@ -1181,8 +1210,9 @@ function _fallbackLSP17Extendable( ``` Forwards the call to an extension mapped to a function selector. -Calls [`_getExtension`](#_getextension) to get the address of the extension mapped to the function selector being +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the `address(0)` will be returned. +Forwards the value sent with the call to the extension if the function selector is mapped to a payable extension. Reverts if there is no extension for the function being called, except for the `bytes4(0)` function selector, which passes even if there is no extension for it. If there is an extension for the function selector being called, it calls the extension with the `CALL` opcode, passing the `msg.data` appended with the 20 bytes of the [`msg.sender`](#msg.sender) and 32 bytes of the `msg.value`. @@ -1198,8 +1228,6 @@ function _verifyCall( ``` Calls [`lsp20VerifyCall`](#lsp20verifycall) function on the logicVerifier. -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
@@ -1213,19 +1241,6 @@ function _verifyCallResult( ``` Calls [`lsp20VerifyCallResult`](#lsp20verifycallresult) function on the logicVerifier. -Reverts in case the value returned does not match the success value (lsp20VerifyCallResult selector) - -
- -### \_validateCall - -```solidity -function _validateCall( - bool postCall, - bool success, - bytes returnedData -) internal pure; -```
@@ -1457,34 +1472,6 @@ Emitted when the [`universalReceiver`](#universalreceiver) function was called w
-### ValueReceived - -:::note References - -- Specification details: [**LSP-0-ERC725Account**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-0-ERC725Account.md#valuereceived) -- Solidity implementation: [`LSP0ERC725Account.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP0ERC725Account/LSP0ERC725Account.sol) -- Event signature: `ValueReceived(address,uint256)` -- Event topic hash: `0x7e71433ddf847725166244795048ecf3e3f9f35628254ecbf736056664233493` - -::: - -```solidity -event ValueReceived(address indexed sender, uint256 indexed value); -``` - -_`value` native tokens received from `sender`._ - -Emitted when receiving native tokens. - -#### Parameters - -| Name | Type | Description | -| ---------------------- | :-------: | ---------------------------------------------------------- | -| `sender` **`indexed`** | `address` | The address that sent some native tokens to this contract. | -| `value` **`indexed`** | `uint256` | The amount of native tokens received. | - -
- ## Errors ### ERC725X_ContractDeploymentFailed @@ -1813,23 +1800,23 @@ Reverts when trying to renounce ownership before the initial confirmation delay. - 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: `LSP20CallVerificationFailed(bool,bytes)` -- Error hash: `0x00c28d0f` +- Error signature: `LSP20CallVerificationFailed(bool,bytes4)` +- Error hash: `0x9d6741e3` ::: ```solidity -error LSP20CallVerificationFailed(bool postCall, bytes returnedData); +error LSP20CallVerificationFailed(bool postCall, bytes4 returnedStatus); ``` reverts when the call to the owner does not return the LSP20 success value #### Parameters -| Name | Type | Description | -| -------------- | :-----: | ---------------------------------------------------- | -| `postCall` | `bool` | True if the execution call was done, False otherwise | -| `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 | +| `returnedStatus` | `bytes4` | The bytes4 decoded data returned by the logic verifier. |
diff --git a/docs/contracts/contracts/LSP17ContractExtension/LSP17Extendable.md b/docs/contracts/contracts/LSP17ContractExtension/LSP17Extendable.md index 859c978e7f..9ce0eb1667 100644 --- a/docs/contracts/contracts/LSP17ContractExtension/LSP17Extendable.md +++ b/docs/contracts/contracts/LSP17ContractExtension/LSP17Extendable.md @@ -78,10 +78,12 @@ extension if the extension is set, if not it returns false.
-### \_getExtension +### \_getExtensionAndForwardValue ```solidity -function _getExtension(bytes4 functionSelector) internal view returns (address); +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); ``` Returns the extension mapped to a specific function selector @@ -113,8 +115,9 @@ function _fallbackLSP17Extendable( ``` Forwards the call to an extension mapped to a function selector. -Calls [`_getExtension`](#_getextension) to get the address of the extension mapped to the function selector being +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the `address(0)` will be returned. +Forwards the value if the extension is payable. Reverts if there is no extension for the function being called. If there is an extension for the function selector being called, it calls the extension with the `CALL` opcode, passing the `msg.data` appended with the 20 bytes of the [`msg.sender`](#msg.sender) and 32 bytes of the `msg.value`. diff --git a/docs/contracts/contracts/LSP17ContractExtension/LSP17Extension.md b/docs/contracts/contracts/LSP17ContractExtension/LSP17Extension.md index 3aa855d2e7..3e8f0778b8 100644 --- a/docs/contracts/contracts/LSP17ContractExtension/LSP17Extension.md +++ b/docs/contracts/contracts/LSP17ContractExtension/LSP17Extension.md @@ -54,6 +54,33 @@ See [`IERC165-supportsInterface`](#ierc165-supportsinterface).
+### version + +:::note References + +- Specification details: [**LSP-17-ContractExtension**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-17-ContractExtension.md#version) +- Solidity implementation: [`LSP17Extension.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP17ContractExtension/LSP17Extension.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. diff --git a/docs/contracts/contracts/LSP17Extensions/Extension4337.md b/docs/contracts/contracts/LSP17Extensions/Extension4337.md index abd1680b3c..a0b0fe12db 100644 --- a/docs/contracts/contracts/LSP17Extensions/Extension4337.md +++ b/docs/contracts/contracts/LSP17Extensions/Extension4337.md @@ -135,6 +135,33 @@ Must validate caller is the entryPoint. Must validate the signature and nonce
+### version + +:::note References + +- Specification details: [**LSP-17-Extensions**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-17-Extensions.md#version) +- Solidity implementation: [`Extension4337.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP17Extensions/Extension4337.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. diff --git a/docs/contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.md b/docs/contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.md index adb4cc5cd7..af880d4a2d 100644 --- a/docs/contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.md +++ b/docs/contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.md @@ -123,6 +123,33 @@ _Reacted on received notification with `typeId`._
+### version + +:::note References + +- Specification details: [**LSP-1-UniversalReceiver**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-1-UniversalReceiver.md#version) +- Solidity implementation: [`LSP1UniversalReceiverDelegateUP.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. diff --git a/docs/contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.md b/docs/contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.md index 3e50d0f829..609078570e 100644 --- a/docs/contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.md +++ b/docs/contracts/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.md @@ -112,6 +112,33 @@ Handles two cases: Writes the received [LSP-7-DigitalAsset] or [LSP-8-Identifiab
+### version + +:::note References + +- Specification details: [**LSP-1-UniversalReceiver**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-1-UniversalReceiver.md#version) +- Solidity implementation: [`LSP1UniversalReceiverDelegateVault.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. diff --git a/docs/contracts/contracts/LSP20CallVerification/LSP20CallVerification.md b/docs/contracts/contracts/LSP20CallVerification/LSP20CallVerification.md index 10423e9327..c6525f4c3c 100644 --- a/docs/contracts/contracts/LSP20CallVerification/LSP20CallVerification.md +++ b/docs/contracts/contracts/LSP20CallVerification/LSP20CallVerification.md @@ -33,8 +33,6 @@ function _verifyCall( ``` Calls [`lsp20VerifyCall`](#lsp20verifycall) function on the logicVerifier. -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,19 +46,6 @@ function _verifyCallResult( ``` Calls [`lsp20VerifyCallResult`](#lsp20verifycallresult) function on the logicVerifier. -Reverts in case the value returned does not match the success value (lsp20VerifyCallResult selector) - -
- -### \_validateCall - -```solidity -function _validateCall( - bool postCall, - bool success, - bytes returnedData -) internal pure; -```
diff --git a/docs/contracts/contracts/LSP6KeyManager/LSP6KeyManager.md b/docs/contracts/contracts/LSP6KeyManager/LSP6KeyManager.md index c96f0b2fd1..953be91156 100644 --- a/docs/contracts/contracts/LSP6KeyManager/LSP6KeyManager.md +++ b/docs/contracts/contracts/LSP6KeyManager/LSP6KeyManager.md @@ -463,6 +463,33 @@ Get The address of the contract linked to this Key Manager.
+### version + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-6-KeyManager.md#version) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP6KeyManager/LSP6KeyManager.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. @@ -1331,6 +1358,44 @@ Reverts when trying to do a `delegatecall` via the ERC725X.execute(uint256,addre
+### ERC725X_ExecuteParametersEmptyArray + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-6-KeyManager.md#erc725x_executeparametersemptyarray) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP6KeyManager/LSP6KeyManager.sol) +- Error signature: `ERC725X_ExecuteParametersEmptyArray()` +- Error hash: `0xe9ad2b5f` + +::: + +```solidity +error ERC725X_ExecuteParametersEmptyArray(); +``` + +Reverts when one of the array parameter provided to the [`executeBatch`](#executebatch) function is an empty array. + +
+ +### ERC725X_ExecuteParametersLengthMismatch + +:::note References + +- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-6-KeyManager.md#erc725x_executeparameterslengthmismatch) +- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP6KeyManager/LSP6KeyManager.sol) +- Error signature: `ERC725X_ExecuteParametersLengthMismatch()` +- Error hash: `0x3ff55f4d` + +::: + +```solidity +error ERC725X_ExecuteParametersLengthMismatch(); +``` + +Reverts when there is not the same number of elements in the `operationTypes`, `targets` addresses, `values`, and `datas` array parameters provided when calling the [`executeBatch`](#executebatch) function. + +
+ ### ERC725Y_DataKeysValuesLengthMismatch :::note References diff --git a/docs/contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md b/docs/contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md index 7ded478dda..abfd06ff58 100644 --- a/docs/contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md +++ b/docs/contracts/contracts/LSP7DigitalAsset/LSP7DigitalAsset.md @@ -102,7 +102,7 @@ function authorizeOperator( ) external nonpayable; ``` -Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). +Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -216,12 +216,6 @@ Returns the number of decimals used to get its user representation. If the asset ::: -:::info - -This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against the double spending allowance vulnerability. - -::: - ```solidity function decreaseAllowance( address operator, @@ -232,25 +226,7 @@ function decreaseAllowance( _Decrease the allowance of `operator` by -`subtractedAmount`_ -Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. - -
- -**Requirements:** - -- `operator` cannot be the zero address. -- `operator` must have allowance for the caller of at least `subtractedAmount`. - -
- -
- -**Emitted events:** - -- [`AuthorizedOperator`](#authorizedoperator) event indicating the updated allowance after decreasing it. -- [`RevokeOperator`](#revokeoperator) event if `subtractedAmount` is the full allowance, indicating `operator` does not have any alauthorizedAmountForlowance left for `msg.sender`. - -
+Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -372,12 +348,6 @@ Returns all `operator` addresses that are allowed to transfer or burn on behalf ::: -:::info - -This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against double spending allowance vulnerability. - -::: - ```solidity function increaseAllowance( address operator, @@ -388,24 +358,7 @@ function increaseAllowance( _Increase the allowance of `operator` by +`addedAmount`_ -Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. - -
- -**Requirements:** - -- `operator` cannot be the same address as `msg.sender` -- `operator` cannot be the zero address. - -
- -
- -**Emitted events:** - -- [`AuthorizedOperator`](#authorizedoperator) indicating the updated allowance - -
+Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -467,14 +420,15 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f - Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#revokeoperator) - Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol) -- Function signature: `revokeOperator(address,bytes)` -- Function selector: `0xca3631e7` +- Function signature: `revokeOperator(address,bool,bytes)` +- Function selector: `0x4521748e` ::: ```solidity function revokeOperator( address operator, + bool notify, bytes operatorNotificationData ) external nonpayable; ``` @@ -483,10 +437,11 @@ Removes the `operator` address as an operator of callers tokens, disallowing it #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | ----------------------------------------------- | -| `operator` | `address` | The address to revoke as an operator. | -| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | +| Name | Type | Description | +| -------------------------- | :-------: | --------------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
@@ -741,6 +696,33 @@ Transfers ownership of the contract to a new account (`newOwner`). Can only be c
+### version + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#version) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. @@ -812,6 +794,7 @@ function _updateOperator( address tokenOwner, address operator, uint256 allowance, + bool notified, bytes operatorNotificationData ) internal nonpayable; ``` @@ -822,12 +805,13 @@ If the amount is zero then the operator is being revoked, otherwise the operator #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | -------------------------------------------------------------------------------------- | -| `tokenOwner` | `address` | The address that will give `operator` an allowance for on its balance. | -| `operator` | `address` | The address to grant an allowance to spend. | -| `allowance` | `uint256` | The maximum amount of token that `operator` can spend from the `tokenOwner`'s balance. | -| `operatorNotificationData` | `bytes` | - | +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------------------------------------------------------- | +| `tokenOwner` | `address` | The address that will give `operator` an allowance for on its balance. | +| `operator` | `address` | @param operatorNotificationData The data to send to the universalReceiver function of the operator in case of notifying | +| `allowance` | `uint256` | The maximum amount of token that `operator` can spend from the `tokenOwner`'s balance. | +| `notified` | `bool` | Boolean indicating whether the operator has been notified about the change of allowance | +| `operatorNotificationData` | `bytes` | The data to send to the universalReceiver function of the operator in case of notifying |
@@ -1038,47 +1022,6 @@ Allows to run custom logic after updating balances, but **before notifiying send
-### \_notifyTokenOperator - -```solidity -function _notifyTokenOperator( - address operator, - bytes lsp1Data -) internal nonpayable; -``` - -Attempt to notify the operator `operator` about the `amount` tokens being authorized with. -This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. -If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. - -#### Parameters - -| Name | Type | Description | -| ---------- | :-------: | ------------------------------------------------------------------------------ | -| `operator` | `address` | The address to call the {universalReceiver} function on. | -| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | - -
- -### \_notifyTokenSender - -```solidity -function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; -``` - -Attempt to notify the token sender `from` about the `amount` of tokens being transferred. -This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENSSENDER` as typeId, if `from` is a contract that supports the LSP1 interface. -If `from` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. - -#### Parameters - -| Name | Type | Description | -| ---------- | :-------: | -------------------------------------------------------------------------- | -| `from` | `address` | The address to call the {universalReceiver} function on. | -| `lsp1Data` | `bytes` | the data to be sent to the `from` address in the `universalReceiver` call. | - -
- ### \_notifyTokenReceiver ```solidity @@ -1123,10 +1066,12 @@ extension if the extension is set, if not it returns false.
-### \_getExtension +### \_getExtensionAndForwardValue ```solidity -function _getExtension(bytes4 functionSelector) internal view returns (address); +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); ``` Returns the extension address stored under the following data key: @@ -1135,6 +1080,8 @@ Returns the extension address stored under the following data key: - If no extension is stored, returns the address(0). +- we do not check that payable bool as in lsp7 standard we will always forward the value to the extension +
### \_fallbackLSP17Extendable @@ -1153,8 +1100,9 @@ function _fallbackLSP17Extendable( ``` Forwards the call with the received value to an extension mapped to a function selector. -Calls [`_getExtension`](#_getextension) to get the address of the extension mapped to the function selector being +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the address(0) will be returned. +Forwards the value if the extension is payable. Reverts if there is no extension for the function being called. If there is an extension for the function selector being called, it calls the extension with the CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and @@ -1250,24 +1198,25 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn - Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#revokedoperator) - Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol) -- Event signature: `RevokedOperator(address,address,bytes)` -- Event topic hash: `0x9ebfc34ce0da1178c4be66252d63a8a173d733c4bbb049241ce142dc4f0e0228` +- Event signature: `RevokedOperator(address,address,bool,bytes)` +- Event topic hash: `0x66015c8835ee443e5bc280176609215a5035da4bae05bdef994596d7e43aae22` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes operatorNotificationData); +event RevokedOperator(address indexed operator, address indexed tokenOwner, bool notified, bytes operatorNotificationData); ``` Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [`authorizedAmountFor(...)`](#`authorizedamountfor) to `0`. #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | ----------------------------------------------- | -| `operator` **`indexed`** | `address` | The address revoked from operating | -| `tokenOwner` **`indexed`** | `address` | The token owner | -| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | +| Name | Type | Description | +| -------------------------- | :-------: | ------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from operating | +| `tokenOwner` **`indexed`** | `address` | The token owner | +| `notified` | `bool` | Bool indicating whether the operator has been notified or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
@@ -1730,6 +1679,31 @@ reverts when there is no extension for the function selector being called with
+### OperatorAllowanceCannotBeIncreasedFromZero + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#operatorallowancecannotbeincreasedfromzero) +- Solidity implementation: [`LSP7DigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol) +- Error signature: `OperatorAllowanceCannotBeIncreasedFromZero(address)` +- Error hash: `0xcba6e977` + +::: + +```solidity +error OperatorAllowanceCannotBeIncreasedFromZero(address operator); +``` + +Reverts when token owner call [`increaseAllowance`](#increaseallowance) for an operator that does not have any allowance + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | + +
+ ### OwnableCallerNotTheOwner :::note References diff --git a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md index f0c7d2b967..28572334b1 100644 --- a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md +++ b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.md @@ -100,7 +100,7 @@ function authorizeOperator( ) external nonpayable; ``` -Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). +Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -241,12 +241,6 @@ Returns the number of decimals used to get its user representation. If the asset ::: -:::info - -This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against the double spending allowance vulnerability. - -::: - ```solidity function decreaseAllowance( address operator, @@ -257,25 +251,7 @@ function decreaseAllowance( _Decrease the allowance of `operator` by -`subtractedAmount`_ -Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. - -
- -**Requirements:** - -- `operator` cannot be the zero address. -- `operator` must have allowance for the caller of at least `subtractedAmount`. - -
- -
- -**Emitted events:** - -- [`AuthorizedOperator`](#authorizedoperator) event indicating the updated allowance after decreasing it. -- [`RevokeOperator`](#revokeoperator) event if `subtractedAmount` is the full allowance, indicating `operator` does not have any alauthorizedAmountForlowance left for `msg.sender`. - -
+Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -397,12 +373,6 @@ Returns all `operator` addresses that are allowed to transfer or burn on behalf ::: -:::info - -This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against double spending allowance vulnerability. - -::: - ```solidity function increaseAllowance( address operator, @@ -413,24 +383,7 @@ function increaseAllowance( _Increase the allowance of `operator` by +`addedAmount`_ -Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. - -
- -**Requirements:** - -- `operator` cannot be the same address as `msg.sender` -- `operator` cannot be the zero address. - -
- -
- -**Emitted events:** - -- [`AuthorizedOperator`](#authorizedoperator) indicating the updated allowance - -
+Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -492,14 +445,15 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f - Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#revokeoperator) - Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol) -- Function signature: `revokeOperator(address,bytes)` -- Function selector: `0xca3631e7` +- Function signature: `revokeOperator(address,bool,bytes)` +- Function selector: `0x4521748e` ::: ```solidity function revokeOperator( address operator, + bool notify, bytes operatorNotificationData ) external nonpayable; ``` @@ -508,10 +462,11 @@ Removes the `operator` address as an operator of callers tokens, disallowing it #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | ----------------------------------------------- | -| `operator` | `address` | The address to revoke as an operator. | -| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | +| Name | Type | Description | +| -------------------------- | :-------: | --------------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
@@ -766,6 +721,33 @@ Transfers ownership of the contract to a new account (`newOwner`). Can only be c
+### version + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#version) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. @@ -837,6 +819,7 @@ function _updateOperator( address tokenOwner, address operator, uint256 allowance, + bool notified, bytes operatorNotificationData ) internal nonpayable; ``` @@ -847,12 +830,13 @@ If the amount is zero then the operator is being revoked, otherwise the operator #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | -------------------------------------------------------------------------------------- | -| `tokenOwner` | `address` | The address that will give `operator` an allowance for on its balance. | -| `operator` | `address` | The address to grant an allowance to spend. | -| `allowance` | `uint256` | The maximum amount of token that `operator` can spend from the `tokenOwner`'s balance. | -| `operatorNotificationData` | `bytes` | - | +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------------------------------------------------------- | +| `tokenOwner` | `address` | The address that will give `operator` an allowance for on its balance. | +| `operator` | `address` | @param operatorNotificationData The data to send to the universalReceiver function of the operator in case of notifying | +| `allowance` | `uint256` | The maximum amount of token that `operator` can spend from the `tokenOwner`'s balance. | +| `notified` | `bool` | Boolean indicating whether the operator has been notified about the change of allowance | +| `operatorNotificationData` | `bytes` | The data to send to the universalReceiver function of the operator in case of notifying |
@@ -1063,47 +1047,6 @@ Allows to run custom logic after updating balances, but **before notifiying send
-### \_notifyTokenOperator - -```solidity -function _notifyTokenOperator( - address operator, - bytes lsp1Data -) internal nonpayable; -``` - -Attempt to notify the operator `operator` about the `amount` tokens being authorized with. -This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. -If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. - -#### Parameters - -| Name | Type | Description | -| ---------- | :-------: | ------------------------------------------------------------------------------ | -| `operator` | `address` | The address to call the {universalReceiver} function on. | -| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | - -
- -### \_notifyTokenSender - -```solidity -function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; -``` - -Attempt to notify the token sender `from` about the `amount` of tokens being transferred. -This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENSSENDER` as typeId, if `from` is a contract that supports the LSP1 interface. -If `from` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. - -#### Parameters - -| Name | Type | Description | -| ---------- | :-------: | -------------------------------------------------------------------------- | -| `from` | `address` | The address to call the {universalReceiver} function on. | -| `lsp1Data` | `bytes` | the data to be sent to the `from` address in the `universalReceiver` call. | - -
- ### \_notifyTokenReceiver ```solidity @@ -1148,10 +1091,12 @@ extension if the extension is set, if not it returns false.
-### \_getExtension +### \_getExtensionAndForwardValue ```solidity -function _getExtension(bytes4 functionSelector) internal view returns (address); +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); ``` Returns the extension address stored under the following data key: @@ -1160,6 +1105,8 @@ Returns the extension address stored under the following data key: - If no extension is stored, returns the address(0). +- we do not check that payable bool as in lsp7 standard we will always forward the value to the extension +
### \_fallbackLSP17Extendable @@ -1178,8 +1125,9 @@ function _fallbackLSP17Extendable( ``` Forwards the call with the received value to an extension mapped to a function selector. -Calls [`_getExtension`](#_getextension) to get the address of the extension mapped to the function selector being +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the address(0) will be returned. +Forwards the value if the extension is payable. Reverts if there is no extension for the function being called. If there is an extension for the function selector being called, it calls the extension with the CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and @@ -1275,24 +1223,25 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn - Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#revokedoperator) - Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol) -- Event signature: `RevokedOperator(address,address,bytes)` -- Event topic hash: `0x9ebfc34ce0da1178c4be66252d63a8a173d733c4bbb049241ce142dc4f0e0228` +- Event signature: `RevokedOperator(address,address,bool,bytes)` +- Event topic hash: `0x66015c8835ee443e5bc280176609215a5035da4bae05bdef994596d7e43aae22` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes operatorNotificationData); +event RevokedOperator(address indexed operator, address indexed tokenOwner, bool notified, bytes operatorNotificationData); ``` Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [`authorizedAmountFor(...)`](#`authorizedamountfor) to `0`. #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | ----------------------------------------------- | -| `operator` **`indexed`** | `address` | The address revoked from operating | -| `tokenOwner` **`indexed`** | `address` | The token owner | -| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | +| Name | Type | Description | +| -------------------------- | :-------: | ------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from operating | +| `tokenOwner` **`indexed`** | `address` | The token owner | +| `notified` | `bool` | Bool indicating whether the operator has been notified or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
@@ -1755,6 +1704,31 @@ reverts when there is no extension for the function selector being called with
+### OperatorAllowanceCannotBeIncreasedFromZero + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#operatorallowancecannotbeincreasedfromzero) +- Solidity implementation: [`LSP7Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol) +- Error signature: `OperatorAllowanceCannotBeIncreasedFromZero(address)` +- Error hash: `0xcba6e977` + +::: + +```solidity +error OperatorAllowanceCannotBeIncreasedFromZero(address operator); +``` + +Reverts when token owner call [`increaseAllowance`](#increaseallowance) for an operator that does not have any allowance + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | + +
+ ### OwnableCallerNotTheOwner :::note References diff --git a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md index 028cf0a491..38ca3799e9 100644 --- a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md +++ b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.md @@ -100,7 +100,7 @@ function authorizeOperator( ) external nonpayable; ``` -Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). +Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -214,12 +214,6 @@ Returns the number of decimals used to get its user representation. If the asset ::: -:::info - -This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against the double spending allowance vulnerability. - -::: - ```solidity function decreaseAllowance( address operator, @@ -230,25 +224,7 @@ function decreaseAllowance( _Decrease the allowance of `operator` by -`subtractedAmount`_ -Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. - -
- -**Requirements:** - -- `operator` cannot be the zero address. -- `operator` must have allowance for the caller of at least `subtractedAmount`. - -
- -
- -**Emitted events:** - -- [`AuthorizedOperator`](#authorizedoperator) event indicating the updated allowance after decreasing it. -- [`RevokeOperator`](#revokeoperator) event if `subtractedAmount` is the full allowance, indicating `operator` does not have any alauthorizedAmountForlowance left for `msg.sender`. - -
+Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -370,12 +346,6 @@ Returns all `operator` addresses that are allowed to transfer or burn on behalf ::: -:::info - -This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against double spending allowance vulnerability. - -::: - ```solidity function increaseAllowance( address operator, @@ -386,24 +356,7 @@ function increaseAllowance( _Increase the allowance of `operator` by +`addedAmount`_ -Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. - -
- -**Requirements:** - -- `operator` cannot be the same address as `msg.sender` -- `operator` cannot be the zero address. - -
- -
- -**Emitted events:** - -- [`AuthorizedOperator`](#authorizedoperator) indicating the updated allowance - -
+Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -465,14 +418,15 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f - Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#revokeoperator) - Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol) -- Function signature: `revokeOperator(address,bytes)` -- Function selector: `0xca3631e7` +- Function signature: `revokeOperator(address,bool,bytes)` +- Function selector: `0x4521748e` ::: ```solidity function revokeOperator( address operator, + bool notify, bytes operatorNotificationData ) external nonpayable; ``` @@ -481,10 +435,11 @@ Removes the `operator` address as an operator of callers tokens, disallowing it #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | ----------------------------------------------- | -| `operator` | `address` | The address to revoke as an operator. | -| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | +| Name | Type | Description | +| -------------------------- | :-------: | --------------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
@@ -766,6 +721,33 @@ Transfers ownership of the contract to a new account (`newOwner`). Can only be c
+### version + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#version) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. @@ -837,6 +819,7 @@ function _updateOperator( address tokenOwner, address operator, uint256 allowance, + bool notified, bytes operatorNotificationData ) internal nonpayable; ``` @@ -847,12 +830,13 @@ If the amount is zero then the operator is being revoked, otherwise the operator #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | -------------------------------------------------------------------------------------- | -| `tokenOwner` | `address` | The address that will give `operator` an allowance for on its balance. | -| `operator` | `address` | The address to grant an allowance to spend. | -| `allowance` | `uint256` | The maximum amount of token that `operator` can spend from the `tokenOwner`'s balance. | -| `operatorNotificationData` | `bytes` | - | +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------------------------------------------------------- | +| `tokenOwner` | `address` | The address that will give `operator` an allowance for on its balance. | +| `operator` | `address` | @param operatorNotificationData The data to send to the universalReceiver function of the operator in case of notifying | +| `allowance` | `uint256` | The maximum amount of token that `operator` can spend from the `tokenOwner`'s balance. | +| `notified` | `bool` | Boolean indicating whether the operator has been notified about the change of allowance | +| `operatorNotificationData` | `bytes` | The data to send to the universalReceiver function of the operator in case of notifying |
@@ -1037,47 +1021,6 @@ Allows to run custom logic after updating balances, but **before notifiying send
-### \_notifyTokenOperator - -```solidity -function _notifyTokenOperator( - address operator, - bytes lsp1Data -) internal nonpayable; -``` - -Attempt to notify the operator `operator` about the `amount` tokens being authorized with. -This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. -If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. - -#### Parameters - -| Name | Type | Description | -| ---------- | :-------: | ------------------------------------------------------------------------------ | -| `operator` | `address` | The address to call the {universalReceiver} function on. | -| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | - -
- -### \_notifyTokenSender - -```solidity -function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; -``` - -Attempt to notify the token sender `from` about the `amount` of tokens being transferred. -This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENSSENDER` as typeId, if `from` is a contract that supports the LSP1 interface. -If `from` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. - -#### Parameters - -| Name | Type | Description | -| ---------- | :-------: | -------------------------------------------------------------------------- | -| `from` | `address` | The address to call the {universalReceiver} function on. | -| `lsp1Data` | `bytes` | the data to be sent to the `from` address in the `universalReceiver` call. | - -
- ### \_notifyTokenReceiver ```solidity @@ -1122,10 +1065,12 @@ extension if the extension is set, if not it returns false.
-### \_getExtension +### \_getExtensionAndForwardValue ```solidity -function _getExtension(bytes4 functionSelector) internal view returns (address); +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); ``` Returns the extension address stored under the following data key: @@ -1134,6 +1079,8 @@ Returns the extension address stored under the following data key: - If no extension is stored, returns the address(0). +- we do not check that payable bool as in lsp7 standard we will always forward the value to the extension +
### \_fallbackLSP17Extendable @@ -1152,8 +1099,9 @@ function _fallbackLSP17Extendable( ``` Forwards the call with the received value to an extension mapped to a function selector. -Calls [`_getExtension`](#_getextension) to get the address of the extension mapped to the function selector being +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the address(0) will be returned. +Forwards the value if the extension is payable. Reverts if there is no extension for the function being called. If there is an extension for the function selector being called, it calls the extension with the CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and @@ -1249,24 +1197,25 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn - Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#revokedoperator) - Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol) -- Event signature: `RevokedOperator(address,address,bytes)` -- Event topic hash: `0x9ebfc34ce0da1178c4be66252d63a8a173d733c4bbb049241ce142dc4f0e0228` +- Event signature: `RevokedOperator(address,address,bool,bytes)` +- Event topic hash: `0x66015c8835ee443e5bc280176609215a5035da4bae05bdef994596d7e43aae22` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes operatorNotificationData); +event RevokedOperator(address indexed operator, address indexed tokenOwner, bool notified, bytes operatorNotificationData); ``` Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [`authorizedAmountFor(...)`](#`authorizedamountfor) to `0`. #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | ----------------------------------------------- | -| `operator` **`indexed`** | `address` | The address revoked from operating | -| `tokenOwner` **`indexed`** | `address` | The token owner | -| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | +| Name | Type | Description | +| -------------------------- | :-------: | ------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from operating | +| `tokenOwner` **`indexed`** | `address` | The token owner | +| `notified` | `bool` | Bool indicating whether the operator has been notified or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
@@ -1771,6 +1720,31 @@ reverts when there is no extension for the function selector being called with
+### OperatorAllowanceCannotBeIncreasedFromZero + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#operatorallowancecannotbeincreasedfromzero) +- Solidity implementation: [`LSP7CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol) +- Error signature: `OperatorAllowanceCannotBeIncreasedFromZero(address)` +- Error hash: `0xcba6e977` + +::: + +```solidity +error OperatorAllowanceCannotBeIncreasedFromZero(address operator); +``` + +Reverts when token owner call [`increaseAllowance`](#increaseallowance) for an operator that does not have any allowance + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | + +
+ ### OwnableCallerNotTheOwner :::note References diff --git a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md index 3792dc3990..49e6a5ceb2 100644 --- a/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md +++ b/docs/contracts/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.md @@ -170,7 +170,7 @@ function authorizeOperator( ) external nonpayable; ``` -Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). +Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -284,12 +284,6 @@ Returns the number of decimals used to get its user representation. If the asset ::: -:::info - -This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against the double spending allowance vulnerability. - -::: - ```solidity function decreaseAllowance( address operator, @@ -300,25 +294,7 @@ function decreaseAllowance( _Decrease the allowance of `operator` by -`subtractedAmount`_ -Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. - -
- -**Requirements:** - -- `operator` cannot be the zero address. -- `operator` must have allowance for the caller of at least `subtractedAmount`. - -
- -
- -**Emitted events:** - -- [`AuthorizedOperator`](#authorizedoperator) event indicating the updated allowance after decreasing it. -- [`RevokeOperator`](#revokeoperator) event if `subtractedAmount` is the full allowance, indicating `operator` does not have any alauthorizedAmountForlowance left for `msg.sender`. - -
+Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -440,12 +416,6 @@ Returns all `operator` addresses that are allowed to transfer or burn on behalf ::: -:::info - -This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against double spending allowance vulnerability. - -::: - ```solidity function increaseAllowance( address operator, @@ -456,24 +426,7 @@ function increaseAllowance( _Increase the allowance of `operator` by +`addedAmount`_ -Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. - -
- -**Requirements:** - -- `operator` cannot be the same address as `msg.sender` -- `operator` cannot be the zero address. - -
- -
- -**Emitted events:** - -- [`AuthorizedOperator`](#authorizedoperator) indicating the updated allowance - -
+Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -560,14 +513,15 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f - Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#revokeoperator) - Solidity implementation: [`LSP7CompatibleERC20.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol) -- Function signature: `revokeOperator(address,bytes)` -- Function selector: `0xca3631e7` +- Function signature: `revokeOperator(address,bool,bytes)` +- Function selector: `0x4521748e` ::: ```solidity function revokeOperator( address operator, + bool notify, bytes operatorNotificationData ) external nonpayable; ``` @@ -576,10 +530,11 @@ Removes the `operator` address as an operator of callers tokens, disallowing it #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | ----------------------------------------------- | -| `operator` | `address` | The address to revoke as an operator. | -| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | +| Name | Type | Description | +| -------------------------- | :-------: | --------------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
@@ -943,6 +898,33 @@ Transfers ownership of the contract to a new account (`newOwner`). Can only be c
+### version + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#version) +- Solidity implementation: [`LSP7CompatibleERC20.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. @@ -1014,6 +996,7 @@ function _updateOperator( address tokenOwner, address operator, uint256 amount, + bool notified, bytes operatorNotificationData ) internal nonpayable; ``` @@ -1127,47 +1110,6 @@ Allows to run custom logic after updating balances, but **before notifiying send
-### \_notifyTokenOperator - -```solidity -function _notifyTokenOperator( - address operator, - bytes lsp1Data -) internal nonpayable; -``` - -Attempt to notify the operator `operator` about the `amount` tokens being authorized with. -This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. -If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. - -#### Parameters - -| Name | Type | Description | -| ---------- | :-------: | ------------------------------------------------------------------------------ | -| `operator` | `address` | The address to call the {universalReceiver} function on. | -| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | - -
- -### \_notifyTokenSender - -```solidity -function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; -``` - -Attempt to notify the token sender `from` about the `amount` of tokens being transferred. -This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENSSENDER` as typeId, if `from` is a contract that supports the LSP1 interface. -If `from` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. - -#### Parameters - -| Name | Type | Description | -| ---------- | :-------: | -------------------------------------------------------------------------- | -| `from` | `address` | The address to call the {universalReceiver} function on. | -| `lsp1Data` | `bytes` | the data to be sent to the `from` address in the `universalReceiver` call. | - -
- ### \_notifyTokenReceiver ```solidity @@ -1212,10 +1154,12 @@ extension if the extension is set, if not it returns false.
-### \_getExtension +### \_getExtensionAndForwardValue ```solidity -function _getExtension(bytes4 functionSelector) internal view returns (address); +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); ``` Returns the extension address stored under the following data key: @@ -1224,6 +1168,8 @@ Returns the extension address stored under the following data key: - If no extension is stored, returns the address(0). +- we do not check that payable bool as in lsp7 standard we will always forward the value to the extension +
### \_fallbackLSP17Extendable @@ -1242,8 +1188,9 @@ function _fallbackLSP17Extendable( ``` Forwards the call with the received value to an extension mapped to a function selector. -Calls [`_getExtension`](#_getextension) to get the address of the extension mapped to the function selector being +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the address(0) will be returned. +Forwards the value if the extension is payable. Reverts if there is no extension for the function being called. If there is an extension for the function selector being called, it calls the extension with the CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and @@ -1366,24 +1313,25 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn - Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#revokedoperator) - Solidity implementation: [`LSP7CompatibleERC20.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol) -- Event signature: `RevokedOperator(address,address,bytes)` -- Event topic hash: `0x9ebfc34ce0da1178c4be66252d63a8a173d733c4bbb049241ce142dc4f0e0228` +- Event signature: `RevokedOperator(address,address,bool,bytes)` +- Event topic hash: `0x66015c8835ee443e5bc280176609215a5035da4bae05bdef994596d7e43aae22` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes operatorNotificationData); +event RevokedOperator(address indexed operator, address indexed tokenOwner, bool notified, bytes operatorNotificationData); ``` Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [`authorizedAmountFor(...)`](#`authorizedamountfor) to `0`. #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | ----------------------------------------------- | -| `operator` **`indexed`** | `address` | The address revoked from operating | -| `tokenOwner` **`indexed`** | `address` | The token owner | -| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | +| Name | Type | Description | +| -------------------------- | :-------: | ------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from operating | +| `tokenOwner` **`indexed`** | `address` | The token owner | +| `notified` | `bool` | Bool indicating whether the operator has been notified or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
@@ -1873,6 +1821,31 @@ reverts when there is no extension for the function selector being called with
+### OperatorAllowanceCannotBeIncreasedFromZero + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#operatorallowancecannotbeincreasedfromzero) +- Solidity implementation: [`LSP7CompatibleERC20.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol) +- Error signature: `OperatorAllowanceCannotBeIncreasedFromZero(address)` +- Error hash: `0xcba6e977` + +::: + +```solidity +error OperatorAllowanceCannotBeIncreasedFromZero(address operator); +``` + +Reverts when token owner call [`increaseAllowance`](#increaseallowance) for an operator that does not have any allowance + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | + +
+ ### OwnableCallerNotTheOwner :::note References diff --git a/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md b/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md index 63ac7291f1..0abc22ff66 100644 --- a/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md +++ b/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.md @@ -171,7 +171,7 @@ function authorizeOperator( ) external nonpayable; ``` -Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). +Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -285,12 +285,6 @@ Returns the number of decimals used to get its user representation. If the asset ::: -:::info - -This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against the double spending allowance vulnerability. - -::: - ```solidity function decreaseAllowance( address operator, @@ -301,25 +295,7 @@ function decreaseAllowance( _Decrease the allowance of `operator` by -`subtractedAmount`_ -Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. - -
- -**Requirements:** - -- `operator` cannot be the zero address. -- `operator` must have allowance for the caller of at least `subtractedAmount`. - -
- -
- -**Emitted events:** - -- [`AuthorizedOperator`](#authorizedoperator) event indicating the updated allowance after decreasing it. -- [`RevokeOperator`](#revokeoperator) event if `subtractedAmount` is the full allowance, indicating `operator` does not have any alauthorizedAmountForlowance left for `msg.sender`. - -
+Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -441,12 +417,6 @@ Returns all `operator` addresses that are allowed to transfer or burn on behalf ::: -:::info - -This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against double spending allowance vulnerability. - -::: - ```solidity function increaseAllowance( address operator, @@ -457,24 +427,7 @@ function increaseAllowance( _Increase the allowance of `operator` by +`addedAmount`_ -Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. - -
- -**Requirements:** - -- `operator` cannot be the same address as `msg.sender` -- `operator` cannot be the zero address. - -
- -
- -**Emitted events:** - -- [`AuthorizedOperator`](#authorizedoperator) indicating the updated allowance - -
+Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -594,14 +547,15 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f - Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#revokeoperator) - Solidity implementation: [`LSP7CompatibleERC20Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol) -- Function signature: `revokeOperator(address,bytes)` -- Function selector: `0xca3631e7` +- Function signature: `revokeOperator(address,bool,bytes)` +- Function selector: `0x4521748e` ::: ```solidity function revokeOperator( address operator, + bool notify, bytes operatorNotificationData ) external nonpayable; ``` @@ -610,10 +564,11 @@ Removes the `operator` address as an operator of callers tokens, disallowing it #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | ----------------------------------------------- | -| `operator` | `address` | The address to revoke as an operator. | -| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | +| Name | Type | Description | +| -------------------------- | :-------: | --------------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
@@ -977,6 +932,33 @@ Transfers ownership of the contract to a new account (`newOwner`). Can only be c
+### version + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#version) +- Solidity implementation: [`LSP7CompatibleERC20Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. @@ -1048,6 +1030,7 @@ function _updateOperator( address tokenOwner, address operator, uint256 amount, + bool notified, bytes operatorNotificationData ) internal nonpayable; ``` @@ -1161,47 +1144,6 @@ Allows to run custom logic after updating balances, but **before notifiying send
-### \_notifyTokenOperator - -```solidity -function _notifyTokenOperator( - address operator, - bytes lsp1Data -) internal nonpayable; -``` - -Attempt to notify the operator `operator` about the `amount` tokens being authorized with. -This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. -If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. - -#### Parameters - -| Name | Type | Description | -| ---------- | :-------: | ------------------------------------------------------------------------------ | -| `operator` | `address` | The address to call the {universalReceiver} function on. | -| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | - -
- -### \_notifyTokenSender - -```solidity -function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; -``` - -Attempt to notify the token sender `from` about the `amount` of tokens being transferred. -This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENSSENDER` as typeId, if `from` is a contract that supports the LSP1 interface. -If `from` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. - -#### Parameters - -| Name | Type | Description | -| ---------- | :-------: | -------------------------------------------------------------------------- | -| `from` | `address` | The address to call the {universalReceiver} function on. | -| `lsp1Data` | `bytes` | the data to be sent to the `from` address in the `universalReceiver` call. | - -
- ### \_notifyTokenReceiver ```solidity @@ -1246,10 +1188,12 @@ extension if the extension is set, if not it returns false.
-### \_getExtension +### \_getExtensionAndForwardValue ```solidity -function _getExtension(bytes4 functionSelector) internal view returns (address); +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); ``` Returns the extension address stored under the following data key: @@ -1258,6 +1202,8 @@ Returns the extension address stored under the following data key: - If no extension is stored, returns the address(0). +- we do not check that payable bool as in lsp7 standard we will always forward the value to the extension +
### \_fallbackLSP17Extendable @@ -1276,8 +1222,9 @@ function _fallbackLSP17Extendable( ``` Forwards the call with the received value to an extension mapped to a function selector. -Calls [`_getExtension`](#_getextension) to get the address of the extension mapped to the function selector being +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the address(0) will be returned. +Forwards the value if the extension is payable. Reverts if there is no extension for the function being called. If there is an extension for the function selector being called, it calls the extension with the CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and @@ -1400,24 +1347,25 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn - Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#revokedoperator) - Solidity implementation: [`LSP7CompatibleERC20Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol) -- Event signature: `RevokedOperator(address,address,bytes)` -- Event topic hash: `0x9ebfc34ce0da1178c4be66252d63a8a173d733c4bbb049241ce142dc4f0e0228` +- Event signature: `RevokedOperator(address,address,bool,bytes)` +- Event topic hash: `0x66015c8835ee443e5bc280176609215a5035da4bae05bdef994596d7e43aae22` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes operatorNotificationData); +event RevokedOperator(address indexed operator, address indexed tokenOwner, bool notified, bytes operatorNotificationData); ``` Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [`authorizedAmountFor(...)`](#`authorizedamountfor) to `0`. #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | ----------------------------------------------- | -| `operator` **`indexed`** | `address` | The address revoked from operating | -| `tokenOwner` **`indexed`** | `address` | The token owner | -| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | +| Name | Type | Description | +| -------------------------- | :-------: | ------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from operating | +| `tokenOwner` **`indexed`** | `address` | The token owner | +| `notified` | `bool` | Bool indicating whether the operator has been notified or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
@@ -1907,6 +1855,31 @@ reverts when there is no extension for the function selector being called with
+### OperatorAllowanceCannotBeIncreasedFromZero + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#operatorallowancecannotbeincreasedfromzero) +- Solidity implementation: [`LSP7CompatibleERC20Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol) +- Error signature: `OperatorAllowanceCannotBeIncreasedFromZero(address)` +- Error hash: `0xcba6e977` + +::: + +```solidity +error OperatorAllowanceCannotBeIncreasedFromZero(address operator); +``` + +Reverts when token owner call [`increaseAllowance`](#increaseallowance) for an operator that does not have any allowance + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | + +
+ ### OwnableCallerNotTheOwner :::note References diff --git a/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md b/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md index a178eff9e9..5bafb806fa 100644 --- a/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md +++ b/docs/contracts/contracts/LSP7DigitalAsset/presets/LSP7Mintable.md @@ -131,7 +131,7 @@ function authorizeOperator( ) external nonpayable; ``` -Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). +Sets an `amount` of tokens that an `operator` has access from the caller's balance (allowance). See [`authorizedAmountFor`](#authorizedamountfor). Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -245,12 +245,6 @@ Returns the number of decimals used to get its user representation. If the asset ::: -:::info - -This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against the double spending allowance vulnerability. - -::: - ```solidity function decreaseAllowance( address operator, @@ -261,25 +255,7 @@ function decreaseAllowance( _Decrease the allowance of `operator` by -`subtractedAmount`_ -Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. - -
- -**Requirements:** - -- `operator` cannot be the zero address. -- `operator` must have allowance for the caller of at least `subtractedAmount`. - -
- -
- -**Emitted events:** - -- [`AuthorizedOperator`](#authorizedoperator) event indicating the updated allowance after decreasing it. -- [`RevokeOperator`](#revokeoperator) event if `subtractedAmount` is the full allowance, indicating `operator` does not have any alauthorizedAmountForlowance left for `msg.sender`. - -
+Atomically decreases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -401,12 +377,6 @@ Returns all `operator` addresses that are allowed to transfer or burn on behalf ::: -:::info - -This is a non-standard function, not part of the LSP7 standard interface. It has been added in the LSP7 contract implementation so that it can be used as a prevention mechanism against double spending allowance vulnerability. - -::: - ```solidity function increaseAllowance( address operator, @@ -417,24 +387,7 @@ function increaseAllowance( _Increase the allowance of `operator` by +`addedAmount`_ -Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. - -
- -**Requirements:** - -- `operator` cannot be the same address as `msg.sender` -- `operator` cannot be the zero address. - -
- -
- -**Emitted events:** - -- [`AuthorizedOperator`](#authorizedoperator) indicating the updated allowance - -
+Atomically increases the allowance granted to `operator` by the caller. This is an alternative approach to [`authorizeOperator`](#authorizeoperator) that can be used as a mitigation for the double spending allowance problem. Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -529,14 +482,15 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f - Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#revokeoperator) - Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol) -- Function signature: `revokeOperator(address,bytes)` -- Function selector: `0xca3631e7` +- Function signature: `revokeOperator(address,bool,bytes)` +- Function selector: `0x4521748e` ::: ```solidity function revokeOperator( address operator, + bool notify, bytes operatorNotificationData ) external nonpayable; ``` @@ -545,10 +499,11 @@ Removes the `operator` address as an operator of callers tokens, disallowing it #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | ----------------------------------------------- | -| `operator` | `address` | The address to revoke as an operator. | -| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | +| Name | Type | Description | +| -------------------------- | :-------: | --------------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not. | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
@@ -803,6 +758,33 @@ Transfers ownership of the contract to a new account (`newOwner`). Can only be c
+### version + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#version) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. @@ -874,6 +856,7 @@ function _updateOperator( address tokenOwner, address operator, uint256 allowance, + bool notified, bytes operatorNotificationData ) internal nonpayable; ``` @@ -884,12 +867,13 @@ If the amount is zero then the operator is being revoked, otherwise the operator #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | -------------------------------------------------------------------------------------- | -| `tokenOwner` | `address` | The address that will give `operator` an allowance for on its balance. | -| `operator` | `address` | The address to grant an allowance to spend. | -| `allowance` | `uint256` | The maximum amount of token that `operator` can spend from the `tokenOwner`'s balance. | -| `operatorNotificationData` | `bytes` | - | +| Name | Type | Description | +| -------------------------- | :-------: | ----------------------------------------------------------------------------------------------------------------------- | +| `tokenOwner` | `address` | The address that will give `operator` an allowance for on its balance. | +| `operator` | `address` | @param operatorNotificationData The data to send to the universalReceiver function of the operator in case of notifying | +| `allowance` | `uint256` | The maximum amount of token that `operator` can spend from the `tokenOwner`'s balance. | +| `notified` | `bool` | Boolean indicating whether the operator has been notified about the change of allowance | +| `operatorNotificationData` | `bytes` | The data to send to the universalReceiver function of the operator in case of notifying |
@@ -1100,47 +1084,6 @@ Allows to run custom logic after updating balances, but **before notifiying send
-### \_notifyTokenOperator - -```solidity -function _notifyTokenOperator( - address operator, - bytes lsp1Data -) internal nonpayable; -``` - -Attempt to notify the operator `operator` about the `amount` tokens being authorized with. -This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. -If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. - -#### Parameters - -| Name | Type | Description | -| ---------- | :-------: | ------------------------------------------------------------------------------ | -| `operator` | `address` | The address to call the {universalReceiver} function on. | -| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | - -
- -### \_notifyTokenSender - -```solidity -function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; -``` - -Attempt to notify the token sender `from` about the `amount` of tokens being transferred. -This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP7_TOKENSSENDER` as typeId, if `from` is a contract that supports the LSP1 interface. -If `from` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. - -#### Parameters - -| Name | Type | Description | -| ---------- | :-------: | -------------------------------------------------------------------------- | -| `from` | `address` | The address to call the {universalReceiver} function on. | -| `lsp1Data` | `bytes` | the data to be sent to the `from` address in the `universalReceiver` call. | - -
- ### \_notifyTokenReceiver ```solidity @@ -1185,10 +1128,12 @@ extension if the extension is set, if not it returns false.
-### \_getExtension +### \_getExtensionAndForwardValue ```solidity -function _getExtension(bytes4 functionSelector) internal view returns (address); +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); ``` Returns the extension address stored under the following data key: @@ -1197,6 +1142,8 @@ Returns the extension address stored under the following data key: - If no extension is stored, returns the address(0). +- we do not check that payable bool as in lsp7 standard we will always forward the value to the extension +
### \_fallbackLSP17Extendable @@ -1215,8 +1162,9 @@ function _fallbackLSP17Extendable( ``` Forwards the call with the received value to an extension mapped to a function selector. -Calls [`_getExtension`](#_getextension) to get the address of the extension mapped to the function selector being +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the address(0) will be returned. +Forwards the value if the extension is payable. Reverts if there is no extension for the function being called. If there is an extension for the function selector being called, it calls the extension with the CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and @@ -1312,24 +1260,25 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn - Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#revokedoperator) - Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol) -- Event signature: `RevokedOperator(address,address,bytes)` -- Event topic hash: `0x9ebfc34ce0da1178c4be66252d63a8a173d733c4bbb049241ce142dc4f0e0228` +- Event signature: `RevokedOperator(address,address,bool,bytes)` +- Event topic hash: `0x66015c8835ee443e5bc280176609215a5035da4bae05bdef994596d7e43aae22` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes operatorNotificationData); +event RevokedOperator(address indexed operator, address indexed tokenOwner, bool notified, bytes operatorNotificationData); ``` Emitted when `tokenOwner` disables `operator` for `amount` tokens and set its [`authorizedAmountFor(...)`](#`authorizedamountfor) to `0`. #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | ----------------------------------------------- | -| `operator` **`indexed`** | `address` | The address revoked from operating | -| `tokenOwner` **`indexed`** | `address` | The token owner | -| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | +| Name | Type | Description | +| -------------------------- | :-------: | ------------------------------------------------------------- | +| `operator` **`indexed`** | `address` | The address revoked from operating | +| `tokenOwner` **`indexed`** | `address` | The token owner | +| `notified` | `bool` | Bool indicating whether the operator has been notified or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
@@ -1792,6 +1741,31 @@ reverts when there is no extension for the function selector being called with
+### OperatorAllowanceCannotBeIncreasedFromZero + +:::note References + +- Specification details: [**LSP-7-DigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-7-DigitalAsset.md#operatorallowancecannotbeincreasedfromzero) +- Solidity implementation: [`LSP7Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol) +- Error signature: `OperatorAllowanceCannotBeIncreasedFromZero(address)` +- Error hash: `0xcba6e977` + +::: + +```solidity +error OperatorAllowanceCannotBeIncreasedFromZero(address operator); +``` + +Reverts when token owner call [`increaseAllowance`](#increaseallowance) for an operator that does not have any allowance + +#### Parameters + +| Name | Type | Description | +| ---------- | :-------: | ----------- | +| `operator` | `address` | - | + +
+ ### OwnableCallerNotTheOwner :::note References diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md index 8cbab934be..e6e5e629de 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.md @@ -96,7 +96,7 @@ function authorizeOperator( ) external nonpayable; ``` -Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). +Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -323,8 +323,8 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f - Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokeoperator) - Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol) -- Function signature: `revokeOperator(address,bytes32,bytes)` -- Function selector: `0xf1b97e04` +- Function signature: `revokeOperator(address,bytes32,bool,bytes)` +- Function selector: `0xdb8c9663` ::: @@ -332,6 +332,7 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f function revokeOperator( address operator, bytes32 tokenId, + bool notify, bytes operatorNotificationData ) external nonpayable; ``` @@ -340,11 +341,12 @@ Remove access of `operator` for a given `tokenId`, disallowing it to transfer `t #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | ---------------------------------------------------- | -| `operator` | `address` | The address to revoke as an operator. | -| `tokenId` | `bytes32` | The tokenId `operator` is revoked from operating on. | -| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | +| Name | Type | Description | +| -------------------------- | :-------: | -------------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `tokenId` | `bytes32` | The tokenId `operator` is revoked from operating on. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
@@ -661,6 +663,33 @@ Transfers ownership of the contract to a new account (`newOwner`). Can only be c
+### version + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#version) +- Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. @@ -752,6 +781,7 @@ function _revokeOperator( address operator, address tokenOwner, bytes32 tokenId, + bool notified, bytes operatorNotificationData ) internal nonpayable; ``` @@ -991,39 +1021,6 @@ Allows to run custom logic after updating balances, but **before notifiying send
-### \_notifyTokenOperator - -```solidity -function _notifyTokenOperator( - address operator, - bytes lsp1Data -) internal nonpayable; -``` - -Attempt to notify the operator `operator` about the `tokenId` tokens being authorized. -This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. -If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. - -#### Parameters - -| Name | Type | Description | -| ---------- | :-------: | ------------------------------------------------------------------------------ | -| `operator` | `address` | The address to call the {universalReceiver} function on. | -| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | - -
- -### \_notifyTokenSender - -```solidity -function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; -``` - -An attempt is made to notify the token sender about the `tokenId` changing owners using -LSP1 interface. - -
- ### \_notifyTokenReceiver ```solidity @@ -1056,10 +1053,12 @@ extension if the extension is set, if not it returns false.
-### \_getExtension +### \_getExtensionAndForwardValue ```solidity -function _getExtension(bytes4 functionSelector) internal view returns (address); +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); ``` Returns the extension address stored under the following data key: @@ -1086,8 +1085,9 @@ function _fallbackLSP17Extendable( ``` Forwards the call with the received value to an extension mapped to a function selector. -Calls [`_getExtension`](#_getextension) to get the address of the extension mapped to the function selector being +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the address(0) will be returned. +We will always forward the value to the extension, as the LSP8 contract is not supposed to hold any native tokens. Reverts if there is no extension for the function being called. If there is an extension for the function selector being called, it calls the extension with the CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and @@ -1183,13 +1183,13 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn - Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokedoperator) - Solidity implementation: [`LSP8IdentifiableDigitalAsset.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol) -- Event signature: `RevokedOperator(address,address,bytes32,bytes)` -- Event topic hash: `0x501bc920d7f604417e315bcf29247652b2327fa1076b27b7f132bd8927cb15ea` +- Event signature: `RevokedOperator(address,address,bytes32,bool,bytes)` +- Event topic hash: `0x3ee932cea40ebbbfd8577d47156cc17cce8683802c57bbd1fb8c131c6f07af0a` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); +event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); ``` Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. @@ -1201,6 +1201,7 @@ Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on i | `operator` **`indexed`** | `address` | The address revoked from the operator array ({getOperatorsOf}). | | `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | | `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` is revoked from operating on. | +| `notified` | `bool` | Bool indicating whether the operator has been notified or not | | `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md index 181bbd5b7f..9b444005be 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.md @@ -94,7 +94,7 @@ function authorizeOperator( ) external nonpayable; ``` -Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). +Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -349,8 +349,8 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f - Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokeoperator) - Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) -- Function signature: `revokeOperator(address,bytes32,bytes)` -- Function selector: `0xf1b97e04` +- Function signature: `revokeOperator(address,bytes32,bool,bytes)` +- Function selector: `0xdb8c9663` ::: @@ -358,6 +358,7 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f function revokeOperator( address operator, bytes32 tokenId, + bool notify, bytes operatorNotificationData ) external nonpayable; ``` @@ -366,11 +367,12 @@ Remove access of `operator` for a given `tokenId`, disallowing it to transfer `t #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | ---------------------------------------------------- | -| `operator` | `address` | The address to revoke as an operator. | -| `tokenId` | `bytes32` | The tokenId `operator` is revoked from operating on. | -| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | +| Name | Type | Description | +| -------------------------- | :-------: | -------------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `tokenId` | `bytes32` | The tokenId `operator` is revoked from operating on. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
@@ -687,6 +689,33 @@ Transfers ownership of the contract to a new account (`newOwner`). Can only be c
+### version + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#version) +- Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. @@ -778,6 +807,7 @@ function _revokeOperator( address operator, address tokenOwner, bytes32 tokenId, + bool notified, bytes operatorNotificationData ) internal nonpayable; ``` @@ -1017,39 +1047,6 @@ Allows to run custom logic after updating balances, but **before notifiying send
-### \_notifyTokenOperator - -```solidity -function _notifyTokenOperator( - address operator, - bytes lsp1Data -) internal nonpayable; -``` - -Attempt to notify the operator `operator` about the `tokenId` tokens being authorized. -This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. -If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. - -#### Parameters - -| Name | Type | Description | -| ---------- | :-------: | ------------------------------------------------------------------------------ | -| `operator` | `address` | The address to call the {universalReceiver} function on. | -| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | - -
- -### \_notifyTokenSender - -```solidity -function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; -``` - -An attempt is made to notify the token sender about the `tokenId` changing owners using -LSP1 interface. - -
- ### \_notifyTokenReceiver ```solidity @@ -1082,10 +1079,12 @@ extension if the extension is set, if not it returns false.
-### \_getExtension +### \_getExtensionAndForwardValue ```solidity -function _getExtension(bytes4 functionSelector) internal view returns (address); +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); ``` Returns the extension address stored under the following data key: @@ -1112,8 +1111,9 @@ function _fallbackLSP17Extendable( ``` Forwards the call with the received value to an extension mapped to a function selector. -Calls [`_getExtension`](#_getextension) to get the address of the extension mapped to the function selector being +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the address(0) will be returned. +We will always forward the value to the extension, as the LSP8 contract is not supposed to hold any native tokens. Reverts if there is no extension for the function being called. If there is an extension for the function selector being called, it calls the extension with the CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and @@ -1209,13 +1209,13 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn - Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokedoperator) - Solidity implementation: [`LSP8Burnable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol) -- Event signature: `RevokedOperator(address,address,bytes32,bytes)` -- Event topic hash: `0x501bc920d7f604417e315bcf29247652b2327fa1076b27b7f132bd8927cb15ea` +- Event signature: `RevokedOperator(address,address,bytes32,bool,bytes)` +- Event topic hash: `0x3ee932cea40ebbbfd8577d47156cc17cce8683802c57bbd1fb8c131c6f07af0a` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); +event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); ``` Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. @@ -1227,6 +1227,7 @@ Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on i | `operator` **`indexed`** | `address` | The address revoked from the operator array ({getOperatorsOf}). | | `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | | `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` is revoked from operating on. | +| `notified` | `bool` | Bool indicating whether the operator has been notified or not | | `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md index 53a5b5f124..a2688e0efa 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.md @@ -94,7 +94,7 @@ function authorizeOperator( ) external nonpayable; ``` -Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). +Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -321,8 +321,8 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f - Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokeoperator) - Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) -- Function signature: `revokeOperator(address,bytes32,bytes)` -- Function selector: `0xf1b97e04` +- Function signature: `revokeOperator(address,bytes32,bool,bytes)` +- Function selector: `0xdb8c9663` ::: @@ -330,6 +330,7 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f function revokeOperator( address operator, bytes32 tokenId, + bool notify, bytes operatorNotificationData ) external nonpayable; ``` @@ -338,11 +339,12 @@ Remove access of `operator` for a given `tokenId`, disallowing it to transfer `t #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | ---------------------------------------------------- | -| `operator` | `address` | The address to revoke as an operator. | -| `tokenId` | `bytes32` | The tokenId `operator` is revoked from operating on. | -| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | +| Name | Type | Description | +| -------------------------- | :-------: | -------------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `tokenId` | `bytes32` | The tokenId `operator` is revoked from operating on. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
@@ -686,6 +688,33 @@ Transfers ownership of the contract to a new account (`newOwner`). Can only be c
+### version + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#version) +- Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. @@ -777,6 +806,7 @@ function _revokeOperator( address operator, address tokenOwner, bytes32 tokenId, + bool notified, bytes operatorNotificationData ) internal nonpayable; ``` @@ -991,39 +1021,6 @@ Allows to run custom logic after updating balances, but **before notifiying send
-### \_notifyTokenOperator - -```solidity -function _notifyTokenOperator( - address operator, - bytes lsp1Data -) internal nonpayable; -``` - -Attempt to notify the operator `operator` about the `tokenId` tokens being authorized. -This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. -If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. - -#### Parameters - -| Name | Type | Description | -| ---------- | :-------: | ------------------------------------------------------------------------------ | -| `operator` | `address` | The address to call the {universalReceiver} function on. | -| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | - -
- -### \_notifyTokenSender - -```solidity -function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; -``` - -An attempt is made to notify the token sender about the `tokenId` changing owners using -LSP1 interface. - -
- ### \_notifyTokenReceiver ```solidity @@ -1056,10 +1053,12 @@ extension if the extension is set, if not it returns false.
-### \_getExtension +### \_getExtensionAndForwardValue ```solidity -function _getExtension(bytes4 functionSelector) internal view returns (address); +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); ``` Returns the extension address stored under the following data key: @@ -1086,8 +1085,9 @@ function _fallbackLSP17Extendable( ``` Forwards the call with the received value to an extension mapped to a function selector. -Calls [`_getExtension`](#_getextension) to get the address of the extension mapped to the function selector being +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the address(0) will be returned. +We will always forward the value to the extension, as the LSP8 contract is not supposed to hold any native tokens. Reverts if there is no extension for the function being called. If there is an extension for the function selector being called, it calls the extension with the CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and @@ -1183,13 +1183,13 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn - Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokedoperator) - Solidity implementation: [`LSP8CappedSupply.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol) -- Event signature: `RevokedOperator(address,address,bytes32,bytes)` -- Event topic hash: `0x501bc920d7f604417e315bcf29247652b2327fa1076b27b7f132bd8927cb15ea` +- Event signature: `RevokedOperator(address,address,bytes32,bool,bytes)` +- Event topic hash: `0x3ee932cea40ebbbfd8577d47156cc17cce8683802c57bbd1fb8c131c6f07af0a` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); +event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); ``` Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. @@ -1201,6 +1201,7 @@ Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on i | `operator` **`indexed`** | `address` | The address revoked from the operator array ({getOperatorsOf}). | | `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | | `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` is revoked from operating on. | +| `notified` | `bool` | Bool indicating whether the operator has been notified or not | | `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.md index d821242109..a23d9573db 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.md @@ -122,7 +122,7 @@ function authorizeOperator( ) external nonpayable; ``` -Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). +Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). Notify the operator based on the LSP1-UniversalReceiver standard
@@ -486,8 +486,8 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f - Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokeoperator) - Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) -- Function signature: `revokeOperator(address,bytes32,bytes)` -- Function selector: `0xf1b97e04` +- Function signature: `revokeOperator(address,bytes32,bool,bytes)` +- Function selector: `0xdb8c9663` ::: @@ -495,6 +495,7 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f function revokeOperator( address operator, bytes32 tokenId, + bool notify, bytes operatorNotificationData ) external nonpayable; ``` @@ -503,11 +504,12 @@ Remove access of `operator` for a given `tokenId`, disallowing it to transfer `t #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | ---------------------------------------------------- | -| `operator` | `address` | The address to revoke as an operator. | -| `tokenId` | `bytes32` | The tokenId `operator` is revoked from operating on. | -| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | +| Name | Type | Description | +| -------------------------- | :-------: | -------------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `tokenId` | `bytes32` | The tokenId `operator` is revoked from operating on. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
@@ -1037,6 +1039,33 @@ Transfers ownership of the contract to a new account (`newOwner`). Can only be c
+### version + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#version) +- Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. @@ -1128,6 +1157,7 @@ function _revokeOperator( address operator, address tokenOwner, bytes32 tokenId, + bool notified, bytes operatorNotificationData ) internal nonpayable; ``` @@ -1262,39 +1292,6 @@ Allows to run custom logic after updating balances, but **before notifiying send
-### \_notifyTokenOperator - -```solidity -function _notifyTokenOperator( - address operator, - bytes lsp1Data -) internal nonpayable; -``` - -Attempt to notify the operator `operator` about the `tokenId` tokens being authorized. -This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. -If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. - -#### Parameters - -| Name | Type | Description | -| ---------- | :-------: | ------------------------------------------------------------------------------ | -| `operator` | `address` | The address to call the {universalReceiver} function on. | -| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | - -
- -### \_notifyTokenSender - -```solidity -function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; -``` - -An attempt is made to notify the token sender about the `tokenId` changing owners using -LSP1 interface. - -
- ### \_notifyTokenReceiver ```solidity @@ -1327,10 +1324,12 @@ extension if the extension is set, if not it returns false.
-### \_getExtension +### \_getExtensionAndForwardValue ```solidity -function _getExtension(bytes4 functionSelector) internal view returns (address); +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); ``` Returns the extension address stored under the following data key: @@ -1357,8 +1356,9 @@ function _fallbackLSP17Extendable( ``` Forwards the call with the received value to an extension mapped to a function selector. -Calls [`_getExtension`](#_getextension) to get the address of the extension mapped to the function selector being +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the address(0) will be returned. +We will always forward the value to the extension, as the LSP8 contract is not supposed to hold any native tokens. Reverts if there is no extension for the function being called. If there is an extension for the function selector being called, it calls the extension with the CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and @@ -1547,13 +1547,13 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn - Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokedoperator) - Solidity implementation: [`LSP8CompatibleERC721.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol) -- Event signature: `RevokedOperator(address,address,bytes32,bytes)` -- Event topic hash: `0x501bc920d7f604417e315bcf29247652b2327fa1076b27b7f132bd8927cb15ea` +- Event signature: `RevokedOperator(address,address,bytes32,bool,bytes)` +- Event topic hash: `0x3ee932cea40ebbbfd8577d47156cc17cce8683802c57bbd1fb8c131c6f07af0a` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); +event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); ``` Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. @@ -1565,6 +1565,7 @@ Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on i | `operator` **`indexed`** | `address` | The address revoked from the operator array ({getOperatorsOf}). | | `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | | `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` is revoked from operating on. | +| `notified` | `bool` | Bool indicating whether the operator has been notified or not | | `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md index eea20e1d98..a9dec5aa0a 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.md @@ -94,7 +94,7 @@ function authorizeOperator( ) external nonpayable; ``` -Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). +Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -321,8 +321,8 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f - Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokeoperator) - Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) -- Function signature: `revokeOperator(address,bytes32,bytes)` -- Function selector: `0xf1b97e04` +- Function signature: `revokeOperator(address,bytes32,bool,bytes)` +- Function selector: `0xdb8c9663` ::: @@ -330,6 +330,7 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f function revokeOperator( address operator, bytes32 tokenId, + bool notify, bytes operatorNotificationData ) external nonpayable; ``` @@ -338,11 +339,12 @@ Remove access of `operator` for a given `tokenId`, disallowing it to transfer `t #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | ---------------------------------------------------- | -| `operator` | `address` | The address to revoke as an operator. | -| `tokenId` | `bytes32` | The tokenId `operator` is revoked from operating on. | -| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | +| Name | Type | Description | +| -------------------------- | :-------: | -------------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `tokenId` | `bytes32` | The tokenId `operator` is revoked from operating on. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
@@ -692,6 +694,33 @@ Transfers ownership of the contract to a new account (`newOwner`). Can only be c
+### version + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#version) +- Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. @@ -783,6 +812,7 @@ function _revokeOperator( address operator, address tokenOwner, bytes32 tokenId, + bool notified, bytes operatorNotificationData ) internal nonpayable; ``` @@ -1019,39 +1049,6 @@ Allows to run custom logic after updating balances, but **before notifiying send
-### \_notifyTokenOperator - -```solidity -function _notifyTokenOperator( - address operator, - bytes lsp1Data -) internal nonpayable; -``` - -Attempt to notify the operator `operator` about the `tokenId` tokens being authorized. -This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. -If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. - -#### Parameters - -| Name | Type | Description | -| ---------- | :-------: | ------------------------------------------------------------------------------ | -| `operator` | `address` | The address to call the {universalReceiver} function on. | -| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | - -
- -### \_notifyTokenSender - -```solidity -function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; -``` - -An attempt is made to notify the token sender about the `tokenId` changing owners using -LSP1 interface. - -
- ### \_notifyTokenReceiver ```solidity @@ -1084,10 +1081,12 @@ extension if the extension is set, if not it returns false.
-### \_getExtension +### \_getExtensionAndForwardValue ```solidity -function _getExtension(bytes4 functionSelector) internal view returns (address); +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); ``` Returns the extension address stored under the following data key: @@ -1114,8 +1113,9 @@ function _fallbackLSP17Extendable( ``` Forwards the call with the received value to an extension mapped to a function selector. -Calls [`_getExtension`](#_getextension) to get the address of the extension mapped to the function selector being +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the address(0) will be returned. +We will always forward the value to the extension, as the LSP8 contract is not supposed to hold any native tokens. Reverts if there is no extension for the function being called. If there is an extension for the function selector being called, it calls the extension with the CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and @@ -1211,13 +1211,13 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn - Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokedoperator) - Solidity implementation: [`LSP8Enumerable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol) -- Event signature: `RevokedOperator(address,address,bytes32,bytes)` -- Event topic hash: `0x501bc920d7f604417e315bcf29247652b2327fa1076b27b7f132bd8927cb15ea` +- Event signature: `RevokedOperator(address,address,bytes32,bool,bytes)` +- Event topic hash: `0x3ee932cea40ebbbfd8577d47156cc17cce8683802c57bbd1fb8c131c6f07af0a` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); +event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); ``` Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. @@ -1229,6 +1229,7 @@ Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on i | `operator` **`indexed`** | `address` | The address revoked from the operator array ({getOperatorsOf}). | | `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | | `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` is revoked from operating on. | +| `notified` | `bool` | Bool indicating whether the operator has been notified or not | | `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.md index 232dbd9d5d..4c33c7597e 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.md @@ -129,7 +129,7 @@ function authorizeOperator( ) external nonpayable; ``` -Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). +Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). Notify the operator based on the LSP1-UniversalReceiver standard
@@ -528,8 +528,8 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f - Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokeoperator) - Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) -- Function signature: `revokeOperator(address,bytes32,bytes)` -- Function selector: `0xf1b97e04` +- Function signature: `revokeOperator(address,bytes32,bool,bytes)` +- Function selector: `0xdb8c9663` ::: @@ -537,6 +537,7 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f function revokeOperator( address operator, bytes32 tokenId, + bool notify, bytes operatorNotificationData ) external nonpayable; ``` @@ -545,11 +546,12 @@ Remove access of `operator` for a given `tokenId`, disallowing it to transfer `t #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | ---------------------------------------------------- | -| `operator` | `address` | The address to revoke as an operator. | -| `tokenId` | `bytes32` | The tokenId `operator` is revoked from operating on. | -| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | +| Name | Type | Description | +| -------------------------- | :-------: | -------------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `tokenId` | `bytes32` | The tokenId `operator` is revoked from operating on. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
@@ -1079,6 +1081,33 @@ Transfers ownership of the contract to a new account (`newOwner`). Can only be c
+### version + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#version) +- Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. @@ -1170,6 +1199,7 @@ function _revokeOperator( address operator, address tokenOwner, bytes32 tokenId, + bool notified, bytes operatorNotificationData ) internal nonpayable; ``` @@ -1304,39 +1334,6 @@ Allows to run custom logic after updating balances, but **before notifiying send
-### \_notifyTokenOperator - -```solidity -function _notifyTokenOperator( - address operator, - bytes lsp1Data -) internal nonpayable; -``` - -Attempt to notify the operator `operator` about the `tokenId` tokens being authorized. -This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. -If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. - -#### Parameters - -| Name | Type | Description | -| ---------- | :-------: | ------------------------------------------------------------------------------ | -| `operator` | `address` | The address to call the {universalReceiver} function on. | -| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | - -
- -### \_notifyTokenSender - -```solidity -function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; -``` - -An attempt is made to notify the token sender about the `tokenId` changing owners using -LSP1 interface. - -
- ### \_notifyTokenReceiver ```solidity @@ -1369,10 +1366,12 @@ extension if the extension is set, if not it returns false.
-### \_getExtension +### \_getExtensionAndForwardValue ```solidity -function _getExtension(bytes4 functionSelector) internal view returns (address); +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); ``` Returns the extension address stored under the following data key: @@ -1399,8 +1398,9 @@ function _fallbackLSP17Extendable( ``` Forwards the call with the received value to an extension mapped to a function selector. -Calls [`_getExtension`](#_getextension) to get the address of the extension mapped to the function selector being +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the address(0) will be returned. +We will always forward the value to the extension, as the LSP8 contract is not supposed to hold any native tokens. Reverts if there is no extension for the function being called. If there is an extension for the function selector being called, it calls the extension with the CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and @@ -1589,13 +1589,13 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn - Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokedoperator) - Solidity implementation: [`LSP8CompatibleERC721Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol) -- Event signature: `RevokedOperator(address,address,bytes32,bytes)` -- Event topic hash: `0x501bc920d7f604417e315bcf29247652b2327fa1076b27b7f132bd8927cb15ea` +- Event signature: `RevokedOperator(address,address,bytes32,bool,bytes)` +- Event topic hash: `0x3ee932cea40ebbbfd8577d47156cc17cce8683802c57bbd1fb8c131c6f07af0a` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); +event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); ``` Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. @@ -1607,6 +1607,7 @@ Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on i | `operator` **`indexed`** | `address` | The address revoked from the operator array ({getOperatorsOf}). | | `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | | `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` is revoked from operating on. | +| `notified` | `bool` | Bool indicating whether the operator has been notified or not | | `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
diff --git a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md index 8f61176f72..8308d80366 100644 --- a/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md +++ b/docs/contracts/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.md @@ -125,7 +125,7 @@ function authorizeOperator( ) external nonpayable; ``` -Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). +Allow an `operator` address to transfer or burn a specific `tokenId` on behalf of its token owner. See [`isOperatorFor`](#isoperatorfor). Notify the operator based on the LSP1-UniversalReceiver standard #### Parameters @@ -387,8 +387,8 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f - Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokeoperator) - Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) -- Function signature: `revokeOperator(address,bytes32,bytes)` -- Function selector: `0xf1b97e04` +- Function signature: `revokeOperator(address,bytes32,bool,bytes)` +- Function selector: `0xdb8c9663` ::: @@ -396,6 +396,7 @@ Leaves the contract without owner. It will not be possible to call `onlyOwner` f function revokeOperator( address operator, bytes32 tokenId, + bool notify, bytes operatorNotificationData ) external nonpayable; ``` @@ -404,11 +405,12 @@ Remove access of `operator` for a given `tokenId`, disallowing it to transfer `t #### Parameters -| Name | Type | Description | -| -------------------------- | :-------: | ---------------------------------------------------- | -| `operator` | `address` | The address to revoke as an operator. | -| `tokenId` | `bytes32` | The tokenId `operator` is revoked from operating on. | -| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. | +| Name | Type | Description | +| -------------------------- | :-------: | -------------------------------------------------------- | +| `operator` | `address` | The address to revoke as an operator. | +| `tokenId` | `bytes32` | The tokenId `operator` is revoked from operating on. | +| `notify` | `bool` | Boolean indicating whether to notify the operator or not | +| `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
@@ -725,6 +727,33 @@ Transfers ownership of the contract to a new account (`newOwner`). Can only be c
+### version + +:::note References + +- Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#version) +- Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. @@ -816,6 +845,7 @@ function _revokeOperator( address operator, address tokenOwner, bytes32 tokenId, + bool notified, bytes operatorNotificationData ) internal nonpayable; ``` @@ -1055,39 +1085,6 @@ Allows to run custom logic after updating balances, but **before notifiying send
-### \_notifyTokenOperator - -```solidity -function _notifyTokenOperator( - address operator, - bytes lsp1Data -) internal nonpayable; -``` - -Attempt to notify the operator `operator` about the `tokenId` tokens being authorized. -This is done by calling its [`universalReceiver`](#universalreceiver) function with the `_TYPEID_LSP8_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface. -If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent. - -#### Parameters - -| Name | Type | Description | -| ---------- | :-------: | ------------------------------------------------------------------------------ | -| `operator` | `address` | The address to call the {universalReceiver} function on. | -| `lsp1Data` | `bytes` | the data to be sent to the `operator` address in the `universalReceiver` call. | - -
- -### \_notifyTokenSender - -```solidity -function _notifyTokenSender(address from, bytes lsp1Data) internal nonpayable; -``` - -An attempt is made to notify the token sender about the `tokenId` changing owners using -LSP1 interface. - -
- ### \_notifyTokenReceiver ```solidity @@ -1120,10 +1117,12 @@ extension if the extension is set, if not it returns false.
-### \_getExtension +### \_getExtensionAndForwardValue ```solidity -function _getExtension(bytes4 functionSelector) internal view returns (address); +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); ``` Returns the extension address stored under the following data key: @@ -1150,8 +1149,9 @@ function _fallbackLSP17Extendable( ``` Forwards the call with the received value to an extension mapped to a function selector. -Calls [`_getExtension`](#_getextension) to get the address of the extension mapped to the function selector being +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the address(0) will be returned. +We will always forward the value to the extension, as the LSP8 contract is not supposed to hold any native tokens. Reverts if there is no extension for the function being called. If there is an extension for the function selector being called, it calls the extension with the CALL opcode, passing the [`msg.data`](#msg.data) appended with the 20 bytes of the [`msg.sender`](#msg.sender) and @@ -1247,13 +1247,13 @@ event OwnershipTransferred(address indexed previousOwner, address indexed newOwn - Specification details: [**LSP-8-IdentifiableDigitalAsset**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-8-IdentifiableDigitalAsset.md#revokedoperator) - Solidity implementation: [`LSP8Mintable.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol) -- Event signature: `RevokedOperator(address,address,bytes32,bytes)` -- Event topic hash: `0x501bc920d7f604417e315bcf29247652b2327fa1076b27b7f132bd8927cb15ea` +- Event signature: `RevokedOperator(address,address,bytes32,bool,bytes)` +- Event topic hash: `0x3ee932cea40ebbbfd8577d47156cc17cce8683802c57bbd1fb8c131c6f07af0a` ::: ```solidity -event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bytes operatorNotificationData); +event RevokedOperator(address indexed operator, address indexed tokenOwner, bytes32 indexed tokenId, bool notified, bytes operatorNotificationData); ``` Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on its behalf. @@ -1265,6 +1265,7 @@ Emitted when `tokenOwner` disables `operator` to transfer or burn `tokenId` on i | `operator` **`indexed`** | `address` | The address revoked from the operator array ({getOperatorsOf}). | | `tokenOwner` **`indexed`** | `address` | The owner of the `tokenId`. | | `tokenId` **`indexed`** | `bytes32` | The tokenId `operator` is revoked from operating on. | +| `notified` | `bool` | Bool indicating whether the operator has been notified or not | | `operatorNotificationData` | `bytes` | The data to notify the operator about via LSP1. |
diff --git a/docs/contracts/contracts/LSP9Vault/LSP9Vault.md b/docs/contracts/contracts/LSP9Vault/LSP9Vault.md index 8622e63628..fc9a6481fd 100644 --- a/docs/contracts/contracts/LSP9Vault/LSP9Vault.md +++ b/docs/contracts/contracts/LSP9Vault/LSP9Vault.md @@ -44,7 +44,7 @@ Sets `initialOwner` as the contract owner and the `SupportedStandards:LSP9Vault` **Emitted events:** -- [`ValueReceived`](#valuereceived) event when funding the contract on deployment. +- [`UniversalReceiver`](#universalreceiver) event when funding the contract on deployment. - [`OwnershipTransferred`](#ownershiptransferred) event when `initialOwner` is set as the contract [`owner`](#owner). - [`DataChanged`](#datachanged) event when setting the [`_LSP9_SUPPORTED_STANDARDS_KEY`](#_lsp9_supported_standards_key). - [`UniversalReceiver`](#universalreceiver) event when notifying the `initialOwner`. @@ -96,7 +96,7 @@ This function is executed when: **Emitted events:** -- [`ValueReceived`](#valuereceived) event when receiving native tokens. +- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens and extension function selector is not found or not payable.
@@ -125,7 +125,7 @@ Executed: **Emitted events:** -- [`ValueReceived`](#valuereceived) when receiving native tokens. +- [`UniversalReceiver`](#universalreceiver) when receiving native tokens.
@@ -310,7 +310,7 @@ Generic executor function to: - [`Executed`](#executed) event for each call that uses under `operationType`: `CALL` (0) and `STATICCALL` (3). - [`ContractCreated`](#contractcreated) event, when a contract is created under `operationType`: `CREATE` (1) and `CREATE2` (2). -- [`ValueReceived`](#valuereceived) event when receiving native tokens. +- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens. @@ -379,7 +379,7 @@ Batch executor function that behaves the same as [`execute`](#execute) but allow - [`Executed`](#executed) event for each call that uses under `operationType`: `CALL` (0) and `STATICCALL` (3). (each iteration) - [`ContractCreated`](#contractcreated) event, when a contract is created under `operationType`: `CREATE` (1) and `CREATE2` (2). (each iteration) -- [`ValueReceived`](#valuereceived) event when receiving native tokens. +- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens. @@ -594,7 +594,6 @@ Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data **Emitted events:** -- [`ValueReceived`](#valuereceived) event when receiving native tokens. - [`DataChanged`](#datachanged) event. @@ -639,7 +638,6 @@ Batch data setting function that behaves the same as [`setData`](#setdata) but a **Emitted events:** -- [`ValueReceived`](#valuereceived) event when receiving native tokens. - [`DataChanged`](#datachanged) event. (on each iteration of setting data) @@ -761,7 +759,6 @@ Achieves the goal of [LSP-1-UniversalReceiver] by allowing the account to be not **Emitted events:** -- [`ValueReceived`](#valuereceived) when receiving native tokens. - [`UniversalReceiver`](#universalreceiver) event with the function parameters, call options, and the response of the UniversalReceiverDelegates (URD) contract that was called. @@ -781,6 +778,33 @@ Achieves the goal of [LSP-1-UniversalReceiver] by allowing the account to be not
+### version + +:::note References + +- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#version) +- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP9Vault/LSP9Vault.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. @@ -1103,10 +1127,12 @@ extension if the extension is set, if not it returns false.
-### \_getExtension +### \_getExtensionAndForwardValue ```solidity -function _getExtension(bytes4 functionSelector) internal view returns (address); +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); ``` Returns the extension address stored under the following data key: @@ -1139,8 +1165,9 @@ function _fallbackLSP17Extendable( ``` Forwards the call to an extension mapped to a function selector. -Calls [`_getExtension`](#_getextension) to get the address of the extension mapped to the function selector being +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the `address(0)` will be returned. +Forwards the value if the extension is payable. Reverts if there is no extension for the function being called, except for the `bytes4(0)` function selector, which passes even if there is no extension for it. If there is an extension for the function selector being called, it calls the extension with the `CALL` opcode, passing the `msg.data` appended with the 20 bytes of the [`msg.sender`](#msg.sender) and 32 bytes of the `msg.value`. @@ -1374,34 +1401,6 @@ Emitted when the [`universalReceiver`](#universalreceiver) function was called w
-### ValueReceived - -:::note References - -- Specification details: [**LSP-9-Vault**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-9-Vault.md#valuereceived) -- Solidity implementation: [`LSP9Vault.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP9Vault/LSP9Vault.sol) -- Event signature: `ValueReceived(address,uint256)` -- Event topic hash: `0x7e71433ddf847725166244795048ecf3e3f9f35628254ecbf736056664233493` - -::: - -```solidity -event ValueReceived(address indexed sender, uint256 indexed value); -``` - -_`value` native tokens received from `sender`._ - -Emitted when receiving native tokens. - -#### Parameters - -| Name | Type | Description | -| ---------------------- | :-------: | ---------------------------------------------------------- | -| `sender` **`indexed`** | `address` | The address that sent some native tokens to this contract. | -| `value` **`indexed`** | `uint256` | The amount of native tokens received. | - -
- ## Errors ### ERC725X_ContractDeploymentFailed diff --git a/docs/contracts/contracts/UniversalProfile.md b/docs/contracts/contracts/UniversalProfile.md index 180c43ddc0..4ec73c3b34 100644 --- a/docs/contracts/contracts/UniversalProfile.md +++ b/docs/contracts/contracts/UniversalProfile.md @@ -44,7 +44,7 @@ Set `initialOwner` as the contract owner and the `SupportedStandards:LSP3Univers **Emitted events:** -- [`ValueReceived`](#valuereceived) event when funding the contract on deployment. +- [`UniversalReceiver`](#universalreceiver) event when funding the contract on deployment. - [`OwnershipTransferred`](#ownershiptransferred) event when `initialOwner` is set as the contract [`owner`](#owner). - [`DataChanged`](#datachanged) event when setting the [`_LSP3_SUPPORTED_STANDARDS_KEY`](#_lsp3_supported_standards_key). @@ -261,7 +261,7 @@ Generic executor function to: - [`Executed`](#executed) event for each call that uses under `operationType`: `CALL` (0), `STATICCALL` (3) and `DELEGATECALL` (4). - [`ContractCreated`](#contractcreated) event, when a contract is created under `operationType`: `CREATE` (1) and `CREATE2` (2). -- [`ValueReceived`](#valuereceived) event when receiving native tokens. +- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens. @@ -330,7 +330,7 @@ Batch executor function that behaves the same as [`execute`](#execute) but allow - [`Executed`](#executed) event for each call that uses under `operationType`: `CALL` (0), `STATICCALL` (3) and `DELEGATECALL` (4). (each iteration) - [`ContractCreated`](#contractcreated) event, when a contract is created under `operationType`: `CREATE` (1) and `CREATE2` (2) (each iteration) -- [`ValueReceived`](#valuereceived) event when receiving native tokens. +- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens. @@ -594,7 +594,7 @@ Sets a single bytes value `dataValue` in the ERC725Y storage for a specific data **Emitted events:** -- [`ValueReceived`](#valuereceived) event when receiving native tokens. +- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens. - [`DataChanged`](#datachanged) event. @@ -639,7 +639,7 @@ Batch data setting function that behaves the same as [`setData`](#setdata) but a **Emitted events:** -- [`ValueReceived`](#valuereceived) event when receiving native tokens. +- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens. - [`DataChanged`](#datachanged) event. (on each iteration of setting data) @@ -761,7 +761,7 @@ Achieves the goal of [LSP-1-UniversalReceiver] by allowing the account to be not **Emitted events:** -- [`ValueReceived`](#valuereceived) when receiving native tokens. +- [`UniversalReceiver`](#universalreceiver) when receiving native tokens. - [`UniversalReceiver`](#universalreceiver) event with the function parameters, call options, and the response of the UniversalReceiverDelegates (URD) contract that was called. @@ -781,6 +781,33 @@ Achieves the goal of [LSP-1-UniversalReceiver] by allowing the account to be not
+### version + +:::note References + +- Specification details: [**UniversalProfile**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-3-UniversalProfile-Metadata.md#version) +- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/UniversalProfile.sol) +- Function signature: `version()` +- Function selector: `0x54fd4d50` + +::: + +```solidity +function version() external view returns (string); +``` + +_Contract version._ + +Get the version of the contract. + +#### Returns + +| Name | Type | Description | +| ---- | :------: | -------------------------------- | +| `0` | `string` | The version of the the contract. | + +
+ ## Internal Methods Any method labeled as `internal` serves as utility function within the contract. They can be used when writing solidity contracts that inherit from this contract. These methods can be extended or modified by overriding their internal behavior to suit specific needs. @@ -1088,10 +1115,12 @@ extension if the extension is set, if not it returns false.
-### \_getExtension +### \_getExtensionAndForwardValue ```solidity -function _getExtension(bytes4 functionSelector) internal view returns (address); +function _getExtensionAndForwardValue( + bytes4 functionSelector +) internal view returns (address, bool); ``` Returns the extension address stored under the following data key: @@ -1124,8 +1153,9 @@ function _fallbackLSP17Extendable( ``` Forwards the call to an extension mapped to a function selector. -Calls [`_getExtension`](#_getextension) to get the address of the extension mapped to the function selector being +Calls [`_getExtensionAndForwardValue`](#_getextensionandforwardvalue) to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the `address(0)` will be returned. +Forwards the value sent with the call to the extension if the function selector is mapped to a payable extension. Reverts if there is no extension for the function being called, except for the `bytes4(0)` function selector, which passes even if there is no extension for it. If there is an extension for the function selector being called, it calls the extension with the `CALL` opcode, passing the `msg.data` appended with the 20 bytes of the [`msg.sender`](#msg.sender) and 32 bytes of the `msg.value`. @@ -1141,8 +1171,6 @@ function _verifyCall( ``` Calls [`lsp20VerifyCall`](#lsp20verifycall) function on the logicVerifier. -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
@@ -1156,19 +1184,6 @@ function _verifyCallResult( ``` Calls [`lsp20VerifyCallResult`](#lsp20verifycallresult) function on the logicVerifier. -Reverts in case the value returned does not match the success value (lsp20VerifyCallResult selector) - -
- -### \_validateCall - -```solidity -function _validateCall( - bool postCall, - bool success, - bytes returnedData -) internal pure; -```
@@ -1400,34 +1415,6 @@ Emitted when the [`universalReceiver`](#universalreceiver) function was called w
-### ValueReceived - -:::note References - -- Specification details: [**UniversalProfile**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-3-UniversalProfile-Metadata.md#valuereceived) -- Solidity implementation: [`UniversalProfile.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/UniversalProfile.sol) -- Event signature: `ValueReceived(address,uint256)` -- Event topic hash: `0x7e71433ddf847725166244795048ecf3e3f9f35628254ecbf736056664233493` - -::: - -```solidity -event ValueReceived(address indexed sender, uint256 indexed value); -``` - -_`value` native tokens received from `sender`._ - -Emitted when receiving native tokens. - -#### Parameters - -| Name | Type | Description | -| ---------------------- | :-------: | ---------------------------------------------------------- | -| `sender` **`indexed`** | `address` | The address that sent some native tokens to this contract. | -| `value` **`indexed`** | `uint256` | The amount of native tokens received. | - -
- ## Errors ### ERC725X_ContractDeploymentFailed @@ -1756,23 +1743,23 @@ Reverts when trying to renounce ownership before the initial confirmation delay. - 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: `LSP20CallVerificationFailed(bool,bytes)` -- Error hash: `0x00c28d0f` +- Error signature: `LSP20CallVerificationFailed(bool,bytes4)` +- Error hash: `0x9d6741e3` ::: ```solidity -error LSP20CallVerificationFailed(bool postCall, bytes returnedData); +error LSP20CallVerificationFailed(bool postCall, bytes4 returnedStatus); ``` reverts when the call to the owner does not return the LSP20 success value #### Parameters -| Name | Type | Description | -| -------------- | :-----: | ---------------------------------------------------- | -| `postCall` | `bool` | True if the execution call was done, False otherwise | -| `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 | +| `returnedStatus` | `bytes4` | The bytes4 decoded data returned by the logic verifier. |
diff --git a/docs/networks/advanced-guides/switch-consensus-clients.md b/docs/networks/advanced-guides/switch-consensus-clients.md index 0a5827f2db..f749f8ec73 100644 --- a/docs/networks/advanced-guides/switch-consensus-clients.md +++ b/docs/networks/advanced-guides/switch-consensus-clients.md @@ -157,9 +157,9 @@ If you are setting up a node for the testnet, add the `--testnet` flag to the st ::: -:::note +:::info -You will need the LUKSO CLI Version 0.8.0 or above in order to use the `--checkpoint-sync` command. If you are using an older version, please pass down the checkpoint flag as described in the [LUKSO CLI Documentation](https://github.com/lukso-network/tools-lukso-cli/tree/main#using-checkpoint-syncing). +You will need the LUKSO CLI Version 0.8.0 or above in order to use the `--checkpoint-sync` command. If you are using an older version or run into issues, please pass down the checkpoint flag manually, as described in the [LUKSO CLI Checkpoint Documentation](https://github.com/lukso-network/tools-lukso-cli/tree/main#using-checkpoint-syncing). ::: diff --git a/docs/networks/advanced-guides/update-clients.md b/docs/networks/advanced-guides/update-clients.md index b416b4ada0..5f8199af76 100644 --- a/docs/networks/advanced-guides/update-clients.md +++ b/docs/networks/advanced-guides/update-clients.md @@ -91,6 +91,12 @@ If you are setting up a node for the testnet, add the `--testnet` flag to the st ::: +:::info + +You will need the LUKSO CLI Version 0.8.0 or above in order to use the `--checkpoint-sync` command. If you are using an older version or run into issues, please pass down the checkpoint flag manually, as described in the [LUKSO CLI Checkpoint Documentation](https://github.com/lukso-network/tools-lukso-cli/tree/main#using-checkpoint-syncing). + +::: + ```sh # Starting the Mainnet Node lukso start --checkpoint-sync diff --git a/docs/networks/advanced-guides/update-the-node.md b/docs/networks/advanced-guides/update-the-node.md index 2787a7178f..bb6cb85a23 100644 --- a/docs/networks/advanced-guides/update-the-node.md +++ b/docs/networks/advanced-guides/update-the-node.md @@ -299,6 +299,12 @@ If you are setting up a node for the testnet, add the `--testnet` flag to the st ::: +:::info + +You will need the LUKSO CLI Version 0.8.0 or above in order to use the `--checkpoint-sync` command. If you are using an older version or run into issues, please pass down the checkpoint flag manually, as described in the [LUKSO CLI Checkpoint Documentation](https://github.com/lukso-network/tools-lukso-cli/tree/main#using-checkpoint-syncing). + +::: + ```sh # Starting the Mainnet Node lukso start --checkpoint-sync diff --git a/docs/networks/advanced-guides/withdrawal-update.md b/docs/networks/advanced-guides/withdrawal-update.md index 8ffe32f732..2b35dfbe47 100644 --- a/docs/networks/advanced-guides/withdrawal-update.md +++ b/docs/networks/advanced-guides/withdrawal-update.md @@ -246,7 +246,7 @@ A maximum of 16 validator keys can update their withdrawal credentials per block ::: 1. Open the Validator Withdrawal Page of the related network: - - [LUKSO Mainnet Validator Withdrawals](https://explorer.consensus.mainnet.lukso.network/tools/broadcast) - - [LUKSO Testnet Validator Withdrawals](https://explorer.consensus.testnet.lukso.network/tools/broadcast) + - [LUKSO Mainnet Validator Withdrawals](https://explorer.consensus.mainnet.lukso.network/validators/withdrawals) + - [LUKSO Testnet Validator Withdrawals](https://explorer.consensus.testnet.lukso.network/validators/withdrawals) 2. Scroll down to the list of **Address Changes**. 3. Your Validator indices should show up as some of the latest entries. diff --git a/docs/networks/mainnet/become-a-validator.md b/docs/networks/mainnet/become-a-validator.md index 30480f1084..bb45aff483 100644 --- a/docs/networks/mainnet/become-a-validator.md +++ b/docs/networks/mainnet/become-a-validator.md @@ -107,9 +107,9 @@ If you are setting up a node for the testnet, add the `--testnet` flag to the st ::: -:::note +:::info -You will need the LUKSO CLI Version 0.8.0 or above in order to use the `--checkpoint-sync` command. If you are using an older version, please pass down the checkpoint flag as described in the [LUKSO CLI Documentation](https://github.com/lukso-network/tools-lukso-cli/tree/main#using-checkpoint-syncing). +You will need the LUKSO CLI Version 0.8.0 or above in order to use the `--checkpoint-sync` command. If you are using an older version or run into issues, please pass down the checkpoint flag manually, as described in the [LUKSO CLI Checkpoint Documentation](https://github.com/lukso-network/tools-lukso-cli/tree/main#using-checkpoint-syncing). ::: diff --git a/docs/networks/mainnet/running-a-node.md b/docs/networks/mainnet/running-a-node.md index bd22d35200..62dd85ac5c 100644 --- a/docs/networks/mainnet/running-a-node.md +++ b/docs/networks/mainnet/running-a-node.md @@ -105,19 +105,6 @@ If you want more convenience and your validator to operate quickly, you can also > After the synchronization is finalized, you will end up with the equal blockchain data. You can use the flag on every startup. However, it shows the most significant effect when synchronizing from scratch or after an extended downtime. The shortcut is ideal for fresh installations, validator migration, or recovery. - - -:::info - -The synchronization process will take multiple hours for the node to finalize. - -::: - -```sh -lukso start -``` - - :::tip @@ -126,9 +113,9 @@ The shortcut is ideal for making installation, validator migration, or recovery ::: -:::note +:::info -You will need the LUKSO CLI Version 0.8.0 or above in order to use the `--checkpoint-sync` command. If you are using an older version, please pass down the checkpoint flag as described in the [LUKSO CLI Documentation](https://github.com/lukso-network/tools-lukso-cli/tree/main#using-checkpoint-syncing). +You will need the LUKSO CLI Version 0.8.0 or above in order to use the `--checkpoint-sync` command. If you are using an older version or run into issues, please pass down the checkpoint flag manually, as described in the [LUKSO CLI Checkpoint Documentation](https://github.com/lukso-network/tools-lukso-cli/tree/main#using-checkpoint-syncing). ::: @@ -137,6 +124,19 @@ lukso start --checkpoint-sync ``` + + +:::info + +The synchronization process will take multiple hours for the node to finalize. + +::: + +```sh +lukso start +``` + + :::info diff --git a/docs/tools/erc725js/classes/ERC725.md b/docs/tools/erc725js/classes/ERC725.md index 538cb6468e..b880c29e48 100644 --- a/docs/tools/erc725js/classes/ERC725.md +++ b/docs/tools/erc725js/classes/ERC725.md @@ -187,8 +187,7 @@ myErc725.decodeData([ value: [ { key: '0x7c8c3416d6cda87cd42c71ea1843df28ac4850354f988d55ee2eaa47b6dc05cd', - value: - '0x0000000000000000000000000000000000000000000000000000000000000002', + value: '0x00000000000000000000000000000002', }, { key: '0x7c8c3416d6cda87cd42c71ea1843df2800000000000000000000000000000000', @@ -593,7 +592,7 @@ myErc725.encodeData([ ], values: [ '0x6f357c6a820464ddfac1bec070cc14a8daf04129871d458f2ca94368aae8391311af6361696670733a2f2f516d597231564a4c776572673670456f73636468564775676f3339706136727963455a4c6a7452504466573834554178', - '0x0000000000000000000000000000000000000000000000000000000000000002', + '0x00000000000000000000000000000002', '0xd94353d9b005b3c0a9da169b768a31c57844e490', '0xdaea594e385fc724449e3118b2db7e86dfba1826', '0x1183790f29be3cdfd0a102862fea1a4a30b3adab', @@ -704,6 +703,7 @@ ERC725.decodeMappingKey( '0x35e6950bc8d21a1699e50000cafecafecafecafecafecafecafecafecafecafe', 'MyKeyName:
', ); +// Decoding will checksum addresses // [{ // type: 'address', // value: '0xCAfEcAfeCAfECaFeCaFecaFecaFECafECafeCaFe' @@ -806,6 +806,7 @@ ERC725.encodePermissions({ ENCRYPT: false, DECRYPT: false, SIGN: false, + EXECUTE_RELAY_CALL: false }), // '0x0000000000000000000000000000000000000000000000000000000000000110' diff --git a/docs/tools/erc725js/providers.md b/docs/tools/erc725js/providers.md index ec0b69e29c..4cda2f447b 100644 --- a/docs/tools/erc725js/providers.md +++ b/docs/tools/erc725js/providers.md @@ -30,9 +30,9 @@ const ethereumProvider = window.ethereum; const erc725 = new ERC725([], '0x...', ethereumProvider); ``` -## Web3 +## Web3 (deprecated) -The following code snippet will use the web3 provider available at web3.providers from the corresponding `web3` library. +The following code snippet will use the web3 provider available at `web3.providers` from the corresponding `web3` library. :::caution Warning diff --git a/docs/tools/erc725js/schemas.md b/docs/tools/erc725js/schemas.md index 915497697b..42ecde81a9 100644 --- a/docs/tools/erc725js/schemas.md +++ b/docs/tools/erc725js/schemas.md @@ -31,9 +31,11 @@ LSP4DigitalAssetLegacy.json LSP4DigitalAsset.json LSP5ReceivedAssets.json LSP6KeyManager.json +LSP8IdentifiableDigitalAsset.json LSP9Vault.json LSP10ReceivedVaults.json LSP12IssuedAssets.json +LSP17ContractExtension.json ``` You can import them from: @@ -45,4 +47,7 @@ import LSP5 from '@erc725/erc725.js/schemas/LSP5ReceivedAssets.json'; // Later use them on instantiation const myErc725Contract = new ERC725js(LSP3, address, web3.currentProvider); + +// You can retrieve the current loaded schema via +myErc725Contract.options.schemas; ```