Skip to content

Commit

Permalink
[create-pull-request] automated change
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 authored Nov 8, 2023
1 parent 8f33440 commit ba61f15
Show file tree
Hide file tree
Showing 25 changed files with 571 additions and 820 deletions.
103 changes: 60 additions & 43 deletions docs/contracts/contracts/LSP0ERC725Account/LSP0ERC725Account.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ constructor(address initialOwner);

_Deploying a LSP0ERC725Account contract with owner set to address `initialOwner`._

Set `initialOwner` as the contract owner. The `constructor` also allows funding the contract on deployment.
Set `initialOwner` as the contract owner.

- The `constructor` also allows funding the contract on deployment.

- The `initialOwner` will then be allowed to call protected functions marked with the `onlyOwner` modifier.

<blockquote>

Expand Down Expand Up @@ -82,6 +86,13 @@ Set `initialOwner` as the contract owner. The `constructor` also allows funding

:::

:::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 Down Expand Up @@ -125,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 +157,7 @@ Executed:

**Emitted events:**

- [`UniversalReceiver`](#universalreceiver) event when receiving native tokens.
- Emits a [`UniversalReceiver`](#universalreceiver) event when the `universalReceiver` logic is executed upon receiving native tokens.

</blockquote>

Expand Down Expand Up @@ -197,6 +215,31 @@ function RENOUNCE_OWNERSHIP_CONFIRMATION_PERIOD()

<br/>

### 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: `0xffa1ad74`

:::

```solidity
function VERSION() external view returns (string);
```

_Contract version._

#### Returns

| Name | Type | Description |
| ---- | :------: | ----------- |
| `0` | `string` | - |

<br/>

### acceptOwnership

:::note References
Expand Down Expand Up @@ -487,6 +530,12 @@ Get in the ERC725Y storage the bytes data stored at multiple data keys `dataKeys

:::

:::caution Warning

This function does not enforce by default the inclusion of the address of this contract in the signature digest. It is recommended that protocols or applications using this contract include the targeted address (= this contract) in the data to sign. To ensure that a signature is valid for a specific LSP0ERC725Account and prevent signatures from the same EOA to be replayed across different LSP0ERC725Accounts.

:::

```solidity
function isValidSignature(
bytes32 dataHash,
Expand Down Expand Up @@ -812,7 +861,7 @@ Achieves the goal of [LSP-1-UniversalReceiver] by allowing the account to be not

- If there is an address stored under the data key, check if this address supports the LSP1 interfaceId.

- If yes, call this address with the typeId and data (params), along with additional calldata consisting of 20 bytes of `msg.sender` and 32 bytes of `msg.value`. If not, continue the execution of the function.
- If yes, call this address with the typeId and data (params), along with additional calldata consisting of 20 bytes of `msg.sender` and 32 bytes of `msg.value`. If not, continue the execution of the function. This function delegates internally the handling of native tokens to the [`universalReceiver`](#universalreceiver) function itself passing `_TYPEID_LSP0_VALUE_RECEIVED` as typeId and the calldata as received data.

<blockquote>

Expand All @@ -838,33 +887,6 @@ Achieves the goal of [LSP-1-UniversalReceiver] by allowing the account to be not

<br/>

### 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. |

<br/>

## 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.
Expand Down Expand Up @@ -1180,26 +1202,21 @@ function _getExtensionAndForwardValue(
) internal view returns (address, bool);
```

Returns the extension address stored under the following data key:
Returns the extension address and the boolean indicating whether to forward the value received to the extension, stored under the following data key:

- [`_LSP17_EXTENSION_PREFIX`](#_lsp17_extension_prefix) + `<bytes4>` (Check [LSP2-ERC725YJSONSchema] for encoding the data key).

- If no extension is stored, returns the address(0).

- If the stored value is 20 bytes, return false for the boolean

<br/>

### \_fallbackLSP17Extendable

:::tip Hint

This function does not forward to the extension contract the `msg.value` received by the contract that inherits `LSP17Extendable`.
If you would like to forward the `msg.value` to the extension contract, you can override the code of this internal function as follow:

```solidity
(bool success, bytes memory result) = extension.call\{value: msg.value\}(
abi.encodePacked(callData, msg.sender, msg.value)
);
```
If you would like to forward the `msg.value` to the extension contract, you should store an additional `0x01` byte after the address of the extension under the corresponding LSP17 data key.

:::

Expand Down Expand Up @@ -1464,11 +1481,11 @@ Emitted when the [`universalReceiver`](#universalreceiver) function was called w

| Name | Type | Description |
| ---------------------- | :-------: | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `from` **`indexed`** | `address` | The address of the EOA or smart contract that called the \{universalReceiver(...)\} function. |
| `value` **`indexed`** | `uint256` | The amount sent to the \{universalReceiver(...)\} function. |
| `from` **`indexed`** | `address` | The address of the EOA or smart contract that called the [`universalReceiver(...)`](#universalreceiver) function. |
| `value` **`indexed`** | `uint256` | The amount sent to the [`universalReceiver(...)`](#universalreceiver) function. |
| `typeId` **`indexed`** | `bytes32` | A `bytes32` unique identifier (= _"hook"_)that describe the type of notification, information or transaction received by the contract. Can be related to a specific standard or a hook. |
| `receivedData` | `bytes` | Any arbitrary data that was sent to the \{universalReceiver(...)\} function. |
| `returnedValue` | `bytes` | The value returned by the \{universalReceiver(...)\} function. |
| `receivedData` | `bytes` | Any arbitrary data that was sent to the [`universalReceiver(...)`](#universalreceiver) function. |
| `returnedValue` | `bytes` | The value returned by the [`universalReceiver(...)`](#universalreceiver) function. |

<br/>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,6 @@ If there is an extension for the function selector being called, it calls the ex

<br/>

### Additional Resources

- [🎥 BuildUP #2 | Adding Functionalities to Universal Profiles using LSP17 - Contract Extension (YouTube)](https://www.youtube.com/watch?v=0KxkLZHFa0E)

<!-- GLOBAL LINKS -->

<!-- prettier-ignore-start -->
Expand Down Expand Up @@ -317,4 +313,4 @@ If there is an extension for the function selector being called, it calls the ex
[`LSP10Utils.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP10ReceivedVaults/LSP10Utils.sol
[`LSP10Constants.sol`]: https://github.com/lukso-network/lsp-smart-contracts/tree/main/contracts/LSP10ReceivedVaults/LSP10Constants.sol

<!-- prettier-ignore-end -->
<!-- prettier-ignore-end -->
48 changes: 23 additions & 25 deletions docs/contracts/contracts/LSP17ContractExtension/LSP17Extension.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,61 +23,59 @@ Implementation of the extension logic according to LSP17ContractExtension. This
Public methods are accessible externally from users, allowing interaction with this function from dApps or other smart contracts.
When marked as 'public', a method can be called both externally and internally, on the other hand, when marked as 'external', a method can only be called externally.

### supportsInterface
### VERSION

:::note References

- Specification details: [**LSP-17-ContractExtension**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-17-ContractExtension.md#supportsinterface)
- 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: `supportsInterface(bytes4)`
- Function selector: `0x01ffc9a7`
- Function signature: `VERSION()`
- Function selector: `0xffa1ad74`

:::

```solidity
function supportsInterface(bytes4 interfaceId) external view returns (bool);
function VERSION() external view returns (string);
```

See [`IERC165-supportsInterface`](#ierc165-supportsinterface).

#### Parameters

| Name | Type | Description |
| ------------- | :------: | ----------- |
| `interfaceId` | `bytes4` | - |
_Contract version._

#### Returns

| Name | Type | Description |
| ---- | :----: | ----------- |
| `0` | `bool` | - |
| Name | Type | Description |
| ---- | :------: | ----------- |
| `0` | `string` | - |

<br/>

### version
### supportsInterface

:::note References

- Specification details: [**LSP-17-ContractExtension**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-17-ContractExtension.md#version)
- Specification details: [**LSP-17-ContractExtension**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-17-ContractExtension.md#supportsinterface)
- Solidity implementation: [`LSP17Extension.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP17ContractExtension/LSP17Extension.sol)
- Function signature: `version()`
- Function selector: `0x54fd4d50`
- Function signature: `supportsInterface(bytes4)`
- Function selector: `0x01ffc9a7`

:::

```solidity
function version() external view returns (string);
function supportsInterface(bytes4 interfaceId) external view returns (bool);
```

_Contract version._
See [`IERC165-supportsInterface`](#ierc165-supportsinterface).

Get the version of the contract.
#### Parameters

| Name | Type | Description |
| ------------- | :------: | ----------- |
| `interfaceId` | `bytes4` | - |

#### Returns

| Name | Type | Description |
| ---- | :------: | -------------------------------- |
| `0` | `string` | The version of the the contract. |
| Name | Type | Description |
| ---- | :----: | ----------- |
| `0` | `bool` | - |

<br/>

Expand Down
54 changes: 26 additions & 28 deletions docs/contracts/contracts/LSP17Extensions/Extension4337.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,31 @@ constructor(address entryPoint_);

<br/>

### 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: `0xffa1ad74`

:::

```solidity
function VERSION() external view returns (string);
```

_Contract version._

#### Returns

| Name | Type | Description |
| ---- | :------: | ----------- |
| `0` | `string` | - |

<br/>

### entryPoint

:::note References
Expand Down Expand Up @@ -131,34 +156,7 @@ Must validate caller is the entryPoint. Must validate the signature and nonce

| Name | Type | Description |
| ---- | :-------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `0` | `uint256` | packaged ValidationData structure. use `_packValidationData` and `_unpackValidationData` to encode and decode \<20-byte\> sigAuthorizer - 0 for valid signature, 1 to mark signature failure, otherwise, an address of an "authorizer" contract. \<6-byte\> validUntil - last timestamp this operation is valid. 0 for "indefinite" \<6-byte\> validAfter - first timestamp this operation is valid If an account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure. Note that the validation code cannot use block.timestamp (or block.number) directly. |

<br/>

### 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. |
| `0` | `uint256` | packaged ValidationData structure. use `_packValidationData` and `_unpackValidationData` to encode and decode <20-byte> sigAuthorizer - 0 for valid signature, 1 to mark signature failure, otherwise, an address of an "authorizer" contract. <6-byte> validUntil - last timestamp this operation is valid. 0 for "indefinite" <6-byte> validAfter - first timestamp this operation is valid If an account doesn't use time-range, it is enough to return SIG_VALIDATION_FAILED value (1) for signature failure. Note that the validation code cannot use block.timestamp (or block.number) directly. |

<br/>

Expand Down
Loading

0 comments on commit ba61f15

Please sign in to comment.