@lukso/lsp-smart-contracts 0.12.1 → 0.13.0

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 (121) hide show
  1. package/README.md +2 -2
  2. package/artifacts/LSP0ERC725Account.json +6 -6
  3. package/artifacts/LSP0ERC725AccountInit.json +6 -6
  4. package/artifacts/LSP11BasicSocialRecovery.json +2 -2
  5. package/artifacts/LSP11BasicSocialRecoveryInit.json +2 -2
  6. package/artifacts/LSP1UniversalReceiverDelegateUP.json +2 -2
  7. package/artifacts/LSP1UniversalReceiverDelegateVault.json +2 -2
  8. package/artifacts/LSP4DigitalAssetMetadata.json +5 -0
  9. package/artifacts/LSP4DigitalAssetMetadataInitAbstract.json +5 -0
  10. package/artifacts/LSP6KeyManager.json +2 -2
  11. package/artifacts/LSP6KeyManagerInit.json +2 -2
  12. package/artifacts/LSP7CappedSupply.json +71 -36
  13. package/artifacts/LSP7CappedSupplyInitAbstract.json +71 -36
  14. package/artifacts/LSP7CompatibleERC20.json +71 -36
  15. package/artifacts/LSP7CompatibleERC20InitAbstract.json +71 -36
  16. package/artifacts/LSP7CompatibleERC20Mintable.json +78 -38
  17. package/artifacts/LSP7CompatibleERC20MintableInit.json +78 -38
  18. package/artifacts/LSP7DigitalAsset.json +71 -36
  19. package/artifacts/LSP7DigitalAssetInitAbstract.json +71 -36
  20. package/artifacts/LSP7Mintable.json +78 -38
  21. package/artifacts/LSP7MintableInit.json +78 -38
  22. package/artifacts/LSP8CappedSupply.json +187 -23
  23. package/artifacts/LSP8CappedSupplyInitAbstract.json +200 -36
  24. package/artifacts/LSP8CompatibleERC721.json +187 -23
  25. package/artifacts/LSP8CompatibleERC721InitAbstract.json +200 -36
  26. package/artifacts/LSP8CompatibleERC721Mintable.json +195 -26
  27. package/artifacts/LSP8CompatibleERC721MintableInit.json +208 -39
  28. package/artifacts/LSP8IdentifiableDigitalAsset.json +187 -23
  29. package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +200 -36
  30. package/artifacts/LSP8Mintable.json +195 -26
  31. package/artifacts/LSP8MintableInit.json +208 -39
  32. package/artifacts/LSP9Vault.json +6 -6
  33. package/artifacts/LSP9VaultInit.json +6 -6
  34. package/artifacts/UniversalProfile.json +6 -6
  35. package/artifacts/UniversalProfileInit.json +6 -6
  36. package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +1 -22
  37. package/contracts/LSP17Extensions/Extension4337.sol +26 -1
  38. package/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +9 -0
  39. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +20 -34
  40. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataCore.sol +47 -0
  41. package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +19 -31
  42. package/contracts/LSP4DigitalAssetMetadata/LSP4Errors.sol +13 -6
  43. package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +1 -1
  44. package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +20 -9
  45. package/contracts/LSP7DigitalAsset/LSP7Constants.sol +1 -1
  46. package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +7 -5
  47. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +128 -25
  48. package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +5 -2
  49. package/contracts/LSP7DigitalAsset/LSP7Errors.sol +6 -0
  50. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +4 -2
  51. package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +7 -4
  52. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +4 -2
  53. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +5 -2
  54. package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +8 -2
  55. package/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +12 -1
  56. package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +4 -0
  57. package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +4 -0
  58. package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +77 -4
  59. package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +15 -12
  60. package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +19 -3
  61. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +25 -16
  62. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +223 -19
  63. package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +28 -15
  64. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +15 -4
  65. package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +8 -4
  66. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +13 -2
  67. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +6 -2
  68. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +4 -2
  69. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +13 -2
  70. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +6 -2
  71. package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +6 -2
  72. package/contracts/LSP9Vault/LSP9VaultCore.sol +0 -22
  73. package/contracts/Version.sol +1 -1
  74. package/devdocs/LSP4DigitalAssetMetadata.json +11 -5
  75. package/devdocs/LSP4DigitalAssetMetadataInitAbstract.json +7 -2
  76. package/devdocs/LSP6KeyManager.json +1 -1
  77. package/devdocs/LSP6KeyManagerInit.json +1 -1
  78. package/devdocs/LSP7CappedSupply.json +22 -2
  79. package/devdocs/LSP7CappedSupplyInitAbstract.json +22 -2
  80. package/devdocs/LSP7CompatibleERC20.json +23 -2
  81. package/devdocs/LSP7CompatibleERC20InitAbstract.json +22 -2
  82. package/devdocs/LSP7CompatibleERC20Mintable.json +23 -2
  83. package/devdocs/LSP7CompatibleERC20MintableInit.json +24 -3
  84. package/devdocs/LSP7DigitalAsset.json +27 -6
  85. package/devdocs/LSP7DigitalAssetInitAbstract.json +22 -2
  86. package/devdocs/LSP7Mintable.json +24 -2
  87. package/devdocs/LSP7MintableInit.json +25 -3
  88. package/devdocs/LSP8CappedSupply.json +66 -4
  89. package/devdocs/LSP8CappedSupplyInitAbstract.json +66 -4
  90. package/devdocs/LSP8CompatibleERC721.json +69 -5
  91. package/devdocs/LSP8CompatibleERC721InitAbstract.json +67 -5
  92. package/devdocs/LSP8CompatibleERC721Mintable.json +69 -5
  93. package/devdocs/LSP8CompatibleERC721MintableInit.json +70 -6
  94. package/devdocs/LSP8IdentifiableDigitalAsset.json +71 -8
  95. package/devdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +66 -4
  96. package/devdocs/LSP8Mintable.json +68 -4
  97. package/devdocs/LSP8MintableInit.json +69 -5
  98. package/dist/constants.cjs.js +4406 -1319
  99. package/dist/constants.d.ts +4184 -844
  100. package/dist/constants.es.js +4405 -1319
  101. package/package.json +2 -2
  102. package/userdocs/LSP7CappedSupply.json +8 -0
  103. package/userdocs/LSP7CappedSupplyInitAbstract.json +8 -0
  104. package/userdocs/LSP7CompatibleERC20.json +8 -0
  105. package/userdocs/LSP7CompatibleERC20InitAbstract.json +8 -0
  106. package/userdocs/LSP7CompatibleERC20Mintable.json +8 -0
  107. package/userdocs/LSP7CompatibleERC20MintableInit.json +9 -1
  108. package/userdocs/LSP7DigitalAsset.json +8 -0
  109. package/userdocs/LSP7DigitalAssetInitAbstract.json +8 -0
  110. package/userdocs/LSP7Mintable.json +8 -0
  111. package/userdocs/LSP7MintableInit.json +9 -1
  112. package/userdocs/LSP8CappedSupply.json +20 -0
  113. package/userdocs/LSP8CappedSupplyInitAbstract.json +20 -0
  114. package/userdocs/LSP8CompatibleERC721.json +20 -0
  115. package/userdocs/LSP8CompatibleERC721InitAbstract.json +20 -0
  116. package/userdocs/LSP8CompatibleERC721Mintable.json +20 -0
  117. package/userdocs/LSP8CompatibleERC721MintableInit.json +21 -1
  118. package/userdocs/LSP8IdentifiableDigitalAsset.json +21 -1
  119. package/userdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +20 -0
  120. package/userdocs/LSP8Mintable.json +20 -0
  121. package/userdocs/LSP8MintableInit.json +21 -1
@@ -20,13 +20,24 @@ contract LSP7Mintable is LSP7DigitalAsset, ILSP7Mintable {
20
20
  * @param name_ The name of the token.
21
21
  * @param symbol_ The symbol of the token.
22
22
  * @param newOwner_ The owner of the token contract.
23
+ * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection).
24
+ * @param isNonDivisible_ Specify if the LSP7 token is a fungible or non-fungible token.
23
25
  */
24
26
  constructor(
25
27
  string memory name_,
26
28
  string memory symbol_,
27
29
  address newOwner_,
30
+ uint256 lsp4TokenType_,
28
31
  bool isNonDivisible_
29
- ) LSP7DigitalAsset(name_, symbol_, newOwner_, isNonDivisible_) {}
32
+ )
33
+ LSP7DigitalAsset(
34
+ name_,
35
+ symbol_,
36
+ newOwner_,
37
+ lsp4TokenType_,
38
+ isNonDivisible_
39
+ )
40
+ {}
30
41
 
31
42
  /**
32
43
  * @dev Public {_mint} function only callable by the {owner}.
@@ -23,17 +23,21 @@ contract LSP7MintableInit is LSP7MintableInitAbstract {
23
23
  * @param name_ The name of the token.
24
24
  * @param symbol_ The symbol of the token.
25
25
  * @param newOwner_ The owner of the token contract.
26
+ * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection).
27
+ * @param isNonDivisible_ Specify if the LSP7 token is a fungible or non-fungible token.
26
28
  */
27
29
  function initialize(
28
30
  string memory name_,
29
31
  string memory symbol_,
30
32
  address newOwner_,
33
+ uint256 lsp4TokenType_,
31
34
  bool isNonDivisible_
32
35
  ) external virtual initializer {
33
36
  LSP7MintableInitAbstract._initialize(
34
37
  name_,
35
38
  symbol_,
36
39
  newOwner_,
40
+ lsp4TokenType_,
37
41
  isNonDivisible_
38
42
  );
39
43
  }
@@ -24,17 +24,21 @@ abstract contract LSP7MintableInitAbstract is
24
24
  * @param name_ The name of the token.
25
25
  * @param symbol_ The symbol of the token.
26
26
  * @param newOwner_ The owner of the token contract.
27
+ * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection).
28
+ * @param isNonDivisible_ Specify if the LSP7 token is a fungible or non-fungible token.
27
29
  */
28
30
  function _initialize(
29
31
  string memory name_,
30
32
  string memory symbol_,
31
33
  address newOwner_,
34
+ uint256 lsp4TokenType_,
32
35
  bool isNonDivisible_
33
36
  ) internal virtual override onlyInitializing {
34
37
  LSP7DigitalAssetInitAbstract._initialize(
35
38
  name_,
36
39
  symbol_,
37
40
  newOwner_,
41
+ lsp4TokenType_,
38
42
  isNonDivisible_
39
43
  );
40
44
  }
@@ -39,7 +39,7 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
39
39
  * @param tokenId The tokenId `operator` address has access on behalf of `tokenOwner`.
40
40
  * @param operatorNotificationData The data to notify the operator about via LSP1.
41
41
  */
42
- event AuthorizedOperator(
42
+ event OperatorAuthorizationChanged(
43
43
  address indexed operator,
44
44
  address indexed tokenOwner,
45
45
  bytes32 indexed tokenId,
@@ -54,7 +54,7 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
54
54
  * @param notified Bool indicating whether the operator has been notified or not
55
55
  * @param operatorNotificationData The data to notify the operator about via LSP1.
56
56
  */
57
- event RevokedOperator(
57
+ event OperatorRevoked(
58
58
  address indexed operator,
59
59
  address indexed tokenOwner,
60
60
  bytes32 indexed tokenId,
@@ -62,6 +62,18 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
62
62
  bytes operatorNotificationData
63
63
  );
64
64
 
65
+ /**
66
+ * @dev Emitted when setting data for `tokenId`.
67
+ * @param tokenId The tokenId which data is set for.
68
+ * @param dataKey The data key for which a bytes value is set.
69
+ * @param dataValue The value to set for the given data key.
70
+ */
71
+ event TokenIdDataChanged(
72
+ bytes32 indexed tokenId,
73
+ bytes32 indexed dataKey,
74
+ bytes dataValue
75
+ );
76
+
65
77
  // --- Token queries
66
78
 
67
79
  /**
@@ -100,6 +112,56 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
100
112
  address tokenOwner
101
113
  ) external view returns (bytes32[] memory);
102
114
 
115
+ // --- TokenId Metadata functionality
116
+
117
+ /**
118
+ * @notice Sets data for a specific `tokenId` and `dataKey`.
119
+ * @param tokenId The unique identifier for a token.
120
+ * @param dataKey The key for the data to set.
121
+ * @param dataValue The value to set for the given data key.
122
+ * @custom:events {TokenIdDataChanged} event.
123
+ */
124
+ function setTokenIdData(
125
+ bytes32 tokenId,
126
+ bytes32 dataKey,
127
+ bytes memory dataValue
128
+ ) external;
129
+
130
+ /**
131
+ * @notice Sets data in batch for multiple `tokenId` and `dataKey` pairs.
132
+ * @param tokenId An array of token IDs.
133
+ * @param dataKey An array of data keys corresponding to the token IDs.
134
+ * @param dataValue An array of values to set for the given data keys.
135
+ * @custom:events {TokenIdDataChanged} event for each pair.
136
+ */
137
+ function setTokenIdDataBatch(
138
+ bytes32[] memory tokenId,
139
+ bytes32[] memory dataKey,
140
+ bytes[] memory dataValue
141
+ ) external;
142
+
143
+ /**
144
+ * @notice Retrieves data for a specific `tokenId` and `dataKey`.
145
+ * @param tokenId The unique identifier for a token.
146
+ * @param dataKey The key for the data to retrieve.
147
+ * @return dataValues The data value associated with the given `tokenId` and `dataKey`.
148
+ */
149
+ function getTokenIdData(
150
+ bytes32 tokenId,
151
+ bytes32 dataKey
152
+ ) external returns (bytes memory dataValues);
153
+
154
+ /**
155
+ * @notice Retrieves data in batch for multiple `tokenId` and `dataKey` pairs.
156
+ * @param tokenId An array of token IDs.
157
+ * @param dataKey An array of data keys corresponding to the token IDs.
158
+ * @return dataValues An array of data values for each pair of `tokenId` and `dataKey`.
159
+ */
160
+ function getTokenIdDataBatch(
161
+ bytes32[] memory tokenId,
162
+ bytes32[] memory dataKey
163
+ ) external returns (bytes[] memory dataValues);
164
+
103
165
  // --- Operator functionality
104
166
 
105
167
  /**
@@ -116,7 +178,7 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
116
178
  * - the owner of a `tokenId` cannot grant itself as an `operator` (`operator` cannot be the calling address).
117
179
  * - `operator` cannot be the zero address.
118
180
  *
119
- * @custom:events {AuthorizedOperator} event.
181
+ * @custom:events {OperatorAuthorizationChanged} event.
120
182
  */
121
183
  function authorizeOperator(
122
184
  address operator,
@@ -139,7 +201,7 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
139
201
  * - the owner of a `tokenId` cannot grant revoke itself as an `operator` (`operator` cannot be the calling address).
140
202
  * - `operator` cannot be the zero address.
141
203
  *
142
- * @custom:events {RevokedOperator} event with address of the operator being revoked for the caller (token owner)..
204
+ * @custom:events {OperatorRevoked} event with address of the operator being revoked for the caller (token owner)..
143
205
  */
144
206
  function revokeOperator(
145
207
  address operator,
@@ -253,4 +315,15 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
253
315
  bool[] memory force,
254
316
  bytes[] memory data
255
317
  ) external;
318
+
319
+ /**
320
+ * @notice Executing the following batch of abi-encoded function calls on the contract: `data`.
321
+ *
322
+ * @dev Allows a caller to batch different function calls in one call. Perform a `delegatecall` on self, to call different functions with preserving the context.
323
+ * @param data An array of ABI encoded function calls to be called on the contract.
324
+ * @return results An array of abi-encoded data returned by the functions executed.
325
+ */
326
+ function batchCalls(
327
+ bytes[] calldata data
328
+ ) external returns (bytes[] memory results);
256
329
  }
@@ -2,15 +2,12 @@
2
2
  pragma solidity ^0.8.4;
3
3
 
4
4
  // --- ERC165 interface ids
5
- bytes4 constant _INTERFACEID_LSP8 = 0x30dc5278;
5
+ bytes4 constant _INTERFACEID_LSP8 = 0xecad9f75;
6
6
 
7
7
  // --- ERC725Y Data Keys
8
8
 
9
- // keccak256('LSP8TokenIdType')
10
- bytes32 constant _LSP8_TOKENID_TYPE_KEY = 0x715f248956de7ce65e94d9d836bfead479f7e70d69b718d47bfe7b00e05b4fe4;
11
-
12
- // bytes10(keccak256('LSP8MetadataTokenURI')) + bytes2(0)
13
- bytes12 constant _LSP8_METADATA_TOKEN_URI_PREFIX = 0x1339e76a390b7b9ec9010000;
9
+ // keccak256('LSP8TokenIdSchema')
10
+ bytes32 constant _LSP8_TOKENID_SCHEMA_KEY = 0x341bc44e55234544c70af9d37b2cb8cc7ba74685b58526221de2cc977f469924;
14
11
 
15
12
  // keccak256('LSP8TokenMetadataBaseURI')
16
13
  bytes32 constant _LSP8_TOKEN_METADATA_BASE_URI = 0x1a7628600c3bac7101f53697f48df381ddc36b9015e7d7c9c5633d1252aa2843;
@@ -29,10 +26,16 @@ bytes32 constant _TYPEID_LSP8_TOKENSRECIPIENT = 0x0b084a55ebf70fd3c06fd755269dac
29
26
  // keccak256('LSP8Tokens_OperatorNotification')
30
27
  bytes32 constant _TYPEID_LSP8_TOKENOPERATOR = 0x8a1c15a8799f71b547e08e2bcb2e85257e81b0a07eee2ce6712549eef1f00970;
31
28
 
32
- // --- Types of token IDs
29
+ // --- Token IDs Schema
30
+
31
+ uint256 constant _LSP8_TOKENID_SCHEMA_NUMBER = 0;
32
+ uint256 constant _LSP8_TOKENID_SCHEMA_STRING = 1;
33
+ uint256 constant _LSP8_TOKENID_SCHEMA_ADDRESS = 2;
34
+ uint256 constant _LSP8_TOKENID_SCHEMA_UNIQUE_ID = 3;
35
+ uint256 constant _LSP8_TOKENID_SCHEMA_HASH = 4;
33
36
 
34
- uint256 constant _LSP8_TOKENID_TYPE_NUMBER = 0;
35
- uint256 constant _LSP8_TOKENID_TYPE_STRING = 1;
36
- uint256 constant _LSP8_TOKENID_TYPE_UNIQUE_ID = 2;
37
- uint256 constant _LSP8_TOKENID_TYPE_HASH = 3;
38
- uint256 constant _LSP8_TOKENID_TYPE_ADDRESS = 4;
37
+ uint256 constant _LSP8_TOKENID_SCHEMA_MIXED_DEFAULT_NUMBER = 100;
38
+ uint256 constant _LSP8_TOKENID_SCHEMA_MIXED_DEFAULT_STRING = 101;
39
+ uint256 constant _LSP8_TOKENID_SCHEMA_MIXED_DEFAULT_ADDRESS = 102;
40
+ uint256 constant _LSP8_TOKENID_SCHEMA_MIXED_DEFAULT_UNIQUE_ID = 103;
41
+ uint256 constant _LSP8_TOKENID_SCHEMA_MIXED_DEFAULT_HASH = 104;
@@ -82,8 +82,24 @@ error LSP8TokenOwnerCannotBeOperator();
82
82
  error LSP8TokenContractCannotHoldValue();
83
83
 
84
84
  /**
85
- * @dev Reverts when trying to edit the data key `LSP8TokenIdType` after the identifiable digital asset contract has been deployed.
86
- * The `LSP8TokenIdType` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract.
85
+ * @dev Reverts when trying to edit the data key `LSP8TokenIdSchema` after the identifiable digital asset contract has been deployed.
86
+ * The `LSP8TokenIdSchema` data key is located inside the ERC725Y Data key-value store of the identifiable digital asset contract.
87
87
  * It can be set only once inside the constructor/initializer when the identifiable digital asset contract is being deployed.
88
88
  */
89
- error LSP8TokenIdTypeNotEditable();
89
+ error LSP8TokenIdSchemaNotEditable();
90
+
91
+ /**
92
+ * @dev Reverts when the length of the token IDs data arrays is not equal
93
+ */
94
+ error LSP8TokenIdsDataLengthMismatch();
95
+
96
+ /**
97
+ * @dev Reverts when empty arrays is passed to the function
98
+ */
99
+ error LSP8TokenIdsDataEmptyArray();
100
+
101
+ /**
102
+ * @dev Reverts when a batch call failed.
103
+ * @notice Batch call failed.
104
+ */
105
+ error LSP8BatchCallFailed(uint256 callIndex);
@@ -1,5 +1,5 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
- pragma solidity ^0.8.4;
2
+ pragma solidity ^0.8.12;
3
3
 
4
4
  // interfaces
5
5
  import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
@@ -13,18 +13,22 @@ import {
13
13
  LSP4DigitalAssetMetadata
14
14
  } from "../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol";
15
15
 
16
+ import {
17
+ LSP4DigitalAssetMetadataCore
18
+ } from "../LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataCore.sol";
19
+
16
20
  import {LSP17Extendable} from "../LSP17ContractExtension/LSP17Extendable.sol";
17
21
 
18
22
  // libraries
19
23
  import {LSP2Utils} from "../LSP2ERC725YJSONSchema/LSP2Utils.sol";
20
24
 
21
25
  // constants
22
- import {_INTERFACEID_LSP8, _LSP8_TOKENID_TYPE_KEY} from "./LSP8Constants.sol";
26
+ import {_INTERFACEID_LSP8, _LSP8_TOKENID_SCHEMA_KEY} from "./LSP8Constants.sol";
23
27
 
24
28
  // errors
25
29
  import {
26
30
  LSP8TokenContractCannotHoldValue,
27
- LSP8TokenIdTypeNotEditable
31
+ LSP8TokenIdSchemaNotEditable
28
32
  } from "./LSP8Errors.sol";
29
33
 
30
34
  import {
@@ -57,29 +61,30 @@ abstract contract LSP8IdentifiableDigitalAsset is
57
61
  {
58
62
  /**
59
63
  * @notice Deploying a LSP8IdentifiableDigitalAsset with name `name_`, symbol `symbol_`, owned by address `newOwner_`
60
- * with tokenId type `tokenIdType_`.
64
+ * with tokenId schema `lsp8TokenIdSchema_`.
61
65
  *
62
- * @dev Deploy a `LSP8IdentifiableDigitalAsset` contract and set the tokenId type inside the ERC725Y storage of the contract.
66
+ * @dev Deploy a `LSP8IdentifiableDigitalAsset` contract and set the tokenId schema inside the ERC725Y storage of the contract.
63
67
  * This will also set the token `name_` and `symbol_` under the ERC725Y data keys `LSP4TokenName` and `LSP4TokenSymbol`.
64
68
  *
65
69
  * @param name_ The name of the token
66
70
  * @param symbol_ The symbol of the token
67
71
  * @param newOwner_ The owner of the the token-Metadata
68
- * @param tokenIdType_ The type of tokenIds (= NFTs) that this contract will create.
69
- * Available options are: NUMBER = `0`; STRING = `1`; UNIQUE_ID = `2`; HASH = `3`; ADDRESS = `4`.
72
+ * @param lsp4TokenType_ The type of token this digital asset contract represents (`1` = Token, `2` = NFT, `3` = Collection).
73
+ * @param lsp8TokenIdSchema_ The schema of tokenIds (= NFTs) that this contract will create.
70
74
  *
71
- * @custom:warning Make sure the tokenId type provided on deployment is correct, as it can only be set once
75
+ * @custom:warning Make sure the tokenId schema provided on deployment is correct, as it can only be set once
72
76
  * and cannot be changed in the ERC725Y storage after the contract has been deployed.
73
77
  */
74
78
  constructor(
75
79
  string memory name_,
76
80
  string memory symbol_,
77
81
  address newOwner_,
78
- uint256 tokenIdType_
79
- ) LSP4DigitalAssetMetadata(name_, symbol_, newOwner_) {
82
+ uint256 lsp4TokenType_,
83
+ uint256 lsp8TokenIdSchema_
84
+ ) LSP4DigitalAssetMetadata(name_, symbol_, newOwner_, lsp4TokenType_) {
80
85
  LSP4DigitalAssetMetadata._setData(
81
- _LSP8_TOKENID_TYPE_KEY,
82
- abi.encode(tokenIdType_)
86
+ _LSP8_TOKENID_SCHEMA_KEY,
87
+ abi.encode(lsp8TokenIdSchema_)
83
88
  );
84
89
  }
85
90
 
@@ -215,15 +220,19 @@ abstract contract LSP8IdentifiableDigitalAsset is
215
220
 
216
221
  /**
217
222
  * @inheritdoc LSP4DigitalAssetMetadata
218
- * @dev The ERC725Y data key `_LSP8_TOKENID_TYPE_KEY` cannot be changed
223
+ * @dev The ERC725Y data key `_LSP8_TOKENID_SCHEMA_KEY` cannot be changed
219
224
  * once the identifiable digital asset contract has been deployed.
220
225
  */
221
226
  function _setData(
222
227
  bytes32 dataKey,
223
228
  bytes memory dataValue
224
- ) internal virtual override {
225
- if (dataKey == _LSP8_TOKENID_TYPE_KEY) {
226
- revert LSP8TokenIdTypeNotEditable();
229
+ )
230
+ internal
231
+ virtual
232
+ override(LSP4DigitalAssetMetadata, LSP4DigitalAssetMetadataCore)
233
+ {
234
+ if (dataKey == _LSP8_TOKENID_SCHEMA_KEY) {
235
+ revert LSP8TokenIdSchemaNotEditable();
227
236
  }
228
237
  LSP4DigitalAssetMetadata._setData(dataKey, dataValue);
229
238
  }