Skip to content

Commit 01d8447

Browse files
committed
Add requestor parameter to lsp20VerifyCall
1 parent 617e4ea commit 01d8447

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
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/

0 commit comments

Comments
 (0)