@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
@@ -2,18 +2,25 @@
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 {ILSP7DigitalAsset} from "./ILSP7DigitalAsset.sol";
7
9
 
8
10
  // libraries
9
- import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
11
+ import {
12
+ ERC165Checker
13
+ } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
10
14
 
11
15
  // errors
12
16
  import "./LSP7Errors.sol";
13
17
 
14
18
  // constants
15
19
  import {_INTERFACEID_LSP1} from "../LSP1UniversalReceiver/LSP1Constants.sol";
16
- import {_TYPEID_LSP7_TOKENSSENDER, _TYPEID_LSP7_TOKENSRECIPIENT} from "./LSP7Constants.sol";
20
+ import {
21
+ _TYPEID_LSP7_TOKENSSENDER,
22
+ _TYPEID_LSP7_TOKENSRECIPIENT
23
+ } from "./LSP7Constants.sol";
17
24
 
18
25
  /**
19
26
  * @title LSP7DigitalAsset contract
@@ -32,7 +39,8 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
32
39
  mapping(address => uint256) private _tokenOwnerBalances;
33
40
 
34
41
  // Mapping a `tokenOwner` to an `operator` to `amount` of tokens.
35
- mapping(address => mapping(address => uint256)) private _operatorAuthorizedAmount;
42
+ mapping(address => mapping(address => uint256))
43
+ private _operatorAuthorizedAmount;
36
44
 
37
45
  uint256 private _existingTokens;
38
46
 
@@ -59,7 +67,9 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
59
67
  /**
60
68
  * @inheritdoc ILSP7DigitalAsset
61
69
  */
62
- function balanceOf(address tokenOwner) public view virtual returns (uint256) {
70
+ function balanceOf(
71
+ address tokenOwner
72
+ ) public view virtual returns (uint256) {
63
73
  return _tokenOwnerBalances[tokenOwner];
64
74
  }
65
75
 
@@ -78,7 +88,10 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
78
88
  * https://docs.google.com/document/d/1YLPtQxZu1UAvO9cZ1O2RPXBbT0mooh4DYKjA_jp-RLM/
79
89
  *
80
90
  */
81
- function authorizeOperator(address operator, uint256 amount) public virtual {
91
+ function authorizeOperator(
92
+ address operator,
93
+ uint256 amount
94
+ ) public virtual {
82
95
  _updateOperator(msg.sender, operator, amount);
83
96
  }
84
97
 
@@ -92,12 +105,10 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
92
105
  /**
93
106
  * @inheritdoc ILSP7DigitalAsset
94
107
  */
95
- function authorizedAmountFor(address operator, address tokenOwner)
96
- public
97
- view
98
- virtual
99
- returns (uint256)
100
- {
108
+ function authorizedAmountFor(
109
+ address operator,
110
+ address tokenOwner
111
+ ) public view virtual returns (uint256) {
101
112
  if (tokenOwner == operator) {
102
113
  return _tokenOwnerBalances[tokenOwner];
103
114
  } else {
@@ -123,7 +134,12 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
123
134
  if (operator != from) {
124
135
  uint256 operatorAmount = _operatorAuthorizedAmount[from][operator];
125
136
  if (amount > operatorAmount) {
126
- revert LSP7AmountExceedsAuthorizedAmount(from, operatorAmount, operator, amount);
137
+ revert LSP7AmountExceedsAuthorizedAmount(
138
+ from,
139
+ operatorAmount,
140
+ operator,
141
+ amount
142
+ );
127
143
  }
128
144
 
129
145
  _updateOperator(from, operator, operatorAmount - amount);
@@ -154,7 +170,13 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
154
170
 
155
171
  for (uint256 i = 0; i < fromLength; ) {
156
172
  // using the public transfer function to handle updates to operator authorized amounts
157
- transfer(from[i], to[i], amount[i], allowNonLSP1Recipient[i], data[i]);
173
+ transfer(
174
+ from[i],
175
+ to[i],
176
+ amount[i],
177
+ allowNonLSP1Recipient[i],
178
+ data[i]
179
+ );
158
180
 
159
181
  unchecked {
160
182
  ++i;
@@ -178,7 +200,10 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
178
200
  * - `operator` cannot be the same address as `msg.sender`
179
201
  * - `operator` cannot be the zero address.
180
202
  */
181
- function increaseAllowance(address operator, uint256 addedAmount) public virtual {
203
+ function increaseAllowance(
204
+ address operator,
205
+ uint256 addedAmount
206
+ ) public virtual {
182
207
  _updateOperator(
183
208
  msg.sender,
184
209
  operator,
@@ -204,14 +229,21 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
204
229
  * - `operator` cannot be the zero address.
205
230
  * - operator` must have allowance for the caller of at least `substractedAmount`.
206
231
  */
207
- function decreaseAllowance(address operator, uint256 substractedAmount) public virtual {
232
+ function decreaseAllowance(
233
+ address operator,
234
+ uint256 substractedAmount
235
+ ) public virtual {
208
236
  uint256 currentAllowance = authorizedAmountFor(operator, msg.sender);
209
237
  if (currentAllowance < substractedAmount) {
210
238
  revert LSP7DecreasedAllowanceBelowZero();
211
239
  }
212
240
 
213
241
  unchecked {
214
- _updateOperator(msg.sender, operator, currentAllowance - substractedAmount);
242
+ _updateOperator(
243
+ msg.sender,
244
+ operator,
245
+ currentAllowance - substractedAmount
246
+ );
215
247
  }
216
248
  }
217
249
 
@@ -278,7 +310,14 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
278
310
 
279
311
  _tokenOwnerBalances[to] += amount;
280
312
 
281
- emit Transfer(operator, address(0), to, amount, allowNonLSP1Recipient, data);
313
+ emit Transfer(
314
+ operator,
315
+ address(0),
316
+ to,
317
+ amount,
318
+ allowNonLSP1Recipient,
319
+ data
320
+ );
282
321
 
283
322
  bytes memory lsp1Data = abi.encodePacked(address(0), to, amount, data);
284
323
  _notifyTokenReceiver(to, allowNonLSP1Recipient, lsp1Data);
@@ -312,9 +351,16 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
312
351
 
313
352
  address operator = msg.sender;
314
353
  if (operator != from) {
315
- uint256 authorizedAmount = _operatorAuthorizedAmount[from][operator];
354
+ uint256 authorizedAmount = _operatorAuthorizedAmount[from][
355
+ operator
356
+ ];
316
357
  if (amount > authorizedAmount) {
317
- revert LSP7AmountExceedsAuthorizedAmount(from, authorizedAmount, operator, amount);
358
+ revert LSP7AmountExceedsAuthorizedAmount(
359
+ from,
360
+ authorizedAmount,
361
+ operator,
362
+ amount
363
+ );
318
364
  }
319
365
  _operatorAuthorizedAmount[from][operator] -= amount;
320
366
  }
@@ -328,7 +374,12 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
328
374
 
329
375
  emit Transfer(operator, from, address(0), amount, false, data);
330
376
 
331
- bytes memory lsp1Data = abi.encodePacked(from, address(0), amount, data);
377
+ bytes memory lsp1Data = abi.encodePacked(
378
+ from,
379
+ address(0),
380
+ amount,
381
+ data
382
+ );
332
383
  _notifyTokenSender(from, lsp1Data);
333
384
  }
334
385
 
@@ -398,9 +449,20 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
398
449
  * @dev An attempt is made to notify the token sender about the `amount` tokens changing owners using
399
450
  * LSP1 interface.
400
451
  */
401
- function _notifyTokenSender(address from, bytes memory lsp1Data) internal virtual {
402
- if (ERC165Checker.supportsERC165InterfaceUnchecked(from, _INTERFACEID_LSP1)) {
403
- ILSP1UniversalReceiver(from).universalReceiver(_TYPEID_LSP7_TOKENSSENDER, lsp1Data);
452
+ function _notifyTokenSender(
453
+ address from,
454
+ bytes memory lsp1Data
455
+ ) internal virtual {
456
+ if (
457
+ ERC165Checker.supportsERC165InterfaceUnchecked(
458
+ from,
459
+ _INTERFACEID_LSP1
460
+ )
461
+ ) {
462
+ ILSP1UniversalReceiver(from).universalReceiver(
463
+ _TYPEID_LSP7_TOKENSSENDER,
464
+ lsp1Data
465
+ );
404
466
  }
405
467
  }
406
468
 
@@ -415,8 +477,16 @@ abstract contract LSP7DigitalAssetCore is ILSP7DigitalAsset {
415
477
  bool allowNonLSP1Recipient,
416
478
  bytes memory lsp1Data
417
479
  ) internal virtual {
418
- if (ERC165Checker.supportsERC165InterfaceUnchecked(to, _INTERFACEID_LSP1)) {
419
- ILSP1UniversalReceiver(to).universalReceiver(_TYPEID_LSP7_TOKENSRECIPIENT, lsp1Data);
480
+ if (
481
+ ERC165Checker.supportsERC165InterfaceUnchecked(
482
+ to,
483
+ _INTERFACEID_LSP1
484
+ )
485
+ ) {
486
+ ILSP1UniversalReceiver(to).universalReceiver(
487
+ _TYPEID_LSP7_TOKENSRECIPIENT,
488
+ lsp1Data
489
+ );
420
490
  } else if (!allowNonLSP1Recipient) {
421
491
  if (to.code.length > 0) {
422
492
  revert LSP7NotifyTokenReceiverContractMissingLSP1Interface(to);
@@ -30,19 +30,21 @@ abstract contract LSP7DigitalAssetInitAbstract is
30
30
  bool isNonDivisible_
31
31
  ) internal virtual onlyInitializing {
32
32
  _isNonDivisible = isNonDivisible_;
33
- LSP4DigitalAssetMetadataInitAbstract._initialize(name_, symbol_, newOwner_);
33
+ LSP4DigitalAssetMetadataInitAbstract._initialize(
34
+ name_,
35
+ symbol_,
36
+ newOwner_
37
+ );
34
38
  }
35
39
 
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_LSP7 || super.supportsInterface(interfaceId);
43
+ function supportsInterface(
44
+ bytes4 interfaceId
45
+ ) public view virtual override(IERC165, ERC725YCore) returns (bool) {
46
+ return
47
+ interfaceId == _INTERFACEID_LSP7 ||
48
+ super.supportsInterface(interfaceId);
47
49
  }
48
50
  }
@@ -6,7 +6,11 @@ pragma solidity ^0.8.4;
6
6
  /**
7
7
  * @dev reverts when sending an `amount` of tokens larger than the current `balance` of the `tokenOwner`.
8
8
  */
9
- error LSP7AmountExceedsBalance(uint256 balance, address tokenOwner, uint256 amount);
9
+ error LSP7AmountExceedsBalance(
10
+ uint256 balance,
11
+ address tokenOwner,
12
+ uint256 amount
13
+ );
10
14
 
11
15
  /**
12
16
  * @dev reverts when `operator` of `tokenOwner` send an `amount` of tokens
@@ -43,7 +47,9 @@ error LSP7InvalidTransferBatch();
43
47
  * @dev reverts if the `tokenReceiver` does not implement LSP1
44
48
  * when minting or transferring tokens with `bool allowNonLSP1Recipient` set as `false`.
45
49
  */
46
- error LSP7NotifyTokenReceiverContractMissingLSP1Interface(address tokenReceiver);
50
+ error LSP7NotifyTokenReceiverContractMissingLSP1Interface(
51
+ address tokenReceiver
52
+ );
47
53
 
48
54
  /**
49
55
  * @dev reverts if the `tokenReceiver` is an EOA
@@ -25,7 +25,11 @@ interface ILSP7CompatibleERC20 is ILSP7DigitalAsset {
25
25
  * @param spender The account receiving approval
26
26
  * @param value The amount of tokens `spender` has access to from `owner`
27
27
  */
28
- event Approval(address indexed owner, address indexed spender, uint256 value);
28
+ event Approval(
29
+ address indexed owner,
30
+ address indexed spender,
31
+ uint256 value
32
+ );
29
33
 
30
34
  /*
31
35
  * @dev Compatible with ERC20 transfer
@@ -59,5 +63,8 @@ interface ILSP7CompatibleERC20 is ILSP7DigitalAsset {
59
63
  * @param operator The address approved by the `tokenOwner`
60
64
  * @return The amount `operator` is approved by `tokenOwner`
61
65
  */
62
- function allowance(address tokenOwner, address operator) external view returns (uint256);
66
+ function allowance(
67
+ address tokenOwner,
68
+ address operator
69
+ ) external view returns (uint256);
63
70
  }
@@ -14,11 +14,7 @@ abstract contract LSP7Burnable is LSP7DigitalAsset {
14
14
  *
15
15
  * See internal _burn function for more details
16
16
  */
17
- function burn(
18
- address from,
19
- uint256 amount,
20
- bytes memory data
21
- ) public {
17
+ function burn(address from, uint256 amount, bytes memory data) public {
22
18
  _burn(from, amount, data);
23
19
  }
24
20
  }
@@ -2,7 +2,9 @@
2
2
  pragma solidity ^0.8.4;
3
3
 
4
4
  // modules
5
- import {LSP7DigitalAssetInitAbstract} from "../LSP7DigitalAssetInitAbstract.sol";
5
+ import {
6
+ LSP7DigitalAssetInitAbstract
7
+ } from "../LSP7DigitalAssetInitAbstract.sol";
6
8
 
7
9
  /**
8
10
  * @dev LSP7 extension that allows token holders to destroy both
@@ -14,11 +16,7 @@ abstract contract LSP7BurnableInitAbstract is LSP7DigitalAssetInitAbstract {
14
16
  *
15
17
  * See internal _burn function for more details
16
18
  */
17
- function burn(
18
- address from,
19
- uint256 amount,
20
- bytes memory data
21
- ) public {
19
+ function burn(address from, uint256 amount, bytes memory data) public {
22
20
  _burn(from, amount, data);
23
21
  }
24
22
  }
@@ -3,7 +3,9 @@
3
3
  pragma solidity ^0.8.4;
4
4
 
5
5
  // modules
6
- import {LSP7DigitalAssetInitAbstract} from "../LSP7DigitalAssetInitAbstract.sol";
6
+ import {
7
+ LSP7DigitalAssetInitAbstract
8
+ } from "../LSP7DigitalAssetInitAbstract.sol";
7
9
 
8
10
  /**
9
11
  * @dev LSP7 extension, adds token supply cap.
@@ -16,7 +18,9 @@ abstract contract LSP7CappedSupplyInitAbstract is LSP7DigitalAssetInitAbstract {
16
18
  // --- Storage
17
19
  uint256 private _tokenSupplyCap;
18
20
 
19
- function _initialize(uint256 tokenSupplyCap_) internal virtual onlyInitializing {
21
+ function _initialize(
22
+ uint256 tokenSupplyCap_
23
+ ) internal virtual onlyInitializing {
20
24
  if (tokenSupplyCap_ == 0) {
21
25
  revert LSP7CappedSupplyRequired();
22
26
  }
@@ -6,13 +6,23 @@ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
6
6
  import {ILSP7CompatibleERC20} from "./ILSP7CompatibleERC20.sol";
7
7
 
8
8
  // modules
9
- import {LSP4Compatibility} from "../../LSP4DigitalAssetMetadata/LSP4Compatibility.sol";
10
- import {LSP7DigitalAsset, LSP4DigitalAssetMetadata, ERC725YCore} from "../LSP7DigitalAsset.sol";
9
+ import {
10
+ LSP4Compatibility
11
+ } from "../../LSP4DigitalAssetMetadata/LSP4Compatibility.sol";
12
+ import {
13
+ LSP7DigitalAsset,
14
+ LSP4DigitalAssetMetadata,
15
+ ERC725YCore
16
+ } from "../LSP7DigitalAsset.sol";
11
17
 
12
18
  /**
13
19
  * @dev LSP7 extension, for compatibility for clients / tools that expect ERC20.
14
20
  */
15
- abstract contract LSP7CompatibleERC20 is ILSP7CompatibleERC20, LSP4Compatibility, LSP7DigitalAsset {
21
+ abstract contract LSP7CompatibleERC20 is
22
+ ILSP7CompatibleERC20,
23
+ LSP4Compatibility,
24
+ LSP7DigitalAsset
25
+ {
16
26
  /**
17
27
  * @notice Sets the name, the symbol and the owner of the token
18
28
  * @param name_ The name of the token
@@ -28,7 +38,9 @@ abstract contract LSP7CompatibleERC20 is ILSP7CompatibleERC20, LSP4Compatibility
28
38
  /**
29
39
  * @dev See {IERC165-supportsInterface}.
30
40
  */
31
- function supportsInterface(bytes4 interfaceId)
41
+ function supportsInterface(
42
+ bytes4 interfaceId
43
+ )
32
44
  public
33
45
  view
34
46
  virtual
@@ -41,14 +53,20 @@ abstract contract LSP7CompatibleERC20 is ILSP7CompatibleERC20, LSP4Compatibility
41
53
  /**
42
54
  * @inheritdoc ILSP7CompatibleERC20
43
55
  */
44
- function allowance(address tokenOwner, address operator) public view virtual returns (uint256) {
56
+ function allowance(
57
+ address tokenOwner,
58
+ address operator
59
+ ) public view virtual returns (uint256) {
45
60
  return authorizedAmountFor(operator, tokenOwner);
46
61
  }
47
62
 
48
63
  /**
49
64
  * @inheritdoc ILSP7CompatibleERC20
50
65
  */
51
- function approve(address operator, uint256 amount) public virtual returns (bool) {
66
+ function approve(
67
+ address operator,
68
+ uint256 amount
69
+ ) public virtual returns (bool) {
52
70
  authorizeOperator(operator, amount);
53
71
  return true;
54
72
  }
@@ -74,7 +92,10 @@ abstract contract LSP7CompatibleERC20 is ILSP7CompatibleERC20, LSP4Compatibility
74
92
  * @dev Compatible with ERC20 transfer.
75
93
  * Using allowNonLSP1Recipient=true so that EOA and any contract may receive the tokens.
76
94
  */
77
- function transfer(address to, uint256 amount) public virtual override returns (bool) {
95
+ function transfer(
96
+ address to,
97
+ uint256 amount
98
+ ) public virtual override returns (bool) {
78
99
  transfer(msg.sender, to, amount, true, "");
79
100
  return true;
80
101
  }
@@ -122,11 +143,10 @@ abstract contract LSP7CompatibleERC20 is ILSP7CompatibleERC20, LSP4Compatibility
122
143
  super._burn(from, amount, data);
123
144
  }
124
145
 
125
- function _setData(bytes32 key, bytes memory value)
126
- internal
127
- virtual
128
- override(LSP4DigitalAssetMetadata, ERC725YCore)
129
- {
146
+ function _setData(
147
+ bytes32 key,
148
+ bytes memory value
149
+ ) internal virtual override(LSP4DigitalAssetMetadata, ERC725YCore) {
130
150
  super._setData(key, value);
131
151
  }
132
152
  }
@@ -6,7 +6,9 @@ import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
6
6
  import {ILSP7CompatibleERC20} from "./ILSP7CompatibleERC20.sol";
7
7
 
8
8
  // modules
9
- import {LSP4Compatibility} from "../../LSP4DigitalAssetMetadata/LSP4Compatibility.sol";
9
+ import {
10
+ LSP4Compatibility
11
+ } from "../../LSP4DigitalAssetMetadata/LSP4Compatibility.sol";
10
12
  import {
11
13
  LSP7DigitalAssetInitAbstract,
12
14
  LSP4DigitalAssetMetadataInitAbstract,
@@ -33,13 +35,20 @@ abstract contract LSP7CompatibleERC20InitAbstract is
33
35
  string memory symbol_,
34
36
  address newOwner_
35
37
  ) internal virtual override onlyInitializing {
36
- LSP7DigitalAssetInitAbstract._initialize(name_, symbol_, newOwner_, false);
38
+ LSP7DigitalAssetInitAbstract._initialize(
39
+ name_,
40
+ symbol_,
41
+ newOwner_,
42
+ false
43
+ );
37
44
  }
38
45
 
39
46
  /**
40
47
  * @dev See {IERC165-supportsInterface}.
41
48
  */
42
- function supportsInterface(bytes4 interfaceId)
49
+ function supportsInterface(
50
+ bytes4 interfaceId
51
+ )
43
52
  public
44
53
  view
45
54
  virtual
@@ -52,14 +61,20 @@ abstract contract LSP7CompatibleERC20InitAbstract is
52
61
  /**
53
62
  * @inheritdoc ILSP7CompatibleERC20
54
63
  */
55
- function allowance(address tokenOwner, address operator) public view virtual returns (uint256) {
64
+ function allowance(
65
+ address tokenOwner,
66
+ address operator
67
+ ) public view virtual returns (uint256) {
56
68
  return authorizedAmountFor(operator, tokenOwner);
57
69
  }
58
70
 
59
71
  /**
60
72
  * @inheritdoc ILSP7CompatibleERC20
61
73
  */
62
- function approve(address operator, uint256 amount) public virtual returns (bool) {
74
+ function approve(
75
+ address operator,
76
+ uint256 amount
77
+ ) public virtual returns (bool) {
63
78
  authorizeOperator(operator, amount);
64
79
  return true;
65
80
  }
@@ -85,7 +100,10 @@ abstract contract LSP7CompatibleERC20InitAbstract is
85
100
  * @dev Compatible with ERC20 transfer.
86
101
  * Using allowNonLSP1Recipient=true so that EOA and any contract may receive the tokens.
87
102
  */
88
- function transfer(address to, uint256 amount) public virtual override returns (bool) {
103
+ function transfer(
104
+ address to,
105
+ uint256 amount
106
+ ) public virtual override returns (bool) {
89
107
  transfer(msg.sender, to, amount, true, "");
90
108
  return true;
91
109
  }
@@ -133,7 +151,10 @@ abstract contract LSP7CompatibleERC20InitAbstract is
133
151
  super._burn(from, amount, data);
134
152
  }
135
153
 
136
- function _setData(bytes32 key, bytes memory value)
154
+ function _setData(
155
+ bytes32 key,
156
+ bytes memory value
157
+ )
137
158
  internal
138
159
  virtual
139
160
  override(LSP4DigitalAssetMetadataInitAbstract, ERC725YCore)
@@ -6,7 +6,9 @@ import {
6
6
  LSP7CompatibleERC20MintableInitAbstract
7
7
  } from "./LSP7CompatibleERC20MintableInitAbstract.sol";
8
8
 
9
- contract LSP7CompatibleERC20MintableInit is LSP7CompatibleERC20MintableInitAbstract {
9
+ contract LSP7CompatibleERC20MintableInit is
10
+ LSP7CompatibleERC20MintableInitAbstract
11
+ {
10
12
  /**
11
13
  * @dev initialize (= lock) base implementation contract on deployment
12
14
  */
@@ -25,6 +27,10 @@ contract LSP7CompatibleERC20MintableInit is LSP7CompatibleERC20MintableInitAbstr
25
27
  string memory symbol_,
26
28
  address newOwner_
27
29
  ) external virtual initializer {
28
- LSP7CompatibleERC20MintableInitAbstract._initialize(name_, symbol_, newOwner_);
30
+ LSP7CompatibleERC20MintableInitAbstract._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 {LSP7CompatibleERC20InitAbstract} from "../extensions/LSP7CompatibleERC20InitAbstract.sol";
5
+ import {
6
+ LSP7CompatibleERC20InitAbstract
7
+ } from "../extensions/LSP7CompatibleERC20InitAbstract.sol";
6
8
 
7
- contract LSP7CompatibleERC20MintableInitAbstract is LSP7CompatibleERC20InitAbstract {
9
+ contract LSP7CompatibleERC20MintableInitAbstract is
10
+ LSP7CompatibleERC20InitAbstract
11
+ {
8
12
  /**
9
13
  * @inheritdoc LSP7CompatibleERC20InitAbstract
10
14
  */
@@ -29,6 +29,11 @@ contract LSP7MintableInit is LSP7MintableInitAbstract {
29
29
  address newOwner_,
30
30
  bool isNonDivisible_
31
31
  ) external virtual initializer {
32
- LSP7MintableInitAbstract._initialize(name_, symbol_, newOwner_, isNonDivisible_);
32
+ LSP7MintableInitAbstract._initialize(
33
+ name_,
34
+ symbol_,
35
+ newOwner_,
36
+ isNonDivisible_
37
+ );
33
38
  }
34
39
  }
@@ -6,19 +6,29 @@ pragma solidity ^0.8.4;
6
6
  import {ILSP7Mintable} from "./ILSP7Mintable.sol";
7
7
 
8
8
  // modules
9
- import {LSP7DigitalAssetInitAbstract} from "../LSP7DigitalAssetInitAbstract.sol";
9
+ import {
10
+ LSP7DigitalAssetInitAbstract
11
+ } from "../LSP7DigitalAssetInitAbstract.sol";
10
12
 
11
13
  /**
12
14
  * @dev LSP7 extension, mintable.
13
15
  */
14
- abstract contract LSP7MintableInitAbstract is LSP7DigitalAssetInitAbstract, ILSP7Mintable {
16
+ abstract contract LSP7MintableInitAbstract is
17
+ LSP7DigitalAssetInitAbstract,
18
+ ILSP7Mintable
19
+ {
15
20
  function _initialize(
16
21
  string memory name_,
17
22
  string memory symbol_,
18
23
  address newOwner_,
19
24
  bool isNonDivisible_
20
25
  ) internal virtual override onlyInitializing {
21
- LSP7DigitalAssetInitAbstract._initialize(name_, symbol_, newOwner_, isNonDivisible_);
26
+ LSP7DigitalAssetInitAbstract._initialize(
27
+ name_,
28
+ symbol_,
29
+ newOwner_,
30
+ isNonDivisible_
31
+ );
22
32
  }
23
33
 
24
34
  /**
@@ -4,10 +4,12 @@ pragma solidity ^0.8.4;
4
4
 
5
5
  // interfaces
6
6
  import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
7
- import {IERC725Y} from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
7
+ import {
8
+ IERC725Y
9
+ } from "@erc725/smart-contracts/contracts/interfaces/IERC725Y.sol";
8
10
 
9
11
  /**
10
- * @title interface of the LSP8 - Identifiable Digital Asset standard.
12
+ * @title Interface of the LSP8 - Identifiable Digital Asset standard, a non-fungible digital asset.
11
13
  */
12
14
  interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
13
15
  // --- Events
@@ -90,7 +92,9 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
90
92
  * @param tokenOwner The address to query owned tokens
91
93
  * @return List of owned tokens by `tokenOwner` address
92
94
  */
93
- function tokenIdsOf(address tokenOwner) external view returns (bytes32[] memory);
95
+ function tokenIdsOf(
96
+ address tokenOwner
97
+ ) external view returns (bytes32[] memory);
94
98
 
95
99
  // --- Operator functionality
96
100
 
@@ -140,7 +144,10 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
140
144
  *
141
145
  * - `tokenId` must exist.
142
146
  */
143
- function isOperatorFor(address operator, bytes32 tokenId) external view returns (bool);
147
+ function isOperatorFor(
148
+ address operator,
149
+ bytes32 tokenId
150
+ ) external view returns (bool);
144
151
 
145
152
  /**
146
153
  * @param tokenId The tokenId to query
@@ -151,7 +158,9 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
151
158
  *
152
159
  * - `tokenId` must exist.
153
160
  */
154
- function getOperatorsOf(bytes32 tokenId) external view returns (address[] memory);
161
+ function getOperatorsOf(
162
+ bytes32 tokenId
163
+ ) external view returns (address[] memory);
155
164
 
156
165
  // --- Transfer functionality
157
166