@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
|
@@ -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
|
import {Create2} from "@openzeppelin/contracts/utils/Create2.sol";
|
|
@@ -23,6 +23,7 @@ contract LSP23LinkedContractsFactory is ILSP23LinkedContractsFactory {
|
|
|
23
23
|
)
|
|
24
24
|
public
|
|
25
25
|
payable
|
|
26
|
+
override
|
|
26
27
|
returns (
|
|
27
28
|
address primaryContractAddress,
|
|
28
29
|
address secondaryContractAddress
|
|
@@ -81,6 +82,7 @@ contract LSP23LinkedContractsFactory is ILSP23LinkedContractsFactory {
|
|
|
81
82
|
)
|
|
82
83
|
public
|
|
83
84
|
payable
|
|
85
|
+
override
|
|
84
86
|
returns (
|
|
85
87
|
address primaryContractAddress,
|
|
86
88
|
address secondaryContractAddress
|
|
@@ -140,6 +142,7 @@ contract LSP23LinkedContractsFactory is ILSP23LinkedContractsFactory {
|
|
|
140
142
|
)
|
|
141
143
|
public
|
|
142
144
|
view
|
|
145
|
+
override
|
|
143
146
|
returns (
|
|
144
147
|
address primaryContractAddress,
|
|
145
148
|
address secondaryContractAddress
|
|
@@ -187,6 +190,7 @@ contract LSP23LinkedContractsFactory is ILSP23LinkedContractsFactory {
|
|
|
187
190
|
)
|
|
188
191
|
public
|
|
189
192
|
view
|
|
193
|
+
override
|
|
190
194
|
returns (
|
|
191
195
|
address primaryContractAddress,
|
|
192
196
|
address secondaryContractAddress
|
|
@@ -56,8 +56,7 @@ abstract contract LSP25MultiChannelNonce {
|
|
|
56
56
|
address from,
|
|
57
57
|
uint128 channelId
|
|
58
58
|
) internal view virtual returns (uint256 idx) {
|
|
59
|
-
uint256
|
|
60
|
-
return (uint256(channelId) << 128) | nonceInChannel;
|
|
59
|
+
return (uint256(channelId) << 128) | _nonceStore[from][channelId];
|
|
61
60
|
}
|
|
62
61
|
|
|
63
62
|
/**
|
|
@@ -109,10 +108,16 @@ abstract contract LSP25MultiChannelNonce {
|
|
|
109
108
|
uint128 startingTimestamp = uint128(validityTimestamps >> 128);
|
|
110
109
|
uint128 endingTimestamp = uint128(validityTimestamps);
|
|
111
110
|
|
|
112
|
-
// solhint-disable not-rely-on-time
|
|
111
|
+
// solhint-disable-next-line not-rely-on-time
|
|
113
112
|
if (block.timestamp < startingTimestamp) {
|
|
114
113
|
revert RelayCallBeforeStartTime();
|
|
115
114
|
}
|
|
115
|
+
|
|
116
|
+
// Allow `endingTimestamp` to be 0
|
|
117
|
+
// Allow execution anytime past `startingTimestamp`
|
|
118
|
+
if (endingTimestamp == 0) return;
|
|
119
|
+
|
|
120
|
+
// solhint-disable-next-line not-rely-on-time
|
|
116
121
|
if (block.timestamp > endingTimestamp) {
|
|
117
122
|
revert RelayCallExpired();
|
|
118
123
|
}
|
|
@@ -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
|
// interfaces
|
|
@@ -6,9 +6,6 @@ import {
|
|
|
6
6
|
IERC725Y
|
|
7
7
|
} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
|
|
8
8
|
|
|
9
|
-
// libraries
|
|
10
|
-
import {BytesLib} from "solidity-bytes-utils/contracts/BytesLib.sol";
|
|
11
|
-
|
|
12
9
|
/**
|
|
13
10
|
* @title LSP2 Utility library.
|
|
14
11
|
* @author Jean Cavallera <CJ42>, Yamen Merhi <YamenMerhi>, Daniel Afteni <B00ste>
|
|
@@ -17,8 +14,6 @@ import {BytesLib} from "solidity-bytes-utils/contracts/BytesLib.sol";
|
|
|
17
14
|
* Based on LSP2 ERC725Y JSON Schema standard.
|
|
18
15
|
*/
|
|
19
16
|
library LSP2Utils {
|
|
20
|
-
using BytesLib for bytes;
|
|
21
|
-
|
|
22
17
|
/**
|
|
23
18
|
* @dev Generates a data key of keyType Singleton by hashing the string `keyName`. As:
|
|
24
19
|
*
|
|
@@ -285,97 +280,6 @@ library LSP2Utils {
|
|
|
285
280
|
return abi.encodePacked(bytes4(hashFunctionDigest), jsonDigest, url);
|
|
286
281
|
}
|
|
287
282
|
|
|
288
|
-
/**
|
|
289
|
-
* @dev Verify if `data` is an abi-encoded array.
|
|
290
|
-
*
|
|
291
|
-
* @param data The bytes value to verify.
|
|
292
|
-
*
|
|
293
|
-
* @return `true` if the `data` represents an abi-encoded array, `false` otherwise.
|
|
294
|
-
*/
|
|
295
|
-
function isEncodedArray(bytes memory data) internal pure returns (bool) {
|
|
296
|
-
uint256 nbOfBytes = data.length;
|
|
297
|
-
|
|
298
|
-
// there must be at least 32 x length bytes after offset
|
|
299
|
-
uint256 offset = uint256(bytes32(data));
|
|
300
|
-
if (nbOfBytes < offset + 32) return false;
|
|
301
|
-
uint256 arrayLength = data.toUint256(offset);
|
|
302
|
-
|
|
303
|
-
// 32 bytes word (= offset)
|
|
304
|
-
// + 32 bytes word (= array length)
|
|
305
|
-
// + remaining bytes that make each element of the array
|
|
306
|
-
if (nbOfBytes < (offset + 32 + (arrayLength * 32))) return false;
|
|
307
|
-
|
|
308
|
-
return true;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
/**
|
|
312
|
-
* @dev Verify if `data` is an abi-encoded array of addresses (`address[]`) encoded according to the ABI specs.
|
|
313
|
-
*
|
|
314
|
-
* @param data The bytes value to verify.
|
|
315
|
-
*
|
|
316
|
-
* @return `true` if the `data` represents an abi-encoded array of addresses, `false` otherwise.
|
|
317
|
-
*/
|
|
318
|
-
function isEncodedArrayOfAddresses(
|
|
319
|
-
bytes memory data
|
|
320
|
-
) internal pure returns (bool) {
|
|
321
|
-
if (!isEncodedArray(data)) return false;
|
|
322
|
-
|
|
323
|
-
uint256 offset = uint256(bytes32(data));
|
|
324
|
-
uint256 arrayLength = data.toUint256(offset);
|
|
325
|
-
|
|
326
|
-
uint256 pointer = offset + 32;
|
|
327
|
-
|
|
328
|
-
for (uint256 ii = 0; ii < arrayLength; ) {
|
|
329
|
-
bytes32 key = data.toBytes32(pointer);
|
|
330
|
-
|
|
331
|
-
// check that the leading bytes are zero bytes "00"
|
|
332
|
-
// NB: address type is padded on the left (unlike bytes20 type that is padded on the right)
|
|
333
|
-
if (bytes12(key) != bytes12(0)) return false;
|
|
334
|
-
|
|
335
|
-
// increment the pointer
|
|
336
|
-
pointer += 32;
|
|
337
|
-
|
|
338
|
-
unchecked {
|
|
339
|
-
++ii;
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
return true;
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
/**
|
|
347
|
-
* @dev Verify if `data` is an abi-array of `bytes4` values (`bytes4[]`) encoded according to the ABI specs.
|
|
348
|
-
*
|
|
349
|
-
* @param data The bytes value to verify.
|
|
350
|
-
*
|
|
351
|
-
* @return `true` if the `data` represents an abi-encoded array of `bytes4`, `false` otherwise.
|
|
352
|
-
*/
|
|
353
|
-
function isBytes4EncodedArray(
|
|
354
|
-
bytes memory data
|
|
355
|
-
) internal pure returns (bool) {
|
|
356
|
-
if (!isEncodedArray(data)) return false;
|
|
357
|
-
|
|
358
|
-
uint256 offset = uint256(bytes32(data));
|
|
359
|
-
uint256 arrayLength = data.toUint256(offset);
|
|
360
|
-
uint256 pointer = offset + 32;
|
|
361
|
-
|
|
362
|
-
for (uint256 ii = 0; ii < arrayLength; ) {
|
|
363
|
-
bytes32 key = data.toBytes32(pointer);
|
|
364
|
-
|
|
365
|
-
// check that the trailing bytes are zero bytes "00"
|
|
366
|
-
if (uint224(uint256(key)) != 0) return false;
|
|
367
|
-
|
|
368
|
-
// increment the pointer
|
|
369
|
-
pointer += 32;
|
|
370
|
-
|
|
371
|
-
unchecked {
|
|
372
|
-
++ii;
|
|
373
|
-
}
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
return true;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
283
|
/**
|
|
380
284
|
* @dev Verify if `data` is a valid array of value encoded as a `CompactBytesArray` according to the LSP2 `CompactBytesArray` valueType specification.
|
|
381
285
|
*
|
|
@@ -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
|
// modules
|
|
@@ -8,7 +8,12 @@ import {ERC725Y} from "@erc725/smart-contracts/contracts/ERC725Y.sol";
|
|
|
8
8
|
import {BytesLib} from "solidity-bytes-utils/contracts/BytesLib.sol";
|
|
9
9
|
|
|
10
10
|
// constants
|
|
11
|
-
import
|
|
11
|
+
import {
|
|
12
|
+
_LSP4_SUPPORTED_STANDARDS_KEY,
|
|
13
|
+
_LSP4_SUPPORTED_STANDARDS_VALUE,
|
|
14
|
+
_LSP4_TOKEN_NAME_KEY,
|
|
15
|
+
_LSP4_TOKEN_SYMBOL_KEY
|
|
16
|
+
} from "./LSP4Constants.sol";
|
|
12
17
|
|
|
13
18
|
// errors
|
|
14
19
|
import {
|
|
@@ -46,7 +51,7 @@ abstract contract LSP4DigitalAssetMetadata is ERC725Y {
|
|
|
46
51
|
|
|
47
52
|
/**
|
|
48
53
|
* @dev The ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol` cannot be changed
|
|
49
|
-
*
|
|
54
|
+
* via this function once the digital asset contract has been deployed.
|
|
50
55
|
*
|
|
51
56
|
* @dev Save gas by emitting the {DataChanged} event with only the first 256 bytes of dataValue
|
|
52
57
|
*/
|
|
@@ -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
|
// modules
|
|
@@ -10,7 +10,12 @@ import {
|
|
|
10
10
|
import {BytesLib} from "solidity-bytes-utils/contracts/BytesLib.sol";
|
|
11
11
|
|
|
12
12
|
// constants
|
|
13
|
-
import
|
|
13
|
+
import {
|
|
14
|
+
_LSP4_SUPPORTED_STANDARDS_KEY,
|
|
15
|
+
_LSP4_SUPPORTED_STANDARDS_VALUE,
|
|
16
|
+
_LSP4_TOKEN_NAME_KEY,
|
|
17
|
+
_LSP4_TOKEN_SYMBOL_KEY
|
|
18
|
+
} from "./LSP4Constants.sol";
|
|
14
19
|
|
|
15
20
|
// errors
|
|
16
21
|
import {
|
|
@@ -50,7 +55,7 @@ abstract contract LSP4DigitalAssetMetadataInitAbstract is ERC725YInitAbstract {
|
|
|
50
55
|
|
|
51
56
|
/**
|
|
52
57
|
* @dev the ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol` cannot be changed
|
|
53
|
-
*
|
|
58
|
+
* via this function once the digital asset contract has been deployed.
|
|
54
59
|
*
|
|
55
60
|
* @dev Save gas by emitting the {DataChanged} event with only the first 256 bytes of dataValue
|
|
56
61
|
*/
|
|
@@ -7,12 +7,13 @@ import {
|
|
|
7
7
|
} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
|
|
8
8
|
|
|
9
9
|
// libraries
|
|
10
|
-
import {BytesLib} from "solidity-bytes-utils/contracts/BytesLib.sol";
|
|
11
10
|
import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";
|
|
12
11
|
|
|
13
12
|
// constants
|
|
14
|
-
import
|
|
15
|
-
|
|
13
|
+
import {
|
|
14
|
+
_LSP5_RECEIVED_ASSETS_MAP_KEY_PREFIX,
|
|
15
|
+
_LSP5_RECEIVED_ASSETS_ARRAY_KEY
|
|
16
|
+
} from "../LSP5ReceivedAssets/LSP5Constants.sol";
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* @title LSP5 Utility library.
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
// --- ERC165 interface ids
|
|
5
|
-
bytes4 constant _INTERFACEID_LSP6 =
|
|
5
|
+
bytes4 constant _INTERFACEID_LSP6 = 0x23f34c62;
|
|
6
6
|
|
|
7
7
|
// --- ERC725Y Data Keys
|
|
8
8
|
|
|
@@ -52,9 +52,10 @@ bytes32 constant _PERMISSION_SETDATA = 0x000000000000000
|
|
|
52
52
|
bytes32 constant _PERMISSION_ENCRYPT = 0x0000000000000000000000000000000000000000000000000000000000080000;
|
|
53
53
|
bytes32 constant _PERMISSION_DECRYPT = 0x0000000000000000000000000000000000000000000000000000000000100000;
|
|
54
54
|
bytes32 constant _PERMISSION_SIGN = 0x0000000000000000000000000000000000000000000000000000000000200000;
|
|
55
|
+
bytes32 constant _PERMISSION_EXECUTE_RELAY_CALL = 0x0000000000000000000000000000000000000000000000000000000000400000;
|
|
55
56
|
|
|
56
57
|
// All Permissions currently exclude REENTRANCY, DELEGATECALL and SUPER_DELEGATECALL for security
|
|
57
|
-
bytes32 constant ALL_REGULAR_PERMISSIONS =
|
|
58
|
+
bytes32 constant ALL_REGULAR_PERMISSIONS = 0x00000000000000000000000000000000000000000000000000000000007f3f7f;
|
|
58
59
|
|
|
59
60
|
// AllowedCalls types
|
|
60
61
|
bytes4 constant _ALLOWEDCALLS_TRANSFERVALUE = 0x00000001; // 0000 0001
|
|
@@ -73,8 +73,9 @@ error InvalidRelayNonce(address signer, uint256 invalidNonce, bytes signature);
|
|
|
73
73
|
* - `setData(bytes32,bytes)` (ERC725Y)
|
|
74
74
|
* - `setDataBatch(bytes32[],bytes[])` (ERC725Y)
|
|
75
75
|
* - `execute(uint256,address,uint256,bytes)` (ERC725X)
|
|
76
|
-
* - `transferOwnership(address)`
|
|
76
|
+
* - `transferOwnership(address)` (LSP14)
|
|
77
77
|
* - `acceptOwnership()` (LSP14)
|
|
78
|
+
* - `renounceOwnership()` (LSP14)
|
|
78
79
|
*
|
|
79
80
|
* @param invalidFunction The `bytes4` selector of the function that was attempted
|
|
80
81
|
* to be called on the linked {target} but not recognised.
|
|
@@ -199,14 +200,6 @@ error DelegateCallDisallowedViaKeyManager();
|
|
|
199
200
|
*/
|
|
200
201
|
error InvalidPayload(bytes payload);
|
|
201
202
|
|
|
202
|
-
/**
|
|
203
|
-
* @notice Cannot sent native tokens while setting data.
|
|
204
|
-
*
|
|
205
|
-
* @dev Reverts when calling the `setData(byte32,bytes)` or `setData(bytes32[],bytes[]) functions
|
|
206
|
-
* on the linked {target} while sending value.
|
|
207
|
-
*/
|
|
208
|
-
error CannotSendValueToSetData();
|
|
209
|
-
|
|
210
203
|
/**
|
|
211
204
|
* @notice Calling the Key Manager address for this transaction is disallowed.
|
|
212
205
|
*
|
|
@@ -214,20 +207,6 @@ error CannotSendValueToSetData();
|
|
|
214
207
|
*/
|
|
215
208
|
error CallingKeyManagerNotAllowed();
|
|
216
209
|
|
|
217
|
-
/**
|
|
218
|
-
* @notice Relay call not valid yet.
|
|
219
|
-
*
|
|
220
|
-
* @dev Reverts when the start timestamp provided to {executeRelayCall} function is bigger than the current timestamp.
|
|
221
|
-
*/
|
|
222
|
-
error RelayCallBeforeStartTime();
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* @notice The date of the relay call expired.
|
|
226
|
-
*
|
|
227
|
-
* @dev Reverts when the period to execute the relay call has expired.
|
|
228
|
-
*/
|
|
229
|
-
error RelayCallExpired();
|
|
230
|
-
|
|
231
210
|
/**
|
|
232
211
|
* @notice Key Manager cannot be used as an LSP17 extension for LSP20 functions.
|
|
233
212
|
*
|