From 4fadea584d08fb8369d8e23d8e0dd786ea9c616b Mon Sep 17 00:00:00 2001 From: CJ42 Date: Tue, 7 Nov 2023 08:02:57 +0000 Subject: [PATCH] docs: mark Natspec comments in `@custom` tags --- .../LSP0ERC725Account/LSP0ERC725AccountCore.sol | 14 +++++++++----- .../LSP0ERC725Account/LSP0ERC725Account.md | 16 ++++++++++++++-- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol b/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol index b3930f53a..97189366b 100644 --- a/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +++ b/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol @@ -93,7 +93,9 @@ abstract contract LSP0ERC725AccountCore is * - When receiving some native tokens without any additional data. * - On empty calls to the contract. * - * This function delegates internally the handling of native tokens to the {universalReceiver} function passing `_TYPEID_LSP0_VALUE_RECEIVED` as typeId and an empty bytes array as received data. + * @custom:info This function internally delegates the handling of native tokens to the {universalReceiver} function + * passing `_TYPEID_LSP0_VALUE_RECEIVED` as typeId and an empty bytes array as received data. + * * @custom:events Emits a {UniversalReceiver} event when the `universalReceiver` logic is executed upon receiving native tokens. */ receive() external payable virtual { @@ -121,18 +123,19 @@ abstract contract LSP0ERC725AccountCore is * * 2. If the data sent to this function is of length less than 4 bytes (not a function selector), return. * - * Whenever the call is associated with native tokens, the function will delegate internally the handling of native tokens to the {universalReceiver} function passing `_TYPEID_LSP0_VALUE_RECEIVED` as typeId and the calldata as received data, except when the native token will be sent directly to the extension. + * @custom:info Whenever the call is associated with native tokens, the function will delegate the handling of native tokens internally to the {universalReceiver} function + * passing `_TYPEID_LSP0_VALUE_RECEIVED` as typeId and the calldata as received data, except when the native token will be sent directly to the extension. * * @custom:events {UniversalReceiver} event when receiving native tokens and extension function selector is not found or not payable. */ - // solhint-disable-next-line no-complex-fallback fallback( bytes calldata callData ) external payable virtual returns (bytes memory) { if (msg.data.length < 4) { // if value is associated with the extension call, use the universalReceiver - if (msg.value != 0) + if (msg.value != 0) { universalReceiver(_TYPEID_LSP0_VALUE_RECEIVED, callData); + } return ""; } @@ -804,8 +807,9 @@ abstract contract LSP0ERC725AccountCore is ) = _getExtensionAndForwardValue(msg.sig); // if value is associated with the extension call and extension function selector is not payable, use the universalReceiver - if (msg.value != 0 && !isForwardingValue) + if (msg.value != 0 && !isForwardingValue) { universalReceiver(_TYPEID_LSP0_VALUE_RECEIVED, callData); + } // if no extension was found for bytes4(0) return don't revert if (msg.sig == bytes4(0) && extension == address(0)) return ""; diff --git a/docs/contracts/LSP0ERC725Account/LSP0ERC725Account.md b/docs/contracts/LSP0ERC725Account/LSP0ERC725Account.md index 12f163cb2..3c2c507bd 100644 --- a/docs/contracts/LSP0ERC725Account/LSP0ERC725Account.md +++ b/docs/contracts/LSP0ERC725Account/LSP0ERC725Account.md @@ -86,6 +86,13 @@ Set `initialOwner` as the contract owner. ::: +:::info + +Whenever the call is associated with native tokens, the function will delegate the handling of native tokens internally to the {universalReceiver} function +passing `_TYPEID_LSP0_VALUE_RECEIVED` as typeId and the calldata as received data, except when the native token will be sent directly to the extension. + +::: + ```solidity fallback(bytes calldata callData) external payable returns (bytes memory); ``` @@ -109,7 +116,6 @@ This function is executed when: - If there is an address, forward the `msg.data` to the extension using the CALL opcode, appending 52 bytes (20 bytes of `msg.sender` and 32 bytes of `msg.value`). Return what the calls returns, or revert if the call failed. 2. If the data sent to this function is of length less than 4 bytes (not a function selector), return. - Whenever the call is associated with native tokens, the function will delegate internally the handling of native tokens to the [`universalReceiver`](#universalreceiver) function passing `_TYPEID_LSP0_VALUE_RECEIVED` as typeId and the calldata as received data, except when the native token will be sent directly to the extension.
@@ -130,6 +136,13 @@ This function is executed when: ::: +:::info + +This function internally delegates the handling of native tokens to the {universalReceiver} function +passing `_TYPEID_LSP0_VALUE_RECEIVED` as typeId and an empty bytes array as received data. + +::: + ```solidity receive() external payable; ``` @@ -139,7 +152,6 @@ Executed: - When receiving some native tokens without any additional data. - On empty calls to the contract. - This function delegates internally the handling of native tokens to the [`universalReceiver`](#universalreceiver) function passing `_TYPEID_LSP0_VALUE_RECEIVED` as typeId and an empty bytes array as received data.