Skip to content

Commit 4db0950

Browse files
authored
Merge pull request #247 from lukso-network/refactor/lsp20
Refactor!: Add `requestor` param to `lsp20VerifyCall` function + update LSP6 interface ID
2 parents a3d6ac3 + 01d8447 commit 4db0950

File tree

2 files changed

+30
-26
lines changed

2 files changed

+30
-26
lines changed

LSPs/LSP-20-CallVerification.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,20 +27,23 @@ Delegating the function call requirements to another smart contract enables a mo
2727

2828
## Specification
2929

30-
There are two distinct contracts involved in the Call Verification standard, each playing a different role in achieving the desired functionality: the contract that receives the initial function call and asks the verifier contract for verification and the verifier contract that handles the actual verification process.
30+
There are two distinct contracts involved in the LSP20 Call Verification standard, each playing a different role in achieving the desired functionality:
3131

32-
The contract receiving the function call and calling a verifier contract MUST support the `LSP20-CallVerification` interfaceId: `0x1a0eb6a5`, calculated as the first 4 bytes of the keccak256 hash of the string `"LSP20CallVerification"`. This interface ensures that the required behavior is available for performing the necessary verifications.
32+
- the contract that receives the initial function call (**LSP20-CallVerification**) and asks the verifier contract for verification.
33+
- the verifier contract (**LSP20-CallVerifier**) that handles the actual verification process.
3334

34-
The verifier contract receiving the verification call MUST support the `LSP20-CallVerifier` interfaceId: `0xc9dfc532`, calculated as the XOR of the functions mentioned below.
35+
The contract receiving the function call and calling a verifier contract MUST support the **LSP20-CallVerification** interfaceId: `0x1a0eb6a5`, calculated as the first 4 bytes of the keccak256 hash of the string `"LSP20CallVerification"`. This interface ensures that the required behavior is available for performing the necessary verifications.
36+
37+
The verifier contract receiving the verification call MUST support the `LSP20-CallVerifier` interfaceId: `0x0d6ecac7`, calculated as the XOR of the functions mentioned below.
3538

3639
### Methods
3740

38-
Smart contracts implementing the LSP20-CallVerifier interfaceId SHOULD implement both of the functions listed below:
41+
Smart contracts implementing the **LSP20-CallVerifier** interfaceId SHOULD implement both of the functions listed below:
3942

4043
#### lsp20VerifyCall
4144

4245
```solidity
43-
function lsp20VerifyCall(address callee, address caller, uint256 value, bytes memory receivedCalldata) external returns (bytes4 returnedStatus);
46+
function lsp20VerifyCall(address requestor, address target, address caller, uint256 value, bytes memory callData) external returns (bytes4 returnedStatus);
4447
```
4548

4649
This function is the pre-verification function.
@@ -49,7 +52,8 @@ It can be used to run any form of verification mechanism **prior to** running th
4952

5053
_Parameters:_
5154

52-
- `callee`: The address of the contract that implements the LSP20 interface.
55+
- `requestor`: The address that requested to make the call to `target`.
56+
- `target`: The address of the contract that implements the `LSP20CallVerification` interface.
5357
- `caller`: The address who called the function on the contract delegating the verification mechanism.
5458
- `value`: The value sent by the caller to the function called on the contract delegating the verification mechanism.
5559
- `receivedCalldata`: The calldata sent by the caller to the contract delegating the verification mechanism.
@@ -61,9 +65,9 @@ _Returns:_
6165
_Requirements_
6266

6367
- the `bytes4` success value returned MUST be of the following format:
64-
- the first 3 bytes MUST be the `lsp20VerifyCall(..)` function selector = this determines if the call to the function is allowed.
68+
- the first 3 bytes MUST be the `lsp20VerifyCall(address,address,address,uint256,bytes)` function selector. This determines if the call to the function is allowed or not.
6569
- any value for the last 4th byte is accepted.
66-
- if the 4th byte is `0x01`, this determines if the `lsp20VerifyCallResult(..)` function should be called after the original function call (The byte that invokes the `lsp20VerifyCallResult(..)` function is strictly `0x01`).
70+
- if the 4th byte is `0x01`, this determines if the `lsp20VerifyCallResult(bytes32,bytes)` function should be called after the original function call (The byte that invokes the `lsp20VerifyCallResult(bytes32,bytes)` function is strictly `0x01`).
6771

6872
#### lsp20VerifyCallResult
6973

@@ -77,7 +81,7 @@ It can be used to run any form of verification mechanism after having run the ac
7781

7882
_Parameters:_
7983

80-
- `callHash`: The keccak256 of the parameters of `lsp20VerifyCall(..)` parameters packed-encoded (concatened).
84+
- `callHash`: The keccak256 hash of the parameters of `lsp20VerifyCall(address,address,address,uint256,bytes)` parameters packed-encoded (concatened).
8185
- `callResult`: the result of the function being called on the contract delegating the verification mechanism.
8286
- if the function being called returns some data, the `callResult` MUST be the value returned by the function being called as abi-encoded `bytes`.
8387
- if the function being called does not return any data, the `callResult` MUST be an empty `bytes`.
@@ -88,7 +92,7 @@ _Returns:_
8892

8993
_Requirements_
9094

91-
- MUST return the `lsp20VerifyCallResult(..)` function selector if the call to the function is allowed.
95+
- MUST return the `lsp20VerifyCallResult(bytes32,bytes)` function selector if the call to the function is allowed.
9296

9397
### Handling Verification Result
9498

@@ -122,7 +126,7 @@ An implementation can be found in the [lukso-network/lsp-smart-contracts] reposi
122126
```solidity
123127
interface ILSP20 /* is ERC165 */ {
124128
125-
function lsp20VerifyCall(address caller, uint256 value, bytes memory receivedCalldata) external returns (bytes4 returnedStatus);
129+
function lsp20VerifyCall(address requestor, address target, address caller, uint256 value, bytes memory receivedCalldata) external returns (bytes4 returnedStatus);
126130
127131
function lsp20VerifyCallResult(bytes32 callHash, bytes memory callResult) external returns (bytes4);
128132
@@ -133,5 +137,5 @@ interface ILSP20 /* is ERC165 */ {
133137

134138
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
135139

136-
[ERC165]: https://eips.ethereum.org/EIPS/eip-165
140+
[erc165]: https://eips.ethereum.org/EIPS/eip-165
137141
[lukso-network/lsp-smart-contracts]: https://github.com/lukso-network/lsp-smart-contracts/blob/develop/contracts/

LSPs/LSP-6-KeyManager.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Storing the permissions at the core [ERC725Account] itself, allows it to survive
3535

3636
## Specification
3737

38-
**LSP6-KeyManager** interface id according to [ERC165]: `0x66918867`.
38+
**LSP6-KeyManager** interface id according to [ERC165]: `0x23f34c62`.
3939

4040
Smart contracts implementing the LSP6 standard MUST implement and support the following standard and their interfaces:
4141

@@ -716,16 +716,16 @@ interface ILSP6 /* is ERC165 */ {
716716

717717
Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/).
718718

719-
[ERC165]: https://eips.ethereum.org/EIPS/eip-165
720-
[ERC1271]: https://eips.ethereum.org/EIPS/eip-1271
721-
[ERC1721 success value]: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1271.md#specification
722-
[ERC1271 fail value]: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1271.md#specification
723-
[ERC725Account]: ./LSP-0-ERC725Account.md
724-
[BitArray]: ./LSP-2-ERC725YJSONSchema.md#bitarray
725-
[CALL]: https://github.com/ERC725Alliance/ERC725/blob/develop/docs/ERC-725.md#execute
726-
[STATICCALL]: https://github.com/ERC725Alliance/ERC725/blob/develop/docs/ERC-725.md#execute
727-
[DELEGATECALL]: https://github.com/ERC725Alliance/ERC725/blob/develop/docs/ERC-725.md#execute
728-
[CREATE]: https://github.com/ERC725Alliance/ERC725/blob/develop/docs/ERC-725.md#execute
729-
[CREATE2]: https://github.com/ERC725Alliance/ERC725/blob/develop/docs/ERC-725.md#execute
730-
[LSP20-CallVerification]: ./LSP-20-CallVerification.md
731-
[LSP25-ExecuteRelayCall]: ./LSP-25-ExecuteRelayCall.md
719+
[erc165]: https://eips.ethereum.org/EIPS/eip-165
720+
[erc1271]: https://eips.ethereum.org/EIPS/eip-1271
721+
[erc1721 success value]: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1271.md#specification
722+
[erc1271 fail value]: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1271.md#specification
723+
[erc725account]: ./LSP-0-ERC725Account.md
724+
[bitarray]: ./LSP-2-ERC725YJSONSchema.md#bitarray
725+
[call]: https://github.com/ERC725Alliance/ERC725/blob/develop/docs/ERC-725.md#execute
726+
[staticcall]: https://github.com/ERC725Alliance/ERC725/blob/develop/docs/ERC-725.md#execute
727+
[delegatecall]: https://github.com/ERC725Alliance/ERC725/blob/develop/docs/ERC-725.md#execute
728+
[create]: https://github.com/ERC725Alliance/ERC725/blob/develop/docs/ERC-725.md#execute
729+
[create2]: https://github.com/ERC725Alliance/ERC725/blob/develop/docs/ERC-725.md#execute
730+
[lsp20-callverification]: ./LSP-20-CallVerification.md
731+
[lsp25-executerelaycall]: ./LSP-25-ExecuteRelayCall.md

0 commit comments

Comments
 (0)