@lukso/lsp8-contracts 0.16.7 → 0.18.1

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 (88) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +99 -4
  3. package/artifacts/IAccessControlExtended.json +285 -0
  4. package/artifacts/ILSP8CappedBalance.json +27 -0
  5. package/artifacts/ILSP8CappedSupply.json +27 -0
  6. package/artifacts/ILSP8IdentifiableDigitalAsset.json +6 -3
  7. package/artifacts/ILSP8Mintable.json +62 -0
  8. package/artifacts/ILSP8NonTransferable.json +116 -0
  9. package/artifacts/ILSP8Revokable.json +112 -0
  10. package/artifacts/LSP8Burnable.json +7 -4
  11. package/artifacts/LSP8BurnableInitAbstract.json +7 -4
  12. package/artifacts/LSP8CappedBalanceAbstract.json +1285 -0
  13. package/artifacts/LSP8CappedBalanceInitAbstract.json +1293 -0
  14. package/artifacts/{LSP8CappedSupply.json → LSP8CappedSupplyAbstract.json} +8 -15
  15. package/artifacts/LSP8CappedSupplyInitAbstract.json +7 -14
  16. package/artifacts/LSP8CustomizableToken.json +1781 -0
  17. package/artifacts/LSP8CustomizableTokenInit.json +1776 -0
  18. package/artifacts/LSP8Enumerable.json +7 -4
  19. package/artifacts/LSP8EnumerableInitAbstract.json +7 -4
  20. package/artifacts/LSP8IdentifiableDigitalAsset.json +6 -3
  21. package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +6 -3
  22. package/artifacts/LSP8Mintable.json +369 -5
  23. package/artifacts/LSP8MintableAbstract.json +1328 -0
  24. package/artifacts/LSP8MintableInit.json +369 -5
  25. package/artifacts/LSP8MintableInitAbstract.json +1336 -0
  26. package/artifacts/LSP8NonTransferableAbstract.json +1373 -0
  27. package/artifacts/LSP8NonTransferableInitAbstract.json +1381 -0
  28. package/artifacts/LSP8RevokableAbstract.json +1354 -0
  29. package/artifacts/LSP8RevokableInitAbstract.json +1362 -0
  30. package/artifacts/LSP8Votes.json +7 -4
  31. package/artifacts/LSP8VotesInitAbstract.json +7 -4
  32. package/contracts/ILSP8IdentifiableDigitalAsset.sol +1 -1
  33. package/contracts/LSP8Constants.sol +1 -1
  34. package/contracts/LSP8Errors.sol +1 -1
  35. package/contracts/LSP8IdentifiableDigitalAsset.sol +73 -114
  36. package/contracts/LSP8IdentifiableDigitalAssetInitAbstract.sol +69 -116
  37. package/contracts/extensions/AccessControlExtended/AccessControlExtendedAbstract.sol +378 -0
  38. package/contracts/extensions/AccessControlExtended/AccessControlExtendedConstants.sol +13 -0
  39. package/contracts/extensions/AccessControlExtended/AccessControlExtendedErrors.sol +23 -0
  40. package/contracts/extensions/AccessControlExtended/AccessControlExtendedInitAbstract.sol +390 -0
  41. package/contracts/extensions/AccessControlExtended/IAccessControlExtended.sol +51 -0
  42. package/contracts/extensions/{LSP8Burnable.sol → LSP8Burnable/LSP8Burnable.sol} +7 -6
  43. package/contracts/extensions/{LSP8BurnableInitAbstract.sol → LSP8Burnable/LSP8BurnableInitAbstract.sol} +7 -6
  44. package/contracts/extensions/LSP8CappedBalance/ILSP8CappedBalance.sol +11 -0
  45. package/contracts/extensions/LSP8CappedBalance/LSP8CappedBalanceAbstract.sol +124 -0
  46. package/contracts/extensions/LSP8CappedBalance/LSP8CappedBalanceErrors.sol +9 -0
  47. package/contracts/extensions/LSP8CappedBalance/LSP8CappedBalanceInitAbstract.sol +174 -0
  48. package/contracts/extensions/LSP8CappedSupply/ILSP8CappedSupply.sol +11 -0
  49. package/contracts/extensions/LSP8CappedSupply/LSP8CappedSupplyAbstract.sol +59 -0
  50. package/contracts/extensions/LSP8CappedSupply/LSP8CappedSupplyErrors.sol +6 -0
  51. package/contracts/extensions/LSP8CappedSupply/LSP8CappedSupplyInitAbstract.sol +97 -0
  52. package/contracts/extensions/{LSP8Enumerable.sol → LSP8Enumerable/LSP8Enumerable.sol} +2 -2
  53. package/contracts/extensions/{LSP8EnumerableInitAbstract.sol → LSP8Enumerable/LSP8EnumerableInitAbstract.sol} +2 -2
  54. package/contracts/extensions/LSP8Mintable/ILSP8Mintable.sol +27 -0
  55. package/contracts/extensions/LSP8Mintable/LSP8MintableAbstract.sol +105 -0
  56. package/contracts/extensions/LSP8Mintable/LSP8MintableErrors.sol +5 -0
  57. package/contracts/extensions/LSP8Mintable/LSP8MintableInitAbstract.sol +155 -0
  58. package/contracts/extensions/LSP8NonTransferable/ILSP8NonTransferable.sol +54 -0
  59. package/contracts/extensions/LSP8NonTransferable/LSP8NonTransferableAbstract.sol +199 -0
  60. package/contracts/extensions/LSP8NonTransferable/LSP8NonTransferableErrors.sol +14 -0
  61. package/contracts/extensions/LSP8NonTransferable/LSP8NonTransferableInitAbstract.sol +255 -0
  62. package/contracts/extensions/LSP8Revokable/ILSP8Revokable.sol +37 -0
  63. package/contracts/extensions/LSP8Revokable/LSP8RevokableAbstract.sol +140 -0
  64. package/contracts/extensions/LSP8Revokable/LSP8RevokableErrors.sol +4 -0
  65. package/contracts/extensions/LSP8Revokable/LSP8RevokableInitAbstract.sol +192 -0
  66. package/contracts/extensions/{LSP8Votes.sol → LSP8Votes/LSP8Votes.sol} +3 -4
  67. package/contracts/extensions/{LSP8VotesConstants.sol → LSP8Votes/LSP8VotesConstants.sol} +1 -1
  68. package/contracts/extensions/{LSP8VotesInitAbstract.sol → LSP8Votes/LSP8VotesInitAbstract.sol} +3 -3
  69. package/contracts/presets/LSP8CustomizableToken.sol +277 -0
  70. package/contracts/presets/LSP8CustomizableTokenConstants.sol +32 -0
  71. package/contracts/presets/LSP8CustomizableTokenInit.sol +318 -0
  72. package/contracts/presets/LSP8Mintable.sol +13 -28
  73. package/contracts/presets/LSP8MintableInit.sol +13 -6
  74. package/dist/abi.cjs +8351 -136
  75. package/dist/abi.d.cts +12122 -266
  76. package/dist/abi.d.mts +12122 -266
  77. package/dist/abi.d.ts +12122 -266
  78. package/dist/abi.mjs +8335 -136
  79. package/dist/constants.cjs +21 -0
  80. package/dist/constants.d.cts +12 -1
  81. package/dist/constants.d.mts +12 -1
  82. package/dist/constants.d.ts +12 -1
  83. package/dist/constants.mjs +16 -1
  84. package/package.json +32 -9
  85. package/contracts/extensions/LSP8CappedSupply.sol +0 -85
  86. package/contracts/extensions/LSP8CappedSupplyInitAbstract.sol +0 -88
  87. package/contracts/presets/ILSP8Mintable.sol +0 -33
  88. package/contracts/presets/LSP8MintableInitAbstract.sol +0 -62
@@ -1,7 +1,7 @@
1
1
  {
2
- "_format": "hh-sol-artifact-1",
2
+ "_format": "hh3-artifact-1",
3
3
  "contractName": "LSP8Votes",
4
- "sourceName": "contracts/extensions/LSP8Votes.sol",
4
+ "sourceName": "contracts/extensions/LSP8Votes/LSP8Votes.sol",
5
5
  "abi": [
6
6
  {
7
7
  "inputs": [],
@@ -1226,5 +1226,8 @@
1226
1226
  "bytecode": "0x",
1227
1227
  "deployedBytecode": "0x",
1228
1228
  "linkReferences": {},
1229
- "deployedLinkReferences": {}
1230
- }
1229
+ "deployedLinkReferences": {},
1230
+ "immutableReferences": {},
1231
+ "inputSourceName": "project/contracts/extensions/LSP8Votes/LSP8Votes.sol",
1232
+ "buildInfoId": "solc-0_8_28-a1f189205db65800e276c245fa7f2fa7071cb3a5"
1233
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
- "_format": "hh-sol-artifact-1",
2
+ "_format": "hh3-artifact-1",
3
3
  "contractName": "LSP8VotesInitAbstract",
4
- "sourceName": "contracts/extensions/LSP8VotesInitAbstract.sol",
4
+ "sourceName": "contracts/extensions/LSP8Votes/LSP8VotesInitAbstract.sol",
5
5
  "abi": [
6
6
  {
7
7
  "inputs": [],
@@ -1218,5 +1218,8 @@
1218
1218
  "bytecode": "0x",
1219
1219
  "deployedBytecode": "0x",
1220
1220
  "linkReferences": {},
1221
- "deployedLinkReferences": {}
1222
- }
1221
+ "deployedLinkReferences": {},
1222
+ "immutableReferences": {},
1223
+ "inputSourceName": "project/contracts/extensions/LSP8Votes/LSP8VotesInitAbstract.sol",
1224
+ "buildInfoId": "solc-0_8_28-a1f189205db65800e276c245fa7f2fa7071cb3a5"
1225
+ }
@@ -79,7 +79,7 @@ interface ILSP8IdentifiableDigitalAsset {
79
79
 
80
80
  /**
81
81
  * @dev Get the number of token IDs owned by `tokenOwner`.
82
-
82
+ *
83
83
  * @param tokenOwner The address to query *
84
84
  * @return The total number of token IDs that `tokenOwner` owns.
85
85
  */
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.4;
2
+ pragma solidity ^0.8.27;
3
3
 
4
4
  // --- ERC165 interface ids
5
5
  bytes4 constant _INTERFACEID_LSP8 = 0x3a271706;
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.4;
2
+ pragma solidity ^0.8.27;
3
3
 
4
4
  // --- Errors
5
5
 
@@ -1,13 +1,9 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.12;
2
+ pragma solidity ^0.8.27;
3
3
 
4
4
  // interfaces
5
- import {
6
- ILSP1UniversalReceiver as ILSP1
7
- } from "@lukso/lsp1-contracts/contracts/ILSP1UniversalReceiver.sol";
8
- import {
9
- ILSP8IdentifiableDigitalAsset
10
- } from "./ILSP8IdentifiableDigitalAsset.sol";
5
+ import {ILSP1UniversalReceiver as ILSP1} from "@lukso/lsp1-contracts/contracts/ILSP1UniversalReceiver.sol";
6
+ import {ILSP8IdentifiableDigitalAsset} from "./ILSP8IdentifiableDigitalAsset.sol";
11
7
 
12
8
  // modules
13
9
  import {
@@ -15,27 +11,17 @@ import {
15
11
  ERC725Y
16
12
  } from "@lukso/lsp4-contracts/contracts/LSP4DigitalAssetMetadata.sol";
17
13
 
18
- import {
19
- LSP17Extendable
20
- } from "@lukso/lsp17contractextension-contracts/contracts/LSP17Extendable.sol";
14
+ import {LSP17Extendable} from "@lukso/lsp17contractextension-contracts/contracts/LSP17Extendable.sol";
21
15
 
22
16
  // libraries
23
- import {
24
- EnumerableSet
25
- } from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
26
- import {
27
- ERC165Checker
28
- } from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
17
+ import {EnumerableSet} from "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
18
+ import {ERC165Checker} from "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
29
19
  import {LSP1Utils} from "@lukso/lsp1-contracts/contracts/LSP1Utils.sol";
30
20
  import {LSP2Utils} from "@lukso/lsp2-contracts/contracts/LSP2Utils.sol";
31
21
 
32
22
  // constants
33
- import {
34
- _INTERFACEID_LSP1
35
- } from "@lukso/lsp1-contracts/contracts/LSP1Constants.sol";
36
- import {
37
- _LSP17_EXTENSION_PREFIX
38
- } from "@lukso/lsp17contractextension-contracts/contracts/LSP17Constants.sol";
23
+ import {_INTERFACEID_LSP1} from "@lukso/lsp1-contracts/contracts/LSP1Constants.sol";
24
+ import {_LSP17_EXTENSION_PREFIX} from "@lukso/lsp17contractextension-contracts/contracts/LSP17Constants.sol";
39
25
  import {
40
26
  _INTERFACEID_LSP8,
41
27
  _LSP8_TOKENID_FORMAT_KEY,
@@ -158,9 +144,7 @@ abstract contract LSP8IdentifiableDigitalAsset is
158
144
  fallback(
159
145
  bytes calldata callData
160
146
  ) external payable virtual returns (bytes memory) {
161
- if (msg.data.length < 4) {
162
- revert InvalidFunctionSelector(callData);
163
- }
147
+ require(msg.data.length >= 4, InvalidFunctionSelector(callData));
164
148
  return _fallbackLSP17Extendable(callData);
165
149
  }
166
150
 
@@ -201,8 +185,10 @@ abstract contract LSP8IdentifiableDigitalAsset is
201
185
  (address extension, ) = _getExtensionAndForwardValue(msg.sig);
202
186
 
203
187
  // if no extension was found, revert
204
- if (extension == address(0))
205
- revert NoExtensionFoundForFunctionSelector(msg.sig);
188
+ require(
189
+ extension != address(0),
190
+ NoExtensionFoundForFunctionSelector(msg.sig)
191
+ );
206
192
 
207
193
  (bool success, bytes memory result) = extension.call{value: msg.value}(
208
194
  abi.encodePacked(callData, msg.sender, msg.value)
@@ -238,8 +224,10 @@ abstract contract LSP8IdentifiableDigitalAsset is
238
224
 
239
225
  // Check if there is an extension stored under the generated data key
240
226
  bytes memory extensionAddress = _getData(mappedExtensionDataKey);
241
- if (extensionAddress.length != 20 && extensionAddress.length != 0)
242
- revert InvalidExtensionAddress(extensionAddress);
227
+ require(
228
+ extensionAddress.length == 20 || extensionAddress.length == 0,
229
+ InvalidExtensionAddress(extensionAddress)
230
+ );
243
231
 
244
232
  return (address(bytes20(extensionAddress)), true);
245
233
  }
@@ -265,9 +253,10 @@ abstract contract LSP8IdentifiableDigitalAsset is
265
253
  bytes32 dataKey,
266
254
  bytes memory dataValue
267
255
  ) internal virtual override {
268
- if (dataKey == _LSP8_TOKENID_FORMAT_KEY) {
269
- revert LSP8TokenIdFormatNotEditable();
270
- }
256
+ require(
257
+ dataKey != _LSP8_TOKENID_FORMAT_KEY,
258
+ LSP8TokenIdFormatNotEditable()
259
+ );
271
260
  LSP4DigitalAssetMetadata._setData(dataKey, dataValue);
272
261
  }
273
262
 
@@ -298,10 +287,7 @@ abstract contract LSP8IdentifiableDigitalAsset is
298
287
  bytes32 tokenId
299
288
  ) public view virtual override returns (address) {
300
289
  address tokenOwner = _tokenOwners[tokenId];
301
-
302
- if (tokenOwner == address(0)) {
303
- revert LSP8NonExistentTokenId(tokenId);
304
- }
290
+ require(tokenOwner != address(0), LSP8NonExistentTokenId(tokenId));
305
291
 
306
292
  return tokenOwner;
307
293
  }
@@ -334,9 +320,10 @@ abstract contract LSP8IdentifiableDigitalAsset is
334
320
  bytes32[] memory tokenIds,
335
321
  bytes32[] memory dataKeys
336
322
  ) public view virtual override returns (bytes[] memory dataValues) {
337
- if (tokenIds.length != dataKeys.length) {
338
- revert LSP8TokenIdsDataLengthMismatch();
339
- }
323
+ require(
324
+ tokenIds.length == dataKeys.length,
325
+ LSP8TokenIdsDataLengthMismatch()
326
+ );
340
327
 
341
328
  dataValues = new bytes[](tokenIds.length);
342
329
 
@@ -371,16 +358,13 @@ abstract contract LSP8IdentifiableDigitalAsset is
371
358
  bytes32[] memory dataKeys,
372
359
  bytes[] memory dataValues
373
360
  ) public virtual override onlyOwner {
374
- if (
375
- tokenIds.length != dataKeys.length ||
376
- dataKeys.length != dataValues.length
377
- ) {
378
- revert LSP8TokenIdsDataLengthMismatch();
379
- }
361
+ require(
362
+ tokenIds.length == dataKeys.length &&
363
+ dataKeys.length == dataValues.length,
364
+ LSP8TokenIdsDataLengthMismatch()
365
+ );
380
366
 
381
- if (tokenIds.length == 0) {
382
- revert LSP8TokenIdsDataEmptyArray();
383
- }
367
+ require(tokenIds.length != 0, LSP8TokenIdsDataEmptyArray());
384
368
 
385
369
  for (uint256 i; i < tokenIds.length; ) {
386
370
  _setDataForTokenId(tokenIds[i], dataKeys[i], dataValues[i]);
@@ -443,20 +427,15 @@ abstract contract LSP8IdentifiableDigitalAsset is
443
427
  ) public virtual override {
444
428
  address tokenOwner = tokenOwnerOf(tokenId);
445
429
 
446
- if (tokenOwner != msg.sender) {
447
- revert LSP8NotTokenOwner(tokenOwner, tokenId, msg.sender);
448
- }
449
-
450
- if (operator == address(0)) {
451
- revert LSP8CannotUseAddressZeroAsOperator();
452
- }
453
-
454
- if (tokenOwner == operator) {
455
- revert LSP8TokenOwnerCannotBeOperator();
456
- }
430
+ require(
431
+ msg.sender == tokenOwner,
432
+ LSP8NotTokenOwner(tokenOwner, tokenId, msg.sender)
433
+ );
434
+ require(operator != address(0), LSP8CannotUseAddressZeroAsOperator());
435
+ require(operator != tokenOwner, LSP8TokenOwnerCannotBeOperator());
457
436
 
458
437
  bool isAdded = _operators[tokenId].add(operator);
459
- if (!isAdded) revert LSP8OperatorAlreadyAuthorized(operator, tokenId);
438
+ require(isAdded, LSP8OperatorAlreadyAuthorized(operator, tokenId));
460
439
 
461
440
  emit OperatorAuthorizationChanged(
462
441
  operator,
@@ -487,22 +466,14 @@ abstract contract LSP8IdentifiableDigitalAsset is
487
466
  address tokenOwner = tokenOwnerOf(tokenId);
488
467
 
489
468
  if (msg.sender != tokenOwner) {
490
- if (operator != msg.sender) {
491
- revert LSP8RevokeOperatorNotAuthorized(
492
- msg.sender,
493
- tokenOwner,
494
- tokenId
495
- );
496
- }
497
- }
498
-
499
- if (operator == address(0)) {
500
- revert LSP8CannotUseAddressZeroAsOperator();
469
+ require(
470
+ msg.sender == operator,
471
+ LSP8RevokeOperatorNotAuthorized(msg.sender, tokenOwner, tokenId)
472
+ );
501
473
  }
502
474
 
503
- if (tokenOwner == operator) {
504
- revert LSP8TokenOwnerCannotBeOperator();
505
- }
475
+ require(operator != address(0), LSP8CannotUseAddressZeroAsOperator());
476
+ require(operator != tokenOwner, LSP8TokenOwnerCannotBeOperator());
506
477
 
507
478
  _revokeOperator(
508
479
  operator,
@@ -569,9 +540,10 @@ abstract contract LSP8IdentifiableDigitalAsset is
569
540
  bool force,
570
541
  bytes memory data
571
542
  ) public virtual override {
572
- if (!_isOperatorOrOwner(msg.sender, tokenId)) {
573
- revert LSP8NotTokenOperator(tokenId, msg.sender);
574
- }
543
+ require(
544
+ _isOperatorOrOwner(msg.sender, tokenId),
545
+ LSP8NotTokenOperator(tokenId, msg.sender)
546
+ );
575
547
 
576
548
  _transfer(from, to, tokenId, force, data);
577
549
  }
@@ -587,14 +559,13 @@ abstract contract LSP8IdentifiableDigitalAsset is
587
559
  bytes[] memory data
588
560
  ) public virtual override {
589
561
  uint256 fromLength = from.length;
590
- if (
591
- fromLength != to.length ||
592
- fromLength != tokenId.length ||
593
- fromLength != force.length ||
594
- fromLength != data.length
595
- ) {
596
- revert LSP8InvalidTransferBatch();
597
- }
562
+ require(
563
+ fromLength == to.length &&
564
+ fromLength == tokenId.length &&
565
+ fromLength == force.length &&
566
+ fromLength == data.length,
567
+ LSP8InvalidTransferBatch()
568
+ );
598
569
 
599
570
  for (uint256 i; i < fromLength; ) {
600
571
  transfer(from[i], to[i], tokenId[i], force[i], data[i]);
@@ -616,7 +587,7 @@ abstract contract LSP8IdentifiableDigitalAsset is
616
587
  bytes memory operatorNotificationData
617
588
  ) internal virtual {
618
589
  bool isRemoved = _operators[tokenId].remove(operator);
619
- if (!isRemoved) revert LSP8NonExistingOperator(operator, tokenId);
590
+ require(isRemoved, LSP8NonExistingOperator(operator, tokenId));
620
591
 
621
592
  emit OperatorRevoked(
622
593
  operator,
@@ -673,9 +644,7 @@ abstract contract LSP8IdentifiableDigitalAsset is
673
644
  * @dev When `tokenId` does not exist then revert with an error.
674
645
  */
675
646
  function _existsOrError(bytes32 tokenId) internal view virtual {
676
- if (!_exists(tokenId)) {
677
- revert LSP8NonExistentTokenId(tokenId);
678
- }
647
+ require(_exists(tokenId), LSP8NonExistentTokenId(tokenId));
679
648
  }
680
649
 
681
650
  /**
@@ -693,7 +662,7 @@ abstract contract LSP8IdentifiableDigitalAsset is
693
662
  * @custom:requirements
694
663
  * - `tokenId` must not exist and not have been already minted.
695
664
  * - `to` cannot be the zero address.
696
-
665
+ *
697
666
  * @custom:events {Transfer} event with `address(0)` as `from` address.
698
667
  */
699
668
  function _mint(
@@ -702,21 +671,15 @@ abstract contract LSP8IdentifiableDigitalAsset is
702
671
  bool force,
703
672
  bytes memory data
704
673
  ) internal virtual {
705
- if (to == address(0)) {
706
- revert LSP8CannotSendToAddressZero();
707
- }
674
+ require(to != address(0), LSP8CannotSendToAddressZero());
708
675
 
709
676
  // Check that `tokenId` is not already minted
710
- if (_exists(tokenId)) {
711
- revert LSP8TokenIdAlreadyMinted(tokenId);
712
- }
677
+ require(!_exists(tokenId), LSP8TokenIdAlreadyMinted(tokenId));
713
678
 
714
679
  _beforeTokenTransfer(address(0), to, tokenId, force, data);
715
680
 
716
681
  // Check that `tokenId` was not minted inside the `_beforeTokenTransfer` hook
717
- if (_exists(tokenId)) {
718
- revert LSP8TokenIdAlreadyMinted(tokenId);
719
- }
682
+ require(!_exists(tokenId), LSP8TokenIdAlreadyMinted(tokenId));
720
683
 
721
684
  // token being minted
722
685
  ++_existingTokens;
@@ -827,25 +790,21 @@ abstract contract LSP8IdentifiableDigitalAsset is
827
790
  bytes memory data
828
791
  ) internal virtual {
829
792
  address tokenOwner = tokenOwnerOf(tokenId);
830
- if (tokenOwner != from) {
831
- revert LSP8NotTokenOwner(tokenOwner, tokenId, from);
832
- }
793
+ require(
794
+ from == tokenOwner,
795
+ LSP8NotTokenOwner(tokenOwner, tokenId, from)
796
+ );
833
797
 
834
- if (to == address(0)) {
835
- revert LSP8CannotSendToAddressZero();
836
- }
798
+ require(to != address(0), LSP8CannotSendToAddressZero());
837
799
 
838
800
  _beforeTokenTransfer(from, to, tokenId, force, data);
839
801
 
840
802
  // Check that `tokenId`'s owner was not changed inside the `_beforeTokenTransfer` hook
841
803
  address currentTokenOwner = tokenOwnerOf(tokenId);
842
- if (tokenOwner != currentTokenOwner) {
843
- revert LSP8TokenOwnerChanged(
844
- tokenId,
845
- tokenOwner,
846
- currentTokenOwner
847
- );
848
- }
804
+ require(
805
+ currentTokenOwner == tokenOwner,
806
+ LSP8TokenOwnerChanged(tokenId, tokenOwner, currentTokenOwner)
807
+ );
849
808
 
850
809
  _clearOperators(from, tokenId);
851
810
 
@@ -934,7 +893,7 @@ abstract contract LSP8IdentifiableDigitalAsset is
934
893
  * @dev Attempt to notify the operator `operator` about the `tokenId` being authorized.
935
894
  * This is done by calling its {universalReceiver} function with the `_TYPEID_LSP8_TOKENOPERATOR` as typeId, if `operator` is a contract that supports the LSP1 interface.
936
895
  * If `operator` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent.
937
-
896
+ *
938
897
  * @param operator The address to call the {universalReceiver} function on.
939
898
  * @param lsp1Data the data to be sent to the `operator` address in the `universalReceiver` call.
940
899
  */
@@ -953,7 +912,7 @@ abstract contract LSP8IdentifiableDigitalAsset is
953
912
  * @dev Attempt to notify the token sender `from` about the `tokenId` being transferred.
954
913
  * This is done by calling its {universalReceiver} function with the `_TYPEID_LSP8_TOKENSSENDER` as typeId, if `from` is a contract that supports the LSP1 interface.
955
914
  * If `from` is an EOA or a contract that does not support the LSP1 interface, nothing will happen and no notification will be sent.
956
-
915
+ *
957
916
  * @param from The address to call the {universalReceiver} function on.
958
917
  * @param lsp1Data the data to be sent to the `from` address in the `universalReceiver` call.
959
918
  */