@lukso/lsp-smart-contracts 0.7.0 → 0.8.1
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 +39 -0
- package/README.md +93 -40
- package/artifacts/Create2Factory.json +2 -2
- package/artifacts/LSP0ERC725Account.json +194 -15
- package/artifacts/LSP0ERC725AccountInit.json +194 -15
- package/artifacts/LSP11BasicSocialRecovery.json +493 -0
- package/artifacts/LSP11BasicSocialRecoveryInit.json +513 -0
- package/artifacts/LSP16UniversalFactory.json +236 -0
- package/artifacts/LSP1UniversalReceiverDelegateUP.json +134 -15
- package/artifacts/LSP1UniversalReceiverDelegateVault.json +80 -15
- package/artifacts/LSP4Compatibility.json +16 -0
- package/artifacts/LSP4DigitalAssetMetadata.json +16 -0
- package/artifacts/LSP4DigitalAssetMetadataInitAbstract.json +16 -0
- package/artifacts/LSP6KeyManager.json +177 -33
- package/artifacts/LSP6KeyManagerInit.json +177 -33
- package/artifacts/LSP7CappedSupply.json +26 -5
- package/artifacts/LSP7CappedSupplyInitAbstract.json +26 -5
- package/artifacts/LSP7CompatibleERC20.json +26 -5
- package/artifacts/LSP7CompatibleERC20InitAbstract.json +28 -7
- package/artifacts/LSP7CompatibleERC20Mintable.json +29 -8
- package/artifacts/LSP7CompatibleERC20MintableInit.json +29 -8
- package/artifacts/LSP7DigitalAsset.json +26 -5
- package/artifacts/LSP7DigitalAssetInitAbstract.json +26 -5
- package/artifacts/LSP7Mintable.json +29 -8
- package/artifacts/LSP7MintableInit.json +29 -8
- package/artifacts/LSP8CappedSupply.json +27 -6
- package/artifacts/LSP8CappedSupplyInitAbstract.json +27 -6
- package/artifacts/LSP8CompatibleERC721.json +28 -7
- package/artifacts/LSP8CompatibleERC721InitAbstract.json +30 -9
- package/artifacts/LSP8CompatibleERC721Mintable.json +31 -10
- package/artifacts/LSP8CompatibleERC721MintableInit.json +31 -10
- package/artifacts/LSP8IdentifiableDigitalAsset.json +27 -6
- package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +27 -6
- package/artifacts/LSP8Mintable.json +30 -9
- package/artifacts/LSP8MintableInit.json +30 -9
- package/artifacts/LSP9Vault.json +202 -17
- package/artifacts/LSP9VaultInit.json +202 -17
- package/artifacts/UniversalProfile.json +194 -15
- package/artifacts/UniversalProfileInit.json +194 -15
- package/artifacts/UniversalReceiverAddressStore.json +3 -3
- package/common/constants.d.ts +738 -0
- package/common/constants.js +785 -0
- package/contracts/Custom/EIP191Signer.sol +12 -0
- package/contracts/Factories/Create2Factory.sol +1 -3
- package/contracts/LSP0ERC725Account/LSP0Constants.sol +13 -2
- package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +2 -1
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +320 -63
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +2 -2
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +2 -1
- package/contracts/LSP0ERC725Account/LSP0Utils.sol +50 -0
- package/contracts/LSP10ReceivedVaults/LSP10Constants.sol +2 -2
- package/contracts/LSP10ReceivedVaults/LSP10Utils.sol +212 -0
- package/contracts/LSP11BasicSocialRecovery/ILSP11BasicSocialRecovery.sol +177 -0
- package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol +23 -0
- package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryCore.sol +258 -0
- package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryInit.sol +26 -0
- package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryInitAbstract.sol +19 -0
- package/contracts/LSP11BasicSocialRecovery/LSP11Constants.sol +6 -0
- package/contracts/LSP11BasicSocialRecovery/LSP11Errors.sol +60 -0
- package/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +53 -0
- package/contracts/LSP14Ownable2Step/LSP14Constants.sol +15 -0
- package/contracts/LSP14Ownable2Step/LSP14Errors.sol +12 -0
- package/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +212 -0
- package/contracts/LSP16UniversalFactory/LSP16UniversalFactory.sol +246 -0
- package/contracts/LSP17ContractExtension/LSP17Constants.sol +17 -0
- package/contracts/LSP17ContractExtension/LSP17Errors.sol +7 -0
- package/contracts/LSP17ContractExtension/LSP17Extendable.sol +104 -0
- package/contracts/LSP17ContractExtension/LSP17Extension.sol +45 -0
- package/contracts/LSP17ContractExtension/LSP17Utils.sol +20 -0
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +5 -5
- package/contracts/LSP1UniversalReceiver/LSP1Constants.sol +5 -3
- package/contracts/LSP1UniversalReceiver/LSP1Errors.sol +21 -0
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +155 -37
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +64 -31
- package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +53 -40
- package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +45 -23
- package/contracts/LSP3UniversalProfile/LSP3Constants.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/ILSP4Compatibility.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4Compatibility.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +2 -2
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +2 -2
- package/contracts/LSP4DigitalAssetMetadata/LSP4Errors.sol +3 -3
- package/contracts/LSP5ReceivedAssets/LSP5Constants.sol +2 -2
- package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +102 -114
- package/contracts/LSP6KeyManager/ILSP6KeyManager.sol +25 -7
- package/contracts/LSP6KeyManager/LSP6Constants.sol +43 -38
- package/contracts/LSP6KeyManager/LSP6Errors.sol +90 -21
- package/contracts/LSP6KeyManager/LSP6KeyManager.sol +2 -1
- package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +224 -506
- package/contracts/LSP6KeyManager/LSP6KeyManagerInit.sol +1 -1
- package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +3 -2
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +229 -0
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6OwnershipModule.sol +25 -0
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +606 -0
- package/contracts/LSP6KeyManager/LSP6Utils.sol +156 -35
- package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +8 -8
- package/contracts/LSP7DigitalAsset/LSP7Constants.sol +6 -6
- package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +1 -1
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +36 -36
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +1 -1
- package/contracts/LSP7DigitalAsset/LSP7Errors.sol +33 -1
- package/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibleERC20.sol +1 -1
- package/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +24 -0
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +28 -8
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +28 -11
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +87 -20
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +97 -19
- package/contracts/LSP7DigitalAsset/presets/ILSP7Mintable.sol +3 -3
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +3 -4
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +2 -2
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +3 -3
- package/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +3 -5
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +2 -2
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +7 -7
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +7 -7
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +45 -2
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +2 -2
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +57 -60
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol +5 -2
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol +20 -0
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +27 -7
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +27 -10
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +234 -30
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +238 -30
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +32 -4
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +35 -8
- package/contracts/LSP8IdentifiableDigitalAsset/presets/ILSP8Mintable.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +3 -4
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +3 -4
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +2 -2
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +3 -3
- package/contracts/LSP9Vault/LSP9Constants.sol +10 -10
- package/contracts/LSP9Vault/LSP9Errors.sol +8 -0
- package/contracts/LSP9Vault/LSP9Vault.sol +6 -4
- package/contracts/LSP9Vault/LSP9VaultCore.sol +350 -127
- package/contracts/LSP9Vault/LSP9VaultInit.sol +2 -2
- package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +4 -3
- package/contracts/Legacy/Registries/AddressRegistry.sol +1 -1
- package/contracts/Legacy/Registries/AddressRegistryRequiresERC725.sol +1 -1
- package/contracts/Legacy/UniversalReceiverAddressStore.sol +4 -14
- package/contracts/UniversalProfile.sol +2 -2
- package/contracts/UniversalProfileInit.sol +2 -2
- package/contracts/UniversalProfileInitAbstract.sol +1 -1
- package/contracts/Utils/GasLib.sol +1 -1
- package/module/constants.d.ts +738 -0
- package/module/constants.js +782 -0
- package/package.json +42 -12
- package/artifacts/UniversalFactory.json +0 -127
- package/constants.js +0 -594
- package/contracts/Custom/ClaimOwnership.sol +0 -96
- package/contracts/Custom/ERC165Checker.sol +0 -130
- package/contracts/Custom/IClaimOwnership.sol +0 -12
- package/contracts/Factories/UniversalFactory.sol +0 -159
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol +0 -24
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/Handling/TokenAndVaultHandling.sol +0 -82
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/Handling/TokenHandling.sol +0 -73
- package/contracts/LSP2ERC725YJSONSchema/LSP2Errors.sol +0 -9
- package/contracts/LSP7DigitalAsset/extensions/ILSP7CappedSupply.sol +0 -17
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyCore.sol +0 -57
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20Core.sol +0 -111
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CappedSupply.sol +0 -17
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8Enumerable.sol +0 -17
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyCore.sol +0 -58
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleConstants.sol +0 -6
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721Core.sol +0 -211
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableCore.sol +0 -50
- package/contracts/Utils/UtilsLib.sol +0 -31
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
pragma solidity ^0.8.
|
|
2
|
+
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
// interfaces
|
|
5
5
|
import {IERC725Y} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
|
|
@@ -7,11 +7,10 @@ import {IERC725Y} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.so
|
|
|
7
7
|
// libraries
|
|
8
8
|
import {BytesLib} from "solidity-bytes-utils/contracts/BytesLib.sol";
|
|
9
9
|
import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";
|
|
10
|
-
import {LSP6Utils} from "../LSP6KeyManager/LSP6Utils.sol";
|
|
11
|
-
import {UtilsLib} from "../Utils/UtilsLib.sol";
|
|
12
10
|
|
|
13
11
|
// constants
|
|
14
|
-
import
|
|
12
|
+
import "../LSP5ReceivedAssets/LSP5Constants.sol";
|
|
13
|
+
import "../LSP7DigitalAsset/LSP7Constants.sol";
|
|
15
14
|
|
|
16
15
|
/**
|
|
17
16
|
* @dev reverts when the value stored under the 'LSP5ReceivedAssets[]' data key is not valid.
|
|
@@ -29,6 +28,18 @@ import {_TYPEID_LSP7_TOKENSSENDER} from "../LSP7DigitalAsset/LSP7Constants.sol";
|
|
|
29
28
|
*/
|
|
30
29
|
error InvalidLSP5ReceivedAssetsArrayLength(bytes invalidValue, uint256 invalidValueLength);
|
|
31
30
|
|
|
31
|
+
/**
|
|
32
|
+
* @dev reverts when the received assets index is superior to uint64
|
|
33
|
+
* @param index the received assets index
|
|
34
|
+
*/
|
|
35
|
+
error ReceivedAssetsIndexSuperiorToUint64(uint256 index);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @dev reverts when the received assets index is superior to uint128
|
|
39
|
+
* @param index the received assets index
|
|
40
|
+
*/
|
|
41
|
+
error ReceivedAssetsIndexSuperiorToUint128(uint256 index);
|
|
42
|
+
|
|
32
43
|
/**
|
|
33
44
|
* @title LSP5Utils
|
|
34
45
|
* @author Yamen Merhi <YamenMerhi>, Jean Cavallera <CJ42>
|
|
@@ -38,56 +49,57 @@ error InvalidLSP5ReceivedAssetsArrayLength(bytes invalidValue, uint256 invalidVa
|
|
|
38
49
|
*/
|
|
39
50
|
library LSP5Utils {
|
|
40
51
|
/**
|
|
41
|
-
* @dev Generating the data keys/values to be set on the
|
|
42
|
-
*
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
45
|
-
*
|
|
46
|
-
* @param
|
|
47
|
-
* @param interfaceID The interfaceID of the asset/vault received
|
|
52
|
+
* @dev Generating the data keys/values to be set on the receiver address after receiving assets
|
|
53
|
+
* @param receiver The address receiving the asset and where the Keys should be added
|
|
54
|
+
* @param asset The address of the asset being received
|
|
55
|
+
* @param assetMapKey The map key of the asset being received containing the interfaceId of the
|
|
56
|
+
* asset and the index in the array
|
|
57
|
+
* @param interfaceID The interfaceID of the asset being received
|
|
48
58
|
*/
|
|
49
|
-
function
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
bytes32
|
|
53
|
-
address caller,
|
|
59
|
+
function generateReceivedAssetKeys(
|
|
60
|
+
address receiver,
|
|
61
|
+
address asset,
|
|
62
|
+
bytes32 assetMapKey,
|
|
54
63
|
bytes4 interfaceID
|
|
55
64
|
) internal view returns (bytes32[] memory keys, bytes[] memory values) {
|
|
56
|
-
/**
|
|
57
|
-
* We will be setting 3 keys:
|
|
58
|
-
* - Keys[0]: The arrayLengthKey containing the number of the received assets/vaults
|
|
59
|
-
* - Keys[1]: The element in arrayKey containing the address of each received asset/vault for a specific index
|
|
60
|
-
* - Keys[2]: The mapKey containing the interfaceID and the index of the asset in the `element in arrayKey`
|
|
61
|
-
*/
|
|
62
65
|
keys = new bytes32[](3);
|
|
63
66
|
values = new bytes[](3);
|
|
64
67
|
|
|
65
|
-
|
|
68
|
+
IERC725Y account = IERC725Y(receiver);
|
|
69
|
+
bytes memory encodedArrayLength = getLSP5ReceivedAssetsCount(account);
|
|
66
70
|
|
|
67
71
|
// If it's the first asset to receive
|
|
68
72
|
if (encodedArrayLength.length == 0) {
|
|
69
|
-
keys[0] =
|
|
70
|
-
values[0] =
|
|
73
|
+
keys[0] = _LSP5_RECEIVED_ASSETS_ARRAY_KEY;
|
|
74
|
+
values[0] = bytes.concat(bytes32(uint256(1)));
|
|
71
75
|
|
|
72
|
-
keys[1] = LSP2Utils.generateArrayElementKeyAtIndex(
|
|
73
|
-
values[1] =
|
|
76
|
+
keys[1] = LSP2Utils.generateArrayElementKeyAtIndex(_LSP5_RECEIVED_ASSETS_ARRAY_KEY, 0);
|
|
77
|
+
values[1] = bytes.concat(bytes20(asset));
|
|
74
78
|
|
|
75
|
-
keys[2] =
|
|
79
|
+
keys[2] = assetMapKey;
|
|
76
80
|
values[2] = bytes.concat(interfaceID, bytes8(0));
|
|
77
81
|
|
|
78
82
|
// If the storage is already initiated
|
|
79
83
|
} else if (encodedArrayLength.length == 32) {
|
|
80
|
-
uint256
|
|
81
|
-
uint256 newArrayLength = arrayLength + 1;
|
|
84
|
+
uint256 oldArrayLength = uint256(bytes32(encodedArrayLength));
|
|
82
85
|
|
|
83
|
-
|
|
84
|
-
|
|
86
|
+
if (oldArrayLength + 1 >= type(uint64).max) {
|
|
87
|
+
revert ReceivedAssetsIndexSuperiorToUint64(oldArrayLength);
|
|
88
|
+
}
|
|
85
89
|
|
|
86
|
-
|
|
87
|
-
values[1] = UtilsLib.addressToBytes(caller);
|
|
90
|
+
uint128 oldArrayLength128 = uint128(oldArrayLength);
|
|
88
91
|
|
|
89
|
-
keys[
|
|
90
|
-
values[
|
|
92
|
+
keys[0] = _LSP5_RECEIVED_ASSETS_ARRAY_KEY;
|
|
93
|
+
values[0] = bytes.concat(bytes32(oldArrayLength + 1));
|
|
94
|
+
|
|
95
|
+
keys[1] = LSP2Utils.generateArrayElementKeyAtIndex(
|
|
96
|
+
_LSP5_RECEIVED_ASSETS_ARRAY_KEY,
|
|
97
|
+
oldArrayLength128
|
|
98
|
+
);
|
|
99
|
+
values[1] = bytes.concat(bytes20(asset));
|
|
100
|
+
|
|
101
|
+
keys[2] = assetMapKey;
|
|
102
|
+
values[2] = bytes.concat(interfaceID, bytes8(uint64(oldArrayLength)));
|
|
91
103
|
} else {
|
|
92
104
|
revert InvalidLSP5ReceivedAssetsArrayLength(
|
|
93
105
|
encodedArrayLength,
|
|
@@ -97,49 +109,46 @@ library LSP5Utils {
|
|
|
97
109
|
}
|
|
98
110
|
|
|
99
111
|
/**
|
|
100
|
-
* @dev Generating the data keys/values to be
|
|
101
|
-
*
|
|
102
|
-
* @param
|
|
103
|
-
*
|
|
104
|
-
* @param
|
|
105
|
-
* @param mapKeyToRemove The mapKey of the asset sent
|
|
106
|
-
* @param mapValue The mapValue of the asset/vault sent
|
|
112
|
+
* @dev Generating the data keys/values to be set on the sender address after sending assets
|
|
113
|
+
* @param sender The address sending the asset and where the Keys should be updated
|
|
114
|
+
* @param assetMapKey The map key of the asset being received containing the interfaceId of the
|
|
115
|
+
* asset and the index in the array
|
|
116
|
+
* @param assetInterfaceIdAndIndex The value of the map key of the asset being sent
|
|
107
117
|
*/
|
|
108
|
-
function
|
|
109
|
-
|
|
110
|
-
bytes32
|
|
111
|
-
|
|
112
|
-
bytes32 mapKeyToRemove,
|
|
113
|
-
bytes memory mapValue
|
|
118
|
+
function generateSentAssetKeys(
|
|
119
|
+
address sender,
|
|
120
|
+
bytes32 assetMapKey,
|
|
121
|
+
bytes memory assetInterfaceIdAndIndex
|
|
114
122
|
) internal view returns (bytes32[] memory keys, bytes[] memory values) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
uint256
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
IERC725Y account = IERC725Y(sender);
|
|
124
|
+
|
|
125
|
+
// Updating the number of the received assets
|
|
126
|
+
uint256 oldArrayLength = uint256(bytes32(getLSP5ReceivedAssetsCount(account)));
|
|
127
|
+
uint256 newArrayLength = oldArrayLength - 1;
|
|
128
|
+
|
|
129
|
+
uint64 index = extractIndexFromMap(assetInterfaceIdAndIndex);
|
|
130
|
+
bytes32 assetInArrayKey = LSP2Utils.generateArrayElementKeyAtIndex(
|
|
131
|
+
_LSP5_RECEIVED_ASSETS_ARRAY_KEY,
|
|
123
132
|
index
|
|
124
133
|
);
|
|
125
134
|
|
|
126
|
-
if (index ==
|
|
135
|
+
if (index == newArrayLength) {
|
|
127
136
|
/**
|
|
128
137
|
* We will be updating/removing 3 keys:
|
|
129
|
-
* - Keys[0]: [Update] The arrayLengthKey to contain the new number of the received assets
|
|
138
|
+
* - Keys[0]: [Update] The arrayLengthKey to contain the new number of the received assets
|
|
130
139
|
* - Keys[1]: [Remove] The element in arrayKey (Remove the address of the asset sent)
|
|
131
140
|
* - Keys[2]: [Remove] The mapKey (Remove the interfaceId and the index of the asset sent)
|
|
132
141
|
*/
|
|
133
142
|
keys = new bytes32[](3);
|
|
134
143
|
values = new bytes[](3);
|
|
135
144
|
|
|
136
|
-
keys[0] =
|
|
137
|
-
values[0] =
|
|
145
|
+
keys[0] = _LSP5_RECEIVED_ASSETS_ARRAY_KEY;
|
|
146
|
+
values[0] = bytes.concat(bytes32(newArrayLength));
|
|
138
147
|
|
|
139
|
-
keys[1] =
|
|
148
|
+
keys[1] = assetInArrayKey;
|
|
140
149
|
values[1] = "";
|
|
141
150
|
|
|
142
|
-
keys[2] =
|
|
151
|
+
keys[2] = assetMapKey;
|
|
143
152
|
values[2] = "";
|
|
144
153
|
|
|
145
154
|
// Swapping last element in ArrayKey with the element in ArrayKey to remove || {Swap and pop} method;
|
|
@@ -147,7 +156,7 @@ library LSP5Utils {
|
|
|
147
156
|
} else {
|
|
148
157
|
/**
|
|
149
158
|
* We will be updating/removing 5 keys:
|
|
150
|
-
* - Keys[0]: [Update] The arrayLengthKey to contain the new number of the received assets
|
|
159
|
+
* - Keys[0]: [Update] The arrayLengthKey to contain the new number of the received assets
|
|
151
160
|
* - Keys[1]: [Remove] The mapKey of the asset to remove (Remove the interfaceId and the index of the asset sent)
|
|
152
161
|
* - Keys[2]: [Update] The element in arrayKey to remove (Swap with the address of the last element in Array)
|
|
153
162
|
* - Keys[3]: [Remove] The last element in arrayKey (Remove (pop) the address of the last element as it's already swapped)
|
|
@@ -156,74 +165,53 @@ library LSP5Utils {
|
|
|
156
165
|
keys = new bytes32[](5);
|
|
157
166
|
values = new bytes[](5);
|
|
158
167
|
|
|
159
|
-
keys[0] =
|
|
160
|
-
values[0] =
|
|
168
|
+
keys[0] = _LSP5_RECEIVED_ASSETS_ARRAY_KEY;
|
|
169
|
+
values[0] = bytes.concat(bytes32(newArrayLength));
|
|
161
170
|
|
|
162
|
-
keys[1] =
|
|
171
|
+
keys[1] = assetMapKey;
|
|
163
172
|
values[1] = "";
|
|
164
173
|
|
|
174
|
+
if (newArrayLength >= type(uint128).max) {
|
|
175
|
+
revert ReceivedAssetsIndexSuperiorToUint128(newArrayLength);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
uint128 newArrayLength128 = uint128(newArrayLength);
|
|
179
|
+
|
|
165
180
|
// Generate all data Keys/values of the last element in Array to swap
|
|
166
181
|
// with data Keys/values of the asset to remove
|
|
167
|
-
bytes32
|
|
168
|
-
|
|
169
|
-
|
|
182
|
+
bytes32 lastAssetInArrayKey = LSP2Utils.generateArrayElementKeyAtIndex(
|
|
183
|
+
_LSP5_RECEIVED_ASSETS_ARRAY_KEY,
|
|
184
|
+
newArrayLength128
|
|
170
185
|
);
|
|
171
|
-
bytes memory lastArrayElementValue = account.getData(lastArrayElementKey);
|
|
172
186
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
187
|
+
bytes20 lastAssetInArrayAddress = bytes20(account.getData(lastAssetInArrayKey));
|
|
188
|
+
|
|
189
|
+
bytes32 lastAssetInArrayMapKey = LSP2Utils.generateMappingKey(
|
|
190
|
+
_LSP5_RECEIVED_ASSETS_MAP_KEY_PREFIX,
|
|
191
|
+
lastAssetInArrayAddress
|
|
176
192
|
);
|
|
177
|
-
bytes memory lastArrayElementMapValue = account.getData(lastArrayElementMapKey);
|
|
178
|
-
bytes memory interfaceID = BytesLib.slice(lastArrayElementMapValue, 0, 4);
|
|
179
193
|
|
|
180
|
-
|
|
181
|
-
|
|
194
|
+
bytes memory lastAssetInterfaceIdAndIndex = account.getData(lastAssetInArrayMapKey);
|
|
195
|
+
bytes memory interfaceID = BytesLib.slice(lastAssetInterfaceIdAndIndex, 0, 4);
|
|
182
196
|
|
|
183
|
-
keys[
|
|
197
|
+
keys[2] = assetInArrayKey;
|
|
198
|
+
values[2] = bytes.concat(lastAssetInArrayAddress);
|
|
199
|
+
|
|
200
|
+
keys[3] = lastAssetInArrayKey;
|
|
184
201
|
values[3] = "";
|
|
185
202
|
|
|
186
|
-
keys[4] =
|
|
203
|
+
keys[4] = lastAssetInArrayMapKey;
|
|
187
204
|
values[4] = bytes.concat(interfaceID, bytes8(index));
|
|
188
205
|
}
|
|
189
206
|
}
|
|
190
207
|
|
|
191
|
-
function
|
|
192
|
-
|
|
193
|
-
bytes32 arrayLengthKey,
|
|
194
|
-
bytes32 mapKey,
|
|
195
|
-
address caller,
|
|
196
|
-
bytes4 interfaceID,
|
|
197
|
-
address keyManager
|
|
198
|
-
) internal returns (bytes memory result) {
|
|
199
|
-
(bytes32[] memory keys, bytes[] memory values) = addMapAndArrayKey(
|
|
200
|
-
account,
|
|
201
|
-
arrayLengthKey,
|
|
202
|
-
mapKey,
|
|
203
|
-
caller,
|
|
204
|
-
interfaceID
|
|
205
|
-
);
|
|
206
|
-
result = LSP6Utils.setDataViaKeyManager(keyManager, keys, values);
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
function removeMapAndArrayKeyViaKeyManager(
|
|
210
|
-
IERC725Y account,
|
|
211
|
-
bytes32 arrayLengthKey,
|
|
212
|
-
bytes10 mapKeyPrefix,
|
|
213
|
-
bytes32 mapKeyToRemove,
|
|
214
|
-
bytes memory mapValue,
|
|
215
|
-
address keyManager
|
|
216
|
-
) internal returns (bytes memory result) {
|
|
217
|
-
(bytes32[] memory keys, bytes[] memory values) = removeMapAndArrayKey(
|
|
218
|
-
account,
|
|
219
|
-
arrayLengthKey,
|
|
220
|
-
mapKeyPrefix,
|
|
221
|
-
mapKeyToRemove,
|
|
222
|
-
mapValue
|
|
223
|
-
);
|
|
224
|
-
result = LSP6Utils.setDataViaKeyManager(keyManager, keys, values);
|
|
208
|
+
function getLSP5ReceivedAssetsCount(IERC725Y account) internal view returns (bytes memory) {
|
|
209
|
+
return account.getData(_LSP5_RECEIVED_ASSETS_ARRAY_KEY);
|
|
225
210
|
}
|
|
226
211
|
|
|
212
|
+
/**
|
|
213
|
+
* @dev returns the index from a maping
|
|
214
|
+
*/
|
|
227
215
|
function extractIndexFromMap(bytes memory mapValue) internal pure returns (uint64) {
|
|
228
216
|
bytes memory val = BytesLib.slice(mapValue, 4, 8);
|
|
229
217
|
return BytesLib.toUint64(val, 0);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
pragma solidity ^0.8.
|
|
2
|
+
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
// interfaces
|
|
5
5
|
import {IERC1271} from "@openzeppelin/contracts/interfaces/IERC1271.sol";
|
|
@@ -11,7 +11,7 @@ interface ILSP6KeyManager is
|
|
|
11
11
|
IERC1271
|
|
12
12
|
/* is ERC165 */
|
|
13
13
|
{
|
|
14
|
-
event Executed(
|
|
14
|
+
event Executed(bytes4 indexed selector, uint256 indexed value);
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* @notice returns the address of the account linked to this KeyManager
|
|
@@ -25,12 +25,12 @@ interface ILSP6KeyManager is
|
|
|
25
25
|
function target() external view returns (address);
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
|
-
* @notice get latest nonce for `from`
|
|
28
|
+
* @notice get latest nonce for `from` in channel ID: `channelId`
|
|
29
29
|
* @dev use channel ID = 0 for sequential nonces, any other number for out-of-order execution (= execution in parallel)
|
|
30
|
-
* @param from caller address
|
|
31
|
-
* @param channelId channel id
|
|
30
|
+
* @param from the caller or signer address
|
|
31
|
+
* @param channelId the channel id to retrieve the nonce from
|
|
32
32
|
*/
|
|
33
|
-
function getNonce(address from,
|
|
33
|
+
function getNonce(address from, uint128 channelId) external view returns (uint256);
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* @notice execute the following payload on the ERC725Account: `payload`
|
|
@@ -40,6 +40,14 @@ interface ILSP6KeyManager is
|
|
|
40
40
|
*/
|
|
41
41
|
function execute(bytes calldata payload) external payable returns (bytes memory);
|
|
42
42
|
|
|
43
|
+
/**
|
|
44
|
+
* @dev batch `execute(bytes)`
|
|
45
|
+
*/
|
|
46
|
+
function execute(uint256[] calldata values, bytes[] calldata payloads)
|
|
47
|
+
external
|
|
48
|
+
payable
|
|
49
|
+
returns (bytes[] memory);
|
|
50
|
+
|
|
43
51
|
/**
|
|
44
52
|
* @dev allows anybody to execute given they have a signed message from an executor
|
|
45
53
|
* @param signature bytes32 ethereum signature
|
|
@@ -48,8 +56,18 @@ interface ILSP6KeyManager is
|
|
|
48
56
|
* @return the data being returned by the ERC725 Account
|
|
49
57
|
*/
|
|
50
58
|
function executeRelayCall(
|
|
51
|
-
bytes
|
|
59
|
+
bytes calldata signature,
|
|
52
60
|
uint256 nonce,
|
|
53
61
|
bytes calldata payload
|
|
54
62
|
) external payable returns (bytes memory);
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @dev batch `executeRelayCall(...)`
|
|
66
|
+
*/
|
|
67
|
+
function executeRelayCall(
|
|
68
|
+
bytes[] calldata signatures,
|
|
69
|
+
uint256[] calldata nonces,
|
|
70
|
+
uint256[] calldata values,
|
|
71
|
+
bytes[] calldata payloads
|
|
72
|
+
) external payable returns (bytes[] memory);
|
|
55
73
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
// SPDX-License-Identifier: CC0-1.0
|
|
2
|
-
pragma solidity ^0.8.
|
|
2
|
+
pragma solidity ^0.8.4;
|
|
3
|
+
|
|
4
|
+
uint256 constant LSP6_VERSION = 6;
|
|
3
5
|
|
|
4
6
|
// --- ERC165 interface ids
|
|
5
|
-
bytes4 constant _INTERFACEID_LSP6 =
|
|
7
|
+
bytes4 constant _INTERFACEID_LSP6 = 0xfb437414;
|
|
6
8
|
|
|
7
|
-
// --- ERC725Y Keys
|
|
9
|
+
// --- ERC725Y Data Keys
|
|
8
10
|
|
|
9
11
|
// PERMISSIONS KEYS
|
|
10
12
|
|
|
@@ -17,44 +19,47 @@ bytes16 constant _LSP6KEY_ADDRESSPERMISSIONS_ARRAY_PREFIX = 0xdf30dba06db6a30e65
|
|
|
17
19
|
// AddressPermissions:...
|
|
18
20
|
bytes6 constant _LSP6KEY_ADDRESSPERMISSIONS_PREFIX = 0x4b80742de2bf;
|
|
19
21
|
|
|
20
|
-
// bytes6(keccak256('AddressPermissions')) + bytes4(keccak256('Permissions'))
|
|
22
|
+
// bytes6(keccak256('AddressPermissions')) + bytes4(keccak256('Permissions'))
|
|
21
23
|
bytes10 constant _LSP6KEY_ADDRESSPERMISSIONS_PERMISSIONS_PREFIX = 0x4b80742de2bf82acb363; // AddressPermissions:Permissions:<address> --> bytes32
|
|
22
24
|
|
|
23
|
-
// bytes6(keccak256('AddressPermissions')) + bytes4(keccak256('
|
|
24
|
-
bytes10 constant
|
|
25
|
+
// bytes6(keccak256('AddressPermissions')) + bytes4(keccak256('AllowedERC725YDataKeys'))
|
|
26
|
+
bytes10 constant _LSP6KEY_ADDRESSPERMISSIONS_AllowedERC725YDataKeys_PREFIX = 0x4b80742de2bf866c2911; // AddressPermissions:AllowedERC725YDataKeys:<address> --> bytes[CompactBytesArray]
|
|
25
27
|
|
|
26
|
-
// bytes6(keccak256('AddressPermissions')) + bytes4(keccak256('
|
|
27
|
-
bytes10 constant
|
|
28
|
+
// bytes6(keccak256('AddressPermissions')) + bytes4(keccak256('AllowedCalls'))
|
|
29
|
+
bytes10 constant _LSP6KEY_ADDRESSPERMISSIONS_ALLOWEDCALLS_PREFIX = 0x4b80742de2bf393a64c7; // AddressPermissions:AllowedCalls:<address>
|
|
28
30
|
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
+
// DEFAULT PERMISSIONS VALUES
|
|
32
|
+
// NB: the SUPER PERMISSIONS allow to not check for:
|
|
33
|
+
// - AddressPermissions:AllowedERC725YDataKeys:...
|
|
34
|
+
// - AddressPermissions:AllowedCalls
|
|
35
|
+
bytes32 constant _PERMISSION_CHANGEOWNER = 0x0000000000000000000000000000000000000000000000000000000000000001;
|
|
36
|
+
bytes32 constant _PERMISSION_ADDCONTROLLER = 0x0000000000000000000000000000000000000000000000000000000000000002;
|
|
37
|
+
bytes32 constant _PERMISSION_CHANGEPERMISSIONS = 0x0000000000000000000000000000000000000000000000000000000000000004;
|
|
38
|
+
bytes32 constant _PERMISSION_ADDEXTENSIONS = 0x0000000000000000000000000000000000000000000000000000000000000008;
|
|
39
|
+
bytes32 constant _PERMISSION_CHANGEEXTENSIONS = 0x0000000000000000000000000000000000000000000000000000000000000010;
|
|
40
|
+
bytes32 constant _PERMISSION_ADDUNIVERSALRECEIVERDELEGATE = 0x0000000000000000000000000000000000000000000000000000000000000020;
|
|
41
|
+
bytes32 constant _PERMISSION_CHANGEUNIVERSALRECEIVERDELEGATE = 0x0000000000000000000000000000000000000000000000000000000000000040;
|
|
42
|
+
bytes32 constant _PERMISSION_REENTRANCY = 0x0000000000000000000000000000000000000000000000000000000000000080;
|
|
43
|
+
bytes32 constant _PERMISSION_SUPER_TRANSFERVALUE = 0x0000000000000000000000000000000000000000000000000000000000000100;
|
|
44
|
+
bytes32 constant _PERMISSION_TRANSFERVALUE = 0x0000000000000000000000000000000000000000000000000000000000000200;
|
|
45
|
+
bytes32 constant _PERMISSION_SUPER_CALL = 0x0000000000000000000000000000000000000000000000000000000000000400;
|
|
46
|
+
bytes32 constant _PERMISSION_CALL = 0x0000000000000000000000000000000000000000000000000000000000000800;
|
|
47
|
+
bytes32 constant _PERMISSION_SUPER_STATICCALL = 0x0000000000000000000000000000000000000000000000000000000000001000;
|
|
48
|
+
bytes32 constant _PERMISSION_STATICCALL = 0x0000000000000000000000000000000000000000000000000000000000002000;
|
|
49
|
+
bytes32 constant _PERMISSION_SUPER_DELEGATECALL = 0x0000000000000000000000000000000000000000000000000000000000004000;
|
|
50
|
+
bytes32 constant _PERMISSION_DELEGATECALL = 0x0000000000000000000000000000000000000000000000000000000000008000;
|
|
51
|
+
bytes32 constant _PERMISSION_DEPLOY = 0x0000000000000000000000000000000000000000000000000000000000010000;
|
|
52
|
+
bytes32 constant _PERMISSION_SUPER_SETDATA = 0x0000000000000000000000000000000000000000000000000000000000020000;
|
|
53
|
+
bytes32 constant _PERMISSION_SETDATA = 0x0000000000000000000000000000000000000000000000000000000000040000;
|
|
54
|
+
bytes32 constant _PERMISSION_ENCRYPT = 0x0000000000000000000000000000000000000000000000000000000000080000;
|
|
55
|
+
bytes32 constant _PERMISSION_DECRYPT = 0x0000000000000000000000000000000000000000000000000000000000100000;
|
|
56
|
+
bytes32 constant _PERMISSION_SIGN = 0x0000000000000000000000000000000000000000000000000000000000200000;
|
|
31
57
|
|
|
32
|
-
//
|
|
33
|
-
|
|
58
|
+
// All Permissions currently exclude REENTRANCY, DELEGATECALL and SUPER_DELEGATECALL for security
|
|
59
|
+
bytes32 constant ALL_REGULAR_PERMISSIONS = 0x00000000000000000000000000000000000000000000000000000000003f3f7f;
|
|
34
60
|
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
bytes32 constant _PERMISSION_CALL = 0x0000000000000000000000000000000000000000000000000000000000000010;
|
|
41
|
-
bytes32 constant _PERMISSION_STATICCALL = 0x0000000000000000000000000000000000000000000000000000000000000020;
|
|
42
|
-
bytes32 constant _PERMISSION_DELEGATECALL = 0x0000000000000000000000000000000000000000000000000000000000000040;
|
|
43
|
-
bytes32 constant _PERMISSION_DEPLOY = 0x0000000000000000000000000000000000000000000000000000000000000080;
|
|
44
|
-
bytes32 constant _PERMISSION_TRANSFERVALUE = 0x0000000000000000000000000000000000000000000000000000000000000100;
|
|
45
|
-
bytes32 constant _PERMISSION_SIGN = 0x0000000000000000000000000000000000000000000000000000000000000200;
|
|
46
|
-
bytes32 constant _PERMISSION_ENCRYPT = 0x0000000000000000000000000000000000000000000000000000000000000400;
|
|
47
|
-
|
|
48
|
-
// SUPER PERMISSIONS
|
|
49
|
-
// -----
|
|
50
|
-
// allow to not check for AddressPermissions:AllowedERC725YKeys:...
|
|
51
|
-
bytes32 constant _PERMISSION_SUPER_SETDATA = 0x0000000000000000000000000000000000000000000000000000000000000800;
|
|
52
|
-
|
|
53
|
-
// allow to not check for:
|
|
54
|
-
// - AddressPermissions:AllowedAddress:...
|
|
55
|
-
// - AddressPermissions:AllowedStandards:...
|
|
56
|
-
// - AddressPermissions:AllowedFunctions:...
|
|
57
|
-
bytes32 constant _PERMISSION_SUPER_TRANSFERVALUE = 0x0000000000000000000000000000000000000000000000000000000000001000;
|
|
58
|
-
bytes32 constant _PERMISSION_SUPER_CALL = 0x0000000000000000000000000000000000000000000000000000000000002000;
|
|
59
|
-
bytes32 constant _PERMISSION_SUPER_STATICCALL = 0x0000000000000000000000000000000000000000000000000000000000004000;
|
|
60
|
-
bytes32 constant _PERMISSION_SUPER_DELEGATECALL = 0x0000000000000000000000000000000000000000000000000000000000008000;
|
|
61
|
+
// LSP6 overloaded function selectors
|
|
62
|
+
bytes4 constant _LSP6_EXECUTE_SELECTOR = 0x09c5eabe;
|
|
63
|
+
bytes4 constant _LSP6_EXECUTE_BATCH_SELECTOR = 0xbf3e1f7b;
|
|
64
|
+
bytes4 constant _LSP6_EXECUTE_RELAYCALL_SELECTOR = 0x902d5fa0;
|
|
65
|
+
bytes4 constant _LSP6_EXECUTE_RELAYCALL_BATCH_SELECTOR = 0xbd68663a;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
pragma solidity ^0.8.
|
|
2
|
+
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* @dev reverts when address `from` does not have any permissions set
|
|
@@ -16,34 +16,20 @@ error NoPermissionsSet(address from);
|
|
|
16
16
|
error NotAuthorised(address from, string permission);
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
|
-
* @dev reverts when
|
|
19
|
+
* @dev reverts when `from` is not authorised to make the call because of a not allowed standard, address or function.
|
|
20
20
|
* @param from address making the request
|
|
21
|
-
* @param
|
|
21
|
+
* @param to the address of an EOA or contract that `from` is trying to interact with
|
|
22
|
+
* @param selector if `to` is a contract, the bytes4 selector of the function that `from` is trying to call.
|
|
23
|
+
* If no function is called (e.g: a native token transfer), selector = 0x00000000
|
|
22
24
|
*/
|
|
23
|
-
error
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* @dev reverts when address `from` is restricted to interact only with smart contracts implementing specific standard interface(s)
|
|
27
|
-
* and try to call an address `addressNotImplementingAllowedStandard` that does not implement one of this restricted standard interfaces.
|
|
28
|
-
* @param from address making the request
|
|
29
|
-
* @param addressNotImplementingAllowedStandard the address of the smart contract that `from` is trying to interact with,
|
|
30
|
-
* and that does not implement an allowed interface.
|
|
31
|
-
*/
|
|
32
|
-
error NotAllowedStandard(address from, address addressNotImplementingAllowedStandard);
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* @dev reverts when address `from` is not authorised to run `disallowedFunction` via the linked account
|
|
36
|
-
* @param from address making the request
|
|
37
|
-
* @param disallowedFunction bytes4 function selector that `from` is not authorised to run
|
|
38
|
-
*/
|
|
39
|
-
error NotAllowedFunction(address from, bytes4 disallowedFunction);
|
|
25
|
+
error NotAllowedCall(address from, address to, bytes4 selector);
|
|
40
26
|
|
|
41
27
|
/**
|
|
42
28
|
* @dev reverts when address `from` is not authorised to set the key `disallowedKey` on the linked account
|
|
43
29
|
* @param from address making the request
|
|
44
30
|
* @param disallowedKey a bytes32 key that `from` is not authorised to set on the ERC725Y storage
|
|
45
31
|
*/
|
|
46
|
-
error
|
|
32
|
+
error NotAllowedERC725YDataKey(address from, bytes32 disallowedKey);
|
|
47
33
|
|
|
48
34
|
/**
|
|
49
35
|
* @dev reverts when `dataKey` is a bytes32 that does not adhere to any of the
|
|
@@ -72,3 +58,86 @@ error InvalidRelayNonce(address signer, uint256 invalidNonce, bytes signature);
|
|
|
72
58
|
* @param invalidFunction the bytes4 selector of the invalid function
|
|
73
59
|
*/
|
|
74
60
|
error InvalidERC725Function(bytes4 invalidFunction);
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* @dev reverts when `allowedCallsValue` is not properly encoded as a bytes28[CompactBytesArray]
|
|
64
|
+
* (CompactBytesArray of bytes28 entries). See LSP2 value type `CompactBytesArray` for details.
|
|
65
|
+
* @param allowedCallsValue the list of allowedCalls
|
|
66
|
+
*/
|
|
67
|
+
error InvalidEncodedAllowedCalls(bytes allowedCallsValue);
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @dev reverts when trying to set a value that is not 20 bytes long under AddressPermissions[index]
|
|
71
|
+
* @param dataKey the AddressPermissions[index] data key
|
|
72
|
+
* @param invalidValue the invalid value that was attempted to be set under AddressPermissions[index]
|
|
73
|
+
*/
|
|
74
|
+
error AddressPermissionArrayIndexValueNotAnAddress(bytes32 dataKey, bytes invalidValue);
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* @dev reverts if there are no AllowedERC725YDataKeys set for the caller
|
|
78
|
+
* @param from the address that has no AllowedERC725YDataKeys
|
|
79
|
+
*/
|
|
80
|
+
error NoERC725YDataKeysAllowed(address from);
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* @dev reverts if there are no allowed calls set for `from`
|
|
84
|
+
* @param from the address that has no AllowedCalls
|
|
85
|
+
*/
|
|
86
|
+
error NoCallsAllowed(address from);
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* @dev reverts when `value` is not encoded properly using the CompactBytesArray
|
|
90
|
+
* @param value the value to check for an CompactBytesArray
|
|
91
|
+
*/
|
|
92
|
+
error InvalidEncodedAllowedERC725YDataKeys(bytes value);
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* @dev a `from` address is not allowed to have 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffff
|
|
96
|
+
* in its list of AddressPermissions:AllowedCalls:<address>, as this allows any STANDARD:ADDRESS:FUNCTION.
|
|
97
|
+
* This is equivalent to granting the SUPER permission and should never be valid.
|
|
98
|
+
*
|
|
99
|
+
* @param from the address that has any allowed calls whitelisted.
|
|
100
|
+
*/
|
|
101
|
+
error InvalidWhitelistedCall(address from);
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @dev reverts when providing array parameters of different sizes to `executeRelayCall(bytes[],uint256[],bytes[])`
|
|
105
|
+
*/
|
|
106
|
+
error BatchExecuteRelayCallParamsLengthMismatch();
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* @dev there should be the same number of elements for each array parameters
|
|
110
|
+
* in the following batch functions:
|
|
111
|
+
* - execute(uint256[],bytes[])
|
|
112
|
+
* - executeRelayCall(bytes[],uint256[],uint256[],bytes[])
|
|
113
|
+
*/
|
|
114
|
+
error BatchExecuteParamsLengthMismatch();
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @dev the `msg.value` sent is not enough to cover the sum of all the values being
|
|
118
|
+
* forwarded on each payloads (`values[]` parameter) in the following batch functions:
|
|
119
|
+
* - execute(uint256[],bytes[])
|
|
120
|
+
* - executeRelayCall(bytes[],uint256[],uint256[],bytes[])
|
|
121
|
+
*/
|
|
122
|
+
error LSP6BatchInsufficientValueSent(uint256 totalValues, uint256 msgValue);
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* @dev reverts to avoid the KeyManager to holds some remaining funds sent
|
|
126
|
+
* to the following batch functions:
|
|
127
|
+
* - execute(uint256[],bytes[])
|
|
128
|
+
* - executeRelayCall(bytes[],uint256[],uint256[],bytes[])
|
|
129
|
+
*
|
|
130
|
+
* This error occurs when `msg.value` is more than the sum of all the values being
|
|
131
|
+
* forwarded on each payloads (`values[]` parameter from the batch functions above).
|
|
132
|
+
*/
|
|
133
|
+
error LSP6BatchExcessiveValueSent(uint256 totalValues, uint256 msgValue);
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* @dev ERC725X operation type 4 (DELEGATECALL) is disallowed by default
|
|
137
|
+
*/
|
|
138
|
+
error DelegateCallDisallowedViaKeyManager();
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* @dev reverts when the payload is invalid.
|
|
142
|
+
*/
|
|
143
|
+
error InvalidPayload(bytes payload);
|