@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
@@ -11,7 +11,27 @@ import {ILSP6KeyManager} from "./ILSP6KeyManager.sol";
11
11
  import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";
12
12
 
13
13
  // constants
14
- import "./LSP6Constants.sol";
14
+ import {
15
+ _LSP6KEY_ADDRESSPERMISSIONS_PERMISSIONS_PREFIX,
16
+ _LSP6KEY_ADDRESSPERMISSIONS_ALLOWEDCALLS_PREFIX,
17
+ _LSP6KEY_ADDRESSPERMISSIONS_AllowedERC725YDataKeys_PREFIX,
18
+ _LSP6KEY_ADDRESSPERMISSIONS_ARRAY,
19
+ _PERMISSION_CHANGEOWNER,
20
+ _PERMISSION_EDITPERMISSIONS,
21
+ _PERMISSION_ADDCONTROLLER,
22
+ _PERMISSION_ADDEXTENSIONS,
23
+ _PERMISSION_CHANGEEXTENSIONS,
24
+ _PERMISSION_ADDUNIVERSALRECEIVERDELEGATE,
25
+ _PERMISSION_CHANGEUNIVERSALRECEIVERDELEGATE,
26
+ _PERMISSION_REENTRANCY,
27
+ _PERMISSION_SETDATA,
28
+ _PERMISSION_CALL,
29
+ _PERMISSION_STATICCALL,
30
+ _PERMISSION_DELEGATECALL,
31
+ _PERMISSION_DEPLOY,
32
+ _PERMISSION_TRANSFERVALUE,
33
+ _PERMISSION_SIGN
34
+ } from "./LSP6Constants.sol";
15
35
 
16
36
  /**
17
37
  * @title LSP6 Utility library.
@@ -30,6 +50,9 @@ library LSP6Utils {
30
50
  * @param caller The controller address to read the permissions from.
31
51
  *
32
52
  * @return A `bytes32` BitArray containing the permissions of a controller address.
53
+ *
54
+ * @custom:info If the raw value fetched from the ERC725Y storage of `target` is not 32 bytes long, this is considered
55
+ * like _"no permissions are set"_ and will return 32 x `0x00` bytes as `bytes32(0)`.
33
56
  */
34
57
  function getPermissionsFor(
35
58
  IERC725Y target,
@@ -42,6 +65,10 @@ library LSP6Utils {
42
65
  )
43
66
  );
44
67
 
68
+ if (permissions.length != 32) {
69
+ return bytes32(0);
70
+ }
71
+
45
72
  return bytes32(permissions);
46
73
  }
47
74
 
@@ -186,7 +213,7 @@ library LSP6Utils {
186
213
  bytes32[] memory permissions
187
214
  ) internal pure returns (bytes32) {
188
215
  bytes32 result;
189
- for (uint256 i = 0; i < permissions.length; i++) {
216
+ for (uint256 i; i < permissions.length; i++) {
190
217
  result |= permissions[i];
191
218
  }
192
219
  return result;
@@ -1,4 +1,4 @@
1
- // SPDX-License-Identifier: MIT
1
+ // SPDX-License-Identifier: Apache-2.0
2
2
 
3
3
  pragma solidity ^0.8.4;
4
4
 
@@ -20,7 +20,7 @@ interface ILSP7DigitalAsset is IERC165, IERC725Y {
20
20
  * @param from The address which tokens were sent from (balance decreased by `-amount`).
21
21
  * @param to The address that received the tokens (balance increased by `+amount`).
22
22
  * @param amount The amount of tokens transferred.
23
- * @param allowNonLSP1Recipient if the transferred enforced the `to` recipient address to be a contract that implements the LSP1 standard or not.
23
+ * @param force if the transferred enforced the `to` recipient address to be a contract that implements the LSP1 standard or not.
24
24
  * @param data Any additional data included by the caller during the transfer, and sent in the LSP1 hooks to the `from` and `to` addresses.
25
25
  */
26
26
  event Transfer(
@@ -28,7 +28,7 @@ interface ILSP7DigitalAsset is IERC165, IERC725Y {
28
28
  address indexed from,
29
29
  address indexed to,
30
30
  uint256 amount,
31
- bool allowNonLSP1Recipient,
31
+ bool force,
32
32
  bytes data
33
33
  );
34
34
 
@@ -173,7 +173,7 @@ interface ILSP7DigitalAsset is IERC165, IERC725Y {
173
173
  * @param from The sender address.
174
174
  * @param to The recipient address.
175
175
  * @param amount The amount of tokens to transfer.
176
- * @param allowNonLSP1Recipient When set to `true`, the `to` address CAN be any address. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard.
176
+ * @param force When set to `true`, the `to` address CAN be any address. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard.
177
177
  * @param data Any additional data the caller wants included in the emitted event, and sent in the hooks of the `from` and `to` addresses.
178
178
  *
179
179
  * @custom:requirements
@@ -188,19 +188,19 @@ interface ILSP7DigitalAsset is IERC165, IERC725Y {
188
188
  * - if the transfer is triggered by an operator, either the {AuthorizedOperator} event will be emitted with the updated allowance or the {RevokedOperator}
189
189
  * event will be emitted if the operator has no more allowance left.
190
190
  *
191
- * @custom:hint The `allowNonLSP1Recipient` parameter **MUST be set to `true`** to transfer tokens to Externally Owned Accounts (EOAs)
191
+ * @custom:hint The `force` parameter **MUST be set to `true`** to transfer tokens to Externally Owned Accounts (EOAs)
192
192
  * or contracts that do not implement the LSP1 Universal Receiver Standard. Otherwise the function will revert making the transfer fail.
193
193
  *
194
- * @custom:info if the `to` address is a contract that implements LSP1, it will always be notified via its `universalReceiver(...)` function, regardless if `allowNonLSP1Recipient` is set to `true` or `false`.
194
+ * @custom:info if the `to` address is a contract that implements LSP1, it will always be notified via its `universalReceiver(...)` function, regardless if `force` is set to `true` or `false`.
195
195
  *
196
196
  * @custom:warning Be aware that when either the sender or the recipient can have logic that revert in their `universalReceiver(...)` function when being notified.
197
- * This even if the `allowNonLSP1Recipient` was set to `true`.
197
+ * This even if the `force` was set to `true`.
198
198
  */
199
199
  function transfer(
200
200
  address from,
201
201
  address to,
202
202
  uint256 amount,
203
- bool allowNonLSP1Recipient,
203
+ bool force,
204
204
  bytes memory data
205
205
  ) external;
206
206
 
@@ -212,7 +212,7 @@ interface ILSP7DigitalAsset is IERC165, IERC725Y {
212
212
  * @param from An array of sending addresses.
213
213
  * @param to An array of receiving addresses.
214
214
  * @param amount An array of amount of tokens to transfer for each `from -> to` transfer.
215
- * @param allowNonLSP1Recipient For each transfer, when set to `true`, the `to` address CAN be any address. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard.
215
+ * @param force For each transfer, when set to `true`, the `to` address CAN be any address. When set to `false`, the `to` address MUST be a contract that supports the LSP1 UniversalReceiver standard.
216
216
  * @param data An array of additional data the caller wants included in the emitted event, and sent in the hooks to `from` and `to` addresses.
217
217
  *
218
218
  * @custom:requirements
@@ -228,7 +228,7 @@ interface ILSP7DigitalAsset is IERC165, IERC725Y {
228
228
  address[] memory from,
229
229
  address[] memory to,
230
230
  uint256[] memory amount,
231
- bool[] memory allowNonLSP1Recipient,
231
+ bool[] memory force,
232
232
  bytes[] memory data
233
233
  ) external;
234
234
  }
@@ -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
  // --- ERC165 interface ids
@@ -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
  // interfaces
@@ -17,8 +17,11 @@ import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";
17
17
 
18
18
  // constants
19
19
  import {_INTERFACEID_LSP7} from "./LSP7Constants.sol";
20
+ import {LSP7TokenContractCannotHoldValue} from "./LSP7Errors.sol";
20
21
 
21
- import "../LSP17ContractExtension/LSP17Constants.sol";
22
+ import {
23
+ _LSP17_EXTENSION_PREFIX
24
+ } from "../LSP17ContractExtension/LSP17Constants.sol";
22
25
 
23
26
  // errors
24
27
 
@@ -60,7 +63,6 @@ abstract contract LSP7DigitalAsset is
60
63
 
61
64
  // fallback function
62
65
 
63
- // solhint-disable no-complex-fallback
64
66
  /**
65
67
  * @notice The `fallback` function was called with the following amount of native tokens: `msg.value`; and the following calldata: `callData`.
66
68
  *
@@ -80,6 +82,7 @@ abstract contract LSP7DigitalAsset is
80
82
  *
81
83
  * 2. If the data sent to this function is of length less than 4 bytes (not a function selector), revert.
82
84
  */
85
+ // solhint-disable-next-line no-complex-fallback
83
86
  fallback(
84
87
  bytes calldata callData
85
88
  ) external payable virtual returns (bytes memory) {
@@ -89,6 +92,19 @@ abstract contract LSP7DigitalAsset is
89
92
  return _fallbackLSP17Extendable(callData);
90
93
  }
91
94
 
95
+ /**
96
+ * @dev Reverts whenever someone tries to send native tokens to a LSP7 contract.
97
+ * @notice LSP7 contract cannot receive native tokens.
98
+ */
99
+ receive() external payable virtual {
100
+ // revert on empty calls with no value
101
+ if (msg.value == 0) {
102
+ revert InvalidFunctionSelector(hex"00000000");
103
+ }
104
+
105
+ revert LSP7TokenContractCannotHoldValue();
106
+ }
107
+
92
108
  /**
93
109
  * @dev Forwards the call with the received value to an extension mapped to a function selector.
94
110
  *
@@ -101,10 +117,8 @@ abstract contract LSP7DigitalAsset is
101
117
  * CALL opcode, passing the {msg.data} appended with the 20 bytes of the {msg.sender} and
102
118
  * 32 bytes of the {msg.value}
103
119
  *
104
- * Because the function uses assembly {return()/revert()} to terminate the call, it cannot be
105
- * called before other codes in fallback().
106
- *
107
- * Otherwise, the codes after _fallbackLSP17Extendable() may never be reached.
120
+ * @custom:info The LSP7 Token contract should not hold any native tokens. Any native tokens received by the contract
121
+ * will be forwarded to the extension address mapped to the selector from `msg.sig`.
108
122
  */
109
123
  function _fallbackLSP17Extendable(
110
124
  bytes calldata callData
@@ -125,8 +139,8 @@ abstract contract LSP7DigitalAsset is
125
139
  } else {
126
140
  // `mload(result)` -> offset in memory where `result.length` is located
127
141
  // `add(result, 32)` -> offset in memory where `result` data starts
128
- // solhint-disable no-inline-assembly
129
142
  /// @solidity memory-safe-assembly
143
+ // solhint-disable-next-line no-inline-assembly
130
144
  assembly {
131
145
  let resultdata_size := mload(result)
132
146
  revert(add(result, 32), resultdata_size)