@lukso/lsp-smart-contracts 0.12.1 → 0.14.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.
- package/README.md +3 -2
- package/artifacts/LSP0ERC725Account.json +6 -6
- package/artifacts/LSP0ERC725AccountInit.json +6 -6
- package/artifacts/LSP11BasicSocialRecovery.json +2 -2
- package/artifacts/LSP11BasicSocialRecoveryInit.json +2 -2
- package/artifacts/LSP1UniversalReceiverDelegateUP.json +2 -2
- package/artifacts/LSP1UniversalReceiverDelegateVault.json +2 -2
- package/artifacts/LSP4DigitalAssetMetadata.json +5 -0
- package/artifacts/LSP4DigitalAssetMetadataInitAbstract.json +5 -0
- package/artifacts/LSP6KeyManager.json +2 -2
- package/artifacts/LSP6KeyManagerInit.json +2 -2
- package/artifacts/LSP7CappedSupply.json +71 -36
- package/artifacts/LSP7CappedSupplyInitAbstract.json +71 -36
- package/artifacts/LSP7CompatibleERC20.json +71 -36
- package/artifacts/LSP7CompatibleERC20InitAbstract.json +71 -36
- package/artifacts/LSP7CompatibleERC20Mintable.json +78 -38
- package/artifacts/LSP7CompatibleERC20MintableInit.json +78 -38
- package/artifacts/LSP7DigitalAsset.json +71 -36
- package/artifacts/LSP7DigitalAssetInitAbstract.json +71 -36
- package/artifacts/LSP7Mintable.json +78 -38
- package/artifacts/LSP7MintableInit.json +78 -38
- package/artifacts/LSP8CappedSupply.json +187 -23
- package/artifacts/LSP8CappedSupplyInitAbstract.json +200 -36
- package/artifacts/LSP8CompatibleERC721.json +187 -23
- package/artifacts/LSP8CompatibleERC721InitAbstract.json +200 -36
- package/artifacts/LSP8CompatibleERC721Mintable.json +195 -26
- package/artifacts/LSP8CompatibleERC721MintableInit.json +208 -39
- package/artifacts/LSP8IdentifiableDigitalAsset.json +187 -23
- package/artifacts/LSP8IdentifiableDigitalAssetInitAbstract.json +200 -36
- package/artifacts/LSP8Mintable.json +195 -26
- package/artifacts/LSP8MintableInit.json +208 -39
- package/artifacts/LSP9Vault.json +6 -6
- package/artifacts/LSP9VaultInit.json +6 -6
- package/artifacts/UniversalProfile.json +6 -6
- package/artifacts/UniversalProfileInit.json +6 -6
- package/contracts/LSP0ERC725Account/LSP0ERC725AccountCore.sol +1 -22
- package/contracts/LSP17Extensions/Extension4337.sol +26 -1
- package/contracts/LSP3ProfileMetadata/LSP3Constants.sol +1 -1
- package/contracts/LSP4DigitalAssetMetadata/LSP4Constants.sol +10 -2
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadata.sol +20 -34
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataCore.sol +47 -0
- package/contracts/LSP4DigitalAssetMetadata/LSP4DigitalAssetMetadataInitAbstract.sol +19 -31
- package/contracts/LSP4DigitalAssetMetadata/LSP4Errors.sol +13 -6
- package/contracts/LSP6KeyManager/LSP6KeyManagerCore.sol +1 -1
- package/contracts/LSP6KeyManager/LSP6Modules/LSP6SetDataModule.sol +2 -2
- package/contracts/LSP6KeyManager/LSP6Utils.sol +1 -1
- package/contracts/LSP7DigitalAsset/ILSP7DigitalAsset.sol +20 -9
- package/contracts/LSP7DigitalAsset/LSP7Constants.sol +1 -1
- package/contracts/LSP7DigitalAsset/LSP7DigitalAsset.sol +7 -5
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetCore.sol +128 -25
- package/contracts/LSP7DigitalAsset/LSP7DigitalAssetInitAbstract.sol +5 -2
- package/contracts/LSP7DigitalAsset/LSP7Errors.sol +6 -0
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20.sol +4 -2
- package/contracts/LSP7DigitalAsset/extensions/LSP7CompatibleERC20InitAbstract.sol +7 -4
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20Mintable.sol +4 -2
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInit.sol +5 -2
- package/contracts/LSP7DigitalAsset/presets/LSP7CompatibleERC20MintableInitAbstract.sol +8 -2
- package/contracts/LSP7DigitalAsset/presets/LSP7Mintable.sol +12 -1
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInit.sol +4 -0
- package/contracts/LSP7DigitalAsset/presets/LSP7MintableInitAbstract.sol +4 -0
- package/contracts/LSP8IdentifiableDigitalAsset/ILSP8IdentifiableDigitalAsset.sol +77 -5
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Constants.sol +15 -12
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8Errors.sol +19 -3
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAsset.sol +25 -16
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetCore.sol +223 -19
- package/contracts/LSP8IdentifiableDigitalAsset/LSP8IdentifiableDigitalAssetInitAbstract.sol +28 -15
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Burnable.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8BurnableInitAbstract.sol +1 -1
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupply.sol +1 -2
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CappedSupplyInitAbstract.sol +1 -2
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721.sol +15 -4
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8CompatibleERC721InitAbstract.sol +8 -4
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8Enumerable.sol +1 -2
- package/contracts/LSP8IdentifiableDigitalAsset/extensions/LSP8EnumerableInitAbstract.sol +1 -2
- package/contracts/LSP8IdentifiableDigitalAsset/presets/ILSP8Mintable.sol +0 -1
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721Mintable.sol +13 -2
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInit.sol +6 -2
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8CompatibleERC721MintableInitAbstract.sol +4 -2
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8Mintable.sol +14 -4
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInit.sol +7 -4
- package/contracts/LSP8IdentifiableDigitalAsset/presets/LSP8MintableInitAbstract.sol +7 -4
- package/contracts/LSP9Vault/LSP9VaultCore.sol +0 -22
- package/contracts/Version.sol +1 -1
- package/devdocs/LSP4DigitalAssetMetadata.json +11 -5
- package/devdocs/LSP4DigitalAssetMetadataInitAbstract.json +7 -2
- package/devdocs/LSP6KeyManager.json +1 -1
- package/devdocs/LSP6KeyManagerInit.json +1 -1
- package/devdocs/LSP7CappedSupply.json +22 -2
- package/devdocs/LSP7CappedSupplyInitAbstract.json +22 -2
- package/devdocs/LSP7CompatibleERC20.json +23 -2
- package/devdocs/LSP7CompatibleERC20InitAbstract.json +22 -2
- package/devdocs/LSP7CompatibleERC20Mintable.json +23 -2
- package/devdocs/LSP7CompatibleERC20MintableInit.json +24 -3
- package/devdocs/LSP7DigitalAsset.json +27 -6
- package/devdocs/LSP7DigitalAssetInitAbstract.json +22 -2
- package/devdocs/LSP7Mintable.json +24 -2
- package/devdocs/LSP7MintableInit.json +25 -3
- package/devdocs/LSP8CappedSupply.json +66 -4
- package/devdocs/LSP8CappedSupplyInitAbstract.json +66 -4
- package/devdocs/LSP8CompatibleERC721.json +69 -5
- package/devdocs/LSP8CompatibleERC721InitAbstract.json +67 -5
- package/devdocs/LSP8CompatibleERC721Mintable.json +69 -5
- package/devdocs/LSP8CompatibleERC721MintableInit.json +70 -6
- package/devdocs/LSP8IdentifiableDigitalAsset.json +71 -8
- package/devdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +66 -4
- package/devdocs/LSP8Mintable.json +68 -4
- package/devdocs/LSP8MintableInit.json +69 -5
- package/dist/constants.cjs.js +4406 -1319
- package/dist/constants.d.ts +4158 -818
- package/dist/constants.es.js +4405 -1319
- package/package.json +2 -2
- package/userdocs/LSP7CappedSupply.json +8 -0
- package/userdocs/LSP7CappedSupplyInitAbstract.json +8 -0
- package/userdocs/LSP7CompatibleERC20.json +8 -0
- package/userdocs/LSP7CompatibleERC20InitAbstract.json +8 -0
- package/userdocs/LSP7CompatibleERC20Mintable.json +8 -0
- package/userdocs/LSP7CompatibleERC20MintableInit.json +9 -1
- package/userdocs/LSP7DigitalAsset.json +8 -0
- package/userdocs/LSP7DigitalAssetInitAbstract.json +8 -0
- package/userdocs/LSP7Mintable.json +8 -0
- package/userdocs/LSP7MintableInit.json +9 -1
- package/userdocs/LSP8CappedSupply.json +20 -0
- package/userdocs/LSP8CappedSupplyInitAbstract.json +20 -0
- package/userdocs/LSP8CompatibleERC721.json +20 -0
- package/userdocs/LSP8CompatibleERC721InitAbstract.json +20 -0
- package/userdocs/LSP8CompatibleERC721Mintable.json +20 -0
- package/userdocs/LSP8CompatibleERC721MintableInit.json +21 -1
- package/userdocs/LSP8IdentifiableDigitalAsset.json +21 -1
- package/userdocs/LSP8IdentifiableDigitalAssetInitAbstract.json +20 -0
- package/userdocs/LSP8Mintable.json +20 -0
- package/userdocs/LSP8MintableInit.json +21 -1
|
@@ -18,9 +18,15 @@ abstract contract LSP7CompatibleERC20MintableInitAbstract is
|
|
|
18
18
|
function _initialize(
|
|
19
19
|
string memory name_,
|
|
20
20
|
string memory symbol_,
|
|
21
|
-
address newOwner_
|
|
21
|
+
address newOwner_,
|
|
22
|
+
uint256 lsp4TokenType_
|
|
22
23
|
) internal virtual override onlyInitializing {
|
|
23
|
-
LSP7CompatibleERC20InitAbstract._initialize(
|
|
24
|
+
LSP7CompatibleERC20InitAbstract._initialize(
|
|
25
|
+
name_,
|
|
26
|
+
symbol_,
|
|
27
|
+
newOwner_,
|
|
28
|
+
lsp4TokenType_
|
|
29
|
+
);
|
|
24
30
|
}
|
|
25
31
|
|
|
26
32
|
/**
|
|
@@ -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 (`0` = Token, `1` = NFT, `2` = 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
|
-
)
|
|
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 (`0` = Token, `1` = NFT, `2` = 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 (`0` = Token, `1` = NFT, `2` = 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
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
|
-
|
|
3
2
|
pragma solidity ^0.8.4;
|
|
4
3
|
|
|
5
4
|
// interfaces
|
|
@@ -39,7 +38,7 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
|
|
|
39
38
|
* @param tokenId The tokenId `operator` address has access on behalf of `tokenOwner`.
|
|
40
39
|
* @param operatorNotificationData The data to notify the operator about via LSP1.
|
|
41
40
|
*/
|
|
42
|
-
event
|
|
41
|
+
event OperatorAuthorizationChanged(
|
|
43
42
|
address indexed operator,
|
|
44
43
|
address indexed tokenOwner,
|
|
45
44
|
bytes32 indexed tokenId,
|
|
@@ -54,7 +53,7 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
|
|
|
54
53
|
* @param notified Bool indicating whether the operator has been notified or not
|
|
55
54
|
* @param operatorNotificationData The data to notify the operator about via LSP1.
|
|
56
55
|
*/
|
|
57
|
-
event
|
|
56
|
+
event OperatorRevoked(
|
|
58
57
|
address indexed operator,
|
|
59
58
|
address indexed tokenOwner,
|
|
60
59
|
bytes32 indexed tokenId,
|
|
@@ -62,6 +61,18 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
|
|
|
62
61
|
bytes operatorNotificationData
|
|
63
62
|
);
|
|
64
63
|
|
|
64
|
+
/**
|
|
65
|
+
* @dev Emitted when setting data for `tokenId`.
|
|
66
|
+
* @param tokenId The tokenId which data is set for.
|
|
67
|
+
* @param dataKey The data key for which a bytes value is set.
|
|
68
|
+
* @param dataValue The value to set for the given data key.
|
|
69
|
+
*/
|
|
70
|
+
event TokenIdDataChanged(
|
|
71
|
+
bytes32 indexed tokenId,
|
|
72
|
+
bytes32 indexed dataKey,
|
|
73
|
+
bytes dataValue
|
|
74
|
+
);
|
|
75
|
+
|
|
65
76
|
// --- Token queries
|
|
66
77
|
|
|
67
78
|
/**
|
|
@@ -100,6 +111,56 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
|
|
|
100
111
|
address tokenOwner
|
|
101
112
|
) external view returns (bytes32[] memory);
|
|
102
113
|
|
|
114
|
+
// --- TokenId Metadata functionality
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* @notice Retrieves data for a specific `tokenId` and `dataKey`.
|
|
118
|
+
* @param tokenId The unique identifier for a token.
|
|
119
|
+
* @param dataKey The key for the data to retrieve.
|
|
120
|
+
* @return dataValues The data value associated with the given `tokenId` and `dataKey`.
|
|
121
|
+
*/
|
|
122
|
+
function getDataForTokenId(
|
|
123
|
+
bytes32 tokenId,
|
|
124
|
+
bytes32 dataKey
|
|
125
|
+
) external returns (bytes memory dataValues);
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* @notice Retrieves data in batch for multiple `tokenId` and `dataKey` pairs.
|
|
129
|
+
* @param tokenIds An array of token IDs.
|
|
130
|
+
* @param dataKeys An array of data keys corresponding to the token IDs.
|
|
131
|
+
* @return dataValues An array of data values for each pair of `tokenId` and `dataKey`.
|
|
132
|
+
*/
|
|
133
|
+
function getDataBatchForTokenIds(
|
|
134
|
+
bytes32[] memory tokenIds,
|
|
135
|
+
bytes32[] memory dataKeys
|
|
136
|
+
) external returns (bytes[] memory dataValues);
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* @notice Sets data for a specific `tokenId` and `dataKey`.
|
|
140
|
+
* @param tokenId The unique identifier for a token.
|
|
141
|
+
* @param dataKey The key for the data to set.
|
|
142
|
+
* @param dataValue The value to set for the given data key.
|
|
143
|
+
* @custom:events {TokenIdDataChanged} event.
|
|
144
|
+
*/
|
|
145
|
+
function setDataForTokenId(
|
|
146
|
+
bytes32 tokenId,
|
|
147
|
+
bytes32 dataKey,
|
|
148
|
+
bytes memory dataValue
|
|
149
|
+
) external;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* @notice Sets data in batch for multiple `tokenId` and `dataKey` pairs.
|
|
153
|
+
* @param tokenIds An array of token IDs.
|
|
154
|
+
* @param dataKeys An array of data keys corresponding to the token IDs.
|
|
155
|
+
* @param dataValues An array of values to set for the given data keys.
|
|
156
|
+
* @custom:events {TokenIdDataChanged} event for each pair.
|
|
157
|
+
*/
|
|
158
|
+
function setDataBatchForTokenIds(
|
|
159
|
+
bytes32[] memory tokenIds,
|
|
160
|
+
bytes32[] memory dataKeys,
|
|
161
|
+
bytes[] memory dataValues
|
|
162
|
+
) external;
|
|
163
|
+
|
|
103
164
|
// --- Operator functionality
|
|
104
165
|
|
|
105
166
|
/**
|
|
@@ -116,7 +177,7 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
|
|
|
116
177
|
* - the owner of a `tokenId` cannot grant itself as an `operator` (`operator` cannot be the calling address).
|
|
117
178
|
* - `operator` cannot be the zero address.
|
|
118
179
|
*
|
|
119
|
-
* @custom:events {
|
|
180
|
+
* @custom:events {OperatorAuthorizationChanged} event.
|
|
120
181
|
*/
|
|
121
182
|
function authorizeOperator(
|
|
122
183
|
address operator,
|
|
@@ -139,7 +200,7 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
|
|
|
139
200
|
* - the owner of a `tokenId` cannot grant revoke itself as an `operator` (`operator` cannot be the calling address).
|
|
140
201
|
* - `operator` cannot be the zero address.
|
|
141
202
|
*
|
|
142
|
-
* @custom:events {
|
|
203
|
+
* @custom:events {OperatorRevoked} event with address of the operator being revoked for the caller (token owner)..
|
|
143
204
|
*/
|
|
144
205
|
function revokeOperator(
|
|
145
206
|
address operator,
|
|
@@ -253,4 +314,15 @@ interface ILSP8IdentifiableDigitalAsset is IERC165, IERC725Y {
|
|
|
253
314
|
bool[] memory force,
|
|
254
315
|
bytes[] memory data
|
|
255
316
|
) external;
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* @notice Executing the following batch of abi-encoded function calls on the contract: `data`.
|
|
320
|
+
*
|
|
321
|
+
* @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.
|
|
322
|
+
* @param data An array of ABI encoded function calls to be called on the contract.
|
|
323
|
+
* @return results An array of abi-encoded data returned by the functions executed.
|
|
324
|
+
*/
|
|
325
|
+
function batchCalls(
|
|
326
|
+
bytes[] calldata data
|
|
327
|
+
) external returns (bytes[] memory results);
|
|
256
328
|
}
|
|
@@ -2,15 +2,12 @@
|
|
|
2
2
|
pragma solidity ^0.8.4;
|
|
3
3
|
|
|
4
4
|
// --- ERC165 interface ids
|
|
5
|
-
bytes4 constant _INTERFACEID_LSP8 =
|
|
5
|
+
bytes4 constant _INTERFACEID_LSP8 = 0x3a271706;
|
|
6
6
|
|
|
7
7
|
// --- ERC725Y Data Keys
|
|
8
8
|
|
|
9
|
-
// keccak256('
|
|
10
|
-
bytes32 constant
|
|
11
|
-
|
|
12
|
-
// bytes10(keccak256('LSP8MetadataTokenURI')) + bytes2(0)
|
|
13
|
-
bytes12 constant _LSP8_METADATA_TOKEN_URI_PREFIX = 0x1339e76a390b7b9ec9010000;
|
|
9
|
+
// keccak256('LSP8TokenIdFormat')
|
|
10
|
+
bytes32 constant _LSP8_TOKENID_FORMAT_KEY = 0xf675e9361af1c1664c1868cfa3eb97672d6b1a513aa5b81dec34c9ee330e818d;
|
|
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
|
-
// ---
|
|
29
|
+
// --- Token IDs Format
|
|
30
|
+
|
|
31
|
+
uint256 constant _LSP8_TOKENID_FORMAT_NUMBER = 0;
|
|
32
|
+
uint256 constant _LSP8_TOKENID_FORMAT_STRING = 1;
|
|
33
|
+
uint256 constant _LSP8_TOKENID_FORMAT_ADDRESS = 2;
|
|
34
|
+
uint256 constant _LSP8_TOKENID_FORMAT_UNIQUE_ID = 3;
|
|
35
|
+
uint256 constant _LSP8_TOKENID_FORMAT_HASH = 4;
|
|
33
36
|
|
|
34
|
-
uint256 constant
|
|
35
|
-
uint256 constant
|
|
36
|
-
uint256 constant
|
|
37
|
-
uint256 constant
|
|
38
|
-
uint256 constant
|
|
37
|
+
uint256 constant _LSP8_TOKENID_FORMAT_MIXED_DEFAULT_NUMBER = 100;
|
|
38
|
+
uint256 constant _LSP8_TOKENID_FORMAT_MIXED_DEFAULT_STRING = 101;
|
|
39
|
+
uint256 constant _LSP8_TOKENID_FORMAT_MIXED_DEFAULT_ADDRESS = 102;
|
|
40
|
+
uint256 constant _LSP8_TOKENID_FORMAT_MIXED_DEFAULT_UNIQUE_ID = 103;
|
|
41
|
+
uint256 constant _LSP8_TOKENID_FORMAT_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 `
|
|
86
|
-
* The `
|
|
85
|
+
* @dev Reverts when trying to edit the data key `LSP8TokenIdFormat` after the identifiable digital asset contract has been deployed.
|
|
86
|
+
* The `LSP8TokenIdFormat` 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
|
|
89
|
+
error LSP8TokenIdFormatNotEditable();
|
|
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.
|
|
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,
|
|
26
|
+
import {_INTERFACEID_LSP8, _LSP8_TOKENID_FORMAT_KEY} from "./LSP8Constants.sol";
|
|
23
27
|
|
|
24
28
|
// errors
|
|
25
29
|
import {
|
|
26
30
|
LSP8TokenContractCannotHoldValue,
|
|
27
|
-
|
|
31
|
+
LSP8TokenIdFormatNotEditable
|
|
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
|
|
64
|
+
* with tokenId format `lsp8TokenIdFormat_`.
|
|
61
65
|
*
|
|
62
|
-
* @dev Deploy a `LSP8IdentifiableDigitalAsset` contract and set the tokenId
|
|
66
|
+
* @dev Deploy a `LSP8IdentifiableDigitalAsset` contract and set the tokenId format 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
|
|
69
|
-
*
|
|
72
|
+
* @param lsp4TokenType_ The type of token this digital asset contract represents (`0` = Token, `1` = NFT, `2` = Collection).
|
|
73
|
+
* @param lsp8TokenIdFormat_ The format of tokenIds (= NFTs) that this contract will create.
|
|
70
74
|
*
|
|
71
|
-
* @custom:warning Make sure the tokenId
|
|
75
|
+
* @custom:warning Make sure the tokenId format 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
|
|
79
|
-
|
|
82
|
+
uint256 lsp4TokenType_,
|
|
83
|
+
uint256 lsp8TokenIdFormat_
|
|
84
|
+
) LSP4DigitalAssetMetadata(name_, symbol_, newOwner_, lsp4TokenType_) {
|
|
80
85
|
LSP4DigitalAssetMetadata._setData(
|
|
81
|
-
|
|
82
|
-
abi.encode(
|
|
86
|
+
_LSP8_TOKENID_FORMAT_KEY,
|
|
87
|
+
abi.encode(lsp8TokenIdFormat_)
|
|
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 `
|
|
223
|
+
* @dev The ERC725Y data key `_LSP8_TOKENID_FORMAT_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
|
-
)
|
|
225
|
-
|
|
226
|
-
|
|
229
|
+
)
|
|
230
|
+
internal
|
|
231
|
+
virtual
|
|
232
|
+
override(LSP4DigitalAssetMetadata, LSP4DigitalAssetMetadataCore)
|
|
233
|
+
{
|
|
234
|
+
if (dataKey == _LSP8_TOKENID_FORMAT_KEY) {
|
|
235
|
+
revert LSP8TokenIdFormatNotEditable();
|
|
227
236
|
}
|
|
228
237
|
LSP4DigitalAssetMetadata._setData(dataKey, dataValue);
|
|
229
238
|
}
|