@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.
Files changed (214) hide show
  1. package/CONTRIBUTING.md +4 -0
  2. package/README.md +10 -2
  3. package/artifacts/Create2Factory.json +2 -2
  4. package/artifacts/LSP0ERC725Account.json +52 -25
  5. package/artifacts/LSP0ERC725AccountInit.json +52 -25
  6. package/artifacts/LSP11BasicSocialRecovery.json +18 -2
  7. package/artifacts/LSP11BasicSocialRecoveryInit.json +18 -2
  8. package/artifacts/LSP16UniversalFactory.json +3 -3
  9. package/artifacts/LSP1UniversalReceiverDelegateUP.json +14 -46
  10. package/artifacts/LSP1UniversalReceiverDelegateVault.json +14 -46
  11. package/artifacts/LSP23LinkedContractsFactory.json +3 -3
  12. package/artifacts/LSP4DigitalAssetMetadata.json +16 -0
  13. package/artifacts/LSP4DigitalAssetMetadataInitAbstract.json +16 -0
  14. package/artifacts/LSP6KeyManager.json +14 -9
  15. package/artifacts/LSP6KeyManagerInit.json +14 -9
  16. package/artifacts/LSP7CappedSupply.json +29 -4
  17. package/artifacts/LSP7CappedSupplyInitAbstract.json +29 -4
  18. package/artifacts/LSP7CompatibleERC20.json +48 -23
  19. package/artifacts/LSP7CompatibleERC20InitAbstract.json +48 -23
  20. package/artifacts/LSP7CompatibleERC20Mintable.json +51 -26
  21. package/artifacts/LSP7CompatibleERC20MintableInit.json +51 -26
  22. package/artifacts/LSP7DigitalAsset.json +29 -4
  23. package/artifacts/LSP7DigitalAssetInitAbstract.json +29 -4
  24. package/artifacts/LSP7Mintable.json +32 -7
  25. package/artifacts/LSP7MintableInit.json +32 -7
  26. package/artifacts/LSP8CappedSupply.json +33 -3
  27. package/artifacts/LSP8CappedSupplyInitAbstract.json +33 -3
  28. package/artifacts/LSP8CompatibleERC721.json +55 -25
  29. package/artifacts/LSP8CompatibleERC721InitAbstract.json +55 -25
  30. package/artifacts/LSP8CompatibleERC721Mintable.json +63 -28
  31. package/artifacts/LSP8CompatibleERC721MintableInit.json +63 -28
  32. package/artifacts/LSP8IdentifiableDigitalAsset.json +33 -3
  33. package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +33 -3
  34. package/artifacts/LSP8Mintable.json +41 -6
  35. package/artifacts/LSP8MintableInit.json +41 -6
  36. package/artifacts/LSP9Vault.json +38 -16
  37. package/artifacts/LSP9VaultInit.json +38 -16
  38. package/artifacts/UniversalProfile.json +52 -25
  39. package/artifacts/UniversalProfileInit.json +52 -25
  40. package/contracts/Factories/Create2Factory.sol +1 -1
  41. package/contracts/LSP0ERC725Account/ILSP0ERC725Account.sol +0 -14
  42. package/contracts/LSP0ERC725Account/LSP0Constants.sol +1 -1
  43. package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +122 -94
  44. package/contracts/LSP10ReceivedVaults/LSP10Utils.sol +5 -3
  45. package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryCore.sol +54 -14
  46. package/contracts/LSP11BasicSocialRecovery/LSP11Constants.sol +1 -1
  47. package/contracts/LSP11BasicSocialRecovery/LSP11Errors.sol +1 -1
  48. package/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +2 -2
  49. package/contracts/LSP14Ownable2Step/LSP14Constants.sol +1 -1
  50. package/contracts/LSP14Ownable2Step/LSP14Errors.sol +9 -3
  51. package/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +16 -12
  52. package/contracts/LSP16UniversalFactory/LSP16UniversalFactory.sol +65 -96
  53. package/contracts/LSP17ContractExtension/LSP17Errors.sol +1 -1
  54. package/contracts/LSP17ContractExtension/LSP17Extendable.sol +10 -7
  55. package/contracts/LSP17ContractExtension/LSP17Extension.sol +4 -4
  56. package/contracts/LSP17Extensions/Extension4337.sol +101 -0
  57. package/contracts/LSP17Extensions/OnERC721ReceivedExtension.sol +15 -0
  58. package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +1 -2
  59. package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol +24 -0
  60. package/contracts/LSP1UniversalReceiver/LSP1Constants.sol +1 -0
  61. package/contracts/LSP1UniversalReceiver/LSP1Errors.sol +0 -6
  62. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +20 -27
  63. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +18 -21
  64. package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +2 -46
  65. package/contracts/LSP20CallVerification/ILSP20CallVerifier.sol +13 -9
  66. package/contracts/LSP20CallVerification/LSP20CallVerification.sol +39 -14
  67. package/contracts/LSP20CallVerification/LSP20Constants.sol +6 -6
  68. package/contracts/LSP20CallVerification/LSP20Errors.sol +9 -3
  69. package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/ILSP23LinkedContractsFactory.sol +1 -1
  70. package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/IPostDeploymentModule.sol +1 -1
  71. package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/LSP23Errors.sol +1 -1
  72. package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/LSP23LinkedContractsFactory.sol +5 -1
  73. package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/modules/UniversalProfileInitPostDeploymentModule.sol +1 -1
  74. package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/modules/UniversalProfilePostDeploymentModule.sol +1 -1
  75. package/contracts/LSP25ExecuteRelayCall/LSP25Constants.sol +1 -1
  76. package/contracts/LSP25ExecuteRelayCall/LSP25MultiChannelNonce.sol +8 -3
  77. package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +1 -97
  78. package/contracts/LSP3ProfileMetadata/LSP3Constants.sol +1 -1
  79. package/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +1 -1
  80. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +8 -3
  81. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +8 -3
  82. package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +4 -3
  83. package/contracts/LSP6KeyManager/LSP6Constants.sol +4 -3
  84. package/contracts/LSP6KeyManager/LSP6Errors.sol +2 -23
  85. package/contracts/LSP6KeyManager/LSP6KeyManager.sol +0 -1
  86. package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +134 -99
  87. package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +0 -1
  88. package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +1 -2
  89. package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteRelayCallModule.sol +27 -0
  90. package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +31 -25
  91. package/contracts/LSP6KeyManager/LSP6Utils.sol +29 -2
  92. package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +10 -10
  93. package/contracts/LSP7DigitalAsset/LSP7Constants.sol +1 -1
  94. package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +22 -8
  95. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +180 -118
  96. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +21 -7
  97. package/contracts/LSP7DigitalAsset/LSP7Errors.sol +12 -3
  98. package/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +5 -1
  99. package/contracts/LSP7DigitalAsset/extensions/LSP7BurnableInitAbstract.sol +4 -1
  100. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +7 -7
  101. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +3 -3
  102. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +120 -53
  103. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +122 -53
  104. package/contracts/LSP7DigitalAsset/presets/ILSP7Mintable.sol +3 -3
  105. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +4 -4
  106. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +2 -2
  107. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +4 -4
  108. package/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +4 -4
  109. package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +1 -1
  110. package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +4 -4
  111. package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +11 -11
  112. package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +12 -1
  113. package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +32 -16
  114. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +61 -11
  115. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +113 -74
  116. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +63 -10
  117. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol +1 -1
  118. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8BurnableInitAbstract.sol +1 -1
  119. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +7 -7
  120. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +3 -3
  121. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +162 -73
  122. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +168 -84
  123. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +7 -7
  124. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +7 -7
  125. package/contracts/LSP8IdentifiableDigitalAsset/presets/ILSP8Mintable.sol +3 -3
  126. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +8 -7
  127. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +5 -3
  128. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +13 -7
  129. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +9 -8
  130. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +9 -3
  131. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +10 -8
  132. package/contracts/LSP9Vault/ILSP9Vault.sol +0 -13
  133. package/contracts/LSP9Vault/LSP9Constants.sol +1 -1
  134. package/contracts/LSP9Vault/LSP9Errors.sol +1 -1
  135. package/contracts/LSP9Vault/LSP9VaultCore.sol +58 -41
  136. package/devdocs/LSP0ERC725Account.json +73 -45
  137. package/devdocs/LSP0ERC725AccountInit.json +73 -45
  138. package/devdocs/LSP11BasicSocialRecovery.json +13 -0
  139. package/devdocs/LSP11BasicSocialRecoveryInit.json +13 -0
  140. package/devdocs/LSP16UniversalFactory.json +9 -9
  141. package/devdocs/LSP1UniversalReceiverDelegateUP.json +1 -6
  142. package/devdocs/LSP1UniversalReceiverDelegateVault.json +1 -6
  143. package/devdocs/LSP4DigitalAssetMetadata.json +32 -10
  144. package/devdocs/LSP4DigitalAssetMetadataInitAbstract.json +32 -10
  145. package/devdocs/LSP6KeyManager.json +12 -14
  146. package/devdocs/LSP6KeyManagerInit.json +12 -14
  147. package/devdocs/LSP7CappedSupply.json +47 -20
  148. package/devdocs/LSP7CappedSupplyInitAbstract.json +47 -20
  149. package/devdocs/LSP7CompatibleERC20.json +88 -24
  150. package/devdocs/LSP7CompatibleERC20InitAbstract.json +88 -24
  151. package/devdocs/LSP7CompatibleERC20Mintable.json +88 -24
  152. package/devdocs/LSP7CompatibleERC20MintableInit.json +88 -24
  153. package/devdocs/LSP7DigitalAsset.json +47 -20
  154. package/devdocs/LSP7DigitalAssetInitAbstract.json +47 -20
  155. package/devdocs/LSP7Mintable.json +47 -20
  156. package/devdocs/LSP7MintableInit.json +47 -20
  157. package/devdocs/LSP8CappedSupply.json +57 -25
  158. package/devdocs/LSP8CappedSupplyInitAbstract.json +57 -25
  159. package/devdocs/LSP8CompatibleERC721.json +84 -31
  160. package/devdocs/LSP8CompatibleERC721InitAbstract.json +84 -31
  161. package/devdocs/LSP8CompatibleERC721Mintable.json +86 -33
  162. package/devdocs/LSP8CompatibleERC721MintableInit.json +87 -34
  163. package/devdocs/LSP8IdentifiableDigitalAsset.json +61 -26
  164. package/devdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +57 -25
  165. package/devdocs/LSP8Mintable.json +59 -27
  166. package/devdocs/LSP8MintableInit.json +60 -28
  167. package/devdocs/LSP9Vault.json +57 -35
  168. package/devdocs/LSP9VaultInit.json +57 -35
  169. package/devdocs/UniversalProfile.json +73 -45
  170. package/devdocs/UniversalProfileInit.json +73 -45
  171. package/dist/constants.cjs.js +4323 -2361
  172. package/dist/constants.d.ts +2933 -1022
  173. package/dist/constants.es.js +4322 -2361
  174. package/package.json +8 -6
  175. package/userdocs/LSP0ERC725Account.json +17 -8
  176. package/userdocs/LSP0ERC725AccountInit.json +17 -8
  177. package/userdocs/LSP16UniversalFactory.json +26 -1
  178. package/userdocs/LSP1UniversalReceiverDelegateUP.json +1 -11
  179. package/userdocs/LSP1UniversalReceiverDelegateVault.json +1 -11
  180. package/userdocs/LSP4DigitalAssetMetadata.json +7 -4
  181. package/userdocs/LSP4DigitalAssetMetadataInitAbstract.json +7 -4
  182. package/userdocs/LSP6KeyManager.json +0 -5
  183. package/userdocs/LSP6KeyManagerInit.json +0 -5
  184. package/userdocs/LSP7CappedSupply.json +14 -6
  185. package/userdocs/LSP7CappedSupplyInitAbstract.json +13 -5
  186. package/userdocs/LSP7CompatibleERC20.json +15 -5
  187. package/userdocs/LSP7CompatibleERC20InitAbstract.json +15 -5
  188. package/userdocs/LSP7CompatibleERC20Mintable.json +15 -5
  189. package/userdocs/LSP7CompatibleERC20MintableInit.json +15 -5
  190. package/userdocs/LSP7DigitalAsset.json +15 -5
  191. package/userdocs/LSP7DigitalAssetInitAbstract.json +15 -5
  192. package/userdocs/LSP7Mintable.json +15 -5
  193. package/userdocs/LSP7MintableInit.json +15 -5
  194. package/userdocs/LSP8CappedSupply.json +13 -5
  195. package/userdocs/LSP8CappedSupplyInitAbstract.json +12 -4
  196. package/userdocs/LSP8CompatibleERC721.json +27 -17
  197. package/userdocs/LSP8CompatibleERC721InitAbstract.json +27 -17
  198. package/userdocs/LSP8CompatibleERC721Mintable.json +28 -18
  199. package/userdocs/LSP8CompatibleERC721MintableInit.json +29 -19
  200. package/userdocs/LSP8IdentifiableDigitalAsset.json +15 -5
  201. package/userdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +14 -4
  202. package/userdocs/LSP8Mintable.json +15 -5
  203. package/userdocs/LSP8MintableInit.json +16 -6
  204. package/userdocs/LSP9Vault.json +20 -11
  205. package/userdocs/LSP9VaultInit.json +20 -11
  206. package/userdocs/UniversalProfile.json +17 -8
  207. package/userdocs/UniversalProfileInit.json +17 -8
  208. package/artifacts/LSP4Compatibility.json +0 -216
  209. package/contracts/LSP4DigitalAssetMetadata/ILSP4Compatibility.sol +0 -25
  210. package/contracts/LSP4DigitalAssetMetadata/LSP4Compatibility.sol +0 -38
  211. package/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibleERC20.sol +0 -83
  212. package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol +0 -175
  213. package/devdocs/LSP4Compatibility.json +0 -79
  214. package/userdocs/LSP4Compatibility.json +0 -20
@@ -8,6 +8,10 @@ import {
8
8
  ILSP1UniversalReceiver
9
9
  } from "../LSP1UniversalReceiver/ILSP1UniversalReceiver.sol";
10
10
 
11
+ import {
12
+ ILSP1UniversalReceiverDelegate as ILSP1Delegate
13
+ } from "../LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol";
14
+
11
15
  // libraries
12
16
  import {BytesLib} from "solidity-bytes-utils/contracts/BytesLib.sol";
13
17
  import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
@@ -19,14 +23,8 @@ import {LSP1Utils} from "../LSP1UniversalReceiver/LSP1Utils.sol";
19
23
  import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";
20
24
 
21
25
  // modules
22
- import {
23
- ERC725YCore,
24
- IERC725Y
25
- } from "@erc725/smart-contracts/contracts/ERC725YCore.sol";
26
- import {
27
- ERC725XCore,
28
- IERC725X
29
- } from "@erc725/smart-contracts/contracts/ERC725XCore.sol";
26
+ import {ERC725YCore} from "@erc725/smart-contracts/contracts/ERC725YCore.sol";
27
+ import {ERC725XCore} from "@erc725/smart-contracts/contracts/ERC725XCore.sol";
30
28
  import {
31
29
  OwnableUnset
32
30
  } from "@erc725/smart-contracts/contracts/custom/OwnableUnset.sol";
@@ -37,18 +35,18 @@ import {
37
35
  } from "../LSP20CallVerification/LSP20CallVerification.sol";
38
36
 
39
37
  // constants
40
- import "@erc725/smart-contracts/contracts/constants.sol";
41
38
  import {
42
39
  _INTERFACEID_LSP0,
43
40
  _INTERFACEID_ERC1271,
44
- _ERC1271_MAGICVALUE,
41
+ _ERC1271_SUCCESSVALUE,
45
42
  _ERC1271_FAILVALUE,
46
43
  _TYPEID_LSP0_OwnershipTransferStarted,
47
44
  _TYPEID_LSP0_OwnershipTransferred_SenderNotification,
48
45
  _TYPEID_LSP0_OwnershipTransferred_RecipientNotification
49
- } from "../LSP0ERC725Account/LSP0Constants.sol";
46
+ } from "./LSP0Constants.sol";
50
47
  import {
51
48
  _INTERFACEID_LSP1,
49
+ _INTERFACEID_LSP1_DELEGATE,
52
50
  _LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX,
53
51
  _LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY
54
52
  } from "../LSP1UniversalReceiver/LSP1Constants.sol";
@@ -63,16 +61,13 @@ import {
63
61
 
64
62
  // errors
65
63
  import {
66
- ERC725Y_DataKeysValuesLengthMismatch
64
+ ERC725Y_DataKeysValuesLengthMismatch,
65
+ ERC725Y_DataKeysValuesEmptyArray
67
66
  } from "@erc725/smart-contracts/contracts/errors.sol";
68
67
  import {
69
68
  NoExtensionFoundForFunctionSelector
70
69
  } from "../LSP17ContractExtension/LSP17Errors.sol";
71
70
 
72
- import {
73
- LSP14MustAcceptOwnershipInSeparateTransaction
74
- } from "../LSP14Ownable2Step/LSP14Errors.sol";
75
-
76
71
  /**
77
72
  * @title The Core Implementation of [LSP-0-ERC725Account] Standard.
78
73
  *
@@ -105,8 +100,6 @@ abstract contract LSP0ERC725AccountCore is
105
100
  }
106
101
  }
107
102
 
108
- // solhint-disable no-complex-fallback
109
-
110
103
  /**
111
104
  * @notice The `fallback` function was called with the following amount of native tokens: `msg.value`; and the following calldata: `callData`.
112
105
  *
@@ -128,6 +121,7 @@ abstract contract LSP0ERC725AccountCore is
128
121
  *
129
122
  * @custom:events {ValueReceived} event when receiving native tokens.
130
123
  */
124
+ // solhint-disable-next-line no-complex-fallback
131
125
  fallback(
132
126
  bytes calldata callData
133
127
  ) external payable virtual returns (bytes memory) {
@@ -149,7 +143,7 @@ abstract contract LSP0ERC725AccountCore is
149
143
  */
150
144
  function batchCalls(
151
145
  bytes[] calldata data
152
- ) public virtual returns (bytes[] memory results) {
146
+ ) public virtual override returns (bytes[] memory results) {
153
147
  results = new bytes[](data.length);
154
148
  for (uint256 i; i < data.length; ) {
155
149
  (bool success, bytes memory result) = address(this).delegatecall(
@@ -158,7 +152,7 @@ abstract contract LSP0ERC725AccountCore is
158
152
 
159
153
  if (!success) {
160
154
  // Look for revert reason and bubble it up if present
161
- if (result.length > 0) {
155
+ if (result.length != 0) {
162
156
  // The easiest way to bubble the revert reason is using memory via assembly
163
157
  // solhint-disable no-inline-assembly
164
158
  /// @solidity memory-safe-assembly
@@ -180,7 +174,7 @@ abstract contract LSP0ERC725AccountCore is
180
174
  }
181
175
 
182
176
  /**
183
- * @inheritdoc IERC725X
177
+ * @inheritdoc ERC725XCore
184
178
  *
185
179
  * @custom:requirements
186
180
  * - Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
@@ -203,16 +197,16 @@ abstract contract LSP0ERC725AccountCore is
203
197
  emit ValueReceived(msg.sender, msg.value);
204
198
  }
205
199
 
206
- address _owner = owner();
200
+ address accountOwner = owner();
207
201
 
208
202
  // If the caller is the owner perform execute directly
209
- if (msg.sender == _owner) {
203
+ if (msg.sender == accountOwner) {
210
204
  return ERC725XCore._execute(operationType, target, value, data);
211
205
  }
212
206
 
213
207
  // If the caller is not the owner, call {lsp20VerifyCall} on the owner
214
- // Depending on the magicValue returned, a second call is done after execution
215
- bool verifyAfter = LSP20CallVerification._verifyCall(_owner);
208
+ // Depending on the returnedStatus, a second call is done after execution
209
+ bool verifyAfter = LSP20CallVerification._verifyCall(accountOwner);
216
210
 
217
211
  // Perform the execution
218
212
  bytes memory result = ERC725XCore._execute(
@@ -224,14 +218,17 @@ abstract contract LSP0ERC725AccountCore is
224
218
 
225
219
  // if verifyAfter is true, Call {lsp20VerifyCallResult} on the owner
226
220
  if (verifyAfter) {
227
- LSP20CallVerification._verifyCallResult(_owner, abi.encode(result));
221
+ LSP20CallVerification._verifyCallResult(
222
+ accountOwner,
223
+ abi.encode(result)
224
+ );
228
225
  }
229
226
 
230
227
  return result;
231
228
  }
232
229
 
233
230
  /**
234
- * @inheritdoc IERC725X
231
+ * @inheritdoc ERC725XCore
235
232
  *
236
233
  * @custom:requirements
237
234
  * - The length of the parameters provided must be equal.
@@ -240,6 +237,9 @@ abstract contract LSP0ERC725AccountCore is
240
237
  * - If the operation type is `CREATE` (1) or `CREATE2` (2), `target` must be `address(0)`.
241
238
  * - If the operation type is `STATICCALL` (3) or `DELEGATECALL` (4), `value` transfer is disallowed and must be 0.
242
239
  *
240
+ * @custom:warning
241
+ * - The `msg.value` should not be trusted for any method called within the batch with `operationType`: `DELEGATECALL` (4).
242
+ *
243
243
  * @custom:events
244
244
  * - {Executed} event for each call that uses under `operationType`: `CALL` (0), `STATICCALL` (3) and `DELEGATECALL` (4). (each iteration)
245
245
  * - {ContractCreated} event, when a contract is created under `operationType`: `CREATE` (1) and `CREATE2` (2) (each iteration)
@@ -255,10 +255,10 @@ abstract contract LSP0ERC725AccountCore is
255
255
  emit ValueReceived(msg.sender, msg.value);
256
256
  }
257
257
 
258
- address _owner = owner();
258
+ address accountOwner = owner();
259
259
 
260
260
  // If the caller is the owner perform execute directly
261
- if (msg.sender == _owner) {
261
+ if (msg.sender == accountOwner) {
262
262
  return
263
263
  ERC725XCore._executeBatch(
264
264
  operationsType,
@@ -269,8 +269,8 @@ abstract contract LSP0ERC725AccountCore is
269
269
  }
270
270
 
271
271
  // If the caller is not the owner, call {lsp20VerifyCall} on the owner
272
- // Depending on the magicValue returned, a second call is done after execution
273
- bool verifyAfter = LSP20CallVerification._verifyCall(_owner);
272
+ // Depending on the returnedStatus, a second call is done after execution
273
+ bool verifyAfter = LSP20CallVerification._verifyCall(accountOwner);
274
274
 
275
275
  // Perform the execution
276
276
  bytes[] memory results = ERC725XCore._executeBatch(
@@ -283,7 +283,7 @@ abstract contract LSP0ERC725AccountCore is
283
283
  // if verifyAfter is true, Call {lsp20VerifyCallResult} on the owner
284
284
  if (verifyAfter) {
285
285
  LSP20CallVerification._verifyCallResult(
286
- _owner,
286
+ accountOwner,
287
287
  abi.encode(results)
288
288
  );
289
289
  }
@@ -292,7 +292,7 @@ abstract contract LSP0ERC725AccountCore is
292
292
  }
293
293
 
294
294
  /**
295
- * @inheritdoc IERC725Y
295
+ * @inheritdoc ERC725YCore
296
296
  *
297
297
  * @custom:requirements Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
298
298
  *
@@ -308,28 +308,28 @@ abstract contract LSP0ERC725AccountCore is
308
308
  emit ValueReceived(msg.sender, msg.value);
309
309
  }
310
310
 
311
- address _owner = owner();
311
+ address accountOwner = owner();
312
312
 
313
313
  // If the caller is the owner perform setData directly
314
- if (msg.sender == _owner) {
314
+ if (msg.sender == accountOwner) {
315
315
  return _setData(dataKey, dataValue);
316
316
  }
317
317
 
318
318
  // If the caller is not the owner, call {lsp20VerifyCall} on the owner
319
- // Depending on the magicValue returned, a second call is done after setting data
320
- bool verifyAfter = _verifyCall(_owner);
319
+ // Depending on the returnedStatus, a second call is done after setting data
320
+ bool verifyAfter = _verifyCall(accountOwner);
321
321
 
322
322
  _setData(dataKey, dataValue);
323
323
 
324
324
  // If verifyAfter is true, Call {lsp20VerifyCallResult} on the owner
325
325
  // The setData function does not return, second parameter of {_verifyCallResult} will be empty
326
326
  if (verifyAfter) {
327
- _verifyCallResult(_owner, "");
327
+ _verifyCallResult(accountOwner, "");
328
328
  }
329
329
  }
330
330
 
331
331
  /**
332
- * @inheritdoc IERC725Y
332
+ * @inheritdoc ERC725YCore
333
333
  *
334
334
  * @custom:requirements Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
335
335
  *
@@ -349,11 +349,15 @@ abstract contract LSP0ERC725AccountCore is
349
349
  revert ERC725Y_DataKeysValuesLengthMismatch();
350
350
  }
351
351
 
352
- address _owner = owner();
352
+ if (dataKeys.length == 0) {
353
+ revert ERC725Y_DataKeysValuesEmptyArray();
354
+ }
355
+
356
+ address accountOwner = owner();
353
357
 
354
358
  // If the caller is the owner perform setData directly
355
- if (msg.sender == _owner) {
356
- for (uint256 i = 0; i < dataKeys.length; ) {
359
+ if (msg.sender == accountOwner) {
360
+ for (uint256 i; i < dataKeys.length; ) {
357
361
  _setData(dataKeys[i], dataValues[i]);
358
362
 
359
363
  unchecked {
@@ -365,10 +369,10 @@ abstract contract LSP0ERC725AccountCore is
365
369
  }
366
370
 
367
371
  // If the caller is not the owner, call {lsp20VerifyCall} on the owner
368
- // Depending on the magicValue returned, a second call is done after setting data
369
- bool verifyAfter = _verifyCall(_owner);
372
+ // Depending on the returnedStatus, a second call is done after setting data
373
+ bool verifyAfter = _verifyCall(accountOwner);
370
374
 
371
- for (uint256 i = 0; i < dataKeys.length; ) {
375
+ for (uint256 i; i < dataKeys.length; ) {
372
376
  _setData(dataKeys[i], dataValues[i]);
373
377
 
374
378
  unchecked {
@@ -379,7 +383,7 @@ abstract contract LSP0ERC725AccountCore is
379
383
  // If verifyAfter is true, Call {lsp20VerifyCallResult} on the owner
380
384
  // The setData function does not return, second parameter of {_verifyCallResult} will be empty
381
385
  if (verifyAfter) {
382
- _verifyCallResult(_owner, "");
386
+ _verifyCallResult(accountOwner, "");
383
387
  }
384
388
  }
385
389
 
@@ -416,7 +420,7 @@ abstract contract LSP0ERC725AccountCore is
416
420
  function universalReceiver(
417
421
  bytes32 typeId,
418
422
  bytes calldata receivedData
419
- ) public payable virtual returns (bytes memory returnedValues) {
423
+ ) public payable virtual override returns (bytes memory returnedValues) {
420
424
  if (msg.value != 0) {
421
425
  emit ValueReceived(msg.sender, msg.value);
422
426
  }
@@ -428,55 +432,49 @@ abstract contract LSP0ERC725AccountCore is
428
432
  bytes memory resultDefaultDelegate;
429
433
 
430
434
  if (lsp1DelegateValue.length >= 20) {
431
- address universalReceiverDelegate = address(
432
- bytes20(lsp1DelegateValue)
433
- );
435
+ address lsp1Delegate = address(bytes20(lsp1DelegateValue));
434
436
 
435
437
  // Checking LSP1 InterfaceId support
436
438
  if (
437
- universalReceiverDelegate.supportsERC165InterfaceUnchecked(
438
- _INTERFACEID_LSP1
439
+ lsp1Delegate.supportsERC165InterfaceUnchecked(
440
+ _INTERFACEID_LSP1_DELEGATE
439
441
  )
440
442
  ) {
441
- // calling {universalReceiver} function on URD appending the caller and the value sent
442
- resultDefaultDelegate = universalReceiverDelegate
443
- .callUniversalReceiverWithCallerInfos(
444
- typeId,
445
- receivedData,
443
+ resultDefaultDelegate = ILSP1Delegate(lsp1Delegate)
444
+ .universalReceiverDelegate(
446
445
  msg.sender,
447
- msg.value
446
+ msg.value,
447
+ typeId,
448
+ receivedData
448
449
  );
449
450
  }
450
451
  }
451
452
 
452
- // Generate the data key {_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY + <bytes32 typeId>}
453
+ // Generate the data key {_LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX + <bytes32 typeId>}
453
454
  bytes32 lsp1typeIdDelegateKey = LSP2Utils.generateMappingKey(
454
455
  _LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX,
455
456
  bytes20(typeId)
456
457
  );
457
458
 
458
- // Query the ERC725Y storage with the data key {_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY + <bytes32 typeId>}
459
+ // Query the ERC725Y storage with the data key {_LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX + <bytes32 typeId>}
459
460
  bytes memory lsp1TypeIdDelegateValue = _getData(lsp1typeIdDelegateKey);
460
461
  bytes memory resultTypeIdDelegate;
461
462
 
462
463
  if (lsp1TypeIdDelegateValue.length >= 20) {
463
- address universalReceiverDelegate = address(
464
- bytes20(lsp1TypeIdDelegateValue)
465
- );
464
+ address lsp1Delegate = address(bytes20(lsp1TypeIdDelegateValue));
466
465
 
467
466
  // Checking LSP1 InterfaceId support
468
467
  if (
469
- universalReceiverDelegate.supportsERC165InterfaceUnchecked(
470
- _INTERFACEID_LSP1
468
+ lsp1Delegate.supportsERC165InterfaceUnchecked(
469
+ _INTERFACEID_LSP1_DELEGATE
471
470
  )
472
471
  ) {
473
- // calling {universalReceiver} function on URD appending the caller and the value sent
474
- resultTypeIdDelegate = universalReceiverDelegate
475
- .callUniversalReceiverWithCallerInfos(
476
- typeId,
477
- receivedData,
472
+ resultTypeIdDelegate = ILSP1Delegate(lsp1Delegate)
473
+ .universalReceiverDelegate(
478
474
  msg.sender,
479
- msg.value
475
+ msg.value,
476
+ typeId,
477
+ receivedData
480
478
  );
481
479
  }
482
480
  }
@@ -526,7 +524,7 @@ abstract contract LSP0ERC725AccountCore is
526
524
  _inTransferOwnership = false;
527
525
  } else {
528
526
  // If the caller is not the owner, call {lsp20VerifyCall} on the owner
529
- // Depending on the magicValue returned, a second call is done after transferring ownership
527
+ // Depending on the returnedStatus, a second call is done after transferring ownership
530
528
  bool verifyAfter = _verifyCall(currentOwner);
531
529
 
532
530
  // set the transfer ownership lock
@@ -563,8 +561,20 @@ abstract contract LSP0ERC725AccountCore is
563
561
  */
564
562
  function acceptOwnership() public virtual override NotInTransferOwnership {
565
563
  address previousOwner = owner();
564
+ address pendingOwnerAddress = pendingOwner();
565
+
566
+ bool verifyAfter;
566
567
 
567
- _acceptOwnership();
568
+ if (msg.sender != pendingOwnerAddress) {
569
+ // If the caller is not the owner, call {lsp20VerifyCall} on the pending owner
570
+ // Depending on the successStatus returned, a second call is done after transferring ownership
571
+ verifyAfter = _verifyCall(pendingOwnerAddress);
572
+
573
+ _setOwner(pendingOwnerAddress);
574
+ delete _pendingOwner;
575
+ } else {
576
+ _acceptOwnership();
577
+ }
568
578
 
569
579
  // notify the previous owner if supports LSP1
570
580
  previousOwner.tryNotifyUniversalReceiver(
@@ -573,10 +583,16 @@ abstract contract LSP0ERC725AccountCore is
573
583
  );
574
584
 
575
585
  // notify the pending owner if supports LSP1
576
- msg.sender.tryNotifyUniversalReceiver(
586
+ pendingOwnerAddress.tryNotifyUniversalReceiver(
577
587
  _TYPEID_LSP0_OwnershipTransferred_RecipientNotification,
578
588
  ""
579
589
  );
590
+
591
+ // If msg.sender != pendingOwnerAddress & verifyAfter is true, Call {lsp20VerifyCallResult} on the new owner
592
+ // The transferOwnership function does not return, second parameter of {_verifyCallResult} will be empty
593
+ if (verifyAfter) {
594
+ _verifyCallResult(pendingOwnerAddress, "");
595
+ }
580
596
  }
581
597
 
582
598
  /**
@@ -584,7 +600,7 @@ abstract contract LSP0ERC725AccountCore is
584
600
  *
585
601
  * @custom:requirements Can be only called by the {owner} or by an authorised address that pass the verification check performed on the owner.
586
602
  *
587
- * @custom:danger Leaves the contract without an owner. Once ownership of the contract has been renounced, any functions that are restricted to be called by the owner will be permanently inaccessible, making these functions not callable anymore and unusable.
603
+ * @custom:danger Leaves the contract without an owner. Once ownership of the contract has been renounced, any functions that are restricted to be called by the owner or an address allowed by the owner will be permanently inaccessible, making these functions not callable anymore and unusable.
588
604
  *
589
605
  */
590
606
  function renounceOwnership()
@@ -592,16 +608,16 @@ abstract contract LSP0ERC725AccountCore is
592
608
  virtual
593
609
  override(LSP14Ownable2Step, OwnableUnset)
594
610
  {
595
- address _owner = owner();
611
+ address accountOwner = owner();
596
612
 
597
613
  // If the caller is the owner perform renounceOwnership directly
598
- if (msg.sender == _owner) {
614
+ if (msg.sender == accountOwner) {
599
615
  return LSP14Ownable2Step._renounceOwnership();
600
616
  }
601
617
 
602
618
  // If the caller is not the owner, call {lsp20VerifyCall} on the owner
603
- // Depending on the magicValue returned, a second call is done after transferring ownership
604
- bool verifyAfter = _verifyCall(_owner);
619
+ // Depending on the returnedStatus, a second call is done after transferring ownership
620
+ bool verifyAfter = _verifyCall(accountOwner);
605
621
 
606
622
  address previousOwner = owner();
607
623
  LSP14Ownable2Step._renounceOwnership();
@@ -616,7 +632,7 @@ abstract contract LSP0ERC725AccountCore is
616
632
  // If verifyAfter is true, Call {lsp20VerifyCallResult} on the owner
617
633
  // The transferOwnership function does not return, second parameter of {_verifyCallResult} will be empty
618
634
  if (verifyAfter) {
619
- _verifyCallResult(_owner, "");
635
+ _verifyCallResult(accountOwner, "");
620
636
  }
621
637
  }
622
638
 
@@ -661,29 +677,29 @@ abstract contract LSP0ERC725AccountCore is
661
677
  *
662
678
  * 1. If the owner is an EOA, recovers an address from the hash and the signature provided:
663
679
  *
664
- * - Returns the `magicValue` if the address recovered is the same as the owner, indicating that it was a valid signature.
680
+ * - Returns the `_ERC1271_SUCCESSVALUE` if the address recovered is the same as the owner, indicating that it was a valid signature.
665
681
  *
666
- * - If the address is different, it returns the fail value indicating that the signature is not valid.
682
+ * - If the address is different, it returns the `_ERC1271_FAILVALUE` indicating that the signature is not valid.
667
683
  *
668
684
  * 2. If the owner is a smart contract, it forwards the call of {isValidSignature()} to the owner contract:
669
685
  *
670
- * - If the contract fails or returns the fail value, the {isValidSignature()} on the account returns the fail value, indicating that the signature is not valid.
686
+ * - If the contract fails or returns the `_ERC1271_FAILVALUE`, the {isValidSignature()} on the account returns the `_ERC1271_FAILVALUE`, indicating that the signature is not valid.
671
687
  *
672
- * - If the {isValidSignature()} on the owner returned the `magicValue`, the {isValidSignature()} on the account returns the `magicValue`, indicating that it's a valid signature.
688
+ * - If the {isValidSignature()} on the owner returned the `_ERC1271_SUCCESSVALUE`, the {isValidSignature()} on the account returns the `_ERC1271_SUCCESSVALUE`, indicating that it's a valid signature.
673
689
  *
674
690
  * @param dataHash The hash of the data to be validated.
675
691
  * @param signature A signature that can validate the previous parameter (Hash).
676
692
  *
677
- * @return magicValue A `bytes4` value that indicates if the signature is valid or not.
693
+ * @return returnedStatus A `bytes4` value that indicates if the signature is valid or not.
678
694
  */
679
695
  function isValidSignature(
680
696
  bytes32 dataHash,
681
697
  bytes memory signature
682
- ) public view virtual returns (bytes4 magicValue) {
698
+ ) public view virtual override returns (bytes4 returnedStatus) {
683
699
  address _owner = owner();
684
700
 
685
701
  // If owner is a contract
686
- if (_owner.code.length > 0) {
702
+ if (_owner.code.length != 0) {
687
703
  (bool success, bytes memory result) = _owner.staticcall(
688
704
  abi.encodeWithSelector(
689
705
  IERC1271.isValidSignature.selector,
@@ -694,9 +710,10 @@ abstract contract LSP0ERC725AccountCore is
694
710
 
695
711
  bool isValid = (success &&
696
712
  result.length == 32 &&
697
- abi.decode(result, (bytes32)) == bytes32(_ERC1271_MAGICVALUE));
713
+ abi.decode(result, (bytes32)) ==
714
+ bytes32(_ERC1271_SUCCESSVALUE));
698
715
 
699
- return isValid ? _ERC1271_MAGICVALUE : _ERC1271_FAILVALUE;
716
+ return isValid ? _ERC1271_SUCCESSVALUE : _ERC1271_FAILVALUE;
700
717
  }
701
718
  // If owner is an EOA
702
719
  else {
@@ -709,11 +726,11 @@ abstract contract LSP0ERC725AccountCore is
709
726
  return _ERC1271_FAILVALUE;
710
727
 
711
728
  // if recovering is successful and the recovered address matches the owner's address,
712
- // return the ERC1271 magic value. Otherwise, return the ERC1271 fail value
729
+ // return the ERC1271 success value. Otherwise, return the ERC1271 fail value
713
730
  // matches the address of the owner, otherwise return fail value
714
731
  return
715
732
  recoveredAddress == _owner
716
- ? _ERC1271_MAGICVALUE
733
+ ? _ERC1271_SUCCESSVALUE
717
734
  : _ERC1271_FAILVALUE;
718
735
  }
719
736
  }
@@ -723,11 +740,22 @@ abstract contract LSP0ERC725AccountCore is
723
740
  /**
724
741
  * @dev Forwards the call to an extension mapped to a function selector.
725
742
  *
726
- * Calls {_getExtension} to get the address of the extension mapped to the function selector being called on the account. If there is no extension, the `address(0)` will be returned.
743
+ * Calls {_getExtension} to get the address of the extension mapped to the function selector being
744
+ * called on the account. If there is no extension, the `address(0)` will be returned.
745
+ *
746
+ * Reverts if there is no extension for the function being called, except for the `bytes4(0)` function selector, which passes even if there is no extension for it.
747
+ *
748
+ * If there is an extension for the function selector being called, it calls the extension with the
749
+ * `CALL` opcode, passing the `msg.data` appended with the 20 bytes of the {msg.sender} and 32 bytes of the `msg.value`.
727
750
  *
728
- * Reverts if there is no extension for the function being called, except for the bytes4(0) function selector, which passes even if there is no extension for it.
751
+ * @custom:hint This function does not forward to the extension contract the `msg.value` received by the contract that inherits `LSP17Extendable`.
752
+ * If you would like to forward the `msg.value` to the extension contract, you can override the code of this internal function as follow:
729
753
  *
730
- * If there is an extension for the function selector being called, it calls the extension with the CALL opcode, passing the `msg.data` appended with the 20 bytes of the `msg.sender` and 32 bytes of the `msg.value`
754
+ * ```solidity
755
+ * (bool success, bytes memory result) = extension.call{value: msg.value}(
756
+ * abi.encodePacked(callData, msg.sender, msg.value)
757
+ * );
758
+ * ```
731
759
  */
732
760
  function _fallbackLSP17Extendable(
733
761
  bytes calldata callData
@@ -7,12 +7,14 @@ 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 "../LSP10ReceivedVaults/LSP10Constants.sol";
15
- import "../LSP9Vault/LSP9Constants.sol";
13
+ import {_INTERFACEID_LSP9} from "../LSP9Vault/LSP9Constants.sol";
14
+ import {
15
+ _LSP10_VAULTS_MAP_KEY_PREFIX,
16
+ _LSP10_VAULTS_ARRAY_KEY
17
+ } from "../LSP10ReceivedVaults/LSP10Constants.sol";
16
18
 
17
19
  /**
18
20
  * @title LSP10 Utility library.