@lukso/lsp-smart-contracts 0.11.1 → 0.12.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +4 -0
- package/README.md +10 -2
- package/artifacts/Create2Factory.json +2 -2
- package/artifacts/LSP0ERC725Account.json +52 -25
- package/artifacts/LSP0ERC725AccountInit.json +52 -25
- package/artifacts/LSP11BasicSocialRecovery.json +18 -2
- package/artifacts/LSP11BasicSocialRecoveryInit.json +18 -2
- package/artifacts/LSP16UniversalFactory.json +3 -3
- package/artifacts/LSP1UniversalReceiverDelegateUP.json +14 -46
- package/artifacts/LSP1UniversalReceiverDelegateVault.json +14 -46
- package/artifacts/LSP23LinkedContractsFactory.json +3 -3
- package/artifacts/LSP4DigitalAssetMetadata.json +16 -0
- package/artifacts/LSP4DigitalAssetMetadataInitAbstract.json +16 -0
- package/artifacts/LSP6KeyManager.json +14 -9
- package/artifacts/LSP6KeyManagerInit.json +14 -9
- package/artifacts/LSP7CappedSupply.json +29 -4
- package/artifacts/LSP7CappedSupplyInitAbstract.json +29 -4
- package/artifacts/LSP7CompatibleERC20.json +48 -23
- package/artifacts/LSP7CompatibleERC20InitAbstract.json +48 -23
- package/artifacts/LSP7CompatibleERC20Mintable.json +51 -26
- package/artifacts/LSP7CompatibleERC20MintableInit.json +51 -26
- package/artifacts/LSP7DigitalAsset.json +29 -4
- package/artifacts/LSP7DigitalAssetInitAbstract.json +29 -4
- package/artifacts/LSP7Mintable.json +32 -7
- package/artifacts/LSP7MintableInit.json +32 -7
- package/artifacts/LSP8CappedSupply.json +33 -3
- package/artifacts/LSP8CappedSupplyInitAbstract.json +33 -3
- package/artifacts/LSP8CompatibleERC721.json +55 -25
- package/artifacts/LSP8CompatibleERC721InitAbstract.json +55 -25
- package/artifacts/LSP8CompatibleERC721Mintable.json +63 -28
- package/artifacts/LSP8CompatibleERC721MintableInit.json +63 -28
- package/artifacts/LSP8IdentifiableDigitalAsset.json +33 -3
- package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +33 -3
- package/artifacts/LSP8Mintable.json +41 -6
- package/artifacts/LSP8MintableInit.json +41 -6
- package/artifacts/LSP9Vault.json +38 -16
- package/artifacts/LSP9VaultInit.json +38 -16
- package/artifacts/UniversalProfile.json +52 -25
- package/artifacts/UniversalProfileInit.json +52 -25
- package/contracts/Factories/Create2Factory.sol +1 -1
- package/contracts/LSP0ERC725Account/ILSP0ERC725Account.sol +0 -14
- package/contracts/LSP0ERC725Account/LSP0Constants.sol +1 -1
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +122 -94
- package/contracts/LSP10ReceivedVaults/LSP10Utils.sol +5 -3
- package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryCore.sol +54 -14
- package/contracts/LSP11BasicSocialRecovery/LSP11Constants.sol +1 -1
- package/contracts/LSP11BasicSocialRecovery/LSP11Errors.sol +1 -1
- package/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +2 -2
- package/contracts/LSP14Ownable2Step/LSP14Constants.sol +1 -1
- package/contracts/LSP14Ownable2Step/LSP14Errors.sol +9 -3
- package/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +16 -12
- package/contracts/LSP16UniversalFactory/LSP16UniversalFactory.sol +65 -96
- package/contracts/LSP17ContractExtension/LSP17Errors.sol +1 -1
- package/contracts/LSP17ContractExtension/LSP17Extendable.sol +10 -7
- package/contracts/LSP17ContractExtension/LSP17Extension.sol +4 -4
- package/contracts/LSP17Extensions/Extension4337.sol +101 -0
- package/contracts/LSP17Extensions/OnERC721ReceivedExtension.sol +15 -0
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +1 -2
- package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol +24 -0
- package/contracts/LSP1UniversalReceiver/LSP1Constants.sol +1 -0
- package/contracts/LSP1UniversalReceiver/LSP1Errors.sol +0 -6
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +20 -27
- package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +18 -21
- package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +2 -46
- package/contracts/LSP20CallVerification/ILSP20CallVerifier.sol +13 -9
- package/contracts/LSP20CallVerification/LSP20CallVerification.sol +39 -14
- package/contracts/LSP20CallVerification/LSP20Constants.sol +6 -6
- package/contracts/LSP20CallVerification/LSP20Errors.sol +9 -3
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/ILSP23LinkedContractsFactory.sol +1 -1
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/IPostDeploymentModule.sol +1 -1
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/LSP23Errors.sol +1 -1
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/LSP23LinkedContractsFactory.sol +5 -1
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/modules/UniversalProfileInitPostDeploymentModule.sol +1 -1
- package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/modules/UniversalProfilePostDeploymentModule.sol +1 -1
- package/contracts/LSP25ExecuteRelayCall/LSP25Constants.sol +1 -1
- package/contracts/LSP25ExecuteRelayCall/LSP25MultiChannelNonce.sol +8 -3
- package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +1 -97
- package/contracts/LSP3ProfileMetadata/LSP3Constants.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +8 -3
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +8 -3
- package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +4 -3
- package/contracts/LSP6KeyManager/LSP6Constants.sol +4 -3
- package/contracts/LSP6KeyManager/LSP6Errors.sol +2 -23
- package/contracts/LSP6KeyManager/LSP6KeyManager.sol +0 -1
- package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +134 -99
- package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +0 -1
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +1 -2
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteRelayCallModule.sol +27 -0
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +31 -25
- package/contracts/LSP6KeyManager/LSP6Utils.sol +29 -2
- package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +10 -10
- package/contracts/LSP7DigitalAsset/LSP7Constants.sol +1 -1
- package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +22 -8
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +180 -118
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +21 -7
- package/contracts/LSP7DigitalAsset/LSP7Errors.sol +12 -3
- package/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +5 -1
- package/contracts/LSP7DigitalAsset/extensions/LSP7BurnableInitAbstract.sol +4 -1
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +7 -7
- package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +3 -3
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +120 -53
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +122 -53
- package/contracts/LSP7DigitalAsset/presets/ILSP7Mintable.sol +3 -3
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +4 -4
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +2 -2
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +4 -4
- package/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +4 -4
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +1 -1
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +4 -4
- package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +11 -11
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +12 -1
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +32 -16
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +61 -11
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +113 -74
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +63 -10
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8BurnableInitAbstract.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +7 -7
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +162 -73
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +168 -84
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +7 -7
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +7 -7
- package/contracts/LSP8IdentifiableDigitalAsset/presets/ILSP8Mintable.sol +3 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +8 -7
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +5 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +13 -7
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +9 -8
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +9 -3
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +10 -8
- package/contracts/LSP9Vault/ILSP9Vault.sol +0 -13
- package/contracts/LSP9Vault/LSP9Constants.sol +1 -1
- package/contracts/LSP9Vault/LSP9Errors.sol +1 -1
- package/contracts/LSP9Vault/LSP9VaultCore.sol +58 -41
- package/devdocs/LSP0ERC725Account.json +73 -45
- package/devdocs/LSP0ERC725AccountInit.json +73 -45
- package/devdocs/LSP11BasicSocialRecovery.json +13 -0
- package/devdocs/LSP11BasicSocialRecoveryInit.json +13 -0
- package/devdocs/LSP16UniversalFactory.json +9 -9
- package/devdocs/LSP1UniversalReceiverDelegateUP.json +1 -6
- package/devdocs/LSP1UniversalReceiverDelegateVault.json +1 -6
- package/devdocs/LSP4DigitalAssetMetadata.json +32 -10
- package/devdocs/LSP4DigitalAssetMetadataInitAbstract.json +32 -10
- package/devdocs/LSP6KeyManager.json +12 -14
- package/devdocs/LSP6KeyManagerInit.json +12 -14
- package/devdocs/LSP7CappedSupply.json +47 -20
- package/devdocs/LSP7CappedSupplyInitAbstract.json +47 -20
- package/devdocs/LSP7CompatibleERC20.json +88 -24
- package/devdocs/LSP7CompatibleERC20InitAbstract.json +88 -24
- package/devdocs/LSP7CompatibleERC20Mintable.json +88 -24
- package/devdocs/LSP7CompatibleERC20MintableInit.json +88 -24
- package/devdocs/LSP7DigitalAsset.json +47 -20
- package/devdocs/LSP7DigitalAssetInitAbstract.json +47 -20
- package/devdocs/LSP7Mintable.json +47 -20
- package/devdocs/LSP7MintableInit.json +47 -20
- package/devdocs/LSP8CappedSupply.json +57 -25
- package/devdocs/LSP8CappedSupplyInitAbstract.json +57 -25
- package/devdocs/LSP8CompatibleERC721.json +84 -31
- package/devdocs/LSP8CompatibleERC721InitAbstract.json +84 -31
- package/devdocs/LSP8CompatibleERC721Mintable.json +86 -33
- package/devdocs/LSP8CompatibleERC721MintableInit.json +87 -34
- package/devdocs/LSP8IdentifiableDigitalAsset.json +61 -26
- package/devdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +57 -25
- package/devdocs/LSP8Mintable.json +59 -27
- package/devdocs/LSP8MintableInit.json +60 -28
- package/devdocs/LSP9Vault.json +57 -35
- package/devdocs/LSP9VaultInit.json +57 -35
- package/devdocs/UniversalProfile.json +73 -45
- package/devdocs/UniversalProfileInit.json +73 -45
- package/dist/constants.cjs.js +4323 -2361
- package/dist/constants.d.ts +2933 -1022
- package/dist/constants.es.js +4322 -2361
- package/package.json +8 -6
- package/userdocs/LSP0ERC725Account.json +17 -8
- package/userdocs/LSP0ERC725AccountInit.json +17 -8
- package/userdocs/LSP16UniversalFactory.json +26 -1
- package/userdocs/LSP1UniversalReceiverDelegateUP.json +1 -11
- package/userdocs/LSP1UniversalReceiverDelegateVault.json +1 -11
- package/userdocs/LSP4DigitalAssetMetadata.json +7 -4
- package/userdocs/LSP4DigitalAssetMetadataInitAbstract.json +7 -4
- package/userdocs/LSP6KeyManager.json +0 -5
- package/userdocs/LSP6KeyManagerInit.json +0 -5
- package/userdocs/LSP7CappedSupply.json +14 -6
- package/userdocs/LSP7CappedSupplyInitAbstract.json +13 -5
- package/userdocs/LSP7CompatibleERC20.json +15 -5
- package/userdocs/LSP7CompatibleERC20InitAbstract.json +15 -5
- package/userdocs/LSP7CompatibleERC20Mintable.json +15 -5
- package/userdocs/LSP7CompatibleERC20MintableInit.json +15 -5
- package/userdocs/LSP7DigitalAsset.json +15 -5
- package/userdocs/LSP7DigitalAssetInitAbstract.json +15 -5
- package/userdocs/LSP7Mintable.json +15 -5
- package/userdocs/LSP7MintableInit.json +15 -5
- package/userdocs/LSP8CappedSupply.json +13 -5
- package/userdocs/LSP8CappedSupplyInitAbstract.json +12 -4
- package/userdocs/LSP8CompatibleERC721.json +27 -17
- package/userdocs/LSP8CompatibleERC721InitAbstract.json +27 -17
- package/userdocs/LSP8CompatibleERC721Mintable.json +28 -18
- package/userdocs/LSP8CompatibleERC721MintableInit.json +29 -19
- package/userdocs/LSP8IdentifiableDigitalAsset.json +15 -5
- package/userdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +14 -4
- package/userdocs/LSP8Mintable.json +15 -5
- package/userdocs/LSP8MintableInit.json +16 -6
- package/userdocs/LSP9Vault.json +20 -11
- package/userdocs/LSP9VaultInit.json +20 -11
- package/userdocs/UniversalProfile.json +17 -8
- package/userdocs/UniversalProfileInit.json +17 -8
- package/artifacts/LSP4Compatibility.json +0 -216
- package/contracts/LSP4DigitalAssetMetadata/ILSP4Compatibility.sol +0 -25
- package/contracts/LSP4DigitalAssetMetadata/LSP4Compatibility.sol +0 -38
- package/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibleERC20.sol +0 -83
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol +0 -175
- package/devdocs/LSP4Compatibility.json +0 -79
- package/userdocs/LSP4Compatibility.json +0 -20
|
@@ -2,31 +2,39 @@
|
|
|
2
2
|
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
// interfaces
|
|
5
|
-
|
|
6
5
|
import {ILSP20CallVerifier as ILSP20} from "./ILSP20CallVerifier.sol";
|
|
7
6
|
|
|
8
7
|
// errors
|
|
9
|
-
import
|
|
8
|
+
import {
|
|
9
|
+
LSP20CallVerificationFailed,
|
|
10
|
+
LSP20CallingVerifierFailed,
|
|
11
|
+
LSP20EOACannotVerifyCall
|
|
12
|
+
} from "./LSP20Errors.sol";
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
15
|
* @title Implementation of a contract calling the verification functions according to LSP20 - Call Verification standard.
|
|
13
16
|
*
|
|
14
17
|
* @dev Module to be inherited used to verify the execution of functions according to a verifier address.
|
|
15
|
-
* Verification can happen before or after execution based on a
|
|
18
|
+
* Verification can happen before or after execution based on a returnedStatus.
|
|
16
19
|
*/
|
|
17
20
|
abstract contract LSP20CallVerification {
|
|
18
21
|
/**
|
|
19
22
|
* @dev Calls {lsp20VerifyCall} function on the logicVerifier.
|
|
20
|
-
* Reverts in case the value returned does not match the
|
|
21
|
-
* Returns whether a verification after the execution should happen based on the last byte of the
|
|
23
|
+
* Reverts in case the value returned does not match the success value (lsp20VerifyCall selector)
|
|
24
|
+
* Returns whether a verification after the execution should happen based on the last byte of the returnedStatus
|
|
22
25
|
*/
|
|
23
26
|
function _verifyCall(
|
|
24
27
|
address logicVerifier
|
|
25
28
|
) internal virtual returns (bool verifyAfter) {
|
|
29
|
+
if (logicVerifier.code.length == 0)
|
|
30
|
+
revert LSP20EOACannotVerifyCall(logicVerifier);
|
|
31
|
+
|
|
26
32
|
(bool success, bytes memory returnedData) = logicVerifier.call(
|
|
27
33
|
abi.encodeWithSelector(
|
|
28
34
|
ILSP20.lsp20VerifyCall.selector,
|
|
29
35
|
msg.sender,
|
|
36
|
+
address(this),
|
|
37
|
+
msg.sender,
|
|
30
38
|
msg.value,
|
|
31
39
|
msg.data
|
|
32
40
|
)
|
|
@@ -34,17 +42,18 @@ abstract contract LSP20CallVerification {
|
|
|
34
42
|
|
|
35
43
|
_validateCall(false, success, returnedData);
|
|
36
44
|
|
|
37
|
-
bytes4
|
|
45
|
+
bytes4 returnedStatus = abi.decode(returnedData, (bytes4));
|
|
38
46
|
|
|
39
|
-
if (bytes3(
|
|
40
|
-
revert
|
|
47
|
+
if (bytes3(returnedStatus) != bytes3(ILSP20.lsp20VerifyCall.selector)) {
|
|
48
|
+
revert LSP20CallVerificationFailed(false, returnedData);
|
|
49
|
+
}
|
|
41
50
|
|
|
42
|
-
return
|
|
51
|
+
return returnedStatus[3] == 0x01;
|
|
43
52
|
}
|
|
44
53
|
|
|
45
54
|
/**
|
|
46
55
|
* @dev Calls {lsp20VerifyCallResult} function on the logicVerifier.
|
|
47
|
-
* Reverts in case the value returned does not match the
|
|
56
|
+
* Reverts in case the value returned does not match the success value (lsp20VerifyCallResult selector)
|
|
48
57
|
*/
|
|
49
58
|
function _verifyCallResult(
|
|
50
59
|
address logicVerifier,
|
|
@@ -53,7 +62,15 @@ abstract contract LSP20CallVerification {
|
|
|
53
62
|
(bool success, bytes memory returnedData) = logicVerifier.call(
|
|
54
63
|
abi.encodeWithSelector(
|
|
55
64
|
ILSP20.lsp20VerifyCallResult.selector,
|
|
56
|
-
keccak256(
|
|
65
|
+
keccak256(
|
|
66
|
+
abi.encodePacked(
|
|
67
|
+
msg.sender,
|
|
68
|
+
address(this),
|
|
69
|
+
msg.sender,
|
|
70
|
+
msg.value,
|
|
71
|
+
msg.data
|
|
72
|
+
)
|
|
73
|
+
),
|
|
57
74
|
callResult
|
|
58
75
|
)
|
|
59
76
|
);
|
|
@@ -63,7 +80,11 @@ abstract contract LSP20CallVerification {
|
|
|
63
80
|
if (
|
|
64
81
|
abi.decode(returnedData, (bytes4)) !=
|
|
65
82
|
ILSP20.lsp20VerifyCallResult.selector
|
|
66
|
-
)
|
|
83
|
+
)
|
|
84
|
+
revert LSP20CallVerificationFailed({
|
|
85
|
+
postCall: true,
|
|
86
|
+
returnedData: returnedData
|
|
87
|
+
});
|
|
67
88
|
}
|
|
68
89
|
|
|
69
90
|
function _validateCall(
|
|
@@ -78,7 +99,11 @@ abstract contract LSP20CallVerification {
|
|
|
78
99
|
if (
|
|
79
100
|
returnedData.length < 32 ||
|
|
80
101
|
bytes28(bytes32(returnedData) << 32) != bytes28(0)
|
|
81
|
-
)
|
|
102
|
+
)
|
|
103
|
+
revert LSP20CallVerificationFailed({
|
|
104
|
+
postCall: postCall,
|
|
105
|
+
returnedData: returnedData
|
|
106
|
+
});
|
|
82
107
|
}
|
|
83
108
|
|
|
84
109
|
function _revertWithLSP20DefaultError(
|
|
@@ -86,7 +111,7 @@ abstract contract LSP20CallVerification {
|
|
|
86
111
|
bytes memory returnedData
|
|
87
112
|
) internal pure virtual {
|
|
88
113
|
// Look for revert reason and bubble it up if present
|
|
89
|
-
if (returnedData.length
|
|
114
|
+
if (returnedData.length != 0) {
|
|
90
115
|
// The easiest way to bubble the revert reason is using memory via assembly
|
|
91
116
|
// solhint-disable no-inline-assembly
|
|
92
117
|
/// @solidity memory-safe-assembly
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
// bytes4(keccak256("LSP20CallVerification"))
|
|
5
5
|
bytes4 constant _INTERFACEID_LSP20_CALL_VERIFICATION = 0x1a0eb6a5;
|
|
6
6
|
|
|
7
|
-
// `lsp20VerifyCall(address,uint256,bytes)` selector XOR `lsp20VerifyCallResult(bytes32,bytes)` selector
|
|
8
|
-
bytes4 constant _INTERFACEID_LSP20_CALL_VERIFIER =
|
|
7
|
+
// `lsp20VerifyCall(address,address,address,uint256,bytes)` selector XOR `lsp20VerifyCallResult(bytes32,bytes)` selector
|
|
8
|
+
bytes4 constant _INTERFACEID_LSP20_CALL_VERIFIER = 0x0d6ecac7;
|
|
9
9
|
|
|
10
10
|
// bytes4(bytes.concat(bytes3(ILSP20.lsp20VerifyCall.selector), hex"01"))
|
|
11
|
-
bytes4 constant
|
|
11
|
+
bytes4 constant _LSP20_VERIFY_CALL_SUCCESS_VALUE_WITH_POST_VERIFICATION = 0xde928f01;
|
|
12
12
|
|
|
13
13
|
// bytes4(bytes.concat(bytes3(ILSP20.lsp20VerifyCall.selector), hex"00"))
|
|
14
|
-
bytes4 constant
|
|
14
|
+
bytes4 constant _LSP20_VERIFY_CALL_SUCCESS_VALUE_WITHOUT_POST_VERIFICATION = 0xde928f00;
|
|
15
15
|
|
|
16
16
|
// bytes4(ILSP20.lsp20VerifyCallResult.selector)
|
|
17
|
-
bytes4 constant
|
|
17
|
+
bytes4 constant _LSP20_VERIFY_CALL_RESULT_SUCCESS_VALUE = 0xd3fc45d3;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// SPDX-License-Identifier:
|
|
1
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -8,8 +8,14 @@ pragma solidity ^0.8.4;
|
|
|
8
8
|
error LSP20CallingVerifierFailed(bool postCall);
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
|
-
* @dev reverts when the call to the owner does not return the
|
|
11
|
+
* @dev reverts when the call to the owner does not return the LSP20 success value
|
|
12
12
|
* @param postCall True if the execution call was done, False otherwise
|
|
13
13
|
* @param returnedData The data returned by the call to the logic verifier
|
|
14
14
|
*/
|
|
15
|
-
error
|
|
15
|
+
error LSP20CallVerificationFailed(bool postCall, bytes returnedData);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @dev Reverts when the logic verifier is an Externally Owned Account (EOA) that cannot return the LSP20 success value.
|
|
19
|
+
* @param logicVerifier The address of the logic verifier
|
|
20
|
+
*/
|
|
21
|
+
error LSP20EOACannotVerifyCall(address logicVerifier);
|
|
@@ -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
|
*
|