@lukso/lsp-smart-contracts 0.11.1 → 0.12.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/README.md +10 -2
- package/artifacts/Create2Factory.json +2 -2
- package/artifacts/LSP0ERC725Account.json +68 -47
- package/artifacts/LSP0ERC725AccountInit.json +68 -47
- package/artifacts/LSP11BasicSocialRecovery.json +18 -2
- package/artifacts/LSP11BasicSocialRecoveryInit.json +18 -2
- package/artifacts/LSP16UniversalFactory.json +3 -3
- package/artifacts/LSP1UniversalReceiverDelegateUP.json +27 -46
- package/artifacts/LSP1UniversalReceiverDelegateVault.json +27 -46
- package/artifacts/LSP23LinkedContractsFactory.json +3 -3
- package/artifacts/LSP4DigitalAssetMetadata.json +16 -0
- package/artifacts/LSP4DigitalAssetMetadataInitAbstract.json +16 -0
- package/artifacts/LSP6KeyManager.json +34 -6
- package/artifacts/LSP6KeyManagerInit.json +34 -6
- package/artifacts/LSP7CappedSupply.json +64 -4
- package/artifacts/LSP7CappedSupplyInitAbstract.json +64 -4
- package/artifacts/LSP7CompatibleERC20.json +83 -23
- package/artifacts/LSP7CompatibleERC20InitAbstract.json +83 -23
- package/artifacts/LSP7CompatibleERC20Mintable.json +86 -26
- package/artifacts/LSP7CompatibleERC20MintableInit.json +86 -26
- package/artifacts/LSP7DigitalAsset.json +64 -4
- package/artifacts/LSP7DigitalAssetInitAbstract.json +64 -4
- package/artifacts/LSP7Mintable.json +67 -7
- package/artifacts/LSP7MintableInit.json +67 -7
- package/artifacts/LSP8CappedSupply.json +57 -3
- package/artifacts/LSP8CappedSupplyInitAbstract.json +57 -3
- package/artifacts/LSP8CompatibleERC721.json +79 -25
- package/artifacts/LSP8CompatibleERC721InitAbstract.json +79 -25
- package/artifacts/LSP8CompatibleERC721Mintable.json +87 -28
- package/artifacts/LSP8CompatibleERC721MintableInit.json +87 -28
- package/artifacts/LSP8IdentifiableDigitalAsset.json +57 -3
- package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +57 -3
- package/artifacts/LSP8Mintable.json +65 -6
- package/artifacts/LSP8MintableInit.json +65 -6
- package/artifacts/LSP9Vault.json +51 -35
- package/artifacts/LSP9VaultInit.json +51 -35
- package/artifacts/UniversalProfile.json +68 -47
- package/artifacts/UniversalProfileInit.json +68 -47
- package/contracts/Factories/Create2Factory.sol +1 -1
- package/contracts/LSP0ERC725Account/ILSP0ERC725Account.sol +0 -22
- package/contracts/LSP0ERC725Account/LSP0Constants.sol +6 -1
- package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +12 -2
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +196 -123
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +1 -1
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +11 -2
- 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 +22 -15
- package/contracts/LSP17ContractExtension/LSP17Extension.sol +6 -5
- 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 +49 -33
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +33 -27
- package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +5 -48
- package/contracts/LSP20CallVerification/ILSP20CallVerifier.sol +13 -9
- package/contracts/LSP20CallVerification/LSP20CallVerification.sol +64 -45
- package/contracts/LSP20CallVerification/LSP20Constants.sol +6 -6
- package/contracts/LSP20CallVerification/LSP20Errors.sol +10 -4
- 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 +176 -101
- 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 +34 -28
- package/contracts/LSP6KeyManager/LSP6Utils.sol +29 -2
- package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +70 -10
- package/contracts/LSP7DigitalAsset/LSP7Constants.sol +2 -2
- package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +29 -13
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +273 -265
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +28 -12
- package/contracts/LSP7DigitalAsset/LSP7Errors.sol +17 -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 +128 -54
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +129 -54
- 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 +16 -11
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +20 -6
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +32 -16
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +67 -16
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +143 -137
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +69 -15
- 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 +172 -80
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +178 -91
- 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 -21
- package/contracts/LSP9Vault/LSP9Constants.sol +6 -1
- package/contracts/LSP9Vault/LSP9Errors.sol +1 -1
- package/contracts/LSP9Vault/LSP9Vault.sol +11 -2
- package/contracts/LSP9Vault/LSP9VaultCore.sol +119 -66
- package/contracts/LSP9Vault/LSP9VaultInit.sol +1 -1
- package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +11 -2
- package/contracts/UniversalProfile.sol +1 -1
- package/contracts/UniversalProfileInit.sol +1 -1
- package/contracts/UniversalProfileInitAbstract.sol +1 -1
- package/contracts/Version.sol +16 -0
- package/devdocs/LSP0ERC725Account.json +86 -52
- package/devdocs/LSP0ERC725AccountInit.json +86 -52
- package/devdocs/LSP11BasicSocialRecovery.json +13 -0
- package/devdocs/LSP11BasicSocialRecoveryInit.json +13 -0
- package/devdocs/LSP16UniversalFactory.json +9 -9
- package/devdocs/LSP1UniversalReceiverDelegateUP.json +7 -6
- package/devdocs/LSP1UniversalReceiverDelegateVault.json +7 -6
- package/devdocs/LSP4DigitalAssetMetadata.json +32 -10
- package/devdocs/LSP4DigitalAssetMetadataInitAbstract.json +32 -10
- package/devdocs/LSP6KeyManager.json +27 -13
- package/devdocs/LSP6KeyManagerInit.json +27 -13
- package/devdocs/LSP7CappedSupply.json +61 -28
- package/devdocs/LSP7CappedSupplyInitAbstract.json +61 -28
- package/devdocs/LSP7CompatibleERC20.json +102 -32
- package/devdocs/LSP7CompatibleERC20InitAbstract.json +102 -32
- package/devdocs/LSP7CompatibleERC20Mintable.json +102 -32
- package/devdocs/LSP7CompatibleERC20MintableInit.json +102 -32
- package/devdocs/LSP7DigitalAsset.json +61 -28
- package/devdocs/LSP7DigitalAssetInitAbstract.json +61 -28
- package/devdocs/LSP7Mintable.json +61 -28
- package/devdocs/LSP7MintableInit.json +61 -28
- package/devdocs/LSP8CappedSupply.json +66 -27
- package/devdocs/LSP8CappedSupplyInitAbstract.json +66 -27
- package/devdocs/LSP8CompatibleERC721.json +93 -33
- package/devdocs/LSP8CompatibleERC721InitAbstract.json +93 -33
- package/devdocs/LSP8CompatibleERC721Mintable.json +95 -35
- package/devdocs/LSP8CompatibleERC721MintableInit.json +96 -36
- package/devdocs/LSP8IdentifiableDigitalAsset.json +70 -28
- package/devdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +66 -27
- package/devdocs/LSP8Mintable.json +68 -29
- package/devdocs/LSP8MintableInit.json +69 -30
- package/devdocs/LSP9Vault.json +69 -41
- package/devdocs/LSP9VaultInit.json +69 -41
- package/devdocs/UniversalProfile.json +86 -52
- package/devdocs/UniversalProfileInit.json +86 -52
- package/dist/constants.cjs.js +5565 -2846
- package/dist/constants.d.ts +3996 -1182
- package/dist/constants.es.js +5564 -2846
- package/package.json +8 -8
- package/userdocs/LSP0ERC725Account.json +20 -11
- package/userdocs/LSP0ERC725AccountInit.json +20 -11
- package/userdocs/LSP16UniversalFactory.json +26 -1
- package/userdocs/LSP1UniversalReceiverDelegateUP.json +4 -11
- package/userdocs/LSP1UniversalReceiverDelegateVault.json +4 -11
- package/userdocs/LSP4DigitalAssetMetadata.json +7 -4
- package/userdocs/LSP4DigitalAssetMetadataInitAbstract.json +7 -4
- package/userdocs/LSP6KeyManager.json +3 -5
- package/userdocs/LSP6KeyManagerInit.json +3 -5
- package/userdocs/LSP7CappedSupply.json +17 -6
- package/userdocs/LSP7CappedSupplyInitAbstract.json +16 -5
- package/userdocs/LSP7CompatibleERC20.json +18 -5
- package/userdocs/LSP7CompatibleERC20InitAbstract.json +18 -5
- package/userdocs/LSP7CompatibleERC20Mintable.json +18 -5
- package/userdocs/LSP7CompatibleERC20MintableInit.json +18 -5
- package/userdocs/LSP7DigitalAsset.json +18 -5
- package/userdocs/LSP7DigitalAssetInitAbstract.json +18 -5
- package/userdocs/LSP7Mintable.json +18 -5
- package/userdocs/LSP7MintableInit.json +18 -5
- package/userdocs/LSP8CappedSupply.json +16 -5
- package/userdocs/LSP8CappedSupplyInitAbstract.json +15 -4
- package/userdocs/LSP8CompatibleERC721.json +30 -17
- package/userdocs/LSP8CompatibleERC721InitAbstract.json +30 -17
- package/userdocs/LSP8CompatibleERC721Mintable.json +31 -18
- package/userdocs/LSP8CompatibleERC721MintableInit.json +32 -19
- package/userdocs/LSP8IdentifiableDigitalAsset.json +18 -5
- package/userdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +17 -4
- package/userdocs/LSP8Mintable.json +18 -5
- package/userdocs/LSP8MintableInit.json +19 -6
- package/userdocs/LSP9Vault.json +23 -14
- package/userdocs/LSP9VaultInit.json +23 -14
- package/userdocs/UniversalProfile.json +20 -11
- package/userdocs/UniversalProfileInit.json +20 -11
- package/CONTRIBUTING.md +0 -184
- 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
|
@@ -18,11 +18,15 @@ import {
|
|
|
18
18
|
} from "../LSP25ExecuteRelayCall/ILSP25ExecuteRelayCall.sol";
|
|
19
19
|
|
|
20
20
|
// modules
|
|
21
|
+
import {Version} from "../Version.sol";
|
|
21
22
|
import {ILSP14Ownable2Step} from "../LSP14Ownable2Step/ILSP14Ownable2Step.sol";
|
|
22
23
|
import {ERC725Y} from "@erc725/smart-contracts/contracts/ERC725Y.sol";
|
|
23
24
|
import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
|
|
24
25
|
import {LSP6SetDataModule} from "./LSP6Modules/LSP6SetDataModule.sol";
|
|
25
26
|
import {LSP6ExecuteModule} from "./LSP6Modules/LSP6ExecuteModule.sol";
|
|
27
|
+
import {
|
|
28
|
+
LSP6ExecuteRelayCallModule
|
|
29
|
+
} from "./LSP6Modules/LSP6ExecuteRelayCallModule.sol";
|
|
26
30
|
import {LSP6OwnershipModule} from "./LSP6Modules/LSP6OwnershipModule.sol";
|
|
27
31
|
import {
|
|
28
32
|
LSP25MultiChannelNonce
|
|
@@ -35,6 +39,10 @@ import {Address} from "@openzeppelin/contracts/utils/Address.sol";
|
|
|
35
39
|
import {LSP6Utils} from "./LSP6Utils.sol";
|
|
36
40
|
|
|
37
41
|
// errors
|
|
42
|
+
import {
|
|
43
|
+
ERC725X_ExecuteParametersLengthMismatch,
|
|
44
|
+
ERC725X_ExecuteParametersEmptyArray
|
|
45
|
+
} from "@erc725/smart-contracts/contracts/errors.sol";
|
|
38
46
|
import {
|
|
39
47
|
BatchExecuteParamsLengthMismatch,
|
|
40
48
|
BatchExecuteRelayCallParamsLengthMismatch,
|
|
@@ -43,13 +51,12 @@ import {
|
|
|
43
51
|
InvalidPayload,
|
|
44
52
|
InvalidRelayNonce,
|
|
45
53
|
NoPermissionsSet,
|
|
46
|
-
InvalidERC725Function
|
|
47
|
-
CannotSendValueToSetData
|
|
54
|
+
InvalidERC725Function
|
|
48
55
|
} from "./LSP6Errors.sol";
|
|
49
56
|
|
|
50
57
|
import {
|
|
51
58
|
_INTERFACEID_ERC1271,
|
|
52
|
-
|
|
59
|
+
_ERC1271_SUCCESSVALUE,
|
|
53
60
|
_ERC1271_FAILVALUE
|
|
54
61
|
} from "../LSP0ERC725Account/LSP0Constants.sol";
|
|
55
62
|
import {
|
|
@@ -57,7 +64,12 @@ import {
|
|
|
57
64
|
_PERMISSION_SIGN,
|
|
58
65
|
_PERMISSION_REENTRANCY
|
|
59
66
|
} from "./LSP6Constants.sol";
|
|
60
|
-
import
|
|
67
|
+
import {
|
|
68
|
+
_INTERFACEID_LSP20_CALL_VERIFIER,
|
|
69
|
+
_LSP20_VERIFY_CALL_SUCCESS_VALUE_WITHOUT_POST_VERIFICATION,
|
|
70
|
+
_LSP20_VERIFY_CALL_SUCCESS_VALUE_WITH_POST_VERIFICATION,
|
|
71
|
+
_LSP20_VERIFY_CALL_RESULT_SUCCESS_VALUE
|
|
72
|
+
} from "../LSP20CallVerification/LSP20Constants.sol";
|
|
61
73
|
import {_INTERFACEID_LSP25} from "../LSP25ExecuteRelayCall/LSP25Constants.sol";
|
|
62
74
|
|
|
63
75
|
/**
|
|
@@ -72,11 +84,14 @@ import {_INTERFACEID_LSP25} from "../LSP25ExecuteRelayCall/LSP25Constants.sol";
|
|
|
72
84
|
*/
|
|
73
85
|
abstract contract LSP6KeyManagerCore is
|
|
74
86
|
ERC165,
|
|
87
|
+
IERC1271,
|
|
75
88
|
ILSP6,
|
|
76
89
|
ILSP20,
|
|
77
90
|
ILSP25,
|
|
91
|
+
Version,
|
|
78
92
|
LSP6SetDataModule,
|
|
79
93
|
LSP6ExecuteModule,
|
|
94
|
+
LSP6ExecuteRelayCallModule,
|
|
80
95
|
LSP6OwnershipModule,
|
|
81
96
|
LSP25MultiChannelNonce
|
|
82
97
|
{
|
|
@@ -86,14 +101,12 @@ abstract contract LSP6KeyManagerCore is
|
|
|
86
101
|
|
|
87
102
|
address internal _target;
|
|
88
103
|
|
|
89
|
-
|
|
90
|
-
// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v4.8/contracts/security/ReentrancyGuard.sol
|
|
91
|
-
bool internal _reentrancyStatus;
|
|
104
|
+
mapping(address => bool) internal _reentrancyStatus;
|
|
92
105
|
|
|
93
106
|
/**
|
|
94
107
|
* @inheritdoc ILSP6
|
|
95
108
|
*/
|
|
96
|
-
function target() public view returns (address) {
|
|
109
|
+
function target() public view override returns (address) {
|
|
97
110
|
return _target;
|
|
98
111
|
}
|
|
99
112
|
|
|
@@ -128,7 +141,7 @@ abstract contract LSP6KeyManagerCore is
|
|
|
128
141
|
function getNonce(
|
|
129
142
|
address from,
|
|
130
143
|
uint128 channelId
|
|
131
|
-
) public view virtual returns (uint256) {
|
|
144
|
+
) public view virtual override returns (uint256) {
|
|
132
145
|
return LSP25MultiChannelNonce._getNonce(from, channelId);
|
|
133
146
|
}
|
|
134
147
|
|
|
@@ -136,14 +149,14 @@ abstract contract LSP6KeyManagerCore is
|
|
|
136
149
|
* @inheritdoc IERC1271
|
|
137
150
|
*
|
|
138
151
|
* @dev Checks if a signature was signed by a controller that has the permission `SIGN`.
|
|
139
|
-
* If the signer is a controller with the permission `SIGN`, it will return the ERC1271
|
|
152
|
+
* If the signer is a controller with the permission `SIGN`, it will return the ERC1271 success value.
|
|
140
153
|
*
|
|
141
|
-
* @return
|
|
154
|
+
* @return returnedStatus `0x1626ba7e` on success, or `0xffffffff` on failure.
|
|
142
155
|
*/
|
|
143
156
|
function isValidSignature(
|
|
144
157
|
bytes32 dataHash,
|
|
145
158
|
bytes memory signature
|
|
146
|
-
) public view virtual returns (bytes4
|
|
159
|
+
) public view virtual override returns (bytes4 returnedStatus) {
|
|
147
160
|
// if isValidSignature fail, the error is catched in returnedError
|
|
148
161
|
(address recoveredAddress, ECDSA.RecoverError returnedError) = ECDSA
|
|
149
162
|
.tryRecover(dataHash, signature);
|
|
@@ -152,12 +165,12 @@ abstract contract LSP6KeyManagerCore is
|
|
|
152
165
|
if (returnedError != ECDSA.RecoverError.NoError)
|
|
153
166
|
return _ERC1271_FAILVALUE;
|
|
154
167
|
|
|
155
|
-
// if the address recovered has SIGN permission return the ERC1271
|
|
168
|
+
// if the address recovered has SIGN permission return the ERC1271 success value, otherwise the fail value
|
|
156
169
|
return (
|
|
157
170
|
ERC725Y(_target).getPermissionsFor(recoveredAddress).hasPermission(
|
|
158
171
|
_PERMISSION_SIGN
|
|
159
172
|
)
|
|
160
|
-
?
|
|
173
|
+
? _ERC1271_SUCCESSVALUE
|
|
161
174
|
: _ERC1271_FAILVALUE
|
|
162
175
|
);
|
|
163
176
|
}
|
|
@@ -169,7 +182,7 @@ abstract contract LSP6KeyManagerCore is
|
|
|
169
182
|
*/
|
|
170
183
|
function execute(
|
|
171
184
|
bytes calldata payload
|
|
172
|
-
) public payable virtual returns (bytes memory) {
|
|
185
|
+
) public payable virtual override returns (bytes memory) {
|
|
173
186
|
return _execute(msg.value, payload);
|
|
174
187
|
}
|
|
175
188
|
|
|
@@ -181,7 +194,7 @@ abstract contract LSP6KeyManagerCore is
|
|
|
181
194
|
function executeBatch(
|
|
182
195
|
uint256[] calldata values,
|
|
183
196
|
bytes[] calldata payloads
|
|
184
|
-
) public payable virtual returns (bytes[] memory) {
|
|
197
|
+
) public payable virtual override returns (bytes[] memory) {
|
|
185
198
|
if (values.length != payloads.length) {
|
|
186
199
|
revert BatchExecuteParamsLengthMismatch();
|
|
187
200
|
}
|
|
@@ -189,7 +202,7 @@ abstract contract LSP6KeyManagerCore is
|
|
|
189
202
|
bytes[] memory results = new bytes[](payloads.length);
|
|
190
203
|
uint256 totalValues;
|
|
191
204
|
|
|
192
|
-
for (uint256 ii
|
|
205
|
+
for (uint256 ii; ii < payloads.length; ) {
|
|
193
206
|
if ((totalValues += values[ii]) > msg.value) {
|
|
194
207
|
revert LSP6BatchInsufficientValueSent(totalValues, msg.value);
|
|
195
208
|
}
|
|
@@ -229,7 +242,7 @@ abstract contract LSP6KeyManagerCore is
|
|
|
229
242
|
uint256 nonce,
|
|
230
243
|
uint256 validityTimestamps,
|
|
231
244
|
bytes calldata payload
|
|
232
|
-
) public payable virtual returns (bytes memory) {
|
|
245
|
+
) public payable virtual override returns (bytes memory) {
|
|
233
246
|
return
|
|
234
247
|
_executeRelayCall(
|
|
235
248
|
signature,
|
|
@@ -259,7 +272,7 @@ abstract contract LSP6KeyManagerCore is
|
|
|
259
272
|
uint256[] calldata validityTimestamps,
|
|
260
273
|
uint256[] calldata values,
|
|
261
274
|
bytes[] calldata payloads
|
|
262
|
-
) public payable virtual returns (bytes[] memory) {
|
|
275
|
+
) public payable virtual override returns (bytes[] memory) {
|
|
263
276
|
if (
|
|
264
277
|
signatures.length != nonces.length ||
|
|
265
278
|
nonces.length != validityTimestamps.length ||
|
|
@@ -272,7 +285,7 @@ abstract contract LSP6KeyManagerCore is
|
|
|
272
285
|
bytes[] memory results = new bytes[](payloads.length);
|
|
273
286
|
uint256 totalValues;
|
|
274
287
|
|
|
275
|
-
for (uint256 ii
|
|
288
|
+
for (uint256 ii; ii < payloads.length; ) {
|
|
276
289
|
if ((totalValues += values[ii]) > msg.value) {
|
|
277
290
|
revert LSP6BatchInsufficientValueSent(totalValues, msg.value);
|
|
278
291
|
}
|
|
@@ -299,53 +312,65 @@ abstract contract LSP6KeyManagerCore is
|
|
|
299
312
|
|
|
300
313
|
/**
|
|
301
314
|
* @inheritdoc ILSP20
|
|
315
|
+
*
|
|
316
|
+
* @custom:hint This function can call by any other address than the {`target`}.
|
|
317
|
+
* This allows to verify permissions in a _"read-only"_ manner.
|
|
318
|
+
*
|
|
319
|
+
* Anyone can call this function to verify if the `caller` has the right permissions to perform the abi-encoded function call `data`
|
|
320
|
+
* on the {`target`} contract (while sending `msgValue` alongside the call).
|
|
321
|
+
*
|
|
322
|
+
* If the permissions have been verified successfully and `caller` is authorized, one of the following two LSP20 success value will be returned:
|
|
323
|
+
* - `0x1a238000`: LSP20 success value **without** post verification (last byte is `0x00`).
|
|
324
|
+
* - `0x1a238001`: LSP20 success value **with** post-verification (last byte is `0x01`).
|
|
302
325
|
*/
|
|
303
326
|
function lsp20VerifyCall(
|
|
327
|
+
address /* requestor */,
|
|
328
|
+
address targetContract,
|
|
304
329
|
address caller,
|
|
305
330
|
uint256 msgValue,
|
|
306
|
-
bytes calldata
|
|
307
|
-
) external virtual returns (bytes4) {
|
|
308
|
-
bool isSetData =
|
|
309
|
-
|
|
310
|
-
bytes4(data) == IERC725Y.setData.selector ||
|
|
311
|
-
bytes4(data) == IERC725Y.setDataBatch.selector
|
|
312
|
-
) {
|
|
313
|
-
isSetData = true;
|
|
314
|
-
}
|
|
331
|
+
bytes calldata callData
|
|
332
|
+
) external virtual override returns (bytes4) {
|
|
333
|
+
bool isSetData = bytes4(callData) == IERC725Y.setData.selector ||
|
|
334
|
+
bytes4(callData) == IERC725Y.setDataBatch.selector;
|
|
315
335
|
|
|
316
336
|
// If target is invoking the verification, emit the event and change the reentrancy guard
|
|
317
|
-
if (msg.sender ==
|
|
318
|
-
bool
|
|
337
|
+
if (msg.sender == targetContract) {
|
|
338
|
+
bool reentrancyStatus = _nonReentrantBefore(
|
|
339
|
+
targetContract,
|
|
340
|
+
isSetData,
|
|
341
|
+
caller
|
|
342
|
+
);
|
|
343
|
+
|
|
344
|
+
_verifyPermissions(targetContract, caller, false, callData);
|
|
319
345
|
|
|
320
|
-
|
|
321
|
-
emit PermissionsVerified(caller, msgValue, bytes4(data));
|
|
346
|
+
emit PermissionsVerified(caller, msgValue, bytes4(callData));
|
|
322
347
|
|
|
323
348
|
// if it's a setData call, do not invoke the `lsp20VerifyCallResult(..)` function
|
|
324
349
|
return
|
|
325
|
-
isSetData ||
|
|
326
|
-
?
|
|
327
|
-
:
|
|
350
|
+
isSetData || reentrancyStatus
|
|
351
|
+
? _LSP20_VERIFY_CALL_SUCCESS_VALUE_WITHOUT_POST_VERIFICATION
|
|
352
|
+
: _LSP20_VERIFY_CALL_SUCCESS_VALUE_WITH_POST_VERIFICATION;
|
|
328
353
|
}
|
|
329
|
-
|
|
330
|
-
|
|
354
|
+
/// @dev If a different address is invoking the verification,
|
|
355
|
+
/// do not change the state or emit the event to allow read-only verification
|
|
331
356
|
else {
|
|
332
|
-
bool
|
|
357
|
+
bool reentrancyStatus = _reentrancyStatus[targetContract];
|
|
333
358
|
|
|
334
|
-
if (
|
|
359
|
+
if (reentrancyStatus) {
|
|
335
360
|
_requirePermissions(
|
|
336
361
|
caller,
|
|
337
|
-
ERC725Y(
|
|
362
|
+
ERC725Y(targetContract).getPermissionsFor(caller),
|
|
338
363
|
_PERMISSION_REENTRANCY
|
|
339
364
|
);
|
|
340
365
|
}
|
|
341
366
|
|
|
342
|
-
_verifyPermissions(caller,
|
|
367
|
+
_verifyPermissions(targetContract, caller, false, callData);
|
|
343
368
|
|
|
344
369
|
// if it's a setData call, do not invoke the `lsp20VerifyCallResult(..)` function
|
|
345
370
|
return
|
|
346
|
-
isSetData ||
|
|
347
|
-
?
|
|
348
|
-
:
|
|
371
|
+
isSetData || reentrancyStatus
|
|
372
|
+
? _LSP20_VERIFY_CALL_SUCCESS_VALUE_WITHOUT_POST_VERIFICATION
|
|
373
|
+
: _LSP20_VERIFY_CALL_SUCCESS_VALUE_WITH_POST_VERIFICATION;
|
|
349
374
|
}
|
|
350
375
|
}
|
|
351
376
|
|
|
@@ -353,15 +378,15 @@ abstract contract LSP6KeyManagerCore is
|
|
|
353
378
|
* @inheritdoc ILSP20
|
|
354
379
|
*/
|
|
355
380
|
function lsp20VerifyCallResult(
|
|
356
|
-
bytes32 /*callHash*/,
|
|
357
|
-
bytes memory /*
|
|
358
|
-
) external virtual returns (bytes4) {
|
|
381
|
+
bytes32 /* callHash */,
|
|
382
|
+
bytes memory /* callResult */
|
|
383
|
+
) external virtual override returns (bytes4) {
|
|
359
384
|
// If it's the target calling, set back the reentrancy guard
|
|
360
|
-
// to false, if not return the
|
|
385
|
+
// to false, if not return the success value
|
|
361
386
|
if (msg.sender == _target) {
|
|
362
|
-
_nonReentrantAfter();
|
|
387
|
+
_nonReentrantAfter(msg.sender);
|
|
363
388
|
}
|
|
364
|
-
return
|
|
389
|
+
return _LSP20_VERIFY_CALL_RESULT_SUCCESS_VALUE;
|
|
365
390
|
}
|
|
366
391
|
|
|
367
392
|
function _execute(
|
|
@@ -372,23 +397,29 @@ abstract contract LSP6KeyManagerCore is
|
|
|
372
397
|
revert InvalidPayload(payload);
|
|
373
398
|
}
|
|
374
399
|
|
|
375
|
-
bool isSetData =
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
400
|
+
bool isSetData = bytes4(payload) == IERC725Y.setData.selector ||
|
|
401
|
+
bytes4(payload) == IERC725Y.setDataBatch.selector;
|
|
402
|
+
|
|
403
|
+
address targetContract = _target;
|
|
404
|
+
|
|
405
|
+
bool reentrancyStatus = _nonReentrantBefore(
|
|
406
|
+
targetContract,
|
|
407
|
+
isSetData,
|
|
408
|
+
msg.sender
|
|
409
|
+
);
|
|
382
410
|
|
|
383
|
-
|
|
411
|
+
_verifyPermissions(targetContract, msg.sender, false, payload);
|
|
384
412
|
|
|
385
|
-
_verifyPermissions(msg.sender, msgValue, payload);
|
|
386
413
|
emit PermissionsVerified(msg.sender, msgValue, bytes4(payload));
|
|
387
414
|
|
|
388
|
-
bytes memory result = _executePayload(
|
|
415
|
+
bytes memory result = _executePayload(
|
|
416
|
+
targetContract,
|
|
417
|
+
msgValue,
|
|
418
|
+
payload
|
|
419
|
+
);
|
|
389
420
|
|
|
390
|
-
if (!
|
|
391
|
-
_nonReentrantAfter();
|
|
421
|
+
if (!reentrancyStatus && !isSetData) {
|
|
422
|
+
_nonReentrantAfter(targetContract);
|
|
392
423
|
}
|
|
393
424
|
|
|
394
425
|
return result;
|
|
@@ -419,6 +450,8 @@ abstract contract LSP6KeyManagerCore is
|
|
|
419
450
|
revert InvalidPayload(payload);
|
|
420
451
|
}
|
|
421
452
|
|
|
453
|
+
address targetContract = _target;
|
|
454
|
+
|
|
422
455
|
address signer = LSP25MultiChannelNonce
|
|
423
456
|
._recoverSignerFromLSP25Signature(
|
|
424
457
|
signature,
|
|
@@ -437,23 +470,27 @@ abstract contract LSP6KeyManagerCore is
|
|
|
437
470
|
|
|
438
471
|
LSP25MultiChannelNonce._verifyValidityTimestamps(validityTimestamps);
|
|
439
472
|
|
|
440
|
-
bool isSetData =
|
|
441
|
-
|
|
442
|
-
bytes4(payload) == IERC725Y.setData.selector ||
|
|
443
|
-
bytes4(payload) == IERC725Y.setDataBatch.selector
|
|
444
|
-
) {
|
|
445
|
-
isSetData = true;
|
|
446
|
-
}
|
|
473
|
+
bool isSetData = bytes4(payload) == IERC725Y.setData.selector ||
|
|
474
|
+
bytes4(payload) == IERC725Y.setDataBatch.selector;
|
|
447
475
|
|
|
448
|
-
bool
|
|
476
|
+
bool reentrancyStatus = _nonReentrantBefore(
|
|
477
|
+
targetContract,
|
|
478
|
+
isSetData,
|
|
479
|
+
signer
|
|
480
|
+
);
|
|
481
|
+
|
|
482
|
+
_verifyPermissions(targetContract, signer, true, payload);
|
|
449
483
|
|
|
450
|
-
_verifyPermissions(signer, msgValue, payload);
|
|
451
484
|
emit PermissionsVerified(signer, msgValue, bytes4(payload));
|
|
452
485
|
|
|
453
|
-
bytes memory result = _executePayload(
|
|
486
|
+
bytes memory result = _executePayload(
|
|
487
|
+
targetContract,
|
|
488
|
+
msgValue,
|
|
489
|
+
payload
|
|
490
|
+
);
|
|
454
491
|
|
|
455
|
-
if (!
|
|
456
|
-
_nonReentrantAfter();
|
|
492
|
+
if (!reentrancyStatus && !isSetData) {
|
|
493
|
+
_nonReentrantAfter(targetContract);
|
|
457
494
|
}
|
|
458
495
|
|
|
459
496
|
return result;
|
|
@@ -465,10 +502,11 @@ abstract contract LSP6KeyManagerCore is
|
|
|
465
502
|
* @return bytes The data returned by the call made to the linked {target} contract.
|
|
466
503
|
*/
|
|
467
504
|
function _executePayload(
|
|
505
|
+
address targetContract,
|
|
468
506
|
uint256 msgValue,
|
|
469
507
|
bytes calldata payload
|
|
470
508
|
) internal virtual returns (bytes memory) {
|
|
471
|
-
(bool success, bytes memory returnData) =
|
|
509
|
+
(bool success, bytes memory returnData) = targetContract.call{
|
|
472
510
|
value: msgValue,
|
|
473
511
|
gas: gasleft()
|
|
474
512
|
}(payload);
|
|
@@ -483,29 +521,37 @@ abstract contract LSP6KeyManagerCore is
|
|
|
483
521
|
|
|
484
522
|
/**
|
|
485
523
|
* @dev Verify if the `from` address is allowed to execute the `payload` on the {target} contract linked to this Key Manager.
|
|
524
|
+
* @param targetContract The contract that is owned by the Key Manager
|
|
486
525
|
* @param from Either the caller of {execute} or the signer of {executeRelayCall}.
|
|
487
526
|
* @param payload The abi-encoded function call to execute on the {target} contract.
|
|
488
527
|
*/
|
|
489
528
|
function _verifyPermissions(
|
|
529
|
+
address targetContract,
|
|
490
530
|
address from,
|
|
491
|
-
|
|
531
|
+
bool isRelayedCall,
|
|
492
532
|
bytes calldata payload
|
|
493
533
|
) internal view virtual {
|
|
494
|
-
bytes32 permissions = ERC725Y(
|
|
534
|
+
bytes32 permissions = ERC725Y(targetContract).getPermissionsFor(from);
|
|
495
535
|
if (permissions == bytes32(0)) revert NoPermissionsSet(from);
|
|
496
536
|
|
|
537
|
+
if (isRelayedCall) {
|
|
538
|
+
LSP6ExecuteRelayCallModule._verifyExecuteRelayCallPermission(
|
|
539
|
+
from,
|
|
540
|
+
permissions
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
|
|
497
544
|
bytes4 erc725Function = bytes4(payload);
|
|
498
545
|
|
|
499
546
|
// ERC725Y.setData(bytes32,bytes)
|
|
500
547
|
if (erc725Function == IERC725Y.setData.selector) {
|
|
501
|
-
if (msgValue != 0) revert CannotSendValueToSetData();
|
|
502
548
|
(bytes32 inputKey, bytes memory inputValue) = abi.decode(
|
|
503
549
|
payload[4:],
|
|
504
550
|
(bytes32, bytes)
|
|
505
551
|
);
|
|
506
552
|
|
|
507
553
|
LSP6SetDataModule._verifyCanSetData(
|
|
508
|
-
|
|
554
|
+
targetContract,
|
|
509
555
|
from,
|
|
510
556
|
permissions,
|
|
511
557
|
inputKey,
|
|
@@ -514,12 +560,11 @@ abstract contract LSP6KeyManagerCore is
|
|
|
514
560
|
|
|
515
561
|
// ERC725Y.setDataBatch(bytes32[],bytes[])
|
|
516
562
|
} else if (erc725Function == IERC725Y.setDataBatch.selector) {
|
|
517
|
-
if (msgValue != 0) revert CannotSendValueToSetData();
|
|
518
563
|
(bytes32[] memory inputKeys, bytes[] memory inputValues) = abi
|
|
519
564
|
.decode(payload[4:], (bytes32[], bytes[]));
|
|
520
565
|
|
|
521
566
|
LSP6SetDataModule._verifyCanSetData(
|
|
522
|
-
|
|
567
|
+
targetContract,
|
|
523
568
|
from,
|
|
524
569
|
permissions,
|
|
525
570
|
inputKeys,
|
|
@@ -532,21 +577,56 @@ abstract contract LSP6KeyManagerCore is
|
|
|
532
577
|
uint256 operationType,
|
|
533
578
|
address to,
|
|
534
579
|
uint256 value,
|
|
535
|
-
bytes memory
|
|
580
|
+
bytes memory callData
|
|
536
581
|
) = abi.decode(payload[4:], (uint256, address, uint256, bytes));
|
|
537
582
|
|
|
538
583
|
LSP6ExecuteModule._verifyCanExecute(
|
|
539
|
-
|
|
584
|
+
targetContract,
|
|
540
585
|
from,
|
|
541
586
|
permissions,
|
|
542
587
|
operationType,
|
|
543
588
|
to,
|
|
544
589
|
value,
|
|
545
|
-
|
|
590
|
+
callData
|
|
546
591
|
);
|
|
592
|
+
} else if (erc725Function == IERC725X.executeBatch.selector) {
|
|
593
|
+
(
|
|
594
|
+
uint256[] memory operationTypes,
|
|
595
|
+
address[] memory targets,
|
|
596
|
+
uint256[] memory values,
|
|
597
|
+
bytes[] memory callDatas
|
|
598
|
+
) = abi.decode(
|
|
599
|
+
payload[4:],
|
|
600
|
+
(uint256[], address[], uint256[], bytes[])
|
|
601
|
+
);
|
|
602
|
+
|
|
603
|
+
if (
|
|
604
|
+
operationTypes.length != targets.length ||
|
|
605
|
+
targets.length != values.length ||
|
|
606
|
+
values.length != callDatas.length
|
|
607
|
+
) {
|
|
608
|
+
revert ERC725X_ExecuteParametersLengthMismatch();
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
if (operationTypes.length == 0) {
|
|
612
|
+
revert ERC725X_ExecuteParametersEmptyArray();
|
|
613
|
+
}
|
|
614
|
+
|
|
615
|
+
for (uint256 ii = 0; ii < operationTypes.length; ii++) {
|
|
616
|
+
LSP6ExecuteModule._verifyCanExecute(
|
|
617
|
+
targetContract,
|
|
618
|
+
from,
|
|
619
|
+
permissions,
|
|
620
|
+
operationTypes[ii],
|
|
621
|
+
targets[ii],
|
|
622
|
+
values[ii],
|
|
623
|
+
callDatas[ii]
|
|
624
|
+
);
|
|
625
|
+
}
|
|
547
626
|
} else if (
|
|
548
627
|
erc725Function == ILSP14Ownable2Step.transferOwnership.selector ||
|
|
549
|
-
erc725Function == ILSP14Ownable2Step.acceptOwnership.selector
|
|
628
|
+
erc725Function == ILSP14Ownable2Step.acceptOwnership.selector ||
|
|
629
|
+
erc725Function == ILSP14Ownable2Step.renounceOwnership.selector
|
|
550
630
|
) {
|
|
551
631
|
LSP6OwnershipModule._verifyOwnershipPermissions(from, permissions);
|
|
552
632
|
} else {
|
|
@@ -554,45 +634,40 @@ abstract contract LSP6KeyManagerCore is
|
|
|
554
634
|
}
|
|
555
635
|
}
|
|
556
636
|
|
|
557
|
-
/**
|
|
558
|
-
* @dev Initialise _reentrancyStatus to _NOT_ENTERED.
|
|
559
|
-
*/
|
|
560
|
-
function _setupLSP6ReentrancyGuard() internal virtual {
|
|
561
|
-
_reentrancyStatus = false;
|
|
562
|
-
}
|
|
563
|
-
|
|
564
637
|
/**
|
|
565
638
|
* @dev Update the status from `_NON_ENTERED` to `_ENTERED` and checks if
|
|
566
639
|
* the status is `_ENTERED` in order to revert the call unless the caller has the REENTRANCY permission
|
|
567
640
|
* Used in the beginning of the `nonReentrant` modifier, before the method execution starts.
|
|
568
641
|
*/
|
|
569
642
|
function _nonReentrantBefore(
|
|
643
|
+
address targetContract,
|
|
570
644
|
bool isSetData,
|
|
571
645
|
address from
|
|
572
|
-
) internal virtual returns (bool
|
|
573
|
-
|
|
574
|
-
|
|
646
|
+
) internal virtual returns (bool reentrancyStatus) {
|
|
647
|
+
reentrancyStatus = _reentrancyStatus[targetContract];
|
|
648
|
+
|
|
649
|
+
if (reentrancyStatus) {
|
|
575
650
|
// CHECK the caller has REENTRANCY permission
|
|
576
651
|
_requirePermissions(
|
|
577
652
|
from,
|
|
578
|
-
ERC725Y(
|
|
653
|
+
ERC725Y(targetContract).getPermissionsFor(from),
|
|
579
654
|
_PERMISSION_REENTRANCY
|
|
580
655
|
);
|
|
581
656
|
} else {
|
|
582
657
|
if (!isSetData) {
|
|
583
|
-
_reentrancyStatus = true;
|
|
658
|
+
_reentrancyStatus[targetContract] = true;
|
|
584
659
|
}
|
|
585
660
|
}
|
|
586
661
|
}
|
|
587
662
|
|
|
588
663
|
/**
|
|
589
|
-
* @dev Resets the status to `
|
|
664
|
+
* @dev Resets the status to `false`
|
|
590
665
|
* Used in the end of the `nonReentrant` modifier after the method execution is terminated
|
|
591
666
|
*/
|
|
592
|
-
function _nonReentrantAfter() internal virtual {
|
|
667
|
+
function _nonReentrantAfter(address targetContract) internal virtual {
|
|
593
668
|
// By storing the original value once again, a refund is triggered (see
|
|
594
669
|
// https://eips.ethereum.org/EIPS/eip-2200)
|
|
595
|
-
_reentrancyStatus = false;
|
|
670
|
+
_reentrancyStatus[targetContract] = false;
|
|
596
671
|
}
|
|
597
672
|
|
|
598
673
|
/**
|
|
@@ -41,7 +41,6 @@ import {
|
|
|
41
41
|
InvalidEncodedAllowedCalls,
|
|
42
42
|
InvalidWhitelistedCall,
|
|
43
43
|
NotAuthorised,
|
|
44
|
-
InvalidPayload,
|
|
45
44
|
CallingKeyManagerNotAllowed
|
|
46
45
|
} from "../LSP6Errors.sol";
|
|
47
46
|
|
|
@@ -262,7 +261,7 @@ abstract contract LSP6ExecuteModule {
|
|
|
262
261
|
isEmptyCall
|
|
263
262
|
);
|
|
264
263
|
|
|
265
|
-
for (uint256 ii
|
|
264
|
+
for (uint256 ii; ii < allowedCalls.length; ii += 34) {
|
|
266
265
|
/// @dev structure of an AllowedCall
|
|
267
266
|
//
|
|
268
267
|
/// AllowedCall = 0x00200000000ncafecafecafecafecafecafecafecafecafecafe5a5a5a5af1f1f1f1
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
pragma solidity ^0.8.5;
|
|
3
|
+
|
|
4
|
+
// libraries
|
|
5
|
+
import {LSP6Utils} from "../LSP6Utils.sol";
|
|
6
|
+
|
|
7
|
+
// constants
|
|
8
|
+
import {_PERMISSION_EXECUTE_RELAY_CALL} from "../LSP6Constants.sol";
|
|
9
|
+
|
|
10
|
+
// errors
|
|
11
|
+
import {NotAuthorised} from "../LSP6Errors.sol";
|
|
12
|
+
|
|
13
|
+
abstract contract LSP6ExecuteRelayCallModule {
|
|
14
|
+
function _verifyExecuteRelayCallPermission(
|
|
15
|
+
address controllerAddress,
|
|
16
|
+
bytes32 controllerPermissions
|
|
17
|
+
) internal pure {
|
|
18
|
+
if (
|
|
19
|
+
!LSP6Utils.hasPermission(
|
|
20
|
+
controllerPermissions,
|
|
21
|
+
_PERMISSION_EXECUTE_RELAY_CALL
|
|
22
|
+
)
|
|
23
|
+
) {
|
|
24
|
+
revert NotAuthorised(controllerAddress, "EXECUTE_RELAY_CALL");
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|