@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.
Files changed (224) hide show
  1. package/README.md +10 -2
  2. package/artifacts/Create2Factory.json +2 -2
  3. package/artifacts/LSP0ERC725Account.json +68 -47
  4. package/artifacts/LSP0ERC725AccountInit.json +68 -47
  5. package/artifacts/LSP11BasicSocialRecovery.json +18 -2
  6. package/artifacts/LSP11BasicSocialRecoveryInit.json +18 -2
  7. package/artifacts/LSP16UniversalFactory.json +3 -3
  8. package/artifacts/LSP1UniversalReceiverDelegateUP.json +27 -46
  9. package/artifacts/LSP1UniversalReceiverDelegateVault.json +27 -46
  10. package/artifacts/LSP23LinkedContractsFactory.json +3 -3
  11. package/artifacts/LSP4DigitalAssetMetadata.json +16 -0
  12. package/artifacts/LSP4DigitalAssetMetadataInitAbstract.json +16 -0
  13. package/artifacts/LSP6KeyManager.json +34 -6
  14. package/artifacts/LSP6KeyManagerInit.json +34 -6
  15. package/artifacts/LSP7CappedSupply.json +64 -4
  16. package/artifacts/LSP7CappedSupplyInitAbstract.json +64 -4
  17. package/artifacts/LSP7CompatibleERC20.json +83 -23
  18. package/artifacts/LSP7CompatibleERC20InitAbstract.json +83 -23
  19. package/artifacts/LSP7CompatibleERC20Mintable.json +86 -26
  20. package/artifacts/LSP7CompatibleERC20MintableInit.json +86 -26
  21. package/artifacts/LSP7DigitalAsset.json +64 -4
  22. package/artifacts/LSP7DigitalAssetInitAbstract.json +64 -4
  23. package/artifacts/LSP7Mintable.json +67 -7
  24. package/artifacts/LSP7MintableInit.json +67 -7
  25. package/artifacts/LSP8CappedSupply.json +57 -3
  26. package/artifacts/LSP8CappedSupplyInitAbstract.json +57 -3
  27. package/artifacts/LSP8CompatibleERC721.json +79 -25
  28. package/artifacts/LSP8CompatibleERC721InitAbstract.json +79 -25
  29. package/artifacts/LSP8CompatibleERC721Mintable.json +87 -28
  30. package/artifacts/LSP8CompatibleERC721MintableInit.json +87 -28
  31. package/artifacts/LSP8IdentifiableDigitalAsset.json +57 -3
  32. package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +57 -3
  33. package/artifacts/LSP8Mintable.json +65 -6
  34. package/artifacts/LSP8MintableInit.json +65 -6
  35. package/artifacts/LSP9Vault.json +51 -35
  36. package/artifacts/LSP9VaultInit.json +51 -35
  37. package/artifacts/UniversalProfile.json +68 -47
  38. package/artifacts/UniversalProfileInit.json +68 -47
  39. package/contracts/Factories/Create2Factory.sol +1 -1
  40. package/contracts/LSP0ERC725Account/ILSP0ERC725Account.sol +0 -22
  41. package/contracts/LSP0ERC725Account/LSP0Constants.sol +6 -1
  42. package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +12 -2
  43. package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +196 -123
  44. package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +1 -1
  45. package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +11 -2
  46. package/contracts/LSP10ReceivedVaults/LSP10Utils.sol +5 -3
  47. package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryCore.sol +54 -14
  48. package/contracts/LSP11BasicSocialRecovery/LSP11Constants.sol +1 -1
  49. package/contracts/LSP11BasicSocialRecovery/LSP11Errors.sol +1 -1
  50. package/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +2 -2
  51. package/contracts/LSP14Ownable2Step/LSP14Constants.sol +1 -1
  52. package/contracts/LSP14Ownable2Step/LSP14Errors.sol +9 -3
  53. package/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +16 -12
  54. package/contracts/LSP16UniversalFactory/LSP16UniversalFactory.sol +65 -96
  55. package/contracts/LSP17ContractExtension/LSP17Errors.sol +1 -1
  56. package/contracts/LSP17ContractExtension/LSP17Extendable.sol +22 -15
  57. package/contracts/LSP17ContractExtension/LSP17Extension.sol +6 -5
  58. package/contracts/LSP17Extensions/Extension4337.sol +101 -0
  59. package/contracts/LSP17Extensions/OnERC721ReceivedExtension.sol +15 -0
  60. package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +1 -2
  61. package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiverDelegate.sol +24 -0
  62. package/contracts/LSP1UniversalReceiver/LSP1Constants.sol +1 -0
  63. package/contracts/LSP1UniversalReceiver/LSP1Errors.sol +0 -6
  64. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +49 -33
  65. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +33 -27
  66. package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +5 -48
  67. package/contracts/LSP20CallVerification/ILSP20CallVerifier.sol +13 -9
  68. package/contracts/LSP20CallVerification/LSP20CallVerification.sol +64 -45
  69. package/contracts/LSP20CallVerification/LSP20Constants.sol +6 -6
  70. package/contracts/LSP20CallVerification/LSP20Errors.sol +10 -4
  71. package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/ILSP23LinkedContractsFactory.sol +1 -1
  72. package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/IPostDeploymentModule.sol +1 -1
  73. package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/LSP23Errors.sol +1 -1
  74. package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/LSP23LinkedContractsFactory.sol +5 -1
  75. package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/modules/UniversalProfileInitPostDeploymentModule.sol +1 -1
  76. package/contracts/{LSP23LinkedContractsDeployment → LSP23LinkedContractsFactory}/modules/UniversalProfilePostDeploymentModule.sol +1 -1
  77. package/contracts/LSP25ExecuteRelayCall/LSP25Constants.sol +1 -1
  78. package/contracts/LSP25ExecuteRelayCall/LSP25MultiChannelNonce.sol +8 -3
  79. package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +1 -97
  80. package/contracts/LSP3ProfileMetadata/LSP3Constants.sol +1 -1
  81. package/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +1 -1
  82. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +8 -3
  83. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +8 -3
  84. package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +4 -3
  85. package/contracts/LSP6KeyManager/LSP6Constants.sol +4 -3
  86. package/contracts/LSP6KeyManager/LSP6Errors.sol +2 -23
  87. package/contracts/LSP6KeyManager/LSP6KeyManager.sol +0 -1
  88. package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +176 -101
  89. package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +0 -1
  90. package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +1 -2
  91. package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteRelayCallModule.sol +27 -0
  92. package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +34 -28
  93. package/contracts/LSP6KeyManager/LSP6Utils.sol +29 -2
  94. package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +70 -10
  95. package/contracts/LSP7DigitalAsset/LSP7Constants.sol +2 -2
  96. package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +29 -13
  97. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +273 -265
  98. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +28 -12
  99. package/contracts/LSP7DigitalAsset/LSP7Errors.sol +17 -3
  100. package/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +5 -1
  101. package/contracts/LSP7DigitalAsset/extensions/LSP7BurnableInitAbstract.sol +4 -1
  102. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupply.sol +7 -7
  103. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +3 -3
  104. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +128 -54
  105. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +129 -54
  106. package/contracts/LSP7DigitalAsset/presets/ILSP7Mintable.sol +3 -3
  107. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +4 -4
  108. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +2 -2
  109. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +4 -4
  110. package/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +4 -4
  111. package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +1 -1
  112. package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +4 -4
  113. package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +16 -11
  114. package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +20 -6
  115. package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +32 -16
  116. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +67 -16
  117. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +143 -137
  118. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +69 -15
  119. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol +1 -1
  120. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8BurnableInitAbstract.sol +1 -1
  121. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +7 -7
  122. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +3 -3
  123. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +172 -80
  124. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +178 -91
  125. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +7 -7
  126. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +7 -7
  127. package/contracts/LSP8IdentifiableDigitalAsset/presets/ILSP8Mintable.sol +3 -3
  128. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +8 -7
  129. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +5 -3
  130. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +13 -7
  131. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +9 -8
  132. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +9 -3
  133. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +10 -8
  134. package/contracts/LSP9Vault/ILSP9Vault.sol +0 -21
  135. package/contracts/LSP9Vault/LSP9Constants.sol +6 -1
  136. package/contracts/LSP9Vault/LSP9Errors.sol +1 -1
  137. package/contracts/LSP9Vault/LSP9Vault.sol +11 -2
  138. package/contracts/LSP9Vault/LSP9VaultCore.sol +119 -66
  139. package/contracts/LSP9Vault/LSP9VaultInit.sol +1 -1
  140. package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +11 -2
  141. package/contracts/UniversalProfile.sol +1 -1
  142. package/contracts/UniversalProfileInit.sol +1 -1
  143. package/contracts/UniversalProfileInitAbstract.sol +1 -1
  144. package/contracts/Version.sol +16 -0
  145. package/devdocs/LSP0ERC725Account.json +86 -52
  146. package/devdocs/LSP0ERC725AccountInit.json +86 -52
  147. package/devdocs/LSP11BasicSocialRecovery.json +13 -0
  148. package/devdocs/LSP11BasicSocialRecoveryInit.json +13 -0
  149. package/devdocs/LSP16UniversalFactory.json +9 -9
  150. package/devdocs/LSP1UniversalReceiverDelegateUP.json +7 -6
  151. package/devdocs/LSP1UniversalReceiverDelegateVault.json +7 -6
  152. package/devdocs/LSP4DigitalAssetMetadata.json +32 -10
  153. package/devdocs/LSP4DigitalAssetMetadataInitAbstract.json +32 -10
  154. package/devdocs/LSP6KeyManager.json +27 -13
  155. package/devdocs/LSP6KeyManagerInit.json +27 -13
  156. package/devdocs/LSP7CappedSupply.json +61 -28
  157. package/devdocs/LSP7CappedSupplyInitAbstract.json +61 -28
  158. package/devdocs/LSP7CompatibleERC20.json +102 -32
  159. package/devdocs/LSP7CompatibleERC20InitAbstract.json +102 -32
  160. package/devdocs/LSP7CompatibleERC20Mintable.json +102 -32
  161. package/devdocs/LSP7CompatibleERC20MintableInit.json +102 -32
  162. package/devdocs/LSP7DigitalAsset.json +61 -28
  163. package/devdocs/LSP7DigitalAssetInitAbstract.json +61 -28
  164. package/devdocs/LSP7Mintable.json +61 -28
  165. package/devdocs/LSP7MintableInit.json +61 -28
  166. package/devdocs/LSP8CappedSupply.json +66 -27
  167. package/devdocs/LSP8CappedSupplyInitAbstract.json +66 -27
  168. package/devdocs/LSP8CompatibleERC721.json +93 -33
  169. package/devdocs/LSP8CompatibleERC721InitAbstract.json +93 -33
  170. package/devdocs/LSP8CompatibleERC721Mintable.json +95 -35
  171. package/devdocs/LSP8CompatibleERC721MintableInit.json +96 -36
  172. package/devdocs/LSP8IdentifiableDigitalAsset.json +70 -28
  173. package/devdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +66 -27
  174. package/devdocs/LSP8Mintable.json +68 -29
  175. package/devdocs/LSP8MintableInit.json +69 -30
  176. package/devdocs/LSP9Vault.json +69 -41
  177. package/devdocs/LSP9VaultInit.json +69 -41
  178. package/devdocs/UniversalProfile.json +86 -52
  179. package/devdocs/UniversalProfileInit.json +86 -52
  180. package/dist/constants.cjs.js +5565 -2846
  181. package/dist/constants.d.ts +3996 -1182
  182. package/dist/constants.es.js +5564 -2846
  183. package/package.json +8 -8
  184. package/userdocs/LSP0ERC725Account.json +20 -11
  185. package/userdocs/LSP0ERC725AccountInit.json +20 -11
  186. package/userdocs/LSP16UniversalFactory.json +26 -1
  187. package/userdocs/LSP1UniversalReceiverDelegateUP.json +4 -11
  188. package/userdocs/LSP1UniversalReceiverDelegateVault.json +4 -11
  189. package/userdocs/LSP4DigitalAssetMetadata.json +7 -4
  190. package/userdocs/LSP4DigitalAssetMetadataInitAbstract.json +7 -4
  191. package/userdocs/LSP6KeyManager.json +3 -5
  192. package/userdocs/LSP6KeyManagerInit.json +3 -5
  193. package/userdocs/LSP7CappedSupply.json +17 -6
  194. package/userdocs/LSP7CappedSupplyInitAbstract.json +16 -5
  195. package/userdocs/LSP7CompatibleERC20.json +18 -5
  196. package/userdocs/LSP7CompatibleERC20InitAbstract.json +18 -5
  197. package/userdocs/LSP7CompatibleERC20Mintable.json +18 -5
  198. package/userdocs/LSP7CompatibleERC20MintableInit.json +18 -5
  199. package/userdocs/LSP7DigitalAsset.json +18 -5
  200. package/userdocs/LSP7DigitalAssetInitAbstract.json +18 -5
  201. package/userdocs/LSP7Mintable.json +18 -5
  202. package/userdocs/LSP7MintableInit.json +18 -5
  203. package/userdocs/LSP8CappedSupply.json +16 -5
  204. package/userdocs/LSP8CappedSupplyInitAbstract.json +15 -4
  205. package/userdocs/LSP8CompatibleERC721.json +30 -17
  206. package/userdocs/LSP8CompatibleERC721InitAbstract.json +30 -17
  207. package/userdocs/LSP8CompatibleERC721Mintable.json +31 -18
  208. package/userdocs/LSP8CompatibleERC721MintableInit.json +32 -19
  209. package/userdocs/LSP8IdentifiableDigitalAsset.json +18 -5
  210. package/userdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +17 -4
  211. package/userdocs/LSP8Mintable.json +18 -5
  212. package/userdocs/LSP8MintableInit.json +19 -6
  213. package/userdocs/LSP9Vault.json +23 -14
  214. package/userdocs/LSP9VaultInit.json +23 -14
  215. package/userdocs/UniversalProfile.json +20 -11
  216. package/userdocs/UniversalProfileInit.json +20 -11
  217. package/CONTRIBUTING.md +0 -184
  218. package/artifacts/LSP4Compatibility.json +0 -216
  219. package/contracts/LSP4DigitalAssetMetadata/ILSP4Compatibility.sol +0 -25
  220. package/contracts/LSP4DigitalAssetMetadata/LSP4Compatibility.sol +0 -38
  221. package/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibleERC20.sol +0 -83
  222. package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol +0 -175
  223. package/devdocs/LSP4Compatibility.json +0 -79
  224. package/userdocs/LSP4Compatibility.json +0 -20
@@ -1,4 +1,4 @@
1
- // SPDX-License-Identifier: MIT
1
+ // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.4;
3
3
 
4
4
  // libraries
@@ -8,13 +8,13 @@ import {Clones} from "@openzeppelin/contracts/proxy/Clones.sol";
8
8
  // errors
9
9
 
10
10
  /**
11
- * @dev Reverts when there is no revert reason bubbled up by the contract created when initializing
11
+ * @notice Couldn't initialize the contract.
12
+ * @dev Reverts when there is no revert reason bubbled up by the created contract when initializing
12
13
  */
13
14
  error ContractInitializationFailed();
14
15
 
15
16
  /**
16
- * @dev Reverts when msg.value sent to {deployCreate2AndInitialize} function is not equal to the sum of the
17
- * `initializeCalldataMsgValue` and `constructorMsgValue`
17
+ * @dev Reverts when `msg.value` sent to {deployCreate2AndInitialize(..)} function is not equal to the sum of the `initializeCalldataMsgValue` and `constructorMsgValue`
18
18
  */
19
19
  error InvalidValueSum();
20
20
 
@@ -61,16 +61,17 @@ contract LSP16UniversalFactory {
61
61
  bytes private constant _EMPTY_BYTE = "";
62
62
 
63
63
  /**
64
- * @dev Emitted whenever a contract is created
65
- * @param contractCreated The address of the contract created
66
- * @param providedSalt The salt provided by the deployer, which will be used to generate the final salt
67
- * that will be used by the `CREATE2` opcode for contract deployment
68
- * @param generatedSalt The salt used by the `CREATE2` opcode for contract deployment
69
- * @param initialized The Boolean that specifies if the contract must be initialized or not
70
- * @param initializeCalldata The bytes provided as initializeCalldata (Empty string when `initialized` is set to false)
64
+ * @notice Contract created. Contract address: `createdContract`.
65
+ * @dev Emitted whenever a contract is created.
66
+ *
67
+ * @param createdContract The address of the contract created.
68
+ * @param providedSalt The salt provided by the deployer, which will be used to generate the final salt that will be used by the `CREATE2` opcode for contract deployment.
69
+ * @param generatedSalt The salt used by the `CREATE2` opcode for contract deployment.
70
+ * @param initialized The Boolean that specifies if the contract must be initialized or not.
71
+ * @param initializeCalldata The bytes provided as initializeCalldata (Empty string when `initialized` is set to false).
71
72
  */
72
73
  event ContractCreated(
73
- address indexed contractCreated,
74
+ address indexed createdContract,
74
75
  bytes32 indexed providedSalt,
75
76
  bytes32 generatedSalt,
76
77
  bool indexed initialized,
@@ -78,24 +79,20 @@ contract LSP16UniversalFactory {
78
79
  );
79
80
 
80
81
  /**
81
- * @dev Deploys a contract using the CREATE2 opcode. The address where the contract will be deployed
82
- * can be known in advance via the {computeAddress} function.
82
+ * @notice Contract deployed. Salt, `providedSalt`, used.
83
+ *
84
+ * @dev Deploys a contract using the CREATE2 opcode. The address where the contract will be deployed can be known in advance via the {computeAddress} function.
83
85
  *
84
86
  * This function deploys contracts without initialization (external call after deployment).
85
87
  *
86
- * The `providedSalt` parameter is not used directly as the salt by the CREATE2 opcode. Instead, it is hashed with
87
- * keccak256: `keccak256(abi.encodePacked(false, providedSalt))`. See {generateSalt} function for more details.
88
+ * The `providedSalt` parameter is not used directly as the salt by the CREATE2 opcode. Instead, it is hashed with keccak256: `keccak256(abi.encodePacked(false, providedSalt))`. See {generateSalt} function for more details.
88
89
  *
89
- * Using the same `byteCode` and `providedSalt` multiple times will revert, as the contract cannot be deployed
90
- * twice at the same address.
90
+ * Using the same `byteCode` and `providedSalt` multiple times will revert, as the contract cannot be deployed twice at the same address.
91
91
  *
92
- * If the constructor of the contract to deploy is payable, value can be sent to this function to fund
93
- * the created contract. However, sending value to this function while the constructor is not payable will
94
- * result in a revert.
92
+ * If the constructor of the contract to deploy is payable, value can be sent to this function to fund the created contract. However, sending value to this function while the constructor is not payable will result in a revert.
95
93
  *
96
94
  * @param byteCode The bytecode of the contract to be deployed
97
- * @param providedSalt The salt provided by the deployer, which will be used to generate the final salt
98
- * that will be used by the `CREATE2` opcode for contract deployment
95
+ * @param providedSalt The salt provided by the deployer, which will be used to generate the final salt that will be used by the `CREATE2` opcode for contract deployment
99
96
  *
100
97
  * @return The address of the deployed contract
101
98
  */
@@ -121,28 +118,22 @@ contract LSP16UniversalFactory {
121
118
  }
122
119
 
123
120
  /**
124
- * @dev Deploys a contract using the CREATE2 opcode. The address where the contract will be deployed
125
- * can be known in advance via the {computeAddress} function.
121
+ * @notice Contract deployed. Salt, `providedSalt`, used.
122
+ *
123
+ * @dev Deploys a contract using the CREATE2 opcode. The address where the contract will be deployed can be known in advance via the {computeAddress} function.
126
124
  *
127
125
  * This function deploys contracts with initialization (external call after deployment).
128
126
  *
129
- * The `providedSalt` parameter is not used directly as the salt by the CREATE2 opcode. Instead, it is hashed with
130
- * keccak256: `keccak256(abi.encodePacked(true, initializeCalldata, providedSalt))`.
131
- * See {generateSalt} function for more details.
127
+ * The `providedSalt` parameter is not used directly as the salt by the CREATE2 opcode. Instead, it is hashed with keccak256: `keccak256(abi.encodePacked(true, initializeCalldata, providedSalt))`. See {generateSalt} function for more details.
132
128
  *
133
- * Using the same `byteCode`, `providedSalt` and `initializeCalldata` multiple times will revert, as the
134
- * contract cannot be deployed twice at the same address.
129
+ * Using the same `byteCode`, `providedSalt` and `initializeCalldata` multiple times will revert, as the contract cannot be deployed twice at the same address.
135
130
  *
136
- * If the constructor or the initialize function of the contract to deploy is payable, value can be sent along
137
- * with the deployment/initialization to fund the created contract. However, sending value to this function while
138
- * the constructor/initialize function is not payable will result in a revert.
131
+ * If the constructor or the initialize function of the contract to deploy is payable, value can be sent along with the deployment/initialization to fund the created contract. However, sending value to this function while the constructor/initialize function is not payable will result in a revert.
139
132
  *
140
- * Will revert if the `msg.value` sent to the function is not equal to the sum of `constructorMsgValue` and
141
- * `initializeCalldataMsgValue`.
133
+ * Will revert if the `msg.value` sent to the function is not equal to the sum of `constructorMsgValue` and `initializeCalldataMsgValue`.
142
134
  *
143
135
  * @param byteCode The bytecode of the contract to be deployed
144
- * @param providedSalt The salt provided by the deployer, which will be used to generate the final salt
145
- * that will be used by the `CREATE2` opcode for contract deployment
136
+ * @param providedSalt The salt provided by the deployer, which will be used to generate the final salt that will be used by the `CREATE2` opcode for contract deployment
146
137
  * @param initializeCalldata The calldata to be executed on the created contract
147
138
  * @param constructorMsgValue The value sent to the contract during deployment
148
139
  * @param initializeCalldataMsgValue The value sent to the contract during initialization
@@ -186,24 +177,22 @@ contract LSP16UniversalFactory {
186
177
  }
187
178
 
188
179
  /**
189
- * @dev Deploys an ERC1167 minimal proxy contract using the CREATE2 opcode. The address where the contract will be deployed
190
- * can be known in advance via the {computeERC1167Address} function.
180
+ * @notice Proxy deployed. Salt, `providedSalt`, used.
181
+ *
182
+ * @dev Deploys an ERC1167 minimal proxy contract using the CREATE2 opcode. The address where the contract will be deployed can be known in advance via the {computeERC1167Address} function.
191
183
  *
192
184
  * This function deploys contracts without initialization (external call after deployment).
193
185
  *
194
- * The `providedSalt` parameter is not used directly as the salt by the CREATE2 opcode. Instead, it is hashed with
195
- * keccak256: `keccak256(abi.encodePacked(false, providedSalt))`. See {generateSalt} function for more details.
186
+ * The `providedSalt` parameter is not used directly as the salt by the CREATE2 opcode. Instead, it is hashed with keccak256: `keccak256(abi.encodePacked(false, providedSalt))`. See {generateSalt} function for more details.
196
187
  *
197
188
  * See {generateSalt} function for more details.
198
189
  *
199
- * Using the same `implementationContract` and `providedSalt` multiple times will revert, as the contract cannot be deployed
200
- * twice at the same address.
190
+ * Using the same `implementationContract` and `providedSalt` multiple times will revert, as the contract cannot be deployed twice at the same address.
201
191
  *
202
192
  * Sending value to the contract created is not possible since the constructor of the ERC1167 minimal proxy is not payable.
203
193
  *
204
194
  * @param implementationContract The contract address to use as the base implementation behind the proxy that will be deployed
205
- * @param providedSalt The salt provided by the deployer, which will be used to generate the final salt
206
- * that will be used by the `CREATE2` opcode for contract deployment
195
+ * @param providedSalt The salt provided by the deployer, which will be used to generate the final salt that will be used by the `CREATE2` opcode for contract deployment
207
196
  *
208
197
  * @return The address of the minimal proxy deployed
209
198
  */
@@ -229,25 +218,22 @@ contract LSP16UniversalFactory {
229
218
  }
230
219
 
231
220
  /**
221
+ * @notice Proxy deployed & initialized. Salt, `providedSalt`, used.
222
+ *
232
223
  * @dev Deploys an ERC1167 minimal proxy contract using the CREATE2 opcode. The address where the contract will be deployed
233
224
  * can be known in advance via the {computeERC1167Address} function.
234
225
  *
235
226
  * This function deploys contracts with initialization (external call after deployment).
236
227
  *
237
- * The `providedSalt` parameter is not used directly as the salt by the CREATE2 opcode. Instead, it is hashed with
238
- * keccak256: `keccak256(abi.encodePacked(true, initializeCalldata, providedSalt))`.
228
+ * The `providedSalt` parameter is not used directly as the salt by the CREATE2 opcode. Instead, it is hashed with keccak256: `keccak256(abi.encodePacked(true, initializeCalldata, providedSalt))`.
239
229
  * See {generateSalt} function for more details.
240
230
  *
241
- * Using the same `implementationContract`, `providedSalt` and `initializeCalldata` multiple times will revert, as the
242
- * contract cannot be deployed twice at the same address.
231
+ * Using the same `implementationContract`, `providedSalt` and `initializeCalldata` multiple times will revert, as the contract cannot be deployed twice at the same address.
243
232
  *
244
- * If the initialize function of the contract to deploy is payable, value can be sent along to fund the created
245
- * contract while initializing. However, sending value to this function while the initialize function is not
246
- * payable will result in a revert.
233
+ * If the initialize function of the contract to deploy is payable, value can be sent along to fund the created contract while initializing. However, sending value to this function while the initialize function is not payable will result in a revert.
247
234
  *
248
235
  * @param implementationContract The contract address to use as the base implementation behind the proxy that will be deployed
249
- * @param providedSalt The salt provided by the deployer, which will be used to generate the final salt
250
- * that will be used by the `CREATE2` opcode for contract deployment
236
+ * @param providedSalt The salt provided by the deployer, which will be used to generate the final salt that will be used by the `CREATE2` opcode for contract deployment
251
237
  * @param initializeCalldata The calldata to be executed on the created contract
252
238
  *
253
239
  * @return The address of the minimal proxy deployed
@@ -285,14 +271,12 @@ contract LSP16UniversalFactory {
285
271
 
286
272
  /**
287
273
  * @dev Computes the address of a contract to be deployed using CREATE2, based on the input parameters.
288
- * Any change in one of these parameters will result in a different address. When the `initializable`
289
- * boolean is set to `false`, `initializeCalldata` will not affect the function output.
274
+ *
275
+ * Any change in one of these parameters will result in a different address. When the `initializable` boolean is set to `false`, `initializeCalldata` will not affect the function output.
290
276
  *
291
277
  * @param byteCodeHash The keccak256 hash of the bytecode to be deployed
292
- * @param providedSalt The salt provided by the deployer, which will be used to generate the final salt
293
- * that will be used by the `CREATE2` opcode for contract deployment
294
- * @param initializable A boolean that indicates whether an external call should be made to initialize the
295
- * contract after deployment
278
+ * @param providedSalt The salt provided by the deployer, which will be used to generate the final salt that will be used by the `CREATE2` opcode for contract deployment
279
+ * @param initializable A boolean that indicates whether an external call should be made to initialize the contract after deployment
296
280
  * @param initializeCalldata The calldata to be executed on the created contract if `initializable` is set to `true`
297
281
  *
298
282
  * @return The address where the contract will be deployed
@@ -313,14 +297,12 @@ contract LSP16UniversalFactory {
313
297
 
314
298
  /**
315
299
  * @dev Computes the address of an ERC1167 proxy contract based on the input parameters.
316
- * Any change in one of these parameters will result in a different address. When the `initializable`
317
- * boolean is set to `false`, `initializeCalldata` will not affect the function output.
300
+ *
301
+ * Any change in one of these parameters will result in a different address. When the `initializable` boolean is set to `false`, `initializeCalldata` will not affect the function output.
318
302
  *
319
303
  * @param implementationContract The contract to create a clone of according to ERC1167
320
- * @param providedSalt The salt provided by the deployer, which will be used to generate the final salt
321
- * that will be used by the `CREATE2` opcode for contract deployment
322
- * @param initializable A boolean that indicates whether an external call should be made to initialize the
323
- * proxy contract after deployment
304
+ * @param providedSalt The salt provided by the deployer, which will be used to generate the final salt that will be used by the `CREATE2` opcode for contract deployment
305
+ * @param initializable A boolean that indicates whether an external call should be made to initialize the proxy contract after deployment
324
306
  * @param initializeCalldata The calldata to be executed on the created contract if `initializable` is set to `true`
325
307
  *
326
308
  * @return The address where the ERC1167 proxy contract will be deployed
@@ -344,61 +326,48 @@ contract LSP16UniversalFactory {
344
326
  }
345
327
 
346
328
  /**
347
- * @dev Generates the salt used to deploy the contract by hashing the following parameters (concatenated
348
- * together) with keccak256:
349
- *
350
- * - the `providedSalt`
351
- * - the `initializable` boolean
352
- * - the `initializeCalldata`, only if the contract is initializable (the `initializable` boolean is set to `true`)
353
- *
354
- * The `providedSalt` parameter is not used directly as the salt by the CREATE2 opcode. Instead, it is
355
- * used along with these parameters:
356
- * - `initializable` boolean
357
- * - `initializeCalldata` (when the contract is initializable and `initializable` is set to `true`).
358
- * These three parameters are concatenated together and hashed to generate the final salt for CREATE2.
329
+ * @dev Generates the salt used to deploy the contract by hashing the following parameters (concatenated together) with keccak256:
330
+ * 1. the `providedSalt`
331
+ * 2. the `initializable` boolean
332
+ * 3. the `initializeCalldata`, only if the contract is initializable (the `initializable` boolean is set to `true`)
359
333
  *
360
- * This approach ensures that in order to reproduce an initializable contract at the same address on another chain,
361
- * not only the `providedSalt` is required to be the same, but also the initialize parameters within the `initializeCalldata`
362
- * must also be the same.
334
+ * - The `providedSalt` parameter is not used directly as the salt by the CREATE2 opcode. Instead, it is used along with these parameters:
335
+ * 1. `initializable` boolean
336
+ * 2. `initializeCalldata` (when the contract is initializable and `initializable` is set to `true`).
363
337
  *
364
- * This maintains consistent deployment behaviour. Users are required to initialize contracts with the same parameters across
365
- * different chains to ensure contracts are deployed at the same address across different chains.
338
+ * - This approach ensures that in order to reproduce an initializable contract at the same address on another chain, not only the `providedSalt` is required to be the same, but also the initialize parameters within the `initializeCalldata` must also be the same. This maintains consistent deployment behaviour. Users are required to initialize contracts with the same parameters across different chains to ensure contracts are deployed at the same address across different chains.
366
339
  *
367
- * -----------
368
- * Example (for initializable contracts)
340
+ * 1. Example (for initializable contracts)
369
341
  *
370
- * For an existing contract A on chain 1 owned by X, to replicate the same contract at the same address with
342
+ * - For an existing contract A on chain 1 owned by X, to replicate the same contract at the same address with
371
343
  * the same owner X on chain 2, the salt used to generate the address should include the initializeCalldata
372
344
  * that assigns X as the owner of contract A.
373
345
  *
374
- * For instance, if another user, Y, tries to deploy the contract at the same address
346
+ * - For instance, if another user, Y, tries to deploy the contract at the same address
375
347
  * on chain 2 using the same providedSalt, but with a different initializeCalldata to make Y the owner instead of X,
376
348
  * the generated address would be different, preventing Y from deploying the contract with different ownership
377
349
  * at the same address.
378
- * -----------
379
350
  *
380
- * However, for non-initializable contracts, if the constructor has arguments that specify the deployment behavior, they
351
+ * - However, for non-initializable contracts, if the constructor has arguments that specify the deployment behavior, they
381
352
  * will be included in the bytecode. Any change in the constructor arguments will lead to a different contract's bytecode
382
353
  * which will result in a different address on other chains.
383
354
  *
384
- * -----------
385
- * Example (for non-initializable contracts)
355
+ * 2. Example (for non-initializable contracts)
386
356
  *
387
- * If a contract is deployed with specific constructor arguments on chain 1, these arguments are embedded within the bytecode.
357
+ * - If a contract is deployed with specific constructor arguments on chain 1, these arguments are embedded within the bytecode.
388
358
  * For instance, if contract B is deployed with a specific `tokenName` and `tokenSymbol` on chain 1, and a user wants to deploy
389
359
  * the same contract with the same `tokenName` and `tokenSymbol` on chain 2, they must use the same constructor arguments to
390
360
  * produce the same bytecode. This ensures that the same deployment behaviour is maintained across different chains,
391
361
  * as long as the same bytecode is used.
392
362
  *
393
- * If another user Z, tries to deploy the same contract B at the same address on chain 2 using the same `providedSalt`
363
+ * - If another user Z, tries to deploy the same contract B at the same address on chain 2 using the same `providedSalt`
394
364
  * but different constructor arguments (a different `tokenName` and/or `tokenSymbol`), the generated address will be different.
395
365
  * This prevents user Z from deploying the contract with different constructor arguments at the same address on chain 2.
396
- * -----------
397
366
  *
398
- * The providedSalt was hashed to produce the salt used by CREATE2 opcode to prevent users from deploying initializable contracts
367
+ * - The providedSalt was hashed to produce the salt used by CREATE2 opcode to prevent users from deploying initializable contracts
399
368
  * using non-initializable functions such as {deployCreate2} without having the initialization call.
400
369
  *
401
- * In other words, if the providedSalt was not hashed and was used as it is as the salt by the CREATE2 opcode, malicious users
370
+ * - In other words, if the providedSalt was not hashed and was used as it is as the salt by the CREATE2 opcode, malicious users
402
371
  * can check the generated salt used for the already deployed initializable contract on chain 1, and deploy the contract
403
372
  * from {deployCreate2} function on chain 2, with passing the generated salt of the deployed contract as providedSalt
404
373
  * that will produce the same address but without the initialization, where the malicious user can initialize after.
@@ -1,4 +1,4 @@
1
- // SPDX-License-Identifier: MIT
1
+ // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.4;
3
3
 
4
4
  /**
@@ -11,7 +11,7 @@ import {
11
11
  import {_INTERFACEID_LSP17_EXTENDABLE} from "./LSP17Constants.sol";
12
12
 
13
13
  // errors
14
- import "./LSP17Errors.sol";
14
+ import {NoExtensionFoundForFunctionSelector} from "./LSP17Errors.sol";
15
15
 
16
16
  /**
17
17
  * @title Module to add more functionalities to a contract using extensions.
@@ -44,7 +44,7 @@ abstract contract LSP17Extendable is ERC165 {
44
44
  function _supportsInterfaceInERC165Extension(
45
45
  bytes4 interfaceId
46
46
  ) internal view virtual returns (bool) {
47
- address erc165Extension = _getExtension(
47
+ (address erc165Extension, ) = _getExtensionAndForwardValue(
48
48
  ERC165.supportsInterface.selector
49
49
  );
50
50
  if (erc165Extension == address(0)) return false;
@@ -62,40 +62,47 @@ abstract contract LSP17Extendable is ERC165 {
62
62
  * To be overrided.
63
63
  * Up to the implementor contract to return an extension based on a function selector
64
64
  */
65
- function _getExtension(
65
+ function _getExtensionAndForwardValue(
66
66
  bytes4 functionSelector
67
- ) internal view virtual returns (address);
67
+ ) internal view virtual returns (address, bool);
68
68
 
69
69
  /**
70
70
  * @dev Forwards the call to an extension mapped to a function selector.
71
71
  *
72
- * Calls {_getExtension} to get the address of the extension mapped to the function selector being
73
- * called on the account. If there is no extension, the address(0) will be returned.
72
+ * Calls {_getExtensionAndForwardValue} to get the address of the extension mapped to the function selector being
73
+ * called on the account. If there is no extension, the `address(0)` will be returned.
74
+ * Forwards the value if the extension is payable.
74
75
  *
75
76
  * Reverts if there is no extension for the function being called.
76
77
  *
77
78
  * If there is an extension for the function selector being called, it calls the extension with the
78
- * CALL opcode, passing the {msg.data} appended with the 20 bytes of the {msg.sender} and
79
- * 32 bytes of the {msg.value}
79
+ * `CALL` opcode, passing the `msg.data` appended with the 20 bytes of the {msg.sender} and 32 bytes of the `msg.value`.
80
80
  *
81
- * Because the function uses assembly {return()/revert()} to terminate the call, it cannot be
82
- * called before other codes in fallback().
81
+ * @custom:hint This function does not forward to the extension contract the `msg.value` received by the contract that inherits `LSP17Extendable`.
82
+ * If you would like to forward the `msg.value` to the extension contract, you can override the code of this internal function as follow:
83
83
  *
84
- * Otherwise, the codes after _fallbackLSP17Extendable() may never be reached.
84
+ * ```solidity
85
+ * (bool success, bytes memory result) = extension.call{value: msg.value}(
86
+ * abi.encodePacked(callData, msg.sender, msg.value)
87
+ * );
88
+ * ```
85
89
  */
86
90
  function _fallbackLSP17Extendable(
87
91
  bytes calldata callData
88
92
  ) internal virtual returns (bytes memory) {
89
93
  // If there is a function selector
90
- address extension = _getExtension(msg.sig);
94
+ (
95
+ address extension,
96
+ bool shouldForwardValue
97
+ ) = _getExtensionAndForwardValue(msg.sig);
91
98
 
92
99
  // if no extension was found, revert
93
100
  if (extension == address(0))
94
101
  revert NoExtensionFoundForFunctionSelector(msg.sig);
95
102
 
96
- (bool success, bytes memory result) = extension.call(
97
- abi.encodePacked(callData, msg.sender, msg.value)
98
- );
103
+ (bool success, bytes memory result) = extension.call{
104
+ value: shouldForwardValue ? msg.value : 0
105
+ }(abi.encodePacked(callData, msg.sender, msg.value));
99
106
 
100
107
  if (success) {
101
108
  return result;
@@ -2,6 +2,7 @@
2
2
  pragma solidity ^0.8.4;
3
3
 
4
4
  // modules
5
+ import {Version} from "../Version.sol";
5
6
  import {ERC165} from "@openzeppelin/contracts/utils/introspection/ERC165.sol";
6
7
 
7
8
  // constants
@@ -13,7 +14,7 @@ import {_INTERFACEID_LSP17_EXTENSION} from "./LSP17Constants.sol";
13
14
  * @dev Implementation of the extension logic according to LSP17ContractExtension.
14
15
  * This module can be inherited to provide context of the msg variable related to the extendable contract
15
16
  */
16
- abstract contract LSP17Extension is ERC165 {
17
+ abstract contract LSP17Extension is ERC165, Version {
17
18
  /**
18
19
  * @dev See {IERC165-supportsInterface}.
19
20
  */
@@ -26,8 +27,8 @@ abstract contract LSP17Extension is ERC165 {
26
27
  }
27
28
 
28
29
  /**
29
- * @dev Returns the original msg.data passed to the extendable contract
30
- * without the appended msg.sender and msg.value
30
+ * @dev Returns the original `msg.data` passed to the extendable contract
31
+ * without the appended `msg.sender` and `msg.value`.
31
32
  */
32
33
  function _extendableMsgData()
33
34
  internal
@@ -39,7 +40,7 @@ abstract contract LSP17Extension is ERC165 {
39
40
  }
40
41
 
41
42
  /**
42
- * @dev Returns the original msg.sender calling the extendable contract
43
+ * @dev Returns the original `msg.sender` calling the extendable contract.
43
44
  */
44
45
  function _extendableMsgSender() internal view virtual returns (address) {
45
46
  return
@@ -49,7 +50,7 @@ abstract contract LSP17Extension is ERC165 {
49
50
  }
50
51
 
51
52
  /**
52
- * @dev Returns the original msg.value sent to the extendable contract
53
+ * @dev Returns the original `msg.value` sent to the extendable contract.
53
54
  */
54
55
  function _extendableMsgValue() internal view virtual returns (uint256) {
55
56
  return uint256(bytes32(msg.data[msg.data.length - 32:]));
@@ -0,0 +1,101 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.12;
3
+
4
+ // interfaces
5
+ import {IAccount} from "@account-abstraction/contracts/interfaces/IAccount.sol";
6
+ import {
7
+ IERC725Y
8
+ } from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
9
+ import {
10
+ ILSP20CallVerifier
11
+ } from "../LSP20CallVerification/ILSP20CallVerifier.sol";
12
+
13
+ // modules
14
+ import {LSP14Ownable2Step} from "../LSP14Ownable2Step/LSP14Ownable2Step.sol";
15
+ import {LSP17Extension} from "../LSP17ContractExtension/LSP17Extension.sol";
16
+
17
+ // librairies
18
+ import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
19
+ import {LSP6Utils} from "../LSP6KeyManager/LSP6Utils.sol";
20
+
21
+ // constants
22
+ import {
23
+ UserOperation
24
+ } from "@account-abstraction/contracts/interfaces/UserOperation.sol";
25
+
26
+ contract Extension4337 is LSP17Extension, IAccount {
27
+ using ECDSA for bytes32;
28
+ using LSP6Utils for *;
29
+
30
+ address internal immutable _ENTRY_POINT;
31
+
32
+ // permission needed to be able to use this extension
33
+ bytes32 internal constant _4337_PERMISSION =
34
+ 0x0000000000000000000000000000000000000000000000000000000000800000;
35
+
36
+ // error code returned when signature or permission validation fails
37
+ uint256 internal constant _SIG_VALIDATION_FAILED = 1;
38
+
39
+ constructor(address entryPoint_) {
40
+ _ENTRY_POINT = entryPoint_;
41
+ }
42
+
43
+ /**
44
+ * @inheritdoc IAccount
45
+ */
46
+ function validateUserOp(
47
+ UserOperation calldata userOp,
48
+ bytes32 userOpHash,
49
+ uint256 /* missingAccountFunds */
50
+ ) external returns (uint256) {
51
+ require(
52
+ _extendableMsgSender() == _ENTRY_POINT,
53
+ "Only EntryPoint contract can call this"
54
+ );
55
+
56
+ // recover initiator of the tx from the signature
57
+ bytes32 hash = userOpHash.toEthSignedMessageHash();
58
+ address recovered = hash.recover(userOp.signature);
59
+
60
+ // verify that the recovered address has the _4337_PERMISSION
61
+ if (
62
+ !LSP6Utils.hasPermission(
63
+ IERC725Y(msg.sender).getPermissionsFor(recovered),
64
+ _4337_PERMISSION
65
+ )
66
+ ) {
67
+ return _SIG_VALIDATION_FAILED;
68
+ }
69
+
70
+ // retrieve owner from caller
71
+ address owner = LSP14Ownable2Step(msg.sender).owner();
72
+
73
+ // verify that the recovered address can execute the userOp.callData
74
+ bytes4 returnedStatus = ILSP20CallVerifier(owner).lsp20VerifyCall({
75
+ requestor: _ENTRY_POINT,
76
+ target: msg.sender,
77
+ caller: recovered,
78
+ value: 0,
79
+ callData: userOp.callData
80
+ });
81
+
82
+ // if the returnedStatus is a value different than the success value, return signature validation failed
83
+ if (
84
+ bytes3(returnedStatus) !=
85
+ bytes3(ILSP20CallVerifier.lsp20VerifyCall.selector)
86
+ ) {
87
+ return _SIG_VALIDATION_FAILED;
88
+ }
89
+
90
+ // if sig validation passed, return 0
91
+ return 0;
92
+ }
93
+
94
+ /**
95
+ * @dev Get the address of the Entry Point contract that will execute the user operation.
96
+ * @return The address of the EntryPoint contract
97
+ */
98
+ function entryPoint() public view returns (address) {
99
+ return _ENTRY_POINT;
100
+ }
101
+ }
@@ -0,0 +1,15 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.4;
3
+
4
+ import {
5
+ ERC721Holder
6
+ } from "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
7
+
8
+ /**
9
+ * @dev LSP17 Extension that can be attached to a LSP17Extendable contract
10
+ * to allow it to receive ERC721 tokens via `safeTransferFrom`.
11
+ */
12
+ // solhint-disable-next-line no-empty-blocks
13
+ contract OnERC721ReceivedExtension is ERC721Holder {
14
+
15
+ }
@@ -1,4 +1,4 @@
1
- // SPDX-License-Identifier: CC0-1.0
1
+ // SPDX-License-Identifier: Apache-2.0
2
2
  pragma solidity ^0.8.4;
3
3
 
4
4
  /**
@@ -8,7 +8,6 @@ pragma solidity ^0.8.4;
8
8
  interface ILSP1UniversalReceiver {
9
9
  /**
10
10
  * @dev Emitted when the {universalReceiver} function was called with a specific `typeId` and some `receivedData`
11
- s
12
11
  * @notice Address `from` called the `universalReceiver(...)` function while sending `value` LYX. Notification type (typeId): `typeId` - Data received: `receivedData`.
13
12
  *
14
13
  * @param from The address of the EOA or smart contract that called the {universalReceiver(...)} function.
@@ -0,0 +1,24 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.4;
3
+
4
+ /**
5
+ * @title Interface of the LSP1 - Universal Receiver Delegate standard.
6
+ * @dev This interface allows contracts implementing the LSP1UniversalReceiver function to delegate the reaction logic to another contract or account. By doing so, the main logic doesn't need to reside within the `universalReceiver` function itself, offering modularity and flexibility.
7
+ */
8
+ interface ILSP1UniversalReceiverDelegate {
9
+ /**
10
+ * @dev A delegate function that reacts to calls forwarded from the `universalReceiver(..)` function. This allows for modular handling of the logic based on the `typeId` and `data` provided by the initial caller.
11
+ * @notice Reacted on received notification forwarded from `universalReceiver` with `typeId` & `data`.
12
+ *
13
+ * @param sender The address of the EOA or smart contract that initially called the `universalReceiver` function.
14
+ * @param value The amount sent by the `sender` to the `universalReceiver` function.
15
+ * @param typeId The hash of a specific standard or a hook.
16
+ * @param data The arbitrary data received with the initial call to `universalReceiver`.
17
+ */
18
+ function universalReceiverDelegate(
19
+ address sender,
20
+ uint256 value,
21
+ bytes32 typeId,
22
+ bytes memory data
23
+ ) external returns (bytes memory);
24
+ }
@@ -3,6 +3,7 @@ pragma solidity ^0.8.4;
3
3
 
4
4
  // --- ERC165 interface ids
5
5
  bytes4 constant _INTERFACEID_LSP1 = 0x6bb56a14;
6
+ bytes4 constant _INTERFACEID_LSP1_DELEGATE = 0xa245bbda;
6
7
 
7
8
  // --- ERC725Y Data Keys
8
9
 
@@ -8,9 +8,3 @@ pragma solidity ^0.8.4;
8
8
  * @param caller The address of the EOA
9
9
  */
10
10
  error CannotRegisterEOAsAsAssets(address caller);
11
-
12
- /**
13
- * @dev Reverts when the {universalReceiver} function in the LSP1 Universal Receiver Delegate contract is called while sending some native tokens along the call (`msg.value` different than `0`)
14
- * @notice Cannot send native tokens to {universalReceiver(...)} function of the delegated contract.
15
- */
16
- error NativeTokensNotAccepted();