@lukso/lsp7-contracts 0.17.3 → 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 (57) hide show
  1. package/README.md +69 -24
  2. package/artifacts/IAccessControlExtended.json +1 -1
  3. package/artifacts/ILSP7CappedBalance.json +1 -1
  4. package/artifacts/ILSP7CappedSupply.json +1 -1
  5. package/artifacts/ILSP7DigitalAsset.json +1 -1
  6. package/artifacts/ILSP7Mintable.json +1 -1
  7. package/artifacts/ILSP7NonTransferable.json +8 -2
  8. package/artifacts/ILSP7Revokable.json +38 -1
  9. package/artifacts/LSP7Burnable.json +1 -1
  10. package/artifacts/LSP7BurnableInitAbstract.json +1 -1
  11. package/artifacts/LSP7CappedBalanceAbstract.json +1 -1
  12. package/artifacts/LSP7CappedBalanceInitAbstract.json +1 -1
  13. package/artifacts/LSP7CappedSupplyAbstract.json +1 -1
  14. package/artifacts/LSP7CappedSupplyInitAbstract.json +1 -1
  15. package/artifacts/LSP7CustomizableToken.json +63 -20
  16. package/artifacts/LSP7CustomizableTokenInit.json +59 -16
  17. package/artifacts/LSP7DigitalAsset.json +1 -1
  18. package/artifacts/LSP7DigitalAssetInitAbstract.json +1 -1
  19. package/artifacts/LSP7Mintable.json +27 -4
  20. package/artifacts/LSP7MintableAbstract.json +1 -1
  21. package/artifacts/LSP7MintableInit.json +26 -3
  22. package/artifacts/LSP7MintableInitAbstract.json +1 -1
  23. package/artifacts/LSP7NonTransferableAbstract.json +20 -14
  24. package/artifacts/LSP7NonTransferableInitAbstract.json +20 -14
  25. package/artifacts/LSP7RevokableAbstract.json +38 -1
  26. package/artifacts/LSP7RevokableInitAbstract.json +38 -1
  27. package/artifacts/LSP7Votes.json +1 -1
  28. package/artifacts/LSP7VotesInitAbstract.json +1 -1
  29. package/contracts/LSP7DigitalAsset.sol +6 -18
  30. package/contracts/extensions/AccessControlExtended/AccessControlExtendedAbstract.sol +3 -9
  31. package/contracts/extensions/AccessControlExtended/AccessControlExtendedInitAbstract.sol +4 -12
  32. package/contracts/extensions/AccessControlExtended/IAccessControlExtended.sol +1 -3
  33. package/contracts/extensions/LSP7CappedBalance/LSP7CappedBalanceAbstract.sol +1 -3
  34. package/contracts/extensions/LSP7CappedBalance/LSP7CappedBalanceInitAbstract.sol +3 -9
  35. package/contracts/extensions/LSP7CappedSupply/LSP7CappedSupplyInitAbstract.sol +1 -3
  36. package/contracts/extensions/LSP7Mintable/LSP7MintableAbstract.sol +1 -3
  37. package/contracts/extensions/LSP7Mintable/LSP7MintableInitAbstract.sol +3 -9
  38. package/contracts/extensions/LSP7MusicNDT/LSP7MusicNDTAbstract.sol +126 -0
  39. package/contracts/extensions/LSP7MusicNDT/LSP7MusicNDTConstants.sol +16 -0
  40. package/contracts/extensions/LSP7MusicNDT/LSP7MusicNDTErrors.sol +7 -0
  41. package/contracts/extensions/LSP7NonTransferable/ILSP7NonTransferable.sol +10 -4
  42. package/contracts/extensions/LSP7NonTransferable/LSP7NonTransferableAbstract.sol +24 -11
  43. package/contracts/extensions/LSP7NonTransferable/LSP7NonTransferableInitAbstract.sol +26 -17
  44. package/contracts/extensions/LSP7Revokable/ILSP7Revokable.sol +15 -1
  45. package/contracts/extensions/LSP7Revokable/LSP7RevokableAbstract.sol +10 -6
  46. package/contracts/extensions/LSP7Revokable/LSP7RevokableInitAbstract.sol +12 -12
  47. package/contracts/extensions/LSP7Votes/LSP7VotesInitAbstract.sol +2 -6
  48. package/contracts/presets/LSP7CustomizableToken.sol +8 -24
  49. package/contracts/presets/LSP7CustomizableTokenInit.sol +10 -30
  50. package/contracts/presets/LSP7Mintable.sol +49 -19
  51. package/contracts/presets/LSP7MintableInit.sol +57 -22
  52. package/dist/abi.cjs +191 -29
  53. package/dist/abi.d.cts +252 -41
  54. package/dist/abi.d.mts +252 -41
  55. package/dist/abi.d.ts +252 -41
  56. package/dist/abi.mjs +191 -29
  57. package/package.json +5 -1
@@ -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
@@ -109,6 +101,14 @@ abstract contract LSP7RevokableInitAbstract is
109
101
  AccessControlUnauthorizedAccount(to, REVOKER_ROLE)
110
102
  );
111
103
 
104
+ emit TokenRevoked({
105
+ revoker: msg.sender,
106
+ from: from,
107
+ to: to,
108
+ amount: amount,
109
+ data: data
110
+ });
111
+
112
112
  // We assume revokers are trusted when specifying revocation destinations.
113
113
  // Therefore, we bypass LSP1 receiver checks.
114
114
  _transfer({
@@ -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
  }