@lukso/lsp-smart-contracts 0.10.0 → 0.10.2

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 (125) hide show
  1. package/README.md +14 -1
  2. package/artifacts/Create2Factory.json +2 -2
  3. package/artifacts/LSP0ERC725Account.json +4 -4
  4. package/artifacts/LSP0ERC725AccountInit.json +4 -4
  5. package/artifacts/LSP11BasicSocialRecovery.json +2 -2
  6. package/artifacts/LSP11BasicSocialRecoveryInit.json +2 -2
  7. package/artifacts/LSP16UniversalFactory.json +27 -21
  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 +4 -4
  23. package/artifacts/UniversalProfileInit.json +4 -4
  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 +11 -6
  28. package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +256 -186
  29. package/contracts/LSP0ERC725Account/LSP0ERC725AccountInit.sol +20 -6
  30. package/contracts/LSP0ERC725Account/LSP0ERC725AccountInitAbstract.sol +23 -9
  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 +333 -128
  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 +14 -5
  108. package/contracts/UniversalProfileInit.sol +17 -5
  109. package/contracts/UniversalProfileInitAbstract.sol +17 -9
  110. package/devdocs/LSP0ERC725Account.json +33 -19
  111. package/devdocs/LSP0ERC725AccountInit.json +33 -20
  112. package/devdocs/LSP16UniversalFactory.json +87 -22
  113. package/devdocs/LSP9Vault.json +3 -3
  114. package/devdocs/LSP9VaultInit.json +3 -3
  115. package/devdocs/UniversalProfile.json +32 -18
  116. package/devdocs/UniversalProfileInit.json +33 -19
  117. package/dist/constants.cjs.js +310 -182
  118. package/dist/constants.d.ts +178 -48
  119. package/dist/constants.es.js +310 -182
  120. package/package.json +19 -17
  121. package/userdocs/LSP0ERC725Account.json +5 -2
  122. package/userdocs/LSP0ERC725AccountInit.json +8 -2
  123. package/userdocs/UniversalProfile.json +3 -3
  124. package/userdocs/UniversalProfileInit.json +6 -3
  125. package/contracts/Custom/EIP191Signer.sol +0 -12
@@ -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
  LSP8IdentifiableDigitalAssetInitAbstract,
18
26
  LSP4DigitalAssetMetadataInitAbstract,
19
27
  ERC725YCore
20
28
  } from "../LSP8IdentifiableDigitalAssetInitAbstract.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.
@@ -48,13 +63,19 @@ abstract contract LSP8CompatibleERC721InitAbstract is
48
63
  string memory symbol_,
49
64
  address newOwner_
50
65
  ) internal virtual override onlyInitializing {
51
- LSP8IdentifiableDigitalAssetInitAbstract._initialize(name_, symbol_, newOwner_);
66
+ LSP8IdentifiableDigitalAssetInitAbstract._initialize(
67
+ name_,
68
+ symbol_,
69
+ newOwner_
70
+ );
52
71
  }
53
72
 
54
73
  /**
55
74
  * @dev See {IERC165-supportsInterface}.
56
75
  */
57
- function supportsInterface(bytes4 interfaceId)
76
+ function supportsInterface(
77
+ bytes4 interfaceId
78
+ )
58
79
  public
59
80
  view
60
81
  virtual
@@ -78,7 +99,11 @@ abstract contract LSP8CompatibleERC721InitAbstract is
78
99
  // offset = bytes4(hashSig) + bytes32(contentHash) -> 4 + 32 = 36
79
100
  uint256 offset = 36;
80
101
 
81
- 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
+ );
82
107
  return string(uriBytes);
83
108
  }
84
109
 
@@ -92,7 +117,9 @@ abstract contract LSP8CompatibleERC721InitAbstract is
92
117
  /**
93
118
  * @inheritdoc ILSP8CompatibleERC721
94
119
  */
95
- function getApproved(uint256 tokenId) public view virtual returns (address) {
120
+ function getApproved(
121
+ uint256 tokenId
122
+ ) public view virtual returns (address) {
96
123
  bytes32 tokenIdAsBytes32 = bytes32(tokenId);
97
124
  _existsOrError(tokenIdAsBytes32);
98
125
 
@@ -115,12 +142,10 @@ abstract contract LSP8CompatibleERC721InitAbstract is
115
142
  /*
116
143
  * @inheritdoc ILSP8CompatibleERC721
117
144
  */
118
- function isApprovedForAll(address tokenOwner, address operator)
119
- public
120
- view
121
- virtual
122
- returns (bool)
123
- {
145
+ function isApprovedForAll(
146
+ address tokenOwner,
147
+ address operator
148
+ ) public view virtual returns (bool) {
124
149
  return _operatorApprovals[tokenOwner][operator];
125
150
  }
126
151
 
@@ -183,10 +208,16 @@ abstract contract LSP8CompatibleERC721InitAbstract is
183
208
  /**
184
209
  * @inheritdoc ILSP8IdentifiableDigitalAsset
185
210
  */
186
- function authorizeOperator(address operator, bytes32 tokenId)
211
+ function authorizeOperator(
212
+ address operator,
213
+ bytes32 tokenId
214
+ )
187
215
  public
188
216
  virtual
189
- override(ILSP8IdentifiableDigitalAsset, LSP8IdentifiableDigitalAssetCore)
217
+ override(
218
+ ILSP8IdentifiableDigitalAsset,
219
+ LSP8IdentifiableDigitalAssetCore
220
+ )
190
221
  {
191
222
  super.authorizeOperator(operator, tokenId);
192
223
  emit Approval(tokenOwnerOf(tokenId), operator, uint256(tokenId));
@@ -201,7 +232,10 @@ abstract contract LSP8CompatibleERC721InitAbstract is
201
232
  ) internal virtual override {
202
233
  address operator = msg.sender;
203
234
 
204
- if (!isApprovedForAll(from, operator) && !_isOperatorOrOwner(operator, tokenId)) {
235
+ if (
236
+ !isApprovedForAll(from, operator) &&
237
+ !_isOperatorOrOwner(operator, tokenId)
238
+ ) {
205
239
  revert LSP8NotTokenOperator(tokenId, operator);
206
240
  }
207
241
 
@@ -232,7 +266,10 @@ abstract contract LSP8CompatibleERC721InitAbstract is
232
266
  super._mint(to, tokenId, allowNonLSP1Recipient, data);
233
267
  }
234
268
 
235
- function _burn(bytes32 tokenId, bytes memory data) internal virtual override {
269
+ function _burn(
270
+ bytes32 tokenId,
271
+ bytes memory data
272
+ ) internal virtual override {
236
273
  address tokenOwner = tokenOwnerOf(tokenId);
237
274
 
238
275
  emit Transfer(tokenOwner, address(0), uint256(tokenId));
@@ -249,7 +286,10 @@ abstract contract LSP8CompatibleERC721InitAbstract is
249
286
  address operator,
250
287
  bool approved
251
288
  ) internal virtual {
252
- require(tokensOwner != operator, "LSP8CompatibleERC721: approve to caller");
289
+ require(
290
+ tokensOwner != operator,
291
+ "LSP8CompatibleERC721: approve to caller"
292
+ );
253
293
  _operatorApprovals[tokensOwner][operator] = approved;
254
294
  emit ApprovalForAll(tokensOwner, operator, approved);
255
295
  }
@@ -271,13 +311,20 @@ abstract contract LSP8CompatibleERC721InitAbstract is
271
311
  bytes memory data
272
312
  ) private returns (bool) {
273
313
  if (to.code.length > 0) {
274
- try IERC721Receiver(to).onERC721Received(msg.sender, from, tokenId, data) returns (
275
- bytes4 retval
276
- ) {
314
+ try
315
+ IERC721Receiver(to).onERC721Received(
316
+ msg.sender,
317
+ from,
318
+ tokenId,
319
+ data
320
+ )
321
+ returns (bytes4 retval) {
277
322
  return retval == IERC721Receiver.onERC721Received.selector;
278
323
  } catch (bytes memory reason) {
279
324
  if (reason.length == 0) {
280
- revert("LSP8CompatibleERC721: transfer to non ERC721Receiver implementer");
325
+ revert(
326
+ "LSP8CompatibleERC721: transfer to non ERC721Receiver implementer"
327
+ );
281
328
  } else {
282
329
  // solhint-disable no-inline-assembly
283
330
  /// @solidity memory-safe-assembly
@@ -291,7 +338,10 @@ abstract contract LSP8CompatibleERC721InitAbstract is
291
338
  }
292
339
  }
293
340
 
294
- function _setData(bytes32 key, bytes memory value)
341
+ function _setData(
342
+ bytes32 key,
343
+ bytes memory value
344
+ )
295
345
  internal
296
346
  virtual
297
347
  override(LSP4DigitalAssetMetadataInitAbstract, ERC725YCore)
@@ -3,8 +3,12 @@
3
3
  pragma solidity ^0.8.4;
4
4
 
5
5
  // modules
6
- import {LSP8IdentifiableDigitalAsset} from "../LSP8IdentifiableDigitalAsset.sol";
7
- import {LSP8IdentifiableDigitalAssetCore} from "../LSP8IdentifiableDigitalAssetCore.sol";
6
+ import {
7
+ LSP8IdentifiableDigitalAsset
8
+ } from "../LSP8IdentifiableDigitalAsset.sol";
9
+ import {
10
+ LSP8IdentifiableDigitalAssetCore
11
+ } from "../LSP8IdentifiableDigitalAssetCore.sol";
8
12
 
9
13
  /**
10
14
  * @dev LSP8 extension.
@@ -6,12 +6,16 @@ pragma solidity ^0.8.4;
6
6
  import {
7
7
  LSP8IdentifiableDigitalAssetInitAbstract
8
8
  } from "../LSP8IdentifiableDigitalAssetInitAbstract.sol";
9
- import {LSP8IdentifiableDigitalAssetCore} from "../LSP8IdentifiableDigitalAssetCore.sol";
9
+ import {
10
+ LSP8IdentifiableDigitalAssetCore
11
+ } from "../LSP8IdentifiableDigitalAssetCore.sol";
10
12
 
11
13
  /**
12
14
  * @dev LSP8 extension.
13
15
  */
14
- abstract contract LSP8EnumerableInitAbstract is LSP8IdentifiableDigitalAssetInitAbstract {
16
+ abstract contract LSP8EnumerableInitAbstract is
17
+ LSP8IdentifiableDigitalAssetInitAbstract
18
+ {
15
19
  // Mapping from token index to token id
16
20
  mapping(uint256 => bytes32) private _indexToken;
17
21
 
@@ -3,7 +3,9 @@
3
3
  pragma solidity ^0.8.4;
4
4
 
5
5
  // interfaces
6
- import {ILSP8IdentifiableDigitalAsset} from "../ILSP8IdentifiableDigitalAsset.sol";
6
+ import {
7
+ ILSP8IdentifiableDigitalAsset
8
+ } from "../ILSP8IdentifiableDigitalAsset.sol";
7
9
 
8
10
  /**
9
11
  * @dev LSP8 extension, mintable.
@@ -6,7 +6,9 @@ import {
6
6
  LSP8CompatibleERC721MintableInitAbstract
7
7
  } from "./LSP8CompatibleERC721MintableInitAbstract.sol";
8
8
 
9
- contract LSP8CompatibleERC721MintableInit is LSP8CompatibleERC721MintableInitAbstract {
9
+ contract LSP8CompatibleERC721MintableInit is
10
+ LSP8CompatibleERC721MintableInitAbstract
11
+ {
10
12
  /**
11
13
  * @dev initialize (= lock) base implementation contract on deployment
12
14
  */
@@ -25,6 +27,10 @@ contract LSP8CompatibleERC721MintableInit is LSP8CompatibleERC721MintableInitAbs
25
27
  string memory symbol_,
26
28
  address newOwner_
27
29
  ) external virtual initializer {
28
- LSP8CompatibleERC721MintableInitAbstract._initialize(name_, symbol_, newOwner_);
30
+ LSP8CompatibleERC721MintableInitAbstract._initialize(
31
+ name_,
32
+ symbol_,
33
+ newOwner_
34
+ );
29
35
  }
30
36
  }
@@ -2,9 +2,13 @@
2
2
  pragma solidity ^0.8.12;
3
3
 
4
4
  // modules
5
- import {LSP8CompatibleERC721InitAbstract} from "../extensions/LSP8CompatibleERC721InitAbstract.sol";
5
+ import {
6
+ LSP8CompatibleERC721InitAbstract
7
+ } from "../extensions/LSP8CompatibleERC721InitAbstract.sol";
6
8
 
7
- contract LSP8CompatibleERC721MintableInitAbstract is LSP8CompatibleERC721InitAbstract {
9
+ contract LSP8CompatibleERC721MintableInitAbstract is
10
+ LSP8CompatibleERC721InitAbstract
11
+ {
8
12
  /**
9
13
  * @inheritdoc LSP8CompatibleERC721InitAbstract
10
14
  */
@@ -6,7 +6,9 @@ pragma solidity ^0.8.4;
6
6
  import {ILSP8Mintable} from "./ILSP8Mintable.sol";
7
7
 
8
8
  // modules
9
- import {LSP8IdentifiableDigitalAsset} from "../LSP8IdentifiableDigitalAsset.sol";
9
+ import {
10
+ LSP8IdentifiableDigitalAsset
11
+ } from "../LSP8IdentifiableDigitalAsset.sol";
10
12
 
11
13
  /**
12
14
  * @dev LSP8 extension.
@@ -21,7 +21,11 @@ abstract contract LSP8MintableInitAbstract is
21
21
  string memory symbol_,
22
22
  address newOwner_
23
23
  ) internal virtual override onlyInitializing {
24
- LSP8IdentifiableDigitalAssetInitAbstract._initialize(name_, symbol_, newOwner_);
24
+ LSP8IdentifiableDigitalAssetInitAbstract._initialize(
25
+ name_,
26
+ symbol_,
27
+ newOwner_
28
+ );
25
29
  }
26
30
 
27
31
  /**
@@ -3,13 +3,19 @@ pragma solidity ^0.8.4;
3
3
 
4
4
  // interfaces
5
5
  import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
6
- import {IERC725X} from "@erc725/smart-contracts/contracts/interfaces/IERC725X.sol";
7
- import {IERC725Y} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
8
- import {ILSP1UniversalReceiver} from "../LSP1UniversalReceiver/ILSP1UniversalReceiver.sol";
6
+ import {
7
+ IERC725X
8
+ } from "@erc725/smart-contracts/contracts/interfaces/IERC725X.sol";
9
+ import {
10
+ IERC725Y
11
+ } from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
12
+ import {
13
+ ILSP1UniversalReceiver
14
+ } from "../LSP1UniversalReceiver/ILSP1UniversalReceiver.sol";
9
15
  import {ILSP14Ownable2Step} from "../LSP14Ownable2Step/ILSP14Ownable2Step.sol";
10
16
 
11
17
  /**
12
- * @title Interface of LSP9Vault built on top of ERC725, LSP1UniversalReceiver
18
+ * @title Interface of LSP9 - Vault standard, a blockchain vault that can hold assets and interact with other smart contracts.
13
19
  * @dev this interface implicitly inherits: IERC165, IERC725X, IERC725Y, ILSP1UniversalReceiver, ILSP14Ownable2Step
14
20
  */
15
21
  interface ILSP9Vault {
@@ -23,5 +29,7 @@ interface ILSP9Vault {
23
29
  /**
24
30
  * @dev Receives and executes a batch of function calls on this contract.
25
31
  */
26
- function batchCalls(bytes[] calldata data) external returns (bytes[] memory results);
32
+ function batchCalls(
33
+ bytes[] calldata data
34
+ ) external returns (bytes[] memory results);
27
35
  }
@@ -2,7 +2,9 @@
2
2
  pragma solidity ^0.8.4;
3
3
 
4
4
  // modules
5
- import {OwnableUnset} from "@erc725/smart-contracts/contracts/custom/OwnableUnset.sol";
5
+ import {
6
+ OwnableUnset
7
+ } from "@erc725/smart-contracts/contracts/custom/OwnableUnset.sol";
6
8
  import {LSP9VaultCore} from "./LSP9VaultCore.sol";
7
9
 
8
10
  // libraries
@@ -33,7 +35,10 @@ contract LSP9Vault is LSP9VaultCore {
33
35
  OwnableUnset._setOwner(newOwner);
34
36
 
35
37
  // set key SupportedStandards:LSP9Vault
36
- _setData(_LSP9_SUPPORTED_STANDARDS_KEY, _LSP9_SUPPORTED_STANDARDS_VALUE);
38
+ _setData(
39
+ _LSP9_SUPPORTED_STANDARDS_KEY,
40
+ _LSP9_SUPPORTED_STANDARDS_VALUE
41
+ );
37
42
 
38
43
  newOwner.tryNotifyUniversalReceiver(
39
44
  _TYPEID_LSP9_OwnershipTransferred_RecipientNotification,
@@ -2,21 +2,33 @@
2
2
  pragma solidity ^0.8.4;
3
3
 
4
4
  // interfaces
5
- import {ILSP1UniversalReceiver} from "../LSP1UniversalReceiver/ILSP1UniversalReceiver.sol";
5
+ import {
6
+ ILSP1UniversalReceiver
7
+ } from "../LSP1UniversalReceiver/ILSP1UniversalReceiver.sol";
6
8
  import {ILSP9Vault} from "./ILSP9Vault.sol";
7
9
 
8
10
  // libraries
9
11
  import {BytesLib} from "solidity-bytes-utils/contracts/BytesLib.sol";
10
12
 
11
13
  import {Address} from "@openzeppelin/contracts/utils/Address.sol";
12
- import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
14
+ import {
15
+ ERC165Checker
16
+ } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
13
17
  import {LSP1Utils} from "../LSP1UniversalReceiver/LSP1Utils.sol";
14
18
  import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";
15
19
 
16
20
  // modules
17
- import {ERC725XCore, IERC725X} from "@erc725/smart-contracts/contracts/ERC725XCore.sol";
18
- import {ERC725YCore, IERC725Y} from "@erc725/smart-contracts/contracts/ERC725YCore.sol";
19
- import {OwnableUnset} from "@erc725/smart-contracts/contracts/custom/OwnableUnset.sol";
21
+ import {
22
+ ERC725XCore,
23
+ IERC725X
24
+ } from "@erc725/smart-contracts/contracts/ERC725XCore.sol";
25
+ import {
26
+ ERC725YCore,
27
+ IERC725Y
28
+ } from "@erc725/smart-contracts/contracts/ERC725YCore.sol";
29
+ import {
30
+ OwnableUnset
31
+ } from "@erc725/smart-contracts/contracts/custom/OwnableUnset.sol";
20
32
  import {LSP14Ownable2Step} from "../LSP14Ownable2Step/LSP14Ownable2Step.sol";
21
33
  import {LSP17Extendable} from "../LSP17ContractExtension/LSP17Extendable.sol";
22
34
 
@@ -34,7 +46,9 @@ import {
34
46
  _LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY
35
47
  } from "../LSP1UniversalReceiver/LSP1Constants.sol";
36
48
 
37
- import {_LSP6KEY_ADDRESSPERMISSIONS_PREFIX} from "../LSP6KeyManager/LSP6Constants.sol";
49
+ import {
50
+ _LSP6KEY_ADDRESSPERMISSIONS_PREFIX
51
+ } from "../LSP6KeyManager/LSP6Constants.sol";
38
52
  import {
39
53
  _INTERFACEID_LSP9,
40
54
  _TYPEID_LSP9_OwnershipTransferStarted,
@@ -42,7 +56,9 @@ import {
42
56
  _TYPEID_LSP9_OwnershipTransferred_RecipientNotification
43
57
  } from "./LSP9Constants.sol";
44
58
  import {_INTERFACEID_LSP14} from "../LSP14Ownable2Step/LSP14Constants.sol";
45
- import {_LSP17_EXTENSION_PREFIX} from "../LSP17ContractExtension/LSP17Constants.sol";
59
+ import {
60
+ _LSP17_EXTENSION_PREFIX
61
+ } from "../LSP17ContractExtension/LSP17Constants.sol";
46
62
 
47
63
  // errors
48
64
  import "./LSP9Errors.sol";
@@ -126,7 +142,8 @@ contract LSP9VaultCore is
126
142
  if (msg.sig == bytes4(0) && extension == address(0)) return;
127
143
 
128
144
  // if no extension was found, revert
129
- if (extension == address(0)) revert NoExtensionFoundForFunctionSelector(msg.sig);
145
+ if (extension == address(0))
146
+ revert NoExtensionFoundForFunctionSelector(msg.sig);
130
147
 
131
148
  // solhint-disable no-inline-assembly
132
149
  // if the extension was found, call the extension with the msg.data
@@ -142,7 +159,15 @@ contract LSP9VaultCore is
142
159
  mstore(add(calldatasize(), 20), callvalue())
143
160
 
144
161
  // Add 52 bytes for the msg.sender and msg.value appended at the end of the calldata
145
- let success := call(gas(), extension, 0, 0, add(calldatasize(), 52), 0, 0)
162
+ let success := call(
163
+ gas(),
164
+ extension,
165
+ 0,
166
+ 0,
167
+ add(calldatasize(), 52),
168
+ 0,
169
+ 0
170
+ )
146
171
 
147
172
  // Copy the returned data
148
173
  returndatacopy(0, 0, returndatasize())
@@ -164,13 +189,9 @@ contract LSP9VaultCore is
164
189
  *
165
190
  * If no extension is stored, returns the address(0)
166
191
  */
167
- function _getExtension(bytes4 functionSelector)
168
- internal
169
- view
170
- virtual
171
- override
172
- returns (address)
173
- {
192
+ function _getExtension(
193
+ bytes4 functionSelector
194
+ ) internal view virtual override returns (address) {
174
195
  bytes32 mappedExtensionDataKey = LSP2Utils.generateMappingKey(
175
196
  _LSP17_EXTENSION_PREFIX,
176
197
  functionSelector
@@ -190,7 +211,9 @@ contract LSP9VaultCore is
190
211
  * `supportsInterface` extension according to LSP17, and checks if the extension
191
212
  * implements the interface defined by `interfaceId`.
192
213
  */
193
- function supportsInterface(bytes4 interfaceId)
214
+ function supportsInterface(
215
+ bytes4 interfaceId
216
+ )
194
217
  public
195
218
  view
196
219
  virtual
@@ -208,10 +231,14 @@ contract LSP9VaultCore is
208
231
  /**
209
232
  * @dev Receives and executes a batch of function calls on this contract.
210
233
  */
211
- function batchCalls(bytes[] calldata data) public returns (bytes[] memory results) {
234
+ function batchCalls(
235
+ bytes[] calldata data
236
+ ) public returns (bytes[] memory results) {
212
237
  results = new bytes[](data.length);
213
238
  for (uint256 i; i < data.length; ) {
214
- (bool success, bytes memory result) = address(this).delegatecall(data[i]);
239
+ (bool success, bytes memory result) = address(this).delegatecall(
240
+ data[i]
241
+ );
215
242
 
216
243
  if (!success) {
217
244
  // Look for revert reason and bubble it up if present
@@ -279,7 +306,10 @@ contract LSP9VaultCore is
279
306
  *
280
307
  * Emits a {DataChanged} event.
281
308
  */
282
- function setData(bytes32 dataKey, bytes memory dataValue) public payable virtual override {
309
+ function setData(
310
+ bytes32 dataKey,
311
+ bytes memory dataValue
312
+ ) public payable virtual override {
283
313
  if (msg.value != 0) revert ERC725Y_MsgValueDisallowed();
284
314
 
285
315
  bool isURD = _validateAndIdentifyCaller();
@@ -303,12 +333,10 @@ contract LSP9VaultCore is
303
333
  *
304
334
  * Emits a {DataChanged} event.
305
335
  */
306
- function setDataBatch(bytes32[] memory dataKeys, bytes[] memory dataValues)
307
- public
308
- payable
309
- virtual
310
- override
311
- {
336
+ function setDataBatch(
337
+ bytes32[] memory dataKeys,
338
+ bytes[] memory dataValues
339
+ ) public payable virtual override {
312
340
  bool isURD = _validateAndIdentifyCaller();
313
341
  if (dataKeys.length != dataValues.length) {
314
342
  revert ERC725Y_DataKeysValuesLengthMismatch();
@@ -319,7 +347,8 @@ contract LSP9VaultCore is
319
347
  for (uint256 i = 0; i < dataKeys.length; ) {
320
348
  if (isURD) {
321
349
  if (
322
- bytes12(dataKeys[i]) == _LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX ||
350
+ bytes12(dataKeys[i]) ==
351
+ _LSP1_UNIVERSAL_RECEIVER_DELEGATE_PREFIX ||
323
352
  bytes6(dataKeys[i]) == _LSP6KEY_ADDRESSPERMISSIONS_PREFIX ||
324
353
  bytes12(dataKeys[i]) == _LSP17_EXTENSION_PREFIX
325
354
  ) {
@@ -357,20 +386,26 @@ contract LSP9VaultCore is
357
386
  * @return returnedValues The ABI encoded return value of the LSP1UniversalReceiverDelegate call
358
387
  * and the LSP1TypeIdDelegate call.
359
388
  */
360
- function universalReceiver(bytes32 typeId, bytes calldata receivedData)
361
- public
362
- payable
363
- virtual
364
- returns (bytes memory returnedValues)
365
- {
389
+ function universalReceiver(
390
+ bytes32 typeId,
391
+ bytes calldata receivedData
392
+ ) public payable virtual returns (bytes memory returnedValues) {
366
393
  if (msg.value != 0) emit ValueReceived(msg.sender, msg.value);
367
- bytes memory lsp1DelegateValue = _getData(_LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY);
394
+ bytes memory lsp1DelegateValue = _getData(
395
+ _LSP1_UNIVERSAL_RECEIVER_DELEGATE_KEY
396
+ );
368
397
  bytes memory resultDefaultDelegate;
369
398
 
370
399
  if (lsp1DelegateValue.length >= 20) {
371
- address universalReceiverDelegate = address(bytes20(lsp1DelegateValue));
400
+ address universalReceiverDelegate = address(
401
+ bytes20(lsp1DelegateValue)
402
+ );
372
403
 
373
- if (universalReceiverDelegate.supportsERC165InterfaceUnchecked(_INTERFACEID_LSP1)) {
404
+ if (
405
+ universalReceiverDelegate.supportsERC165InterfaceUnchecked(
406
+ _INTERFACEID_LSP1
407
+ )
408
+ ) {
374
409
  _reentrantDelegate = universalReceiverDelegate;
375
410
  resultDefaultDelegate = universalReceiverDelegate
376
411
  .callUniversalReceiverWithCallerInfos(
@@ -391,9 +426,15 @@ contract LSP9VaultCore is
391
426
  bytes memory resultTypeIdDelegate;
392
427
 
393
428
  if (lsp1TypeIdDelegateValue.length >= 20) {
394
- address universalReceiverDelegate = address(bytes20(lsp1TypeIdDelegateValue));
429
+ address universalReceiverDelegate = address(
430
+ bytes20(lsp1TypeIdDelegateValue)
431
+ );
395
432
 
396
- if (universalReceiverDelegate.supportsERC165InterfaceUnchecked(_INTERFACEID_LSP1)) {
433
+ if (
434
+ universalReceiverDelegate.supportsERC165InterfaceUnchecked(
435
+ _INTERFACEID_LSP1
436
+ )
437
+ ) {
397
438
  _reentrantDelegate = universalReceiverDelegate;
398
439
  resultTypeIdDelegate = universalReceiverDelegate
399
440
  .callUniversalReceiverWithCallerInfos(
@@ -406,8 +447,17 @@ contract LSP9VaultCore is
406
447
  }
407
448
 
408
449
  delete _reentrantDelegate;
409
- returnedValues = abi.encode(resultDefaultDelegate, resultTypeIdDelegate);
410
- emit UniversalReceiver(msg.sender, msg.value, typeId, receivedData, returnedValues);
450
+ returnedValues = abi.encode(
451
+ resultDefaultDelegate,
452
+ resultTypeIdDelegate
453
+ );
454
+ emit UniversalReceiver(
455
+ msg.sender,
456
+ msg.value,
457
+ typeId,
458
+ receivedData,
459
+ returnedValues
460
+ );
411
461
  }
412
462
 
413
463
  /**
@@ -418,18 +468,18 @@ contract LSP9VaultCore is
418
468
  * Requirements:
419
469
  * - when notifying the new owner via LSP1, the typeId used MUST be keccak256('LSP9OwnershipTransferStarted')
420
470
  */
421
- function transferOwnership(address newOwner)
422
- public
423
- virtual
424
- override(LSP14Ownable2Step, OwnableUnset)
425
- onlyOwner
426
- {
471
+ function transferOwnership(
472
+ address newOwner
473
+ ) public virtual override(LSP14Ownable2Step, OwnableUnset) onlyOwner {
427
474
  LSP14Ownable2Step._transferOwnership(newOwner);
428
475
 
429
476
  address currentOwner = owner();
430
477
  emit OwnershipTransferStarted(currentOwner, newOwner);
431
478
 
432
- newOwner.tryNotifyUniversalReceiver(_TYPEID_LSP9_OwnershipTransferStarted, "");
479
+ newOwner.tryNotifyUniversalReceiver(
480
+ _TYPEID_LSP9_OwnershipTransferStarted,
481
+ ""
482
+ );
433
483
 
434
484
  require(
435
485
  currentOwner == owner(),
@@ -477,11 +527,16 @@ contract LSP9VaultCore is
477
527
  /**
478
528
  * @dev SAVE GAS by emitting the DataChanged event with only the first 256 bytes of dataValue
479
529
  */
480
- function _setData(bytes32 dataKey, bytes memory dataValue) internal virtual override {
530
+ function _setData(
531
+ bytes32 dataKey,
532
+ bytes memory dataValue
533
+ ) internal virtual override {
481
534
  _store[dataKey] = dataValue;
482
535
  emit DataChanged(
483
536
  dataKey,
484
- dataValue.length <= 256 ? dataValue : BytesLib.slice(dataValue, 0, 256)
537
+ dataValue.length <= 256
538
+ ? dataValue
539
+ : BytesLib.slice(dataValue, 0, 256)
485
540
  );
486
541
  }
487
542
 
@@ -503,13 +558,15 @@ contract LSP9VaultCore is
503
558
 
504
559
  // Deploy with CREATE
505
560
  if (operationType == uint256(OPERATION_1_CREATE)) {
506
- if (target != address(0)) revert ERC725X_CreateOperationsRequireEmptyRecipientAddress();
561
+ if (target != address(0))
562
+ revert ERC725X_CreateOperationsRequireEmptyRecipientAddress();
507
563
  return _deployCreate(value, data);
508
564
  }
509
565
 
510
566
  // Deploy with CREATE2
511
567
  if (operationType == uint256(OPERATION_2_CREATE2)) {
512
- if (target != address(0)) revert ERC725X_CreateOperationsRequireEmptyRecipientAddress();
568
+ if (target != address(0))
569
+ revert ERC725X_CreateOperationsRequireEmptyRecipientAddress();
513
570
  return _deployCreate2(value, data);
514
571
  }
515
572