Skip to content

Commit

Permalink
docs: add LSP6 auto-generated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
CJ42 committed Aug 22, 2023
1 parent f0b33e0 commit 36facf9
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 31 deletions.
5 changes: 2 additions & 3 deletions contracts/LSP6KeyManager/LSP6Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -114,10 +114,9 @@ error AddressPermissionArrayIndexValueNotAnAddress(
error NoERC725YDataKeysAllowed(address from);

/**
* @notice The address `from` is not authorised to use the linked account contract to make external calls, because it has Allowed Calls set.
* @notice The address `from` is not authorised to use the linked account contract to make external calls, because it has no Allowed Calls set.
*
* @dev Reverts when the `from` address has no `AllowedCalls` set and cannot interact with any address
* using the linked {target}.
* @dev Reverts when the `from` address has no `AllowedCalls` set and cannot interact with any address using the linked {target}.
*
* @param from The address that has no AllowedCalls.
*/
Expand Down
6 changes: 3 additions & 3 deletions contracts/LSP6KeyManager/LSP6KeyManagerCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ abstract contract LSP6KeyManagerCore is
/**
* @inheritdoc ILSP6KeyManager
*
* @custom:events VerifiedCall event when the permissions related to `payload` have been verified successfully.
* @custom:events {PermissionsVerified} event when the permissions related to `payload` have been verified successfully.
*/
function execute(
bytes calldata payload
Expand All @@ -164,7 +164,7 @@ abstract contract LSP6KeyManagerCore is
/**
* @inheritdoc ILSP6KeyManager
*
* @custom:events VerifiedCall event for each permissions related to each `payload` that have been verified successfully.
* @custom:events {PermissionsVerified} event for each permissions related to each `payload` that have been verified successfully.
*/
function executeBatch(
uint256[] calldata values,
Expand Down Expand Up @@ -199,7 +199,7 @@ abstract contract LSP6KeyManagerCore is
/**
* @inheritdoc ILSP6KeyManager
*
* @custom:events {VerifiedCall} event when the permissions related to `payload` have been verified successfully.
* @custom:events {PermissionsVerified} event when the permissions related to `payload` have been verified successfully.
*
* @custom:hint You can use `validityTimestamps == 0` to define an `executeRelayCall` transaction that is indefinitely valid,
* meaning that does not require to start from a specific date/time, or that has an expiration date/time/
Expand Down
1 change: 0 additions & 1 deletion contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ abstract contract LSP6ExecuteModule {
* @param controller the address who want to run the execute function on the ERC725Account.
* @param permissions the permissions of the controller address.
*/
// * @param payload the ABI encoded payload `controlledContract.execute(...)`.
function _verifyCanExecute(
address controlledContract,
address controller,
Expand Down
70 changes: 46 additions & 24 deletions docs/contracts/LSP6KeyManager/LSP6KeyManager.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Execute A `payload` on the linked [`target`](#target) contract after having veri

**Emitted events:**

- VerifiedCall event when the permissions related to `payload` have been verified successfully.
- [`PermissionsVerified`](#permissionsverified) event when the permissions related to `payload` have been verified successfully.

</blockquote>

Expand Down Expand Up @@ -119,7 +119,7 @@ Same as [`execute`](#execute) but execute a batch of payloads (abi-encoded funct

**Emitted events:**

- VerifiedCall event for each permissions related to each `payload` that have been verified successfully.
- [`PermissionsVerified`](#permissionsverified) event for each permissions related to each `payload` that have been verified successfully.

</blockquote>

Expand Down Expand Up @@ -172,7 +172,7 @@ Allows any address (executor) to execute a payload (= abi-encoded function call)

**Emitted events:**

- [`VerifiedCall`](#verifiedcall) event when the permissions related to `payload` have been verified successfully.
- [`PermissionsVerified`](#permissionsverified) event when the permissions related to `payload` have been verified successfully.

</blockquote>

Expand Down Expand Up @@ -776,7 +776,10 @@ function _verifyCanExecute(
address controlledContract,
address controller,
bytes32 permissions,
bytes payload
uint256 operationType,
address to,
uint256 value,
bytes data
) internal view;
```

Expand All @@ -789,7 +792,10 @@ verify if `controllerAddress` has the required permissions to interact with othe
| `controlledContract` | `address` | the address of the ERC725 contract where the payload is executed and where the permissions are verified. |
| `controller` | `address` | the address who want to run the execute function on the ERC725Account. |
| `permissions` | `bytes32` | the permissions of the controller address. |
| `payload` | `bytes` | the ABI encoded payload `controlledContract.execute(...)`. |
| `operationType` | `uint256` | - |
| `to` | `address` | - |
| `value` | `uint256` | - |
| `data` | `bytes` | - |

<br/>

Expand All @@ -812,7 +818,9 @@ function _verifyCanStaticCall(
address controlledContract,
address controller,
bytes32 permissions,
bytes payload
address to,
uint256 value,
bytes data
) internal view;
```

Expand All @@ -825,7 +833,9 @@ function _verifyCanCall(
address controlledContract,
address controller,
bytes32 permissions,
bytes payload
address to,
uint256 value,
bytes data
) internal view;
```

Expand All @@ -837,7 +847,10 @@ function _verifyCanCall(
function _verifyAllowedCall(
address controlledContract,
address controllerAddress,
bytes payload
uint256 operationType,
address to,
uint256 value,
bytes data
) internal view;
```

Expand Down Expand Up @@ -871,16 +884,6 @@ extract the bytes4 representation of a single bit for the type of call according

<br/>

### \_extractExecuteParameters

```solidity
function _extractExecuteParameters(
bytes executeCalldata
) internal pure returns (uint256, address, uint256, bytes4, bool);
```

<br/>

### \_isAllowedAddress

```solidity
Expand Down Expand Up @@ -1071,19 +1074,19 @@ Used in the end of the `nonReentrant` modifier after the method execution is ter

## Events

### VerifiedCall
### PermissionsVerified

:::note References

- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-6-KeyManager.md#verifiedcall)
- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-6-KeyManager.md#permissionsverified)
- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP6KeyManager/LSP6KeyManager.sol)
- Event signature: `VerifiedCall(address,uint256,bytes4)`
- Event topic hash: `0xa54458b75709e42f79700ffb6cfc57c7e224d8a77a52c457ee7ecb8e22636280`
- Event signature: `PermissionsVerified(address,uint256,bytes4)`
- Event topic hash: `0xc0a62328f6bf5e3172bb1fcb2019f54b2c523b6a48e3513a2298fbf0150b781e`

:::

```solidity
event VerifiedCall(address indexed signer, uint256 indexed value, bytes4 indexed selector);
event PermissionsVerified(address indexed signer, uint256 indexed value, bytes4 indexed selector);
```

_Verified the permissions of `signer` for calling function `selector` on the linked account and sending `value` of native token._
Expand Down Expand Up @@ -1453,6 +1456,25 @@ Reverts when a `from` address has _"any whitelisted call"_ as allowed call set.

<br/>

### KeyManagerCannotBeSetAsExtensionForLSP20Functions

:::note References

- Specification details: [**LSP-6-KeyManager**](https://github.com/lukso-network/lips/tree/main/LSPs/LSP-6-KeyManager.md#keymanagercannotbesetasextensionforlsp20functions)
- Solidity implementation: [`LSP6KeyManager.sol`](https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/LSP6KeyManager/LSP6KeyManager.sol)
- Error signature: `KeyManagerCannotBeSetAsExtensionForLSP20Functions()`
- Error hash: `0x4a9fa8cf`

:::

```solidity
error KeyManagerCannotBeSetAsExtensionForLSP20Functions();
```

reverts when the address of the Key Manager is being set as extensions for lsp20 functions

<br/>

### LSP6BatchExcessiveValueSent

:::note References
Expand Down Expand Up @@ -1528,7 +1550,7 @@ This error occurs when there was not enough funds sent to the batch functions `e
error NoCallsAllowed(address from);
```

_The address `from` is not authorised to use the linked account contract to make external calls, because it has Allowed Calls set._
_The address `from` is not authorised to use the linked account contract to make external calls, because it has no Allowed Calls set._

Reverts when the `from` address has no `AllowedCalls` set and cannot interact with any address using the linked [`target`](#target).

Expand Down

0 comments on commit 36facf9

Please sign in to comment.