@lukso/lsp-smart-contracts 0.10.1 → 0.10.3

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 (124) hide show
  1. package/README.md +0 -1
  2. package/artifacts/Create2Factory.json +2 -2
  3. package/artifacts/LSP0ERC725Account.json +3 -3
  4. package/artifacts/LSP0ERC725AccountInit.json +3 -3
  5. package/artifacts/LSP11BasicSocialRecovery.json +2 -2
  6. package/artifacts/LSP11BasicSocialRecoveryInit.json +2 -2
  7. package/artifacts/LSP16UniversalFactory.json +2 -2
  8. package/artifacts/LSP1UniversalReceiverDelegateUP.json +2 -2
  9. package/artifacts/LSP1UniversalReceiverDelegateVault.json +2 -2
  10. package/artifacts/LSP6KeyManager.json +2 -2
  11. package/artifacts/LSP6KeyManagerInit.json +2 -2
  12. package/artifacts/LSP7CompatibleERC20Mintable.json +2 -2
  13. package/artifacts/LSP7CompatibleERC20MintableInit.json +2 -2
  14. package/artifacts/LSP7Mintable.json +2 -2
  15. package/artifacts/LSP7MintableInit.json +2 -2
  16. package/artifacts/LSP8CompatibleERC721Mintable.json +2 -2
  17. package/artifacts/LSP8CompatibleERC721MintableInit.json +2 -2
  18. package/artifacts/LSP8Mintable.json +2 -2
  19. package/artifacts/LSP8MintableInit.json +2 -2
  20. package/artifacts/LSP9Vault.json +2 -2
  21. package/artifacts/LSP9VaultInit.json +2 -2
  22. package/artifacts/UniversalProfile.json +3 -3
  23. package/artifacts/UniversalProfileInit.json +3 -3
  24. package/artifacts/UniversalReceiverAddressStore.json +2 -2
  25. package/contracts/Factories/Create2Factory.sol +11 -3
  26. package/contracts/LSP0ERC725Account/ILSP0ERC725Account.sol +13 -5
  27. package/contracts/LSP0ERC725Account/LSP0ERC725Account.sol +5 -5
  28. package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +256 -186
  29. package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +6 -2
  30. package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +13 -4
  31. package/contracts/LSP0ERC725Account/LSP0Utils.sol +3 -5
  32. package/contracts/LSP10ReceivedVaults/LSP10Utils.sol +25 -10
  33. package/contracts/LSP11BasicSocialRecovery/ILSP11BasicSocialRecovery.sol +4 -2
  34. package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecovery.sol +3 -1
  35. package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryCore.sol +65 -23
  36. package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryInit.sol +7 -2
  37. package/contracts/LSP11BasicSocialRecovery/LSP11BasicSocialRecoveryInitAbstract.sol +14 -4
  38. package/contracts/LSP11BasicSocialRecovery/LSP11Errors.sol +4 -1
  39. package/contracts/LSP14Ownable2Step/ILSP14Ownable2Step.sol +17 -16
  40. package/contracts/LSP14Ownable2Step/LSP14Errors.sol +4 -1
  41. package/contracts/LSP14Ownable2Step/LSP14Ownable2Step.sol +22 -11
  42. package/contracts/LSP16UniversalFactory/LSP16UniversalFactory.sol +85 -27
  43. package/contracts/LSP17ContractExtension/LSP17Extendable.sol +38 -16
  44. package/contracts/LSP17ContractExtension/LSP17Extension.sol +20 -8
  45. package/contracts/LSP17ContractExtension/LSP17Utils.sol +4 -5
  46. package/contracts/LSP1UniversalReceiver/ILSP1UniversalReceiver.sol +5 -5
  47. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateUP/LSP1UniversalReceiverDelegateUP.sol +38 -14
  48. package/contracts/LSP1UniversalReceiver/LSP1UniversalReceiverDelegateVault/LSP1UniversalReceiverDelegateVault.sol +31 -11
  49. package/contracts/LSP1UniversalReceiver/LSP1Utils.sol +34 -9
  50. package/contracts/LSP20CallVerification/{ILSP20CallVerification.sol → ILSP20CallVerifier.sol} +7 -2
  51. package/contracts/LSP20CallVerification/LSP20CallVerification.sol +24 -9
  52. package/contracts/LSP20CallVerification/LSP20Errors.sol +1 -1
  53. package/contracts/LSP2ERC725YJSONSchema/LSP2Utils.sol +62 -36
  54. package/contracts/LSP4DigitalAssetMetadata/ILSP4Compatibility.sol +3 -1
  55. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +15 -4
  56. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +18 -5
  57. package/contracts/LSP5ReceivedAssets/LSP5Utils.sol +32 -12
  58. package/contracts/LSP6KeyManager/ILSP6KeyManager.sol +17 -8
  59. package/contracts/LSP6KeyManager/LSP6Constants.sol +3 -9
  60. package/contracts/LSP6KeyManager/LSP6Errors.sol +4 -1
  61. package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +114 -72
  62. package/contracts/LSP6KeyManager/LSP6KeyManagerInitAbstract.sol +7 -2
  63. package/contracts/LSP6KeyManager/LSP6Modules/LSP6ExecuteModule.sol +96 -46
  64. package/contracts/LSP6KeyManager/LSP6Modules/LSP6OwnershipModule.sol +10 -5
  65. package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +98 -32
  66. package/contracts/LSP6KeyManager/LSP6Utils.sol +42 -34
  67. package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +8 -6
  68. package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +13 -10
  69. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +96 -26
  70. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +11 -9
  71. package/contracts/LSP7DigitalAsset/LSP7Errors.sol +8 -2
  72. package/contracts/LSP7DigitalAsset/extensions/ILSP7CompatibleERC20.sol +9 -2
  73. package/contracts/LSP7DigitalAsset/extensions/LSP7Burnable.sol +1 -5
  74. package/contracts/LSP7DigitalAsset/extensions/LSP7BurnableInitAbstract.sol +4 -6
  75. package/contracts/LSP7DigitalAsset/extensions/LSP7CappedSupplyInitAbstract.sol +6 -2
  76. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +32 -12
  77. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +28 -7
  78. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +8 -2
  79. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +6 -2
  80. package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +6 -1
  81. package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +13 -3
  82. package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +14 -5
  83. package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +3 -1
  84. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +12 -10
  85. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +95 -28
  86. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +14 -10
  87. package/contracts/LSP8IdentifiableDigitalAsset/extensions/ILSP8CompatibleERC721.sol +23 -10
  88. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol +3 -1
  89. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +3 -1
  90. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +6 -2
  91. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +72 -30
  92. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +77 -27
  93. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +6 -2
  94. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +6 -2
  95. package/contracts/LSP8IdentifiableDigitalAsset/presets/ILSP8Mintable.sol +3 -1
  96. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +8 -2
  97. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +6 -2
  98. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +3 -1
  99. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +5 -1
  100. package/contracts/LSP9Vault/ILSP9Vault.sol +13 -5
  101. package/contracts/LSP9Vault/LSP9Vault.sol +7 -2
  102. package/contracts/LSP9Vault/LSP9VaultCore.sol +108 -51
  103. package/contracts/LSP9Vault/LSP9VaultInitAbstract.sol +10 -3
  104. package/contracts/Legacy/Registries/AddressRegistry.sol +13 -4
  105. package/contracts/Legacy/Registries/AddressRegistryRequiresERC725.sol +6 -2
  106. package/contracts/Legacy/UniversalReceiverAddressStore.sol +17 -6
  107. package/contracts/UniversalProfile.sol +4 -1
  108. package/contracts/UniversalProfileInit.sol +3 -1
  109. package/contracts/UniversalProfileInitAbstract.sol +13 -4
  110. package/devdocs/LSP0ERC725Account.json +33 -19
  111. package/devdocs/LSP0ERC725AccountInit.json +30 -17
  112. package/devdocs/LSP9Vault.json +3 -3
  113. package/devdocs/LSP9VaultInit.json +3 -3
  114. package/devdocs/UniversalProfile.json +30 -17
  115. package/devdocs/UniversalProfileInit.json +30 -17
  116. package/dist/constants.cjs.js +142 -102
  117. package/dist/constants.d.ts +62 -10
  118. package/dist/constants.es.js +142 -102
  119. package/package.json +26 -23
  120. package/userdocs/LSP0ERC725Account.json +2 -2
  121. package/userdocs/LSP0ERC725AccountInit.json +2 -2
  122. package/userdocs/UniversalProfile.json +2 -2
  123. package/userdocs/UniversalProfileInit.json +2 -2
  124. package/contracts/Custom/EIP191Signer.sol +0 -12
@@ -57,7 +57,9 @@ error LSP8InvalidTransferBatch();
57
57
  * @dev reverts if the `tokenReceiver` does not implement LSP1
58
58
  * when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`.
59
59
  */
60
- error LSP8NotifyTokenReceiverContractMissingLSP1Interface(address tokenReceiver);
60
+ error LSP8NotifyTokenReceiverContractMissingLSP1Interface(
61
+ address tokenReceiver
62
+ );
61
63
 
62
64
  /**
63
65
  * @dev reverts if the `tokenReceiver` is an EOA
@@ -6,8 +6,12 @@ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
6
6
 
7
7
  // modules
8
8
  import {ERC725YCore} from "@erc725/smart-contracts/contracts/ERC725YCore.sol";
9
- import {LSP8IdentifiableDigitalAssetCore} from "./LSP8IdentifiableDigitalAssetCore.sol";
10
- import {LSP4DigitalAssetMetadata} from "../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol";
9
+ import {
10
+ LSP8IdentifiableDigitalAssetCore
11
+ } from "./LSP8IdentifiableDigitalAssetCore.sol";
12
+ import {
13
+ LSP4DigitalAssetMetadata
14
+ } from "../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol";
11
15
 
12
16
  // constants
13
17
  import {_INTERFACEID_LSP8} from "./LSP8Constants.sol";
@@ -36,13 +40,11 @@ abstract contract LSP8IdentifiableDigitalAsset is
36
40
  /**
37
41
  * @dev See {IERC165-supportsInterface}.
38
42
  */
39
- function supportsInterface(bytes4 interfaceId)
40
- public
41
- view
42
- virtual
43
- override(IERC165, ERC725YCore)
44
- returns (bool)
45
- {
46
- return interfaceId == _INTERFACEID_LSP8 || super.supportsInterface(interfaceId);
43
+ function supportsInterface(
44
+ bytes4 interfaceId
45
+ ) public view virtual override(IERC165, ERC725YCore) returns (bool) {
46
+ return
47
+ interfaceId == _INTERFACEID_LSP8 ||
48
+ super.supportsInterface(interfaceId);
47
49
  }
48
50
  }
@@ -2,26 +2,39 @@
2
2
  pragma solidity ^0.8.4;
3
3
 
4
4
  // interfaces
5
- import {ILSP1UniversalReceiver} from "../LSP1UniversalReceiver/ILSP1UniversalReceiver.sol";
6
- import {ILSP8IdentifiableDigitalAsset} from "./ILSP8IdentifiableDigitalAsset.sol";
5
+ import {
6
+ ILSP1UniversalReceiver
7
+ } from "../LSP1UniversalReceiver/ILSP1UniversalReceiver.sol";
8
+ import {
9
+ ILSP8IdentifiableDigitalAsset
10
+ } from "./ILSP8IdentifiableDigitalAsset.sol";
7
11
 
8
12
  // libraries
9
- import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
10
- import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
13
+ import {
14
+ EnumerableSet
15
+ } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
16
+ import {
17
+ ERC165Checker
18
+ } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
11
19
 
12
20
  // errors
13
21
  import "./LSP8Errors.sol";
14
22
 
15
23
  // constants
16
24
  import {_INTERFACEID_LSP1} from "../LSP1UniversalReceiver/LSP1Constants.sol";
17
- import {_TYPEID_LSP8_TOKENSSENDER, _TYPEID_LSP8_TOKENSRECIPIENT} from "./LSP8Constants.sol";
25
+ import {
26
+ _TYPEID_LSP8_TOKENSSENDER,
27
+ _TYPEID_LSP8_TOKENSRECIPIENT
28
+ } from "./LSP8Constants.sol";
18
29
 
19
30
  /**
20
31
  * @title LSP8IdentifiableDigitalAsset contract
21
32
  * @author Matthew Stevens
22
33
  * @dev Core Implementation of a LSP8 compliant contract.
23
34
  */
24
- abstract contract LSP8IdentifiableDigitalAssetCore is ILSP8IdentifiableDigitalAsset {
35
+ abstract contract LSP8IdentifiableDigitalAssetCore is
36
+ ILSP8IdentifiableDigitalAsset
37
+ {
25
38
  using EnumerableSet for EnumerableSet.AddressSet;
26
39
  using EnumerableSet for EnumerableSet.Bytes32Set;
27
40
 
@@ -54,14 +67,18 @@ abstract contract LSP8IdentifiableDigitalAssetCore is ILSP8IdentifiableDigitalAs
54
67
  /**
55
68
  * @inheritdoc ILSP8IdentifiableDigitalAsset
56
69
  */
57
- function balanceOf(address tokenOwner) public view virtual returns (uint256) {
70
+ function balanceOf(
71
+ address tokenOwner
72
+ ) public view virtual returns (uint256) {
58
73
  return _ownedTokens[tokenOwner].length();
59
74
  }
60
75
 
61
76
  /**
62
77
  * @inheritdoc ILSP8IdentifiableDigitalAsset
63
78
  */
64
- function tokenOwnerOf(bytes32 tokenId) public view virtual returns (address) {
79
+ function tokenOwnerOf(
80
+ bytes32 tokenId
81
+ ) public view virtual returns (address) {
65
82
  address tokenOwner = _tokenOwners[tokenId];
66
83
 
67
84
  if (tokenOwner == address(0)) {
@@ -74,7 +91,9 @@ abstract contract LSP8IdentifiableDigitalAssetCore is ILSP8IdentifiableDigitalAs
74
91
  /**
75
92
  * @inheritdoc ILSP8IdentifiableDigitalAsset
76
93
  */
77
- function tokenIdsOf(address tokenOwner) public view virtual returns (bytes32[] memory) {
94
+ function tokenIdsOf(
95
+ address tokenOwner
96
+ ) public view virtual returns (bytes32[] memory) {
78
97
  return _ownedTokens[tokenOwner].values();
79
98
  }
80
99
 
@@ -83,7 +102,10 @@ abstract contract LSP8IdentifiableDigitalAssetCore is ILSP8IdentifiableDigitalAs
83
102
  /**
84
103
  * @inheritdoc ILSP8IdentifiableDigitalAsset
85
104
  */
86
- function authorizeOperator(address operator, bytes32 tokenId) public virtual {
105
+ function authorizeOperator(
106
+ address operator,
107
+ bytes32 tokenId
108
+ ) public virtual {
87
109
  address tokenOwner = tokenOwnerOf(tokenId);
88
110
 
89
111
  if (tokenOwner != msg.sender) {
@@ -128,7 +150,10 @@ abstract contract LSP8IdentifiableDigitalAssetCore is ILSP8IdentifiableDigitalAs
128
150
  /**
129
151
  * @inheritdoc ILSP8IdentifiableDigitalAsset
130
152
  */
131
- function isOperatorFor(address operator, bytes32 tokenId) public view virtual returns (bool) {
153
+ function isOperatorFor(
154
+ address operator,
155
+ bytes32 tokenId
156
+ ) public view virtual returns (bool) {
132
157
  _existsOrError(tokenId);
133
158
 
134
159
  return _isOperatorOrOwner(operator, tokenId);
@@ -137,7 +162,9 @@ abstract contract LSP8IdentifiableDigitalAssetCore is ILSP8IdentifiableDigitalAs
137
162
  /**
138
163
  * @inheritdoc ILSP8IdentifiableDigitalAsset
139
164
  */
140
- function getOperatorsOf(bytes32 tokenId) public view virtual returns (address[] memory) {
165
+ function getOperatorsOf(
166
+ bytes32 tokenId
167
+ ) public view virtual returns (address[] memory) {
141
168
  _existsOrError(tokenId);
142
169
 
143
170
  return _operators[tokenId].values();
@@ -147,12 +174,10 @@ abstract contract LSP8IdentifiableDigitalAssetCore is ILSP8IdentifiableDigitalAs
147
174
  * @dev verifies if the `caller` is operator or owner for the `tokenId`
148
175
  * @return true if `caller` is either operator or owner
149
176
  */
150
- function _isOperatorOrOwner(address caller, bytes32 tokenId)
151
- internal
152
- view
153
- virtual
154
- returns (bool)
155
- {
177
+ function _isOperatorOrOwner(
178
+ address caller,
179
+ bytes32 tokenId
180
+ ) internal view virtual returns (bool) {
156
181
  address tokenOwner = tokenOwnerOf(tokenId);
157
182
 
158
183
  return (caller == tokenOwner || _operators[tokenId].contains(caller));
@@ -200,7 +225,13 @@ abstract contract LSP8IdentifiableDigitalAssetCore is ILSP8IdentifiableDigitalAs
200
225
  }
201
226
 
202
227
  for (uint256 i = 0; i < fromLength; ) {
203
- transfer(from[i], to[i], tokenId[i], allowNonLSP1Recipient[i], data[i]);
228
+ transfer(
229
+ from[i],
230
+ to[i],
231
+ tokenId[i],
232
+ allowNonLSP1Recipient[i],
233
+ data[i]
234
+ );
204
235
 
205
236
  unchecked {
206
237
  ++i;
@@ -224,14 +255,19 @@ abstract contract LSP8IdentifiableDigitalAssetCore is ILSP8IdentifiableDigitalAs
224
255
  /**
225
256
  * @dev clear all the operators for the `tokenId`
226
257
  */
227
- function _clearOperators(address tokenOwner, bytes32 tokenId) internal virtual {
258
+ function _clearOperators(
259
+ address tokenOwner,
260
+ bytes32 tokenId
261
+ ) internal virtual {
228
262
  // here is a good example of why having multiple operators will be expensive.. we
229
263
  // need to clear them on token transfer
230
264
  //
231
265
  // NOTE: this may cause a tx to fail if there is too many operators to clear, in which case
232
266
  // the tokenOwner needs to call `revokeOperator` until there is less operators to clear and
233
267
  // the desired `transfer` or `burn` call can succeed.
234
- EnumerableSet.AddressSet storage operatorsForTokenId = _operators[tokenId];
268
+ EnumerableSet.AddressSet storage operatorsForTokenId = _operators[
269
+ tokenId
270
+ ];
235
271
 
236
272
  uint256 operatorListLength = operatorsForTokenId.length();
237
273
  for (uint256 i = 0; i < operatorListLength; ) {
@@ -298,7 +334,14 @@ abstract contract LSP8IdentifiableDigitalAssetCore is ILSP8IdentifiableDigitalAs
298
334
  _ownedTokens[to].add(tokenId);
299
335
  _tokenOwners[tokenId] = to;
300
336
 
301
- emit Transfer(operator, address(0), to, tokenId, allowNonLSP1Recipient, data);
337
+ emit Transfer(
338
+ operator,
339
+ address(0),
340
+ to,
341
+ tokenId,
342
+ allowNonLSP1Recipient,
343
+ data
344
+ );
302
345
 
303
346
  bytes memory lsp1Data = abi.encodePacked(address(0), to, tokenId, data);
304
347
  _notifyTokenReceiver(to, allowNonLSP1Recipient, lsp1Data);
@@ -329,7 +372,12 @@ abstract contract LSP8IdentifiableDigitalAssetCore is ILSP8IdentifiableDigitalAs
329
372
 
330
373
  emit Transfer(operator, tokenOwner, address(0), tokenId, false, data);
331
374
 
332
- bytes memory lsp1Data = abi.encodePacked(tokenOwner, address(0), tokenId, data);
375
+ bytes memory lsp1Data = abi.encodePacked(
376
+ tokenOwner,
377
+ address(0),
378
+ tokenId,
379
+ data
380
+ );
333
381
  _notifyTokenSender(tokenOwner, lsp1Data);
334
382
  }
335
383
 
@@ -403,9 +451,20 @@ abstract contract LSP8IdentifiableDigitalAssetCore is ILSP8IdentifiableDigitalAs
403
451
  * @dev An attempt is made to notify the token sender about the `tokenId` changing owners using
404
452
  * LSP1 interface.
405
453
  */
406
- function _notifyTokenSender(address from, bytes memory lsp1Data) internal virtual {
407
- if (ERC165Checker.supportsERC165InterfaceUnchecked(from, _INTERFACEID_LSP1)) {
408
- ILSP1UniversalReceiver(from).universalReceiver(_TYPEID_LSP8_TOKENSSENDER, lsp1Data);
454
+ function _notifyTokenSender(
455
+ address from,
456
+ bytes memory lsp1Data
457
+ ) internal virtual {
458
+ if (
459
+ ERC165Checker.supportsERC165InterfaceUnchecked(
460
+ from,
461
+ _INTERFACEID_LSP1
462
+ )
463
+ ) {
464
+ ILSP1UniversalReceiver(from).universalReceiver(
465
+ _TYPEID_LSP8_TOKENSSENDER,
466
+ lsp1Data
467
+ );
409
468
  }
410
469
  }
411
470
 
@@ -420,8 +479,16 @@ abstract contract LSP8IdentifiableDigitalAssetCore is ILSP8IdentifiableDigitalAs
420
479
  bool allowNonLSP1Recipient,
421
480
  bytes memory lsp1Data
422
481
  ) internal virtual {
423
- if (ERC165Checker.supportsERC165InterfaceUnchecked(to, _INTERFACEID_LSP1)) {
424
- ILSP1UniversalReceiver(to).universalReceiver(_TYPEID_LSP8_TOKENSRECIPIENT, lsp1Data);
482
+ if (
483
+ ERC165Checker.supportsERC165InterfaceUnchecked(
484
+ to,
485
+ _INTERFACEID_LSP1
486
+ )
487
+ ) {
488
+ ILSP1UniversalReceiver(to).universalReceiver(
489
+ _TYPEID_LSP8_TOKENSRECIPIENT,
490
+ lsp1Data
491
+ );
425
492
  } else if (!allowNonLSP1Recipient) {
426
493
  if (to.code.length > 0) {
427
494
  revert LSP8NotifyTokenReceiverContractMissingLSP1Interface(to);
@@ -6,7 +6,9 @@ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
6
6
 
7
7
  // modules
8
8
  import {ERC725YCore} from "@erc725/smart-contracts/contracts/ERC725YCore.sol";
9
- import {LSP8IdentifiableDigitalAssetCore} from "./LSP8IdentifiableDigitalAssetCore.sol";
9
+ import {
10
+ LSP8IdentifiableDigitalAssetCore
11
+ } from "./LSP8IdentifiableDigitalAssetCore.sol";
10
12
  import {
11
13
  LSP4DigitalAssetMetadataInitAbstract
12
14
  } from "../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol";
@@ -28,19 +30,21 @@ abstract contract LSP8IdentifiableDigitalAssetInitAbstract is
28
30
  string memory symbol_,
29
31
  address newOwner_
30
32
  ) internal virtual override onlyInitializing {
31
- LSP4DigitalAssetMetadataInitAbstract._initialize(name_, symbol_, newOwner_);
33
+ LSP4DigitalAssetMetadataInitAbstract._initialize(
34
+ name_,
35
+ symbol_,
36
+ newOwner_
37
+ );
32
38
  }
33
39
 
34
40
  /**
35
41
  * @dev See {IERC165-supportsInterface}.
36
42
  */
37
- function supportsInterface(bytes4 interfaceId)
38
- public
39
- view
40
- virtual
41
- override(IERC165, ERC725YCore)
42
- returns (bool)
43
- {
44
- return interfaceId == _INTERFACEID_LSP8 || super.supportsInterface(interfaceId);
43
+ function supportsInterface(
44
+ bytes4 interfaceId
45
+ ) public view virtual override(IERC165, ERC725YCore) returns (bool) {
46
+ return
47
+ interfaceId == _INTERFACEID_LSP8 ||
48
+ super.supportsInterface(interfaceId);
45
49
  }
46
50
  }
@@ -2,7 +2,9 @@
2
2
  pragma solidity ^0.8.4;
3
3
 
4
4
  // interfaces
5
- import {ILSP8IdentifiableDigitalAsset} from "../ILSP8IdentifiableDigitalAsset.sol";
5
+ import {
6
+ ILSP8IdentifiableDigitalAsset
7
+ } from "../ILSP8IdentifiableDigitalAsset.sol";
6
8
 
7
9
  // --- ERC165 interface ids
8
10
  bytes4 constant _INTERFACEID_ERC721 = 0x80ac58cd;
@@ -19,7 +21,11 @@ interface ILSP8CompatibleERC721 is ILSP8IdentifiableDigitalAsset {
19
21
  * @param to The receiving address
20
22
  * @param tokenId The tokenId to transfer
21
23
  */
22
- event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
24
+ event Transfer(
25
+ address indexed from,
26
+ address indexed to,
27
+ uint256 indexed tokenId
28
+ );
23
29
 
24
30
  /**
25
31
  * @notice To provide compatibility with indexing ERC721 events.
@@ -28,13 +34,21 @@ interface ILSP8CompatibleERC721 is ILSP8IdentifiableDigitalAsset {
28
34
  * @param approved The address set as operator
29
35
  * @param tokenId The approved tokenId
30
36
  */
31
- event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
37
+ event Approval(
38
+ address indexed owner,
39
+ address indexed approved,
40
+ uint256 indexed tokenId
41
+ );
32
42
 
33
43
  /**
34
44
  * @dev This emits when an operator is enabled or disabled for an owner.
35
45
  * The operator can manage all NFTs of the owner.
36
46
  */
37
- event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
47
+ event ApprovalForAll(
48
+ address indexed owner,
49
+ address indexed operator,
50
+ bool approved
51
+ );
38
52
 
39
53
  /**
40
54
  * @dev Compatible with ERC721 transferFrom.
@@ -42,11 +56,7 @@ interface ILSP8CompatibleERC721 is ILSP8IdentifiableDigitalAsset {
42
56
  * @param to The receiving address
43
57
  * @param tokenId The tokenId to transfer
44
58
  */
45
- function transferFrom(
46
- address from,
47
- address to,
48
- uint256 tokenId
49
- ) external;
59
+ function transferFrom(address from, address to, uint256 tokenId) external;
50
60
 
51
61
  /**
52
62
  * @dev Compatible with ERC721 transferFrom.
@@ -109,7 +119,10 @@ interface ILSP8CompatibleERC721 is ILSP8IdentifiableDigitalAsset {
109
119
  * @param operator The operator address to query
110
120
  * @return Returns if the `operator` is allowed to manage all of the assets of `owner`
111
121
  */
112
- function isApprovedForAll(address owner, address operator) external view returns (bool);
122
+ function isApprovedForAll(
123
+ address owner,
124
+ address operator
125
+ ) external view returns (bool);
113
126
 
114
127
  /*
115
128
  * @dev Compatible with ERC721Metadata tokenURI.
@@ -1,7 +1,9 @@
1
1
  // SPDX-License-Identifier: MIT
2
2
  pragma solidity ^0.8.4;
3
3
 
4
- import {LSP8IdentifiableDigitalAssetCore} from "../LSP8IdentifiableDigitalAssetCore.sol";
4
+ import {
5
+ LSP8IdentifiableDigitalAssetCore
6
+ } from "../LSP8IdentifiableDigitalAssetCore.sol";
5
7
 
6
8
  // errors
7
9
  import {LSP8NotTokenOperator} from "../LSP8Errors.sol";
@@ -3,7 +3,9 @@
3
3
  pragma solidity ^0.8.4;
4
4
 
5
5
  // modules
6
- import {LSP8IdentifiableDigitalAsset} from "../LSP8IdentifiableDigitalAsset.sol";
6
+ import {
7
+ LSP8IdentifiableDigitalAsset
8
+ } from "../LSP8IdentifiableDigitalAsset.sol";
7
9
 
8
10
  /**
9
11
  * @dev LSP8 extension, adds token supply cap.
@@ -10,7 +10,9 @@ import {
10
10
  /**
11
11
  * @dev LSP8 extension, adds token supply cap.
12
12
  */
13
- abstract contract LSP8CappedSupplyInitAbstract is LSP8IdentifiableDigitalAssetInitAbstract {
13
+ abstract contract LSP8CappedSupplyInitAbstract is
14
+ LSP8IdentifiableDigitalAssetInitAbstract
15
+ {
14
16
  // --- Errors
15
17
  error LSP8CappedSupplyRequired();
16
18
  error LSP8CappedSupplyCannotMintOverCap();
@@ -18,7 +20,9 @@ abstract contract LSP8CappedSupplyInitAbstract is LSP8IdentifiableDigitalAssetIn
18
20
  // --- Storage
19
21
  uint256 private _tokenSupplyCap;
20
22
 
21
- function _initialize(uint256 tokenSupplyCap_) internal virtual onlyInitializing {
23
+ function _initialize(
24
+ uint256 tokenSupplyCap_
25
+ ) internal virtual onlyInitializing {
22
26
  if (tokenSupplyCap_ == 0) {
23
27
  revert LSP8CappedSupplyRequired();
24
28
  }
@@ -3,29 +3,44 @@ pragma solidity ^0.8.12;
3
3
 
4
4
  // interfaces
5
5
  import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
6
- import {IERC721Receiver} from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
6
+ import {
7
+ IERC721Receiver
8
+ } from "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
7
9
  import {ILSP8CompatibleERC721} from "./ILSP8CompatibleERC721.sol";
8
- import {ILSP8IdentifiableDigitalAsset} from "../ILSP8IdentifiableDigitalAsset.sol";
10
+ import {
11
+ ILSP8IdentifiableDigitalAsset
12
+ } from "../ILSP8IdentifiableDigitalAsset.sol";
9
13
 
10
14
  // libraries
11
- import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
15
+ import {
16
+ EnumerableSet
17
+ } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
12
18
  import {BytesLib} from "solidity-bytes-utils/contracts/BytesLib.sol";
13
19
 
14
20
  // modules
15
- import {LSP4Compatibility} from "../../LSP4DigitalAssetMetadata/LSP4Compatibility.sol";
21
+ import {
22
+ LSP4Compatibility
23
+ } from "../../LSP4DigitalAssetMetadata/LSP4Compatibility.sol";
16
24
  import {
17
25
  LSP8IdentifiableDigitalAsset,
18
26
  LSP4DigitalAssetMetadata,
19
27
  ERC725YCore
20
28
  } from "../LSP8IdentifiableDigitalAsset.sol";
21
- import {LSP8IdentifiableDigitalAssetCore} from "../LSP8IdentifiableDigitalAssetCore.sol";
29
+ import {
30
+ LSP8IdentifiableDigitalAssetCore
31
+ } from "../LSP8IdentifiableDigitalAssetCore.sol";
22
32
 
23
33
  // errors
24
34
  import "../LSP8Errors.sol";
25
35
 
26
36
  // constants
27
- import {_LSP4_METADATA_KEY} from "../../LSP4DigitalAssetMetadata/LSP4Constants.sol";
28
- import {_INTERFACEID_ERC721, _INTERFACEID_ERC721METADATA} from "././ILSP8CompatibleERC721.sol";
37
+ import {
38
+ _LSP4_METADATA_KEY
39
+ } from "../../LSP4DigitalAssetMetadata/LSP4Constants.sol";
40
+ import {
41
+ _INTERFACEID_ERC721,
42
+ _INTERFACEID_ERC721METADATA
43
+ } from "././ILSP8CompatibleERC721.sol";
29
44
 
30
45
  /**
31
46
  * @dev LSP8 extension, for compatibility for clients / tools that expect ERC721.
@@ -58,7 +73,9 @@ abstract contract LSP8CompatibleERC721 is
58
73
  /**
59
74
  * @dev See {IERC165-supportsInterface}.
60
75
  */
61
- function supportsInterface(bytes4 interfaceId)
76
+ function supportsInterface(
77
+ bytes4 interfaceId
78
+ )
62
79
  public
63
80
  view
64
81
  virtual
@@ -82,7 +99,11 @@ abstract contract LSP8CompatibleERC721 is
82
99
  // offset = bytes4(hashSig) + bytes32(contentHash) -> 4 + 32 = 36
83
100
  uint256 offset = 36;
84
101
 
85
- bytes memory uriBytes = BytesLib.slice(data, offset, data.length - offset);
102
+ bytes memory uriBytes = BytesLib.slice(
103
+ data,
104
+ offset,
105
+ data.length - offset
106
+ );
86
107
  return string(uriBytes);
87
108
  }
88
109
 
@@ -96,7 +117,9 @@ abstract contract LSP8CompatibleERC721 is
96
117
  /**
97
118
  * @inheritdoc ILSP8CompatibleERC721
98
119
  */
99
- function getApproved(uint256 tokenId) public view virtual returns (address) {
120
+ function getApproved(
121
+ uint256 tokenId
122
+ ) public view virtual returns (address) {
100
123
  bytes32 tokenIdAsBytes32 = bytes32(tokenId);
101
124
  _existsOrError(tokenIdAsBytes32);
102
125
 
@@ -119,12 +142,10 @@ abstract contract LSP8CompatibleERC721 is
119
142
  /*
120
143
  * @inheritdoc ILSP8CompatibleERC721
121
144
  */
122
- function isApprovedForAll(address tokenOwner, address operator)
123
- public
124
- view
125
- virtual
126
- returns (bool)
127
- {
145
+ function isApprovedForAll(
146
+ address tokenOwner,
147
+ address operator
148
+ ) public view virtual returns (bool) {
128
149
  return _operatorApprovals[tokenOwner][operator];
129
150
  }
130
151
 
@@ -187,10 +208,16 @@ abstract contract LSP8CompatibleERC721 is
187
208
  /**
188
209
  * @inheritdoc ILSP8IdentifiableDigitalAsset
189
210
  */
190
- function authorizeOperator(address operator, bytes32 tokenId)
211
+ function authorizeOperator(
212
+ address operator,
213
+ bytes32 tokenId
214
+ )
191
215
  public
192
216
  virtual
193
- override(ILSP8IdentifiableDigitalAsset, LSP8IdentifiableDigitalAssetCore)
217
+ override(
218
+ ILSP8IdentifiableDigitalAsset,
219
+ LSP8IdentifiableDigitalAssetCore
220
+ )
194
221
  {
195
222
  super.authorizeOperator(operator, tokenId);
196
223
  emit Approval(tokenOwnerOf(tokenId), operator, uint256(tokenId));
@@ -205,7 +232,10 @@ abstract contract LSP8CompatibleERC721 is
205
232
  ) internal virtual override {
206
233
  address operator = msg.sender;
207
234
 
208
- if (!isApprovedForAll(from, operator) && !_isOperatorOrOwner(operator, tokenId)) {
235
+ if (
236
+ !isApprovedForAll(from, operator) &&
237
+ !_isOperatorOrOwner(operator, tokenId)
238
+ ) {
209
239
  revert LSP8NotTokenOperator(tokenId, operator);
210
240
  }
211
241
 
@@ -236,7 +266,10 @@ abstract contract LSP8CompatibleERC721 is
236
266
  super._mint(to, tokenId, allowNonLSP1Recipient, data);
237
267
  }
238
268
 
239
- function _burn(bytes32 tokenId, bytes memory data) internal virtual override {
269
+ function _burn(
270
+ bytes32 tokenId,
271
+ bytes memory data
272
+ ) internal virtual override {
240
273
  address tokenOwner = tokenOwnerOf(tokenId);
241
274
 
242
275
  emit Transfer(tokenOwner, address(0), uint256(tokenId));
@@ -253,7 +286,10 @@ abstract contract LSP8CompatibleERC721 is
253
286
  address operator,
254
287
  bool approved
255
288
  ) internal virtual {
256
- require(tokensOwner != operator, "LSP8CompatibleERC721: approve to caller");
289
+ require(
290
+ tokensOwner != operator,
291
+ "LSP8CompatibleERC721: approve to caller"
292
+ );
257
293
  _operatorApprovals[tokensOwner][operator] = approved;
258
294
  emit ApprovalForAll(tokensOwner, operator, approved);
259
295
  }
@@ -275,13 +311,20 @@ abstract contract LSP8CompatibleERC721 is
275
311
  bytes memory data
276
312
  ) private returns (bool) {
277
313
  if (to.code.length > 0) {
278
- try IERC721Receiver(to).onERC721Received(msg.sender, from, tokenId, data) returns (
279
- bytes4 retval
280
- ) {
314
+ try
315
+ IERC721Receiver(to).onERC721Received(
316
+ msg.sender,
317
+ from,
318
+ tokenId,
319
+ data
320
+ )
321
+ returns (bytes4 retval) {
281
322
  return retval == IERC721Receiver.onERC721Received.selector;
282
323
  } catch (bytes memory reason) {
283
324
  if (reason.length == 0) {
284
- revert("LSP8CompatibleERC721: transfer to non ERC721Receiver implementer");
325
+ revert(
326
+ "LSP8CompatibleERC721: transfer to non ERC721Receiver implementer"
327
+ );
285
328
  } else {
286
329
  // solhint-disable no-inline-assembly
287
330
  /// @solidity memory-safe-assembly
@@ -295,11 +338,10 @@ abstract contract LSP8CompatibleERC721 is
295
338
  }
296
339
  }
297
340
 
298
- function _setData(bytes32 key, bytes memory value)
299
- internal
300
- virtual
301
- override(LSP4DigitalAssetMetadata, ERC725YCore)
302
- {
341
+ function _setData(
342
+ bytes32 key,
343
+ bytes memory value
344
+ ) internal virtual override(LSP4DigitalAssetMetadata, ERC725YCore) {
303
345
  super._setData(key, value);
304
346
  }
305
347
  }