Skip to content

Commit

Permalink
docs: mark Natspec comments in @custom tags
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 committed Nov 7, 2023
1 parent f5a6c0e commit 4fadea5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
14 changes: 9 additions & 5 deletions contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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(

Check warning on line 131 in contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol

View workflow job for this annotation

GitHub Actions / build

Fallback function must be simple
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 "";
}

Expand Down Expand Up @@ -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 "";
Expand Down
16 changes: 14 additions & 2 deletions docs/contracts/LSP0ERC725Account/LSP0ERC725Account.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
```
Expand All @@ -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.

<blockquote>

Expand All @@ -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;
```
Expand All @@ -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.

<blockquote>

Expand Down

0 comments on commit 4fadea5

Please sign in to comment.