@lukso/lsp7-contracts 0.18.1 → 0.19.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 (55) hide show
  1. package/artifacts/IAccessControlExtended.json +1 -1
  2. package/artifacts/ILSP7CappedBalance.json +1 -1
  3. package/artifacts/ILSP7CappedSupply.json +1 -1
  4. package/artifacts/ILSP7DigitalAsset.json +1 -1
  5. package/artifacts/ILSP7Mintable.json +1 -1
  6. package/artifacts/ILSP7NonTransferable.json +1 -1
  7. package/artifacts/ILSP7Revokable.json +1 -1
  8. package/artifacts/LSP7Burnable.json +1 -1
  9. package/artifacts/LSP7BurnableInitAbstract.json +1 -1
  10. package/artifacts/LSP7CappedBalanceAbstract.json +1 -1
  11. package/artifacts/LSP7CappedBalanceInitAbstract.json +1 -1
  12. package/artifacts/LSP7CappedSupplyAbstract.json +1 -1
  13. package/artifacts/LSP7CappedSupplyInitAbstract.json +1 -1
  14. package/artifacts/LSP7CustomizableToken.json +3 -3
  15. package/artifacts/LSP7CustomizableTokenInit.json +3 -3
  16. package/artifacts/LSP7DigitalAsset.json +1 -1
  17. package/artifacts/LSP7DigitalAssetInitAbstract.json +1 -1
  18. package/artifacts/LSP7Mintable.json +27 -4
  19. package/artifacts/LSP7MintableAbstract.json +1 -1
  20. package/artifacts/LSP7MintableInit.json +26 -3
  21. package/artifacts/LSP7MintableInitAbstract.json +1 -1
  22. package/artifacts/LSP7NonTransferableAbstract.json +1 -1
  23. package/artifacts/LSP7NonTransferableInitAbstract.json +1 -1
  24. package/artifacts/LSP7RevokableAbstract.json +1 -1
  25. package/artifacts/LSP7RevokableInitAbstract.json +1 -1
  26. package/artifacts/LSP7Votes.json +1 -1
  27. package/artifacts/LSP7VotesInitAbstract.json +1 -1
  28. package/contracts/LSP7DigitalAsset.sol +6 -18
  29. package/contracts/extensions/AccessControlExtended/AccessControlExtendedAbstract.sol +3 -9
  30. package/contracts/extensions/AccessControlExtended/AccessControlExtendedInitAbstract.sol +4 -12
  31. package/contracts/extensions/AccessControlExtended/IAccessControlExtended.sol +1 -3
  32. package/contracts/extensions/LSP7CappedBalance/LSP7CappedBalanceAbstract.sol +1 -3
  33. package/contracts/extensions/LSP7CappedBalance/LSP7CappedBalanceInitAbstract.sol +3 -9
  34. package/contracts/extensions/LSP7CappedSupply/LSP7CappedSupplyInitAbstract.sol +1 -3
  35. package/contracts/extensions/LSP7Mintable/LSP7MintableAbstract.sol +1 -3
  36. package/contracts/extensions/LSP7Mintable/LSP7MintableInitAbstract.sol +3 -9
  37. package/contracts/extensions/LSP7MusicNDT/LSP7MusicNDTAbstract.sol +126 -0
  38. package/contracts/extensions/LSP7MusicNDT/LSP7MusicNDTConstants.sol +16 -0
  39. package/contracts/extensions/LSP7MusicNDT/LSP7MusicNDTErrors.sol +7 -0
  40. package/contracts/extensions/LSP7NonTransferable/LSP7NonTransferableAbstract.sol +8 -4
  41. package/contracts/extensions/LSP7NonTransferable/LSP7NonTransferableInitAbstract.sol +10 -10
  42. package/contracts/extensions/LSP7Revokable/ILSP7Revokable.sol +6 -1
  43. package/contracts/extensions/LSP7Revokable/LSP7RevokableAbstract.sol +2 -6
  44. package/contracts/extensions/LSP7Revokable/LSP7RevokableInitAbstract.sol +4 -12
  45. package/contracts/extensions/LSP7Votes/LSP7VotesInitAbstract.sol +2 -6
  46. package/contracts/presets/LSP7CustomizableToken.sol +8 -24
  47. package/contracts/presets/LSP7CustomizableTokenInit.sol +10 -30
  48. package/contracts/presets/LSP7Mintable.sol +49 -19
  49. package/contracts/presets/LSP7MintableInit.sol +57 -22
  50. package/dist/abi.cjs +22 -0
  51. package/dist/abi.d.cts +36 -0
  52. package/dist/abi.d.mts +36 -0
  53. package/dist/abi.d.ts +36 -0
  54. package/dist/abi.mjs +22 -0
  55. package/package.json +5 -1
@@ -0,0 +1,126 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.27;
3
+
4
+ // modules
5
+ import {LSP7DigitalAsset} from "../../LSP7DigitalAsset.sol";
6
+
7
+ import {ERC725Y} from "@erc725/smart-contracts-v8/contracts/ERC725Y.sol";
8
+
9
+ // constants
10
+ import {
11
+ _LSP33_SUPPORTED_STANDARDS_KEY,
12
+ _LSP33_SUPPORTED_STANDARDS_VALUE,
13
+ _LSP34_OWNERSHIP_SOURCE_KEY
14
+ } from "./LSP7MusicNDTConstants.sol";
15
+
16
+ import {_LSP4_TOKEN_TYPE_NFT} from "@lukso/lsp4-contracts/contracts/LSP4Constants.sol";
17
+
18
+ // errors
19
+ import {LSP34NotAuthorizedToMint} from "./LSP7MusicNDTErrors.sol";
20
+
21
+ /// @dev Minimal ERC173 interface used to resolve the minter when
22
+ /// `LSP34OwnershipSource` points to a plain owned contract
23
+ /// (i.e. `tokenId == bytes32(0)`).
24
+ interface IERC173 {
25
+ function owner() external view returns (address);
26
+ }
27
+
28
+ /// @dev Minimal LSP8 interface used to resolve the minter when
29
+ /// `LSP34OwnershipSource` points to an LSP8 tokenId
30
+ /// (i.e. `tokenId != bytes32(0)`). Declared locally, like `IERC173`, so
31
+ /// that the LSP7 package does not need the LSP8 package as a dependency.
32
+ interface ILSP8TokenOwnerOf {
33
+ function tokenOwnerOf(bytes32 tokenId) external view returns (address);
34
+ }
35
+
36
+ /// @title LSP7MusicNDTAbstract
37
+ /// @dev LSP33 music carrier for an LSP7 Music NDT (Non-Divisible Token): a
38
+ /// track token whose supply consists of multiple units, combined with LSP34
39
+ /// minting-rights delegation. Unlike an LSP8 collection, where every item is
40
+ /// a unique `tokenId`, the units of one LSP7 Music NDT are interchangeable.
41
+ ///
42
+ /// The `isNonDivisible_` constructor argument is forwarded unchanged to
43
+ /// `LSP7DigitalAsset`; deploy with `isNonDivisible_ = true` (`decimals()` = 0)
44
+ /// so that each unit is a whole, non-divisible token.
45
+ ///
46
+ /// The contract sets the `SupportedStandards:LSP33MusicNFT` marker at
47
+ /// construction and exposes a `mint` function that honours LSP34: in addition
48
+ /// to the ERC173 `owner()`, minting is allowed by the address resolved from
49
+ /// `LSP34OwnershipSource` when it has been set. Everything else — ownership
50
+ /// transfer, renouncement, and ERC725Y access control for `setData` — follows
51
+ /// the standard LSP7 / ERC725Y rules as required by LSP34.
52
+ abstract contract LSP7MusicNDTAbstract is LSP7DigitalAsset {
53
+ constructor(
54
+ string memory name_,
55
+ string memory symbol_,
56
+ address initialOwner_,
57
+ bool isNonDivisible_
58
+ )
59
+ LSP7DigitalAsset(
60
+ name_,
61
+ symbol_,
62
+ initialOwner_,
63
+ _LSP4_TOKEN_TYPE_NFT,
64
+ isNonDivisible_
65
+ )
66
+ {
67
+ ERC725Y._setData(
68
+ _LSP33_SUPPORTED_STANDARDS_KEY,
69
+ _LSP33_SUPPORTED_STANDARDS_VALUE
70
+ );
71
+ }
72
+
73
+ /// @notice Mint `amount` tokens to `to`.
74
+ /// @dev Authorisation follows LSP34: callable by the contract's own ERC173
75
+ /// `owner()` or, when `LSP34OwnershipSource` is set, by the address
76
+ /// resolved from that source.
77
+ function mint(
78
+ address to,
79
+ uint256 amount,
80
+ bool force,
81
+ bytes memory data
82
+ ) public virtual {
83
+ if (msg.sender != owner() && msg.sender != _resolveLSP34Minter()) {
84
+ revert LSP34NotAuthorizedToMint(msg.sender);
85
+ }
86
+ _mint(to, amount, force, data);
87
+ }
88
+
89
+ /// @dev Returns the address authorised to mint via `LSP34OwnershipSource`.
90
+ /// The value is the packed LSP2 `(address,bytes32)` tuple
91
+ /// `abi.encodePacked(address sourceContract, bytes32 tokenId)`: exactly
92
+ /// 52 bytes, `sourceContract` in bytes 0..19 and `tokenId` in bytes
93
+ /// 20..51. Returns `address(0)` when the source is unset or its value is
94
+ /// not exactly 52 bytes long (e.g. the 64-byte `abi.encode` form).
95
+ /// Reverts, granting no minting rights, when the source query reverts
96
+ /// (e.g. burned or nonexistent `tokenId`, source without code). `mint`
97
+ /// only calls this for callers other than `owner()`.
98
+ ///
99
+ /// Resolution rules per LSP34:
100
+ /// - If `tokenId != bytes32(0)`, query `tokenOwnerOf(tokenId)` on the source.
101
+ /// - If `tokenId == bytes32(0)`, query `owner()` on the source.
102
+ function _resolveLSP34Minter() internal view returns (address) {
103
+ bytes memory source = _getData(_LSP34_OWNERSHIP_SOURCE_KEY);
104
+ if (source.length != 52) {
105
+ return address(0);
106
+ }
107
+
108
+ address sourceContract;
109
+ bytes32 tokenId;
110
+ // `add(source, 32)` -> offset in memory where `source` data starts.
111
+ // Both reads stay within the 52 bytes of `source`: the first word
112
+ // holds `sourceContract` in its upper 20 bytes, the word starting at
113
+ // byte 20 is `tokenId`.
114
+ /// @solidity memory-safe-assembly
115
+ // solhint-disable-next-line no-inline-assembly
116
+ assembly {
117
+ sourceContract := shr(96, mload(add(source, 32)))
118
+ tokenId := mload(add(source, 52))
119
+ }
120
+
121
+ if (tokenId == bytes32(0)) {
122
+ return IERC173(sourceContract).owner();
123
+ }
124
+ return ILSP8TokenOwnerOf(sourceContract).tokenOwnerOf(tokenId);
125
+ }
126
+ }
@@ -0,0 +1,16 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.27;
3
+
4
+ // bytes10(keccak256('SupportedStandards')) + bytes2(0) + bytes20(keccak256('LSP33MusicNFT'))
5
+ // LSP2 Mapping: bytes20(...) keeps the first 20 bytes of keccak256('LSP33MusicNFT').
6
+ // The legacy draft key ...0000f43ae543...ff2ca4 (last 20 bytes) is mis-derived and is not written.
7
+ bytes32 constant _LSP33_SUPPORTED_STANDARDS_KEY = 0xeafec4d89fa9619884b600003cd4661761f237efa2fead11f43ae543d533ae73;
8
+
9
+ // bytes4(keccak256('LSP33MusicNFT'))
10
+ bytes constant _LSP33_SUPPORTED_STANDARDS_VALUE = hex"3cd46617";
11
+
12
+ // keccak256('LSP33Metadata')
13
+ bytes32 constant _LSP33_METADATA_KEY = 0xbecee5b67fa43fb2e96c7c6ccdc23007fffc2b24205416b2122cd7b8d8ef48fa;
14
+
15
+ // keccak256('LSP34OwnershipSource')
16
+ bytes32 constant _LSP34_OWNERSHIP_SOURCE_KEY = 0xa8bc5aea0671308a0920eb016db4108c486ef117a7cd18bf3a9dfcadab6232e1;
@@ -0,0 +1,7 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ pragma solidity ^0.8.27;
3
+
4
+ /// @dev Reverts when an address that is neither the contract's ERC173 `owner()`
5
+ /// nor the address resolved via `LSP34OwnershipSource` attempts to call `mint()`.
6
+ /// @param caller The address that attempted the mint call.
7
+ error LSP34NotAuthorizedToMint(address caller);
@@ -4,9 +4,7 @@ pragma solidity ^0.8.27;
4
4
  // modules
5
5
  import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
6
6
  import {LSP7DigitalAsset} from "../../LSP7DigitalAsset.sol";
7
- import {
8
- AccessControlExtendedAbstract
9
- } from "../AccessControlExtended/AccessControlExtendedAbstract.sol";
7
+ import {AccessControlExtendedAbstract} from "../AccessControlExtended/AccessControlExtendedAbstract.sol";
10
8
 
11
9
  // interfaces
12
10
  import {ILSP7NonTransferable} from "./ILSP7NonTransferable.sol";
@@ -74,6 +72,8 @@ abstract contract LSP7NonTransferableAbstract is
74
72
  }
75
73
 
76
74
  /// @inheritdoc ILSP7NonTransferable
75
+ // solhint-disable not-rely-on-time
76
+ // Transfer-lock windows are inherently time-based; `block.timestamp` is the intended source.
77
77
  function isTransferable() public view virtual override returns (bool) {
78
78
  if (!nonTransferabilityEnabled) return true;
79
79
 
@@ -100,6 +100,7 @@ abstract contract LSP7NonTransferableAbstract is
100
100
  transferLockStart > block.timestamp ||
101
101
  transferLockEnd < block.timestamp;
102
102
  }
103
+ // solhint-enable not-rely-on-time
103
104
 
104
105
  /// @inheritdoc ILSP7NonTransferable
105
106
  /// @custom:info The list of addresses holding the `NON_TRANSFERABLE_BYPASS_ROLE` remains populated after the non-transferable feature is switched off.
@@ -122,7 +123,10 @@ abstract contract LSP7NonTransferableAbstract is
122
123
  uint256 newTransferLockStart,
123
124
  uint256 newTransferLockEnd
124
125
  ) public virtual override onlyOwner {
125
- require(nonTransferabilityEnabled, LSP7CannotUpdateTransferLockPeriod());
126
+ require(
127
+ nonTransferabilityEnabled,
128
+ LSP7CannotUpdateTransferLockPeriod()
129
+ );
126
130
 
127
131
  // When `transferLockEnd` is 0, it means no end time is set (transfers locked indefinitely since `transferLockStart`)
128
132
  // When `transferLockStart` is 0, it means no start time is set (transfers locked up until `transferLockEnd`)
@@ -2,15 +2,9 @@
2
2
  pragma solidity ^0.8.4;
3
3
 
4
4
  // modules
5
- import {
6
- OwnableUpgradeable
7
- } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
8
- import {
9
- LSP7DigitalAssetInitAbstract
10
- } from "../../LSP7DigitalAssetInitAbstract.sol";
11
- import {
12
- AccessControlExtendedInitAbstract
13
- } from "../AccessControlExtended/AccessControlExtendedInitAbstract.sol";
5
+ import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
6
+ import {LSP7DigitalAssetInitAbstract} from "../../LSP7DigitalAssetInitAbstract.sol";
7
+ import {AccessControlExtendedInitAbstract} from "../AccessControlExtended/AccessControlExtendedInitAbstract.sol";
14
8
 
15
9
  // interfaces
16
10
  import {ILSP7NonTransferable} from "./ILSP7NonTransferable.sol";
@@ -117,6 +111,8 @@ abstract contract LSP7NonTransferableInitAbstract is
117
111
  }
118
112
 
119
113
  /// @inheritdoc ILSP7NonTransferable
114
+ // solhint-disable not-rely-on-time
115
+ // Transfer-lock windows are inherently time-based; `block.timestamp` is the intended source.
120
116
  function isTransferable() public view virtual override returns (bool) {
121
117
  if (!nonTransferabilityEnabled) return true;
122
118
 
@@ -143,6 +139,7 @@ abstract contract LSP7NonTransferableInitAbstract is
143
139
  transferLockStart > block.timestamp ||
144
140
  transferLockEnd < block.timestamp;
145
141
  }
142
+ // solhint-enable not-rely-on-time
146
143
 
147
144
  /// @inheritdoc ILSP7NonTransferable
148
145
  /// @custom:info The list of addresses holding the `NON_TRANSFERABLE_BYPASS_ROLE` remains populated after the non-transferable feature is switched off.
@@ -165,7 +162,10 @@ abstract contract LSP7NonTransferableInitAbstract is
165
162
  uint256 newTransferLockStart,
166
163
  uint256 newTransferLockEnd
167
164
  ) public virtual override onlyOwner {
168
- require(nonTransferabilityEnabled, LSP7CannotUpdateTransferLockPeriod());
165
+ require(
166
+ nonTransferabilityEnabled,
167
+ LSP7CannotUpdateTransferLockPeriod()
168
+ );
169
169
 
170
170
  // When transferLockEnd is 0, it means no end time is set (transfers locked indefinitely after transferLockStart)
171
171
  // When transferLockStart is 0, it means no start time is set (transfers locked up until transferLockEnd)
@@ -33,5 +33,10 @@ interface ILSP7Revokable {
33
33
  /// @param to The address receiving the revoked tokens.
34
34
  /// @param amount The amount of tokens to revoke.
35
35
  /// @param data Additional data to include in the transfer notification.
36
- function revoke(address from, address to, uint256 amount, bytes memory data) external;
36
+ function revoke(
37
+ address from,
38
+ address to,
39
+ uint256 amount,
40
+ bytes memory data
41
+ ) external;
37
42
  }
@@ -4,17 +4,13 @@ pragma solidity ^0.8.27;
4
4
  // modules
5
5
  import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
6
6
  import {LSP7DigitalAsset} from "../../LSP7DigitalAsset.sol";
7
- import {
8
- AccessControlExtendedAbstract
9
- } from "../AccessControlExtended/AccessControlExtendedAbstract.sol";
7
+ import {AccessControlExtendedAbstract} from "../AccessControlExtended/AccessControlExtendedAbstract.sol";
10
8
 
11
9
  // interfaces
12
10
  import {ILSP7Revokable} from "./ILSP7Revokable.sol";
13
11
 
14
12
  // errors
15
- import {
16
- AccessControlUnauthorizedAccount
17
- } from "../AccessControlExtended/AccessControlExtendedErrors.sol";
13
+ import {AccessControlUnauthorizedAccount} from "../AccessControlExtended/AccessControlExtendedErrors.sol";
18
14
  import {LSP7RevokableFeatureDisabled} from "./LSP7RevokableErrors.sol";
19
15
 
20
16
  /// @title LSP7RevokableAbstract
@@ -2,23 +2,15 @@
2
2
  pragma solidity ^0.8.27;
3
3
 
4
4
  // modules
5
- import {
6
- OwnableUpgradeable
7
- } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
8
- import {
9
- LSP7DigitalAssetInitAbstract
10
- } from "../../LSP7DigitalAssetInitAbstract.sol";
11
- import {
12
- AccessControlExtendedInitAbstract
13
- } from "../AccessControlExtended/AccessControlExtendedInitAbstract.sol";
5
+ import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
6
+ import {LSP7DigitalAssetInitAbstract} from "../../LSP7DigitalAssetInitAbstract.sol";
7
+ import {AccessControlExtendedInitAbstract} from "../AccessControlExtended/AccessControlExtendedInitAbstract.sol";
14
8
 
15
9
  // interfaces
16
10
  import {ILSP7Revokable} from "./ILSP7Revokable.sol";
17
11
 
18
12
  // errors
19
- import {
20
- AccessControlUnauthorizedAccount
21
- } from "../AccessControlExtended/AccessControlExtendedErrors.sol";
13
+ import {AccessControlUnauthorizedAccount} from "../AccessControlExtended/AccessControlExtendedErrors.sol";
22
14
  import {LSP7RevokableFeatureDisabled} from "./LSP7RevokableErrors.sol";
23
15
 
24
16
  /// @title LSP7RevokableInitAbstract
@@ -5,12 +5,8 @@ pragma solidity ^0.8.27;
5
5
  import {IERC5805} from "@openzeppelin/contracts/interfaces/IERC5805.sol";
6
6
 
7
7
  // modules
8
- import {
9
- EIP712Upgradeable
10
- } from "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol";
11
- import {
12
- LSP7DigitalAssetInitAbstract
13
- } from "../../LSP7DigitalAssetInitAbstract.sol";
8
+ import {EIP712Upgradeable} from "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol";
9
+ import {LSP7DigitalAssetInitAbstract} from "../../LSP7DigitalAssetInitAbstract.sol";
14
10
 
15
11
  // libraries
16
12
  import {Counters} from "@openzeppelin/contracts/utils/Counters.sol";
@@ -3,28 +3,16 @@ pragma solidity ^0.8.27;
3
3
 
4
4
  // modules
5
5
  import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
6
- import {
7
- AccessControlExtendedAbstract
8
- } from "../extensions/AccessControlExtended/AccessControlExtendedAbstract.sol";
6
+ import {AccessControlExtendedAbstract} from "../extensions/AccessControlExtended/AccessControlExtendedAbstract.sol";
9
7
  import {LSP7DigitalAsset} from "../LSP7DigitalAsset.sol";
10
8
 
11
9
  // extensions
12
10
  import {LSP7Burnable} from "../extensions/LSP7Burnable/LSP7Burnable.sol";
13
- import {
14
- LSP7MintableAbstract
15
- } from "../extensions/LSP7Mintable/LSP7MintableAbstract.sol";
16
- import {
17
- LSP7CappedSupplyAbstract
18
- } from "../extensions/LSP7CappedSupply/LSP7CappedSupplyAbstract.sol";
19
- import {
20
- LSP7CappedBalanceAbstract
21
- } from "../extensions/LSP7CappedBalance/LSP7CappedBalanceAbstract.sol";
22
- import {
23
- LSP7NonTransferableAbstract
24
- } from "../extensions/LSP7NonTransferable/LSP7NonTransferableAbstract.sol";
25
- import {
26
- LSP7RevokableAbstract
27
- } from "../extensions/LSP7Revokable/LSP7RevokableAbstract.sol";
11
+ import {LSP7MintableAbstract} from "../extensions/LSP7Mintable/LSP7MintableAbstract.sol";
12
+ import {LSP7CappedSupplyAbstract} from "../extensions/LSP7CappedSupply/LSP7CappedSupplyAbstract.sol";
13
+ import {LSP7CappedBalanceAbstract} from "../extensions/LSP7CappedBalance/LSP7CappedBalanceAbstract.sol";
14
+ import {LSP7NonTransferableAbstract} from "../extensions/LSP7NonTransferable/LSP7NonTransferableAbstract.sol";
15
+ import {LSP7RevokableAbstract} from "../extensions/LSP7Revokable/LSP7RevokableAbstract.sol";
28
16
 
29
17
  // constants
30
18
  import {
@@ -35,12 +23,8 @@ import {
35
23
  } from "./LSP7CustomizableTokenConstants.sol";
36
24
 
37
25
  // errors
38
- import {
39
- LSP7MintDisabled
40
- } from "../extensions/LSP7Mintable/LSP7MintableErrors.sol";
41
- import {
42
- LSP7CappedSupplyCannotMintOverCap
43
- } from "../extensions/LSP7CappedSupply/LSP7CappedSupplyErrors.sol";
26
+ import {LSP7MintDisabled} from "../extensions/LSP7Mintable/LSP7MintableErrors.sol";
27
+ import {LSP7CappedSupplyCannotMintOverCap} from "../extensions/LSP7CappedSupply/LSP7CappedSupplyErrors.sol";
44
28
 
45
29
  /// @title LSP7CustomizableToken
46
30
  /// @dev A customizable LSP7 token that implements multiple features and uses role-based exemptions.
@@ -2,32 +2,16 @@
2
2
  pragma solidity ^0.8.27;
3
3
 
4
4
  // modules
5
- import {
6
- OwnableUpgradeable
7
- } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
8
- import {
9
- LSP7DigitalAssetInitAbstract
10
- } from "../LSP7DigitalAssetInitAbstract.sol";
5
+ import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
6
+ import {LSP7DigitalAssetInitAbstract} from "../LSP7DigitalAssetInitAbstract.sol";
11
7
 
12
8
  // extensions
13
- import {
14
- LSP7BurnableInitAbstract
15
- } from "../extensions/LSP7Burnable/LSP7BurnableInitAbstract.sol";
16
- import {
17
- LSP7MintableInitAbstract
18
- } from "../extensions/LSP7Mintable/LSP7MintableInitAbstract.sol";
19
- import {
20
- LSP7CappedSupplyInitAbstract
21
- } from "../extensions/LSP7CappedSupply/LSP7CappedSupplyInitAbstract.sol";
22
- import {
23
- LSP7CappedBalanceInitAbstract
24
- } from "../extensions/LSP7CappedBalance/LSP7CappedBalanceInitAbstract.sol";
25
- import {
26
- LSP7NonTransferableInitAbstract
27
- } from "../extensions/LSP7NonTransferable/LSP7NonTransferableInitAbstract.sol";
28
- import {
29
- LSP7RevokableInitAbstract
30
- } from "../extensions/LSP7Revokable/LSP7RevokableInitAbstract.sol";
9
+ import {LSP7BurnableInitAbstract} from "../extensions/LSP7Burnable/LSP7BurnableInitAbstract.sol";
10
+ import {LSP7MintableInitAbstract} from "../extensions/LSP7Mintable/LSP7MintableInitAbstract.sol";
11
+ import {LSP7CappedSupplyInitAbstract} from "../extensions/LSP7CappedSupply/LSP7CappedSupplyInitAbstract.sol";
12
+ import {LSP7CappedBalanceInitAbstract} from "../extensions/LSP7CappedBalance/LSP7CappedBalanceInitAbstract.sol";
13
+ import {LSP7NonTransferableInitAbstract} from "../extensions/LSP7NonTransferable/LSP7NonTransferableInitAbstract.sol";
14
+ import {LSP7RevokableInitAbstract} from "../extensions/LSP7Revokable/LSP7RevokableInitAbstract.sol";
31
15
 
32
16
  // constants
33
17
  import {
@@ -38,12 +22,8 @@ import {
38
22
  } from "./LSP7CustomizableTokenConstants.sol";
39
23
 
40
24
  // errors
41
- import {
42
- LSP7MintDisabled
43
- } from "../extensions/LSP7Mintable/LSP7MintableErrors.sol";
44
- import {
45
- LSP7CappedSupplyCannotMintOverCap
46
- } from "../extensions/LSP7CappedSupply/LSP7CappedSupplyErrors.sol";
25
+ import {LSP7MintDisabled} from "../extensions/LSP7Mintable/LSP7MintableErrors.sol";
26
+ import {LSP7CappedSupplyCannotMintOverCap} from "../extensions/LSP7CappedSupply/LSP7CappedSupplyErrors.sol";
47
27
 
48
28
  /// @title LSP7CustomizableTokenInit
49
29
  /// @dev A customizable LSP7 token that implements multiple features and uses role-based exemptions. This version of the contract is the implementation to use behind proxies.
@@ -2,27 +2,23 @@
2
2
  pragma solidity ^0.8.27;
3
3
 
4
4
  // modules
5
+ import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
5
6
  import {LSP7DigitalAsset} from "../LSP7DigitalAsset.sol";
6
- import {
7
- LSP7MintableAbstract
8
- } from "../extensions/LSP7Mintable/LSP7MintableAbstract.sol";
9
- import {
10
- AccessControlExtendedAbstract
11
- } from "../extensions/AccessControlExtended/AccessControlExtendedAbstract.sol";
7
+ import {LSP7Burnable} from "../extensions/LSP7Burnable/LSP7Burnable.sol";
8
+ import {LSP7MintableAbstract} from "../extensions/LSP7Mintable/LSP7MintableAbstract.sol";
9
+ import {AccessControlExtendedAbstract} from "../extensions/AccessControlExtended/AccessControlExtendedAbstract.sol";
12
10
 
13
- /**
14
- * @title LSP7DigitalAsset deployable preset contract with a public {mint} function callable by addresses holding `MINTER_ROLE`.
15
- */
16
- contract LSP7Mintable is LSP7MintableAbstract {
17
- /**
18
- * @notice Deploying a `LSP7Mintable` token contract.
19
- * @dev Set the token to be mintable to allow minting more tokens after deployment.
20
- * @param name_ The name of the token.
21
- * @param symbol_ The symbol of the token.
22
- * @param newOwner_ The owner of the token contract.
23
- * @param lsp4TokenType_ The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection).
24
- * @param isNonDivisible_ Specify if the LSP7 token is divisible (decimals = 18) or non-divisible (decimals = 0).
25
- */
11
+ /// @title LSP7DigitalAsset deployable preset contract with:
12
+ /// - a public {mint} function callable by addresses holding `MINTER_ROLE`.
13
+ /// - a public {burn} function callable by any token holder or operator.
14
+ contract LSP7Mintable is LSP7MintableAbstract, LSP7Burnable {
15
+ /// @notice Deploying a `LSP7Mintable` token contract.
16
+ /// @dev Set the token to be mintable to allow minting more tokens after deployment.
17
+ /// @param name_ The name of the token.
18
+ /// @param symbol_ The symbol of the token.
19
+ /// @param newOwner_ The owner of the token contract.
20
+ /// @param lsp4TokenType_ The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection).
21
+ /// @param isNonDivisible_ Specify if the LSP7 token is divisible (decimals = 18) or non-divisible (decimals = 0).
26
22
  constructor(
27
23
  string memory name_,
28
24
  string memory symbol_,
@@ -40,4 +36,38 @@ contract LSP7Mintable is LSP7MintableAbstract {
40
36
  AccessControlExtendedAbstract()
41
37
  LSP7MintableAbstract(true)
42
38
  {}
39
+
40
+ /// @dev Required override to resolve multiple inheritance. Delegates via `super` to the parent implementation
41
+ /// that aggregates the interface IDs supported across all inherited modules.
42
+ function supportsInterface(
43
+ bytes4 interfaceId
44
+ )
45
+ public
46
+ view
47
+ virtual
48
+ override(LSP7MintableAbstract, LSP7DigitalAsset)
49
+ returns (bool)
50
+ {
51
+ return super.supportsInterface(interfaceId);
52
+ }
53
+
54
+ /// @inheritdoc LSP7MintableAbstract
55
+ /// @dev Required override to resolve multiple inheritance. Calls every parent {_mint} function via `super`.
56
+ function _mint(
57
+ address to,
58
+ uint256 amount,
59
+ bool force,
60
+ bytes memory data
61
+ ) internal virtual override(LSP7MintableAbstract, LSP7DigitalAsset) {
62
+ super._mint(to, amount, force, data);
63
+ }
64
+
65
+ /// @dev Required override to resolve multiple inheritance. Calls every parent {_transferOwnership} function
66
+ /// via `super` so that each inherited module updates its ownership-dependent state.
67
+ /// When contract ownership changes, this resets the admin role of `MINTER_ROLE` back to `DEFAULT_ADMIN_ROLE`.
68
+ function _transferOwnership(
69
+ address newOwner
70
+ ) internal virtual override(LSP7MintableAbstract, Ownable) {
71
+ super._transferOwnership(newOwner);
72
+ }
43
73
  }
@@ -2,33 +2,30 @@
2
2
  pragma solidity ^0.8.27;
3
3
 
4
4
  // modules
5
- import {
6
- LSP7DigitalAssetInitAbstract
7
- } from "../LSP7DigitalAssetInitAbstract.sol";
8
- import {
9
- LSP7MintableInitAbstract
10
- } from "../extensions/LSP7Mintable/LSP7MintableInitAbstract.sol";
5
+ import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
6
+ import {LSP7BurnableInitAbstract} from "../extensions/LSP7Burnable/LSP7BurnableInitAbstract.sol";
7
+ import {LSP7DigitalAssetInitAbstract} from "../LSP7DigitalAssetInitAbstract.sol";
8
+ import {LSP7MintableInitAbstract} from "../extensions/LSP7Mintable/LSP7MintableInitAbstract.sol";
11
9
 
12
- /**
13
- * @dev LSP7DigitalAsset deployable preset contract (proxy version) with a public {mint} function callable by addresses holding `MINTER_ROLE`.
14
- */
15
- contract LSP7MintableInit is LSP7MintableInitAbstract {
16
- /**
17
- * @dev initialize (= lock) base implementation contract on deployment
18
- */
10
+ /// @dev LSP7DigitalAsset deployable preset contract (proxy version) with:
11
+ /// - a public {mint} function callable by addresses holding `MINTER_ROLE`.
12
+ /// - a public {burn} function callable by any token holder or operator.
13
+ contract LSP7MintableInit is
14
+ LSP7MintableInitAbstract,
15
+ LSP7BurnableInitAbstract
16
+ {
17
+ /// @dev initialize (= lock) base implementation contract on deployment
19
18
  constructor() {
20
19
  _disableInitializers();
21
20
  }
22
21
 
23
- /**
24
- * @notice Initializing a `LSP7MintableInit` token contract.
25
- * @dev Set the token to be mintable to allow minting more tokens after deployment.
26
- * @param name_ The name of the token.
27
- * @param symbol_ The symbol of the token.
28
- * @param newOwner_ The owner of the token contract.
29
- * @param lsp4TokenType_ The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection).
30
- * @param isNonDivisible_ Specify if the LSP7 token is divisible (decimals = 18) or non-divisible (decimals = 0)
31
- */
22
+ /// @notice Initializing a `LSP7MintableInit` token contract.
23
+ /// @dev Set the token to be mintable to allow minting more tokens after deployment.
24
+ /// @param name_ The name of the token.
25
+ /// @param symbol_ The symbol of the token.
26
+ /// @param newOwner_ The owner of the token contract.
27
+ /// @param lsp4TokenType_ The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection).
28
+ /// @param isNonDivisible_ Specify if the LSP7 token is divisible (decimals = 18) or non-divisible (decimals = 0)
32
29
  function initialize(
33
30
  string calldata name_,
34
31
  string calldata symbol_,
@@ -46,4 +43,42 @@ contract LSP7MintableInit is LSP7MintableInitAbstract {
46
43
  __AccessControlExtended_init();
47
44
  __LSP7Mintable_init_unchained(true);
48
45
  }
46
+
47
+ /// @dev Required override to resolve multiple inheritance. Delegates via `super` to the parent implementation
48
+ /// that aggregates the interface IDs supported across all inherited modules.
49
+ function supportsInterface(
50
+ bytes4 interfaceId
51
+ )
52
+ public
53
+ view
54
+ virtual
55
+ override(LSP7MintableInitAbstract, LSP7DigitalAssetInitAbstract)
56
+ returns (bool)
57
+ {
58
+ return super.supportsInterface(interfaceId);
59
+ }
60
+
61
+ /// @inheritdoc LSP7MintableInitAbstract
62
+ /// @dev Required override to resolve multiple inheritance. Calls every parent {_mint} function via `super`.
63
+ function _mint(
64
+ address to,
65
+ uint256 amount,
66
+ bool force,
67
+ bytes memory data
68
+ )
69
+ internal
70
+ virtual
71
+ override(LSP7MintableInitAbstract, LSP7DigitalAssetInitAbstract)
72
+ {
73
+ super._mint(to, amount, force, data);
74
+ }
75
+
76
+ /// @dev Required override to resolve multiple inheritance. Calls every parent {_transferOwnership} function
77
+ /// via `super` so that each inherited module updates its ownership-dependent state.
78
+ /// When contract ownership changes, this resets the admin role of `MINTER_ROLE` back to `DEFAULT_ADMIN_ROLE`.
79
+ function _transferOwnership(
80
+ address newOwner
81
+ ) internal virtual override(LSP7MintableInitAbstract, OwnableUpgradeable) {
82
+ super._transferOwnership(newOwner);
83
+ }
49
84
  }
package/dist/abi.cjs CHANGED
@@ -6364,6 +6364,17 @@ const lsp7MintableAbi = [
6364
6364
  outputs: [{ name: "results", internalType: "bytes[]", type: "bytes[]" }],
6365
6365
  stateMutability: "nonpayable"
6366
6366
  },
6367
+ {
6368
+ type: "function",
6369
+ inputs: [
6370
+ { name: "from", internalType: "address", type: "address" },
6371
+ { name: "amount", internalType: "uint256", type: "uint256" },
6372
+ { name: "data", internalType: "bytes", type: "bytes" }
6373
+ ],
6374
+ name: "burn",
6375
+ outputs: [],
6376
+ stateMutability: "nonpayable"
6377
+ },
6367
6378
  {
6368
6379
  type: "function",
6369
6380
  inputs: [],
@@ -7615,6 +7626,17 @@ const lsp7MintableInitAbi = [
7615
7626
  outputs: [{ name: "results", internalType: "bytes[]", type: "bytes[]" }],
7616
7627
  stateMutability: "nonpayable"
7617
7628
  },
7629
+ {
7630
+ type: "function",
7631
+ inputs: [
7632
+ { name: "from", internalType: "address", type: "address" },
7633
+ { name: "amount", internalType: "uint256", type: "uint256" },
7634
+ { name: "data", internalType: "bytes", type: "bytes" }
7635
+ ],
7636
+ name: "burn",
7637
+ outputs: [],
7638
+ stateMutability: "nonpayable"
7639
+ },
7618
7640
  {
7619
7641
  type: "function",
7620
7642
  inputs: [],