@lukso/lsp-smart-contracts 0.11.1 → 0.12.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +4 -0
- package/README.md +10 -2
- package/artifacts/Create2Factory.json +2 -2
- package/artifacts/LSP0ERC725Account.json +52 -25
- package/artifacts/LSP0ERC725AccountInit.json +52 -25
- package/artifacts/LSP11BasicSocialRecovery.json +18 -2
- package/artifacts/LSP11BasicSocialRecoveryInit.json +18 -2
- package/artifacts/LSP16UniversalFactory.json +3 -3
- package/artifacts/LSP1UniversalReceiverDelegateUP.json +14 -46
- package/artifacts/LSP1UniversalReceiverDelegateVault.json +14 -46
- package/artifacts/LSP23LinkedContractsFactory.json +3 -3
- package/artifacts/LSP4DigitalAssetMetadata.json +16 -0
- package/artifacts/LSP4DigitalAssetMetadataInitAbstract.json +16 -0
- package/artifacts/LSP6KeyManager.json +14 -9
- package/artifacts/LSP6KeyManagerInit.json +14 -9
- package/artifacts/LSP7CappedSupply.json +29 -4
- package/artifacts/LSP7CappedSupplyInitAbstract.json +29 -4
- package/artifacts/LSP7CompatibleERC20.json +48 -23
- package/artifacts/LSP7CompatibleERC20InitAbstract.json +48 -23
- package/artifacts/LSP7CompatibleERC20Mintable.json +51 -26
- package/artifacts/LSP7CompatibleERC20MintableInit.json +51 -26
- package/artifacts/LSP7DigitalAsset.json +29 -4
- package/artifacts/LSP7DigitalAssetInitAbstract.json +29 -4
- package/artifacts/LSP7Mintable.json +32 -7
- package/artifacts/LSP7MintableInit.json +32 -7
- package/artifacts/LSP8CappedSupply.json +33 -3
- package/artifacts/LSP8CappedSupplyInitAbstract.json +33 -3
- package/artifacts/LSP8CompatibleERC721.json +55 -25
- package/artifacts/LSP8CompatibleERC721InitAbstract.json +55 -25
- package/artifacts/LSP8CompatibleERC721Mintable.json +63 -28
- package/artifacts/LSP8CompatibleERC721MintableInit.json +63 -28
- package/artifacts/LSP8IdentifiableDigitalAsset.json +33 -3
- package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +33 -3
- package/artifacts/LSP8Mintable.json +41 -6
- package/artifacts/LSP8MintableInit.json +41 -6
- package/artifacts/LSP9Vault.json +38 -16
- package/artifacts/LSP9VaultInit.json +38 -16
- package/artifacts/UniversalProfile.json +52 -25
- package/artifacts/UniversalProfileInit.json +52 -25
- package/contracts/Factories/Create2Factory.sol +1 -1
- package/contracts/LSP0ERC725Account/ILSP0ERC725Account.sol +0 -14
- package/contracts/LSP0ERC725Account/LSP0Constants.sol +1 -1
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +122 -94
- package/contracts/LSP10ReceivedVaults/LSP10Utils.sol +5 -3
- package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryCore.sol +54 -14
- package/contracts/LSP11BasicSocialRecovery/LSP11Constants.sol +1 -1
- package/contracts/LSP11BasicSocialRecovery/LSP11Errors.sol +1 -1
- package/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +2 -2
- package/contracts/LSP14Ownable2Step/LSP14Constants.sol +1 -1
- package/contracts/LSP14Ownable2Step/LSP14Errors.sol +9 -3
- package/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +16 -12
- package/contracts/LSP16UniversalFactory/LSP16UniversalFactory.sol +65 -96
- package/contracts/LSP17ContractExtension/LSP17Errors.sol +1 -1
- package/contracts/LSP17ContractExtension/LSP17Extendable.sol +10 -7
- package/contracts/LSP17ContractExtension/LSP17Extension.sol +4 -4
- package/contracts/LSP17Extensions/Extension4337.sol +101 -0
- package/contracts/LSP17Extensions/OnERC721ReceivedExtension.sol +15 -0
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +1 -2
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol +24 -0
- package/contracts/LSP1UniversalReceiver/LSP1Constants.sol +1 -0
- package/contracts/LSP1UniversalReceiver/LSP1Errors.sol +0 -6
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +20 -27
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +18 -21
- package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +2 -46
- package/contracts/LSP20CallVerification/ILSP20CallVerifier.sol +13 -9
- package/contracts/LSP20CallVerification/LSP20CallVerification.sol +39 -14
- package/contracts/LSP20CallVerification/LSP20Constants.sol +6 -6
- package/contracts/LSP20CallVerification/LSP20Errors.sol +9 -3
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/ILSP23LinkedContractsFactory.sol +1 -1
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/IPostDeploymentModule.sol +1 -1
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/LSP23Errors.sol +1 -1
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/LSP23LinkedContractsFactory.sol +5 -1
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/modules/UniversalProfileInitPostDeploymentModule.sol +1 -1
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/modules/UniversalProfilePostDeploymentModule.sol +1 -1
- package/contracts/LSP25ExecuteRelayCall/LSP25Constants.sol +1 -1
- package/contracts/LSP25ExecuteRelayCall/LSP25MultiChannelNonce.sol +8 -3
- package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +1 -97
- package/contracts/LSP3ProfileMetadata/LSP3Constants.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +8 -3
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +8 -3
- package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +4 -3
- package/contracts/LSP6KeyManager/LSP6Constants.sol +4 -3
- package/contracts/LSP6KeyManager/LSP6Errors.sol +2 -23
- package/contracts/LSP6KeyManager/LSP6KeyManager.sol +0 -1
- package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +134 -99
- package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +0 -1
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +1 -2
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteRelayCallModule.sol +27 -0
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +31 -25
- package/contracts/LSP6KeyManager/LSP6Utils.sol +29 -2
- package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +10 -10
- package/contracts/LSP7DigitalAsset/LSP7Constants.sol +1 -1
- package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +22 -8
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +180 -118
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +21 -7
- package/contracts/LSP7DigitalAsset/LSP7Errors.sol +12 -3
- package/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +5 -1
- package/contracts/LSP7DigitalAsset/extensions/LSP7BurnableInitAbstract.sol +4 -1
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +7 -7
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +3 -3
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +120 -53
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +122 -53
- package/contracts/LSP7DigitalAsset/presets/ILSP7Mintable.sol +3 -3
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +4 -4
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +2 -2
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +4 -4
- package/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +4 -4
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +1 -1
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +4 -4
- package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +11 -11
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +12 -1
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +32 -16
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +61 -11
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +113 -74
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +63 -10
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8BurnableInitAbstract.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +7 -7
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +162 -73
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +168 -84
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +7 -7
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +7 -7
- package/contracts/LSP8IdentifiableDigitalAsset/presets/ILSP8Mintable.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +8 -7
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +5 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +13 -7
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +9 -8
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +9 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +10 -8
- package/contracts/LSP9Vault/ILSP9Vault.sol +0 -13
- package/contracts/LSP9Vault/LSP9Constants.sol +1 -1
- package/contracts/LSP9Vault/LSP9Errors.sol +1 -1
- package/contracts/LSP9Vault/LSP9VaultCore.sol +58 -41
- package/devdocs/LSP0ERC725Account.json +73 -45
- package/devdocs/LSP0ERC725AccountInit.json +73 -45
- package/devdocs/LSP11BasicSocialRecovery.json +13 -0
- package/devdocs/LSP11BasicSocialRecoveryInit.json +13 -0
- package/devdocs/LSP16UniversalFactory.json +9 -9
- package/devdocs/LSP1UniversalReceiverDelegateUP.json +1 -6
- package/devdocs/LSP1UniversalReceiverDelegateVault.json +1 -6
- package/devdocs/LSP4DigitalAssetMetadata.json +32 -10
- package/devdocs/LSP4DigitalAssetMetadataInitAbstract.json +32 -10
- package/devdocs/LSP6KeyManager.json +12 -14
- package/devdocs/LSP6KeyManagerInit.json +12 -14
- package/devdocs/LSP7CappedSupply.json +47 -20
- package/devdocs/LSP7CappedSupplyInitAbstract.json +47 -20
- package/devdocs/LSP7CompatibleERC20.json +88 -24
- package/devdocs/LSP7CompatibleERC20InitAbstract.json +88 -24
- package/devdocs/LSP7CompatibleERC20Mintable.json +88 -24
- package/devdocs/LSP7CompatibleERC20MintableInit.json +88 -24
- package/devdocs/LSP7DigitalAsset.json +47 -20
- package/devdocs/LSP7DigitalAssetInitAbstract.json +47 -20
- package/devdocs/LSP7Mintable.json +47 -20
- package/devdocs/LSP7MintableInit.json +47 -20
- package/devdocs/LSP8CappedSupply.json +57 -25
- package/devdocs/LSP8CappedSupplyInitAbstract.json +57 -25
- package/devdocs/LSP8CompatibleERC721.json +84 -31
- package/devdocs/LSP8CompatibleERC721InitAbstract.json +84 -31
- package/devdocs/LSP8CompatibleERC721Mintable.json +86 -33
- package/devdocs/LSP8CompatibleERC721MintableInit.json +87 -34
- package/devdocs/LSP8IdentifiableDigitalAsset.json +61 -26
- package/devdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +57 -25
- package/devdocs/LSP8Mintable.json +59 -27
- package/devdocs/LSP8MintableInit.json +60 -28
- package/devdocs/LSP9Vault.json +57 -35
- package/devdocs/LSP9VaultInit.json +57 -35
- package/devdocs/UniversalProfile.json +73 -45
- package/devdocs/UniversalProfileInit.json +73 -45
- package/dist/constants.cjs.js +4323 -2361
- package/dist/constants.d.ts +2933 -1022
- package/dist/constants.es.js +4322 -2361
- package/package.json +8 -6
- package/userdocs/LSP0ERC725Account.json +17 -8
- package/userdocs/LSP0ERC725AccountInit.json +17 -8
- package/userdocs/LSP16UniversalFactory.json +26 -1
- package/userdocs/LSP1UniversalReceiverDelegateUP.json +1 -11
- package/userdocs/LSP1UniversalReceiverDelegateVault.json +1 -11
- package/userdocs/LSP4DigitalAssetMetadata.json +7 -4
- package/userdocs/LSP4DigitalAssetMetadataInitAbstract.json +7 -4
- package/userdocs/LSP6KeyManager.json +0 -5
- package/userdocs/LSP6KeyManagerInit.json +0 -5
- package/userdocs/LSP7CappedSupply.json +14 -6
- package/userdocs/LSP7CappedSupplyInitAbstract.json +13 -5
- package/userdocs/LSP7CompatibleERC20.json +15 -5
- package/userdocs/LSP7CompatibleERC20InitAbstract.json +15 -5
- package/userdocs/LSP7CompatibleERC20Mintable.json +15 -5
- package/userdocs/LSP7CompatibleERC20MintableInit.json +15 -5
- package/userdocs/LSP7DigitalAsset.json +15 -5
- package/userdocs/LSP7DigitalAssetInitAbstract.json +15 -5
- package/userdocs/LSP7Mintable.json +15 -5
- package/userdocs/LSP7MintableInit.json +15 -5
- package/userdocs/LSP8CappedSupply.json +13 -5
- package/userdocs/LSP8CappedSupplyInitAbstract.json +12 -4
- package/userdocs/LSP8CompatibleERC721.json +27 -17
- package/userdocs/LSP8CompatibleERC721InitAbstract.json +27 -17
- package/userdocs/LSP8CompatibleERC721Mintable.json +28 -18
- package/userdocs/LSP8CompatibleERC721MintableInit.json +29 -19
- package/userdocs/LSP8IdentifiableDigitalAsset.json +15 -5
- package/userdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +14 -4
- package/userdocs/LSP8Mintable.json +15 -5
- package/userdocs/LSP8MintableInit.json +16 -6
- package/userdocs/LSP9Vault.json +20 -11
- package/userdocs/LSP9VaultInit.json +20 -11
- package/userdocs/UniversalProfile.json +17 -8
- package/userdocs/UniversalProfileInit.json +17 -8
- package/artifacts/LSP4Compatibility.json +0 -216
- package/contracts/LSP4DigitalAssetMetadata/ILSP4Compatibility.sol +0 -25
- package/contracts/LSP4DigitalAssetMetadata/LSP4Compatibility.sol +0 -38
- package/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibleERC20.sol +0 -83
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol +0 -175
- package/devdocs/LSP4Compatibility.json +0 -79
- package/userdocs/LSP4Compatibility.json +0 -20
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import {_INTERFACEID_LSP17_EXTENDABLE} from "./LSP17Constants.sol";
|
|
12
12
|
|
|
13
13
|
// errors
|
|
14
|
-
import "./LSP17Errors.sol";
|
|
14
|
+
import {NoExtensionFoundForFunctionSelector} from "./LSP17Errors.sol";
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* @title Module to add more functionalities to a contract using extensions.
|
|
@@ -70,18 +70,21 @@ abstract contract LSP17Extendable is ERC165 {
|
|
|
70
70
|
* @dev Forwards the call to an extension mapped to a function selector.
|
|
71
71
|
*
|
|
72
72
|
* Calls {_getExtension} to get the address of the extension mapped to the function selector being
|
|
73
|
-
* called on the account. If there is no extension, the address(0) will be returned.
|
|
73
|
+
* called on the account. If there is no extension, the `address(0)` will be returned.
|
|
74
74
|
*
|
|
75
75
|
* Reverts if there is no extension for the function being called.
|
|
76
76
|
*
|
|
77
77
|
* If there is an extension for the function selector being called, it calls the extension with the
|
|
78
|
-
* CALL opcode, passing the
|
|
79
|
-
* 32 bytes of the {msg.value}
|
|
78
|
+
* `CALL` opcode, passing the `msg.data` appended with the 20 bytes of the {msg.sender} and 32 bytes of the `msg.value`.
|
|
80
79
|
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
80
|
+
* @custom:hint This function does not forward to the extension contract the `msg.value` received by the contract that inherits `LSP17Extendable`.
|
|
81
|
+
* If you would like to forward the `msg.value` to the extension contract, you can override the code of this internal function as follow:
|
|
83
82
|
*
|
|
84
|
-
*
|
|
83
|
+
* ```solidity
|
|
84
|
+
* (bool success, bytes memory result) = extension.call{value: msg.value}(
|
|
85
|
+
* abi.encodePacked(callData, msg.sender, msg.value)
|
|
86
|
+
* );
|
|
87
|
+
* ```
|
|
85
88
|
*/
|
|
86
89
|
function _fallbackLSP17Extendable(
|
|
87
90
|
bytes calldata callData
|
|
@@ -26,8 +26,8 @@ abstract contract LSP17Extension is ERC165 {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/**
|
|
29
|
-
* @dev Returns the original msg.data passed to the extendable contract
|
|
30
|
-
* without the appended msg.sender and msg.value
|
|
29
|
+
* @dev Returns the original `msg.data` passed to the extendable contract
|
|
30
|
+
* without the appended `msg.sender` and `msg.value`.
|
|
31
31
|
*/
|
|
32
32
|
function _extendableMsgData()
|
|
33
33
|
internal
|
|
@@ -39,7 +39,7 @@ abstract contract LSP17Extension is ERC165 {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* @dev Returns the original msg.sender calling the extendable contract
|
|
42
|
+
* @dev Returns the original `msg.sender` calling the extendable contract.
|
|
43
43
|
*/
|
|
44
44
|
function _extendableMsgSender() internal view virtual returns (address) {
|
|
45
45
|
return
|
|
@@ -49,7 +49,7 @@ abstract contract LSP17Extension is ERC165 {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
-
* @dev Returns the original msg.value sent to the extendable contract
|
|
52
|
+
* @dev Returns the original `msg.value` sent to the extendable contract.
|
|
53
53
|
*/
|
|
54
54
|
function _extendableMsgValue() internal view virtual returns (uint256) {
|
|
55
55
|
return uint256(bytes32(msg.data[msg.data.length - 32:]));
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
pragma solidity ^0.8.12;
|
|
3
|
+
|
|
4
|
+
// interfaces
|
|
5
|
+
import {IAccount} from "@account-abstraction/contracts/interfaces/IAccount.sol";
|
|
6
|
+
import {
|
|
7
|
+
IERC725Y
|
|
8
|
+
} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
|
|
9
|
+
import {
|
|
10
|
+
ILSP20CallVerifier
|
|
11
|
+
} from "../LSP20CallVerification/ILSP20CallVerifier.sol";
|
|
12
|
+
|
|
13
|
+
// modules
|
|
14
|
+
import {LSP14Ownable2Step} from "../LSP14Ownable2Step/LSP14Ownable2Step.sol";
|
|
15
|
+
import {LSP17Extension} from "../LSP17ContractExtension/LSP17Extension.sol";
|
|
16
|
+
|
|
17
|
+
// librairies
|
|
18
|
+
import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
|
|
19
|
+
import {LSP6Utils} from "../LSP6KeyManager/LSP6Utils.sol";
|
|
20
|
+
|
|
21
|
+
// constants
|
|
22
|
+
import {
|
|
23
|
+
UserOperation
|
|
24
|
+
} from "@account-abstraction/contracts/interfaces/UserOperation.sol";
|
|
25
|
+
|
|
26
|
+
contract Extension4337 is LSP17Extension, IAccount {
|
|
27
|
+
using ECDSA for bytes32;
|
|
28
|
+
using LSP6Utils for *;
|
|
29
|
+
|
|
30
|
+
address internal immutable _ENTRY_POINT;
|
|
31
|
+
|
|
32
|
+
// permission needed to be able to use this extension
|
|
33
|
+
bytes32 internal constant _4337_PERMISSION =
|
|
34
|
+
0x0000000000000000000000000000000000000000000000000000000000800000;
|
|
35
|
+
|
|
36
|
+
// error code returned when signature or permission validation fails
|
|
37
|
+
uint256 internal constant _SIG_VALIDATION_FAILED = 1;
|
|
38
|
+
|
|
39
|
+
constructor(address entryPoint_) {
|
|
40
|
+
_ENTRY_POINT = entryPoint_;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @inheritdoc IAccount
|
|
45
|
+
*/
|
|
46
|
+
function validateUserOp(
|
|
47
|
+
UserOperation calldata userOp,
|
|
48
|
+
bytes32 userOpHash,
|
|
49
|
+
uint256 /* missingAccountFunds */
|
|
50
|
+
) external returns (uint256) {
|
|
51
|
+
require(
|
|
52
|
+
_extendableMsgSender() == _ENTRY_POINT,
|
|
53
|
+
"Only EntryPoint contract can call this"
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
// recover initiator of the tx from the signature
|
|
57
|
+
bytes32 hash = userOpHash.toEthSignedMessageHash();
|
|
58
|
+
address recovered = hash.recover(userOp.signature);
|
|
59
|
+
|
|
60
|
+
// verify that the recovered address has the _4337_PERMISSION
|
|
61
|
+
if (
|
|
62
|
+
!LSP6Utils.hasPermission(
|
|
63
|
+
IERC725Y(msg.sender).getPermissionsFor(recovered),
|
|
64
|
+
_4337_PERMISSION
|
|
65
|
+
)
|
|
66
|
+
) {
|
|
67
|
+
return _SIG_VALIDATION_FAILED;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// retrieve owner from caller
|
|
71
|
+
address owner = LSP14Ownable2Step(msg.sender).owner();
|
|
72
|
+
|
|
73
|
+
// verify that the recovered address can execute the userOp.callData
|
|
74
|
+
bytes4 returnedStatus = ILSP20CallVerifier(owner).lsp20VerifyCall({
|
|
75
|
+
requestor: _ENTRY_POINT,
|
|
76
|
+
target: msg.sender,
|
|
77
|
+
caller: recovered,
|
|
78
|
+
value: 0,
|
|
79
|
+
callData: userOp.callData
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
// if the returnedStatus is a value different than the success value, return signature validation failed
|
|
83
|
+
if (
|
|
84
|
+
bytes3(returnedStatus) !=
|
|
85
|
+
bytes3(ILSP20CallVerifier.lsp20VerifyCall.selector)
|
|
86
|
+
) {
|
|
87
|
+
return _SIG_VALIDATION_FAILED;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// if sig validation passed, return 0
|
|
91
|
+
return 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @dev Get the address of the Entry Point contract that will execute the user operation.
|
|
96
|
+
* @return The address of the EntryPoint contract
|
|
97
|
+
*/
|
|
98
|
+
function entryPoint() public view returns (address) {
|
|
99
|
+
return _ENTRY_POINT;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
pragma solidity ^0.8.4;
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
ERC721Holder
|
|
6
|
+
} from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @dev LSP17 Extension that can be attached to a LSP17Extendable contract
|
|
10
|
+
* to allow it to receive ERC721 tokens via `safeTransferFrom`.
|
|
11
|
+
*/
|
|
12
|
+
// solhint-disable-next-line no-empty-blocks
|
|
13
|
+
contract OnERC721ReceivedExtension is ERC721Holder {
|
|
14
|
+
|
|
15
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -8,7 +8,6 @@ pragma solidity ^0.8.4;
|
|
|
8
8
|
interface ILSP1UniversalReceiver {
|
|
9
9
|
/**
|
|
10
10
|
* @dev Emitted when the {universalReceiver} function was called with a specific `typeId` and some `receivedData`
|
|
11
|
-
s
|
|
12
11
|
* @notice Address `from` called the `universalReceiver(...)` function while sending `value` LYX. Notification type (typeId): `typeId` - Data received: `receivedData`.
|
|
13
12
|
*
|
|
14
13
|
* @param from The address of the EOA or smart contract that called the {universalReceiver(...)} function.
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
pragma solidity ^0.8.4;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @title Interface of the LSP1 - Universal Receiver Delegate standard.
|
|
6
|
+
* @dev This interface allows contracts implementing the LSP1UniversalReceiver function to delegate the reaction logic to another contract or account. By doing so, the main logic doesn't need to reside within the `universalReceiver` function itself, offering modularity and flexibility.
|
|
7
|
+
*/
|
|
8
|
+
interface ILSP1UniversalReceiverDelegate {
|
|
9
|
+
/**
|
|
10
|
+
* @dev A delegate function that reacts to calls forwarded from the `universalReceiver(..)` function. This allows for modular handling of the logic based on the `typeId` and `data` provided by the initial caller.
|
|
11
|
+
* @notice Reacted on received notification forwarded from `universalReceiver` with `typeId` & `data`.
|
|
12
|
+
*
|
|
13
|
+
* @param sender The address of the EOA or smart contract that initially called the `universalReceiver` function.
|
|
14
|
+
* @param value The amount sent by the `sender` to the `universalReceiver` function.
|
|
15
|
+
* @param typeId The hash of a specific standard or a hook.
|
|
16
|
+
* @param data The arbitrary data received with the initial call to `universalReceiver`.
|
|
17
|
+
*/
|
|
18
|
+
function universalReceiverDelegate(
|
|
19
|
+
address sender,
|
|
20
|
+
uint256 value,
|
|
21
|
+
bytes32 typeId,
|
|
22
|
+
bytes memory data
|
|
23
|
+
) external returns (bytes memory);
|
|
24
|
+
}
|
|
@@ -8,9 +8,3 @@ pragma solidity ^0.8.4;
|
|
|
8
8
|
* @param caller The address of the EOA
|
|
9
9
|
*/
|
|
10
10
|
error CannotRegisterEOAsAsAssets(address caller);
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* @dev Reverts when the {universalReceiver} function in the LSP1 Universal Receiver Delegate contract is called while sending some native tokens along the call (`msg.value` different than `0`)
|
|
14
|
-
* @notice Cannot send native tokens to {universalReceiver(...)} function of the delegated contract.
|
|
15
|
-
*/
|
|
16
|
-
error NativeTokensNotAccepted();
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
// interfaces
|
|
5
5
|
import {
|
|
6
6
|
IERC725Y
|
|
7
7
|
} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
ILSP1UniversalReceiverDelegate
|
|
10
|
+
} from "../ILSP1UniversalReceiverDelegate.sol";
|
|
9
11
|
import {ILSP7DigitalAsset} from "../../LSP7DigitalAsset/ILSP7DigitalAsset.sol";
|
|
10
12
|
|
|
11
13
|
// modules
|
|
@@ -15,9 +17,11 @@ import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
|
15
17
|
import {
|
|
16
18
|
ERC165Checker
|
|
17
19
|
} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
|
|
18
|
-
import {LSP1Utils} from "../LSP1Utils.sol";
|
|
19
|
-
import {LSP2Utils} from "../../LSP2ERC725YJSONSchema/LSP2Utils.sol";
|
|
20
20
|
import {LSP5Utils} from "../../LSP5ReceivedAssets/LSP5Utils.sol";
|
|
21
|
+
import {LSP10Utils} from "../../LSP10ReceivedVaults/LSP10Utils.sol";
|
|
22
|
+
|
|
23
|
+
// constants
|
|
24
|
+
import {_INTERFACEID_LSP1_DELEGATE} from "../LSP1Constants.sol";
|
|
21
25
|
import {
|
|
22
26
|
_TYPEID_LSP7_TOKENSSENDER,
|
|
23
27
|
_TYPEID_LSP7_TOKENSRECIPIENT,
|
|
@@ -32,18 +36,9 @@ import {
|
|
|
32
36
|
_TYPEID_LSP9_OwnershipTransferred_SenderNotification,
|
|
33
37
|
_TYPEID_LSP9_OwnershipTransferred_RecipientNotification
|
|
34
38
|
} from "../../LSP9Vault/LSP9Constants.sol";
|
|
35
|
-
import {LSP10Utils} from "../../LSP10ReceivedVaults/LSP10Utils.sol";
|
|
36
|
-
|
|
37
|
-
// constants
|
|
38
|
-
import "../LSP1Constants.sol";
|
|
39
|
-
import "../../LSP0ERC725Account/LSP0Constants.sol";
|
|
40
|
-
import "../../LSP6KeyManager/LSP6Constants.sol";
|
|
41
|
-
import "../../LSP9Vault/LSP9Constants.sol";
|
|
42
|
-
import "../../LSP10ReceivedVaults/LSP10Constants.sol";
|
|
43
|
-
import "../../LSP14Ownable2Step/LSP14Constants.sol";
|
|
44
39
|
|
|
45
40
|
// errors
|
|
46
|
-
import "../LSP1Errors.sol";
|
|
41
|
+
import {CannotRegisterEOAsAsAssets} from "../LSP1Errors.sol";
|
|
47
42
|
|
|
48
43
|
/**
|
|
49
44
|
* @title Implementation of a UniversalReceiverDelegate for the [LSP-0-ERC725Account]
|
|
@@ -57,7 +52,10 @@ import "../LSP1Errors.sol";
|
|
|
57
52
|
* - Writes the data keys representing the owned vaults from type [LSP-9-Vault] into your account storage, and removes them when transferring ownership to other accounts according to the [LSP-10-ReceivedVaults] Standard.
|
|
58
53
|
*
|
|
59
54
|
*/
|
|
60
|
-
contract LSP1UniversalReceiverDelegateUP is
|
|
55
|
+
contract LSP1UniversalReceiverDelegateUP is
|
|
56
|
+
ERC165,
|
|
57
|
+
ILSP1UniversalReceiverDelegate
|
|
58
|
+
{
|
|
61
59
|
using ERC165Checker for address;
|
|
62
60
|
|
|
63
61
|
/**
|
|
@@ -80,20 +78,15 @@ contract LSP1UniversalReceiverDelegateUP is ERC165, ILSP1UniversalReceiver {
|
|
|
80
78
|
* @param typeId Unique identifier for a specific notification.
|
|
81
79
|
* @return The result of the reaction for `typeId`.
|
|
82
80
|
*/
|
|
83
|
-
function
|
|
81
|
+
function universalReceiverDelegate(
|
|
82
|
+
address notifier,
|
|
83
|
+
uint256 /*value*/,
|
|
84
84
|
bytes32 typeId,
|
|
85
85
|
bytes memory /* data */
|
|
86
|
-
) public
|
|
87
|
-
// CHECK that we did not send any native tokens to the LSP1 Delegate, as it cannot transfer them back.
|
|
88
|
-
if (msg.value != 0) {
|
|
89
|
-
revert NativeTokensNotAccepted();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
address notifier = address(bytes20(msg.data[msg.data.length - 52:]));
|
|
93
|
-
|
|
86
|
+
) public virtual override returns (bytes memory) {
|
|
94
87
|
// The notifier is supposed to be either the LSP7 or LSP8 or LSP9 contract
|
|
95
88
|
// If it's EOA we revert to avoid registering the EOA as asset or vault (spam protection)
|
|
96
|
-
// solhint-disable avoid-tx-origin
|
|
89
|
+
// solhint-disable-next-line avoid-tx-origin
|
|
97
90
|
if (notifier == tx.origin) {
|
|
98
91
|
revert CannotRegisterEOAsAsAssets(notifier);
|
|
99
92
|
}
|
|
@@ -176,7 +169,7 @@ contract LSP1UniversalReceiverDelegateUP is ERC165, ILSP1UniversalReceiver {
|
|
|
176
169
|
) internal returns (bytes memory) {
|
|
177
170
|
// CHECK balance only when the Token contract is already deployed,
|
|
178
171
|
// not when tokens are being transferred on deployment through the `constructor`
|
|
179
|
-
if (notifier.code.length
|
|
172
|
+
if (notifier.code.length != 0) {
|
|
180
173
|
// if the amount sent is 0, then do not update the keys
|
|
181
174
|
try ILSP7DigitalAsset(notifier).balanceOf(msg.sender) returns (
|
|
182
175
|
uint256 balance
|
|
@@ -275,7 +268,7 @@ contract LSP1UniversalReceiverDelegateUP is ERC165, ILSP1UniversalReceiver {
|
|
|
275
268
|
bytes4 interfaceId
|
|
276
269
|
) public view virtual override returns (bool) {
|
|
277
270
|
return
|
|
278
|
-
interfaceId ==
|
|
271
|
+
interfaceId == _INTERFACEID_LSP1_DELEGATE ||
|
|
279
272
|
super.supportsInterface(interfaceId);
|
|
280
273
|
}
|
|
281
274
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
// interfaces
|
|
5
5
|
import {
|
|
6
6
|
IERC725Y
|
|
7
7
|
} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
ILSP1UniversalReceiverDelegate
|
|
10
|
+
} from "../ILSP1UniversalReceiverDelegate.sol";
|
|
9
11
|
import {ILSP7DigitalAsset} from "../../LSP7DigitalAsset/ILSP7DigitalAsset.sol";
|
|
10
12
|
|
|
11
13
|
// modules
|
|
12
14
|
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
13
15
|
|
|
14
16
|
// libraries
|
|
15
|
-
import {LSP1Utils} from "../LSP1Utils.sol";
|
|
16
|
-
import {LSP2Utils} from "../../LSP2ERC725YJSONSchema/LSP2Utils.sol";
|
|
17
17
|
import {LSP5Utils} from "../../LSP5ReceivedAssets/LSP5Utils.sol";
|
|
18
18
|
|
|
19
19
|
// constants
|
|
20
|
-
import "../LSP1Constants.sol";
|
|
20
|
+
import {_INTERFACEID_LSP1_DELEGATE} from "../LSP1Constants.sol";
|
|
21
21
|
import {
|
|
22
22
|
_TYPEID_LSP7_TOKENSSENDER,
|
|
23
23
|
_TYPEID_LSP7_TOKENSRECIPIENT,
|
|
@@ -28,10 +28,9 @@ import {
|
|
|
28
28
|
_TYPEID_LSP8_TOKENSRECIPIENT,
|
|
29
29
|
_INTERFACEID_LSP8
|
|
30
30
|
} from "../../LSP8IdentifiableDigitalAsset/LSP8Constants.sol";
|
|
31
|
-
import "../../LSP9Vault/LSP9Constants.sol";
|
|
32
31
|
|
|
33
32
|
// errors
|
|
34
|
-
import "../LSP1Errors.sol";
|
|
33
|
+
import {CannotRegisterEOAsAsAssets} from "../LSP1Errors.sol";
|
|
35
34
|
|
|
36
35
|
/**
|
|
37
36
|
* @title Implementation of a UniversalReceiverDelegate for the [LSP9Vault]
|
|
@@ -43,9 +42,12 @@ import "../LSP1Errors.sol";
|
|
|
43
42
|
*
|
|
44
43
|
* - Writes the data keys representing assets received from type [LSP-7-DigitalAsset] and [LSP-8-IdentifiableDigitalAsset] into the account storage, and removes them when the balance is zero according to the [LSP-5-ReceivedAssets] Standard.
|
|
45
44
|
*/
|
|
46
|
-
contract LSP1UniversalReceiverDelegateVault is
|
|
45
|
+
contract LSP1UniversalReceiverDelegateVault is
|
|
46
|
+
ERC165,
|
|
47
|
+
ILSP1UniversalReceiverDelegate
|
|
48
|
+
{
|
|
47
49
|
/**
|
|
48
|
-
* @inheritdoc
|
|
50
|
+
* @inheritdoc ILSP1UniversalReceiverDelegate
|
|
49
51
|
* @dev Handles two cases:
|
|
50
52
|
*
|
|
51
53
|
* Writes the received [LSP-7-DigitalAsset] or [LSP-8-IdentifiableDigitalAsset] assets into the vault storage according to the [LSP-5-ReceivedAssets] standard.
|
|
@@ -60,20 +62,15 @@ contract LSP1UniversalReceiverDelegateVault is ERC165, ILSP1UniversalReceiver {
|
|
|
60
62
|
* @param typeId Unique identifier for a specific notification.
|
|
61
63
|
* @return The result of the reaction for `typeId`.
|
|
62
64
|
*/
|
|
63
|
-
function
|
|
65
|
+
function universalReceiverDelegate(
|
|
66
|
+
address notifier,
|
|
67
|
+
uint256 /*value*/,
|
|
64
68
|
bytes32 typeId,
|
|
65
69
|
bytes memory /* data */
|
|
66
|
-
) public
|
|
67
|
-
// CHECK that we did not send any native tokens to the LSP1 Delegate, as it cannot transfer them back.
|
|
68
|
-
if (msg.value != 0) {
|
|
69
|
-
revert NativeTokensNotAccepted();
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
address notifier = address(bytes20(msg.data[msg.data.length - 52:]));
|
|
73
|
-
|
|
70
|
+
) public virtual override returns (bytes memory) {
|
|
74
71
|
// The notifier is supposed to be either the LSP7 or LSP8 contract
|
|
75
72
|
// If it's EOA we revert to avoid registering the EOA as asset (spam protection)
|
|
76
|
-
// solhint-disable avoid-tx-origin
|
|
73
|
+
// solhint-disable-next-line avoid-tx-origin
|
|
77
74
|
if (notifier == tx.origin) {
|
|
78
75
|
revert CannotRegisterEOAsAsAssets(notifier);
|
|
79
76
|
}
|
|
@@ -148,7 +145,7 @@ contract LSP1UniversalReceiverDelegateVault is ERC165, ILSP1UniversalReceiver {
|
|
|
148
145
|
) internal returns (bytes memory) {
|
|
149
146
|
// CHECK balance only when the Token contract is already deployed,
|
|
150
147
|
// not when tokens are being transferred on deployment through the `constructor`
|
|
151
|
-
if (notifier.code.length
|
|
148
|
+
if (notifier.code.length != 0) {
|
|
152
149
|
// if the amount sent is 0, then do not update the keys
|
|
153
150
|
try ILSP7DigitalAsset(notifier).balanceOf(msg.sender) returns (
|
|
154
151
|
uint256 balance
|
|
@@ -201,7 +198,7 @@ contract LSP1UniversalReceiverDelegateVault is ERC165, ILSP1UniversalReceiver {
|
|
|
201
198
|
bytes4 interfaceId
|
|
202
199
|
) public view virtual override returns (bool) {
|
|
203
200
|
return
|
|
204
|
-
interfaceId ==
|
|
201
|
+
interfaceId == _INTERFACEID_LSP1_DELEGATE ||
|
|
205
202
|
super.supportsInterface(interfaceId);
|
|
206
203
|
}
|
|
207
204
|
}
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
// libraries
|
|
5
|
-
import {Address} from "@openzeppelin/contracts/utils/Address.sol";
|
|
6
5
|
import {
|
|
7
6
|
ERC165Checker
|
|
8
7
|
} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
|
|
9
8
|
import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";
|
|
10
9
|
|
|
11
10
|
// constants
|
|
12
|
-
import "./ILSP1UniversalReceiver.sol";
|
|
11
|
+
import {ILSP1UniversalReceiver as ILSP1} from "./ILSP1UniversalReceiver.sol";
|
|
13
12
|
|
|
14
13
|
// constants
|
|
15
14
|
import {
|
|
@@ -45,53 +44,10 @@ library LSP1Utils {
|
|
|
45
44
|
_INTERFACEID_LSP1
|
|
46
45
|
)
|
|
47
46
|
) {
|
|
48
|
-
|
|
49
|
-
typeId,
|
|
50
|
-
data
|
|
51
|
-
);
|
|
47
|
+
ILSP1(lsp1Implementation).universalReceiver(typeId, data);
|
|
52
48
|
}
|
|
53
49
|
}
|
|
54
50
|
|
|
55
|
-
/**
|
|
56
|
-
* @dev Call a LSP1UniversalReceiverDelegate contract at `universalReceiverDelegate` address and append `msgSender` and `msgValue`
|
|
57
|
-
* as additional informations in the calldata.
|
|
58
|
-
*
|
|
59
|
-
* @param universalReceiverDelegate The address of the LSP1UniversalReceiverDelegate to delegate the `universalReceiver` function to.
|
|
60
|
-
* @param typeId A `bytes32` typeId.
|
|
61
|
-
* @param receivedData The data sent initially to the `universalReceiver` function.
|
|
62
|
-
* @param msgSender The address that initially called the `universalReceiver` function.
|
|
63
|
-
* @param msgValue The amount of native token received initially by the `universalReceiver` function.
|
|
64
|
-
*
|
|
65
|
-
* @return The data returned by the LSP1UniversalReceiverDelegate contract.
|
|
66
|
-
*/
|
|
67
|
-
function callUniversalReceiverWithCallerInfos(
|
|
68
|
-
address universalReceiverDelegate,
|
|
69
|
-
bytes32 typeId,
|
|
70
|
-
bytes calldata receivedData,
|
|
71
|
-
address msgSender,
|
|
72
|
-
uint256 msgValue
|
|
73
|
-
) internal returns (bytes memory) {
|
|
74
|
-
bytes memory callData = abi.encodePacked(
|
|
75
|
-
abi.encodeWithSelector(
|
|
76
|
-
ILSP1UniversalReceiver.universalReceiver.selector,
|
|
77
|
-
typeId,
|
|
78
|
-
receivedData
|
|
79
|
-
),
|
|
80
|
-
msgSender,
|
|
81
|
-
msgValue
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
(bool success, bytes memory result) = universalReceiverDelegate.call(
|
|
85
|
-
callData
|
|
86
|
-
);
|
|
87
|
-
Address.verifyCallResult(
|
|
88
|
-
success,
|
|
89
|
-
result,
|
|
90
|
-
"Call to universalReceiver failed"
|
|
91
|
-
);
|
|
92
|
-
return result.length != 0 ? abi.decode(result, (bytes)) : result;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
51
|
/**
|
|
96
52
|
* @notice Retrieving the value stored under the ERC725Y data key `LSP1UniversalReceiverDelegate`.
|
|
97
53
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -8,28 +8,32 @@ pragma solidity ^0.8.4;
|
|
|
8
8
|
*/
|
|
9
9
|
interface ILSP20CallVerifier {
|
|
10
10
|
/**
|
|
11
|
-
* @return
|
|
11
|
+
* @return returnedStatus MUST return the first 3 bytes of `lsp20VerifyCall(address,uint256,bytes)` function selector if the call to
|
|
12
12
|
* the function is allowed, concatened with a byte that determines if the lsp20VerifyCallResult function should
|
|
13
13
|
* be called after the original function call. The byte that invoke the lsp20VerifyCallResult function is strictly `0x01`.
|
|
14
14
|
*
|
|
15
|
-
* @param
|
|
15
|
+
* @param requestor The address that requested to make the call to `target`.
|
|
16
|
+
* @param target The address of the contract that implements the `LSP20CallVerification` interface.
|
|
17
|
+
* @param caller The address who called the function on the `target` contract.
|
|
16
18
|
* @param value The value sent by the caller to the function called on the msg.sender
|
|
17
|
-
* @param
|
|
19
|
+
* @param callData The calldata sent by the caller to the msg.sender
|
|
18
20
|
*/
|
|
19
21
|
function lsp20VerifyCall(
|
|
22
|
+
address requestor,
|
|
23
|
+
address target,
|
|
20
24
|
address caller,
|
|
21
25
|
uint256 value,
|
|
22
|
-
bytes memory
|
|
23
|
-
) external returns (bytes4
|
|
26
|
+
bytes memory callData
|
|
27
|
+
) external returns (bytes4 returnedStatus);
|
|
24
28
|
|
|
25
29
|
/**
|
|
26
30
|
* @return MUST return the lsp20VerifyCallResult function selector if the call to the function is allowed
|
|
27
31
|
*
|
|
28
|
-
* @param callHash The keccak256 of the parameters of {lsp20VerifyCall} concatenated
|
|
29
|
-
* @param
|
|
32
|
+
* @param callHash The keccak256 hash of the parameters of {lsp20VerifyCall} concatenated
|
|
33
|
+
* @param callResult The value result of the function called on the msg.sender
|
|
30
34
|
*/
|
|
31
35
|
function lsp20VerifyCallResult(
|
|
32
36
|
bytes32 callHash,
|
|
33
|
-
bytes memory
|
|
37
|
+
bytes memory callResult
|
|
34
38
|
) external returns (bytes4);
|
|
35
39
|
}
|